From 1cea9ee0885cc1ff978586a55b7729520cbb2f84 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 24 Jun 2018 13:03:31 +0300 Subject: [PATCH 001/298] add prototype bean ex with function --- .../java/com/baeldung/scope/AppConfig.java | 21 ++++++++++++++ .../baeldung/scope/AppProxyScopeConfig.java | 2 ++ .../scope/PrototypeFactoryBeanConfig.java | 27 ++++++++++++++++++ .../prototype/PrototypeBeanWithParam.java | 28 +++++++++++++++++++ .../singletone/SingletonFunctionBean.java | 19 +++++++++++++ ...PrototypeBeanInjectionIntegrationTest.java | 18 ++++++++++++ 6 files changed, 115 insertions(+) create mode 100644 spring-core/src/main/java/com/baeldung/scope/PrototypeFactoryBeanConfig.java create mode 100644 spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBeanWithParam.java create mode 100644 spring-core/src/main/java/com/baeldung/scope/singletone/SingletonFunctionBean.java diff --git a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java index 5c8c539e7a..6a6efe26c5 100644 --- a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java +++ b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java @@ -1,10 +1,15 @@ package com.baeldung.scope; import com.baeldung.scope.prototype.PrototypeBean; +import com.baeldung.scope.prototype.PrototypeBeanWithParam; import com.baeldung.scope.singletone.SingletonAppContextBean; import com.baeldung.scope.singletone.SingletonBean; +import com.baeldung.scope.singletone.SingletonFunctionBean; import com.baeldung.scope.singletone.SingletonObjectFactoryBean; import com.baeldung.scope.singletone.SingletonProviderBean; + +import java.util.function.Function; + import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -40,4 +45,20 @@ public class AppConfig { public SingletonObjectFactoryBean singletonObjectFactoryBean() { return new SingletonObjectFactoryBean(); } + + @Bean + public Function beanFactory() { + return name -> prototypeBeanWithParam(name); + } + + @Bean + @Scope(value = "prototype") + public PrototypeBeanWithParam prototypeBeanWithParam(String name) { + return new PrototypeBeanWithParam(name); + } + + @Bean + public SingletonFunctionBean singletonFunctionBean() { + return new SingletonFunctionBean(); + } } diff --git a/spring-core/src/main/java/com/baeldung/scope/AppProxyScopeConfig.java b/spring-core/src/main/java/com/baeldung/scope/AppProxyScopeConfig.java index fc7a30471c..9f1874375e 100644 --- a/spring-core/src/main/java/com/baeldung/scope/AppProxyScopeConfig.java +++ b/spring-core/src/main/java/com/baeldung/scope/AppProxyScopeConfig.java @@ -2,6 +2,7 @@ package com.baeldung.scope; import com.baeldung.scope.prototype.PrototypeBean; import com.baeldung.scope.singletone.SingletonBean; + import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.*; @@ -19,4 +20,5 @@ public class AppProxyScopeConfig { public SingletonBean singletonBean() { return new SingletonBean(); } + } diff --git a/spring-core/src/main/java/com/baeldung/scope/PrototypeFactoryBeanConfig.java b/spring-core/src/main/java/com/baeldung/scope/PrototypeFactoryBeanConfig.java new file mode 100644 index 0000000000..6196672db8 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/scope/PrototypeFactoryBeanConfig.java @@ -0,0 +1,27 @@ +package com.baeldung.scope; + +import java.util.function.Function; + +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; +import org.springframework.context.annotation.ScopedProxyMode; + +import com.baeldung.scope.prototype.PrototypeBeanWithParam; + +@Configuration +public class PrototypeFactoryBeanConfig { + + @Bean + @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS) + public PrototypeBeanWithParam prototypeBeanWithParam(String name) { + return new PrototypeBeanWithParam(name); + } + + @Bean + public Function prototypeBeanFactory() { + return runtimeArg -> prototypeBeanWithParam(runtimeArg); + } + +} diff --git a/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBeanWithParam.java b/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBeanWithParam.java new file mode 100644 index 0000000000..018084db09 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBeanWithParam.java @@ -0,0 +1,28 @@ +package com.baeldung.scope.prototype; + +import org.apache.log4j.Logger; + +public class PrototypeBeanWithParam { + + private String name; + + private final Logger logger = Logger.getLogger(this.getClass()); + + public PrototypeBeanWithParam() { + logger.info("Prototype instance with param created"); + } + + public PrototypeBeanWithParam(String name) { + this.name = name; + logger.info("Prototype instance " + name + " created"); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/spring-core/src/main/java/com/baeldung/scope/singletone/SingletonFunctionBean.java b/spring-core/src/main/java/com/baeldung/scope/singletone/SingletonFunctionBean.java new file mode 100644 index 0000000000..5cc40549a0 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/scope/singletone/SingletonFunctionBean.java @@ -0,0 +1,19 @@ +package com.baeldung.scope.singletone; + +import java.util.function.Function; + +import org.springframework.beans.factory.annotation.Autowired; + +import com.baeldung.scope.prototype.PrototypeBeanWithParam; + +public class SingletonFunctionBean { + + @Autowired + private Function beanFactory; + + public PrototypeBeanWithParam getPrototypeInstance(String name) { + PrototypeBeanWithParam bean = beanFactory.apply(name); + return bean; + } + +} diff --git a/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java b/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java index 1c05bb3e8e..719e25eb51 100644 --- a/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java +++ b/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java @@ -1,6 +1,8 @@ package com.baeldung.scope; import com.baeldung.scope.prototype.PrototypeBean; +import com.baeldung.scope.prototype.PrototypeBeanWithParam; +import com.baeldung.scope.singletone.SingletonFunctionBean; import com.baeldung.scope.singletone.SingletonLookupBean; import com.baeldung.scope.singletone.SingletonObjectFactoryBean; import com.baeldung.scope.singletone.SingletonProviderBean; @@ -58,4 +60,20 @@ public class PrototypeBeanInjectionIntegrationTest { Assert.assertTrue("New instance expected", firstInstance != secondInstance); } + + + @Test + public void givenPrototypeInjection_WhenFunction_ThenNewInstanceReturn() { + + AbstractApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class); + + SingletonFunctionBean firstContext = context.getBean(SingletonFunctionBean.class); + SingletonFunctionBean secondContext = context.getBean(SingletonFunctionBean.class); + + PrototypeBeanWithParam firstInstance = firstContext.getPrototypeInstance("instance1"); + PrototypeBeanWithParam secondInstance = secondContext.getPrototypeInstance("instance2"); + + Assert.assertTrue("New instance expected", firstInstance != secondInstance); + } + } From c19dfa510a821b34f8471d76dc36e30e21d37a92 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 24 Jun 2018 19:16:02 +0300 Subject: [PATCH 002/298] remove extra classes --- .../java/com/baeldung/scope/AppConfig.java | 6 ++-- .../scope/PrototypeFactoryBeanConfig.java | 27 ------------------ .../scope/prototype/PrototypeBean.java | 16 +++++++++++ .../prototype/PrototypeBeanWithParam.java | 28 ------------------- .../singletone/SingletonFunctionBean.java | 8 +++--- ...PrototypeBeanInjectionIntegrationTest.java | 5 ++-- 6 files changed, 25 insertions(+), 65 deletions(-) delete mode 100644 spring-core/src/main/java/com/baeldung/scope/PrototypeFactoryBeanConfig.java delete mode 100644 spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBeanWithParam.java diff --git a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java index 6a6efe26c5..ee6ae1a924 100644 --- a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java +++ b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java @@ -47,14 +47,14 @@ public class AppConfig { } @Bean - public Function beanFactory() { + public Function beanFactory() { return name -> prototypeBeanWithParam(name); } @Bean @Scope(value = "prototype") - public PrototypeBeanWithParam prototypeBeanWithParam(String name) { - return new PrototypeBeanWithParam(name); + public PrototypeBean prototypeBeanWithParam(String name) { + return new PrototypeBean(name); } @Bean diff --git a/spring-core/src/main/java/com/baeldung/scope/PrototypeFactoryBeanConfig.java b/spring-core/src/main/java/com/baeldung/scope/PrototypeFactoryBeanConfig.java deleted file mode 100644 index 6196672db8..0000000000 --- a/spring-core/src/main/java/com/baeldung/scope/PrototypeFactoryBeanConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.scope; - -import java.util.function.Function; - -import org.springframework.beans.factory.config.ConfigurableBeanFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Scope; -import org.springframework.context.annotation.ScopedProxyMode; - -import com.baeldung.scope.prototype.PrototypeBeanWithParam; - -@Configuration -public class PrototypeFactoryBeanConfig { - - @Bean - @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS) - public PrototypeBeanWithParam prototypeBeanWithParam(String name) { - return new PrototypeBeanWithParam(name); - } - - @Bean - public Function prototypeBeanFactory() { - return runtimeArg -> prototypeBeanWithParam(runtimeArg); - } - -} diff --git a/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBean.java b/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBean.java index cfccb62e45..c87c7a8d44 100644 --- a/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBean.java +++ b/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBean.java @@ -9,4 +9,20 @@ public class PrototypeBean { public PrototypeBean() { logger.info("Prototype instance created"); } + + private String name; + + public PrototypeBean(String name) { + this.name = name; + logger.info("Prototype instance " + name + " created"); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } diff --git a/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBeanWithParam.java b/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBeanWithParam.java deleted file mode 100644 index 018084db09..0000000000 --- a/spring-core/src/main/java/com/baeldung/scope/prototype/PrototypeBeanWithParam.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.scope.prototype; - -import org.apache.log4j.Logger; - -public class PrototypeBeanWithParam { - - private String name; - - private final Logger logger = Logger.getLogger(this.getClass()); - - public PrototypeBeanWithParam() { - logger.info("Prototype instance with param created"); - } - - public PrototypeBeanWithParam(String name) { - this.name = name; - logger.info("Prototype instance " + name + " created"); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} diff --git a/spring-core/src/main/java/com/baeldung/scope/singletone/SingletonFunctionBean.java b/spring-core/src/main/java/com/baeldung/scope/singletone/SingletonFunctionBean.java index 5cc40549a0..8cdc56a6fa 100644 --- a/spring-core/src/main/java/com/baeldung/scope/singletone/SingletonFunctionBean.java +++ b/spring-core/src/main/java/com/baeldung/scope/singletone/SingletonFunctionBean.java @@ -4,15 +4,15 @@ import java.util.function.Function; import org.springframework.beans.factory.annotation.Autowired; -import com.baeldung.scope.prototype.PrototypeBeanWithParam; +import com.baeldung.scope.prototype.PrototypeBean; public class SingletonFunctionBean { @Autowired - private Function beanFactory; + private Function beanFactory; - public PrototypeBeanWithParam getPrototypeInstance(String name) { - PrototypeBeanWithParam bean = beanFactory.apply(name); + public PrototypeBean getPrototypeInstance(String name) { + PrototypeBean bean = beanFactory.apply(name); return bean; } diff --git a/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java b/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java index 719e25eb51..68b4e6ff73 100644 --- a/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java +++ b/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java @@ -1,7 +1,6 @@ package com.baeldung.scope; import com.baeldung.scope.prototype.PrototypeBean; -import com.baeldung.scope.prototype.PrototypeBeanWithParam; import com.baeldung.scope.singletone.SingletonFunctionBean; import com.baeldung.scope.singletone.SingletonLookupBean; import com.baeldung.scope.singletone.SingletonObjectFactoryBean; @@ -70,8 +69,8 @@ public class PrototypeBeanInjectionIntegrationTest { SingletonFunctionBean firstContext = context.getBean(SingletonFunctionBean.class); SingletonFunctionBean secondContext = context.getBean(SingletonFunctionBean.class); - PrototypeBeanWithParam firstInstance = firstContext.getPrototypeInstance("instance1"); - PrototypeBeanWithParam secondInstance = secondContext.getPrototypeInstance("instance2"); + PrototypeBean firstInstance = firstContext.getPrototypeInstance("instance1"); + PrototypeBean secondInstance = secondContext.getPrototypeInstance("instance2"); Assert.assertTrue("New instance expected", firstInstance != secondInstance); } From fd34932f4cc5d625285e463c2501aa9bb8fa5105 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 24 Jun 2018 19:16:55 +0300 Subject: [PATCH 003/298] remove extra import --- spring-core/src/main/java/com/baeldung/scope/AppConfig.java | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java index ee6ae1a924..e1395ba72f 100644 --- a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java +++ b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java @@ -1,7 +1,6 @@ package com.baeldung.scope; import com.baeldung.scope.prototype.PrototypeBean; -import com.baeldung.scope.prototype.PrototypeBeanWithParam; import com.baeldung.scope.singletone.SingletonAppContextBean; import com.baeldung.scope.singletone.SingletonBean; import com.baeldung.scope.singletone.SingletonFunctionBean; From 32a9212fc9bbfcfdd65aec485c47d79323f5f109 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 24 Jun 2018 19:22:26 +0300 Subject: [PATCH 004/298] separate configs --- .../java/com/baeldung/scope/AppConfig.java | 18 ---------- .../baeldung/scope/AppConfigFunctionBean.java | 32 +++++++++++++++++ ...PrototypeBeanInjectionIntegrationTest.java | 15 -------- .../PrototypeFunctionBeanIntegrationTest.java | 35 +++++++++++++++++++ 4 files changed, 67 insertions(+), 33 deletions(-) create mode 100644 spring-core/src/main/java/com/baeldung/scope/AppConfigFunctionBean.java create mode 100644 spring-core/src/test/java/com/baeldung/scope/PrototypeFunctionBeanIntegrationTest.java diff --git a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java index e1395ba72f..18c53fee15 100644 --- a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java +++ b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java @@ -3,12 +3,9 @@ package com.baeldung.scope; import com.baeldung.scope.prototype.PrototypeBean; import com.baeldung.scope.singletone.SingletonAppContextBean; import com.baeldung.scope.singletone.SingletonBean; -import com.baeldung.scope.singletone.SingletonFunctionBean; import com.baeldung.scope.singletone.SingletonObjectFactoryBean; import com.baeldung.scope.singletone.SingletonProviderBean; -import java.util.function.Function; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -45,19 +42,4 @@ public class AppConfig { return new SingletonObjectFactoryBean(); } - @Bean - public Function beanFactory() { - return name -> prototypeBeanWithParam(name); - } - - @Bean - @Scope(value = "prototype") - public PrototypeBean prototypeBeanWithParam(String name) { - return new PrototypeBean(name); - } - - @Bean - public SingletonFunctionBean singletonFunctionBean() { - return new SingletonFunctionBean(); - } } diff --git a/spring-core/src/main/java/com/baeldung/scope/AppConfigFunctionBean.java b/spring-core/src/main/java/com/baeldung/scope/AppConfigFunctionBean.java new file mode 100644 index 0000000000..80779b62fd --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/scope/AppConfigFunctionBean.java @@ -0,0 +1,32 @@ +package com.baeldung.scope; + +import java.util.function.Function; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; + +import com.baeldung.scope.prototype.PrototypeBean; +import com.baeldung.scope.singletone.SingletonFunctionBean; + +@Configuration +public class AppConfigFunctionBean { + + @Bean + public Function beanFactory() { + return name -> prototypeBeanWithParam(name); + } + + @Bean + @Scope(value = "prototype") + public PrototypeBean prototypeBeanWithParam(String name) { + return new PrototypeBean(name); + } + + @Bean + public SingletonFunctionBean singletonFunctionBean() { + return new SingletonFunctionBean(); + } + +} diff --git a/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java b/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java index 68b4e6ff73..d0c2733765 100644 --- a/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java +++ b/spring-core/src/test/java/com/baeldung/scope/PrototypeBeanInjectionIntegrationTest.java @@ -60,19 +60,4 @@ public class PrototypeBeanInjectionIntegrationTest { Assert.assertTrue("New instance expected", firstInstance != secondInstance); } - - @Test - public void givenPrototypeInjection_WhenFunction_ThenNewInstanceReturn() { - - AbstractApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class); - - SingletonFunctionBean firstContext = context.getBean(SingletonFunctionBean.class); - SingletonFunctionBean secondContext = context.getBean(SingletonFunctionBean.class); - - PrototypeBean firstInstance = firstContext.getPrototypeInstance("instance1"); - PrototypeBean secondInstance = secondContext.getPrototypeInstance("instance2"); - - Assert.assertTrue("New instance expected", firstInstance != secondInstance); - } - } diff --git a/spring-core/src/test/java/com/baeldung/scope/PrototypeFunctionBeanIntegrationTest.java b/spring-core/src/test/java/com/baeldung/scope/PrototypeFunctionBeanIntegrationTest.java new file mode 100644 index 0000000000..6c2309d86f --- /dev/null +++ b/spring-core/src/test/java/com/baeldung/scope/PrototypeFunctionBeanIntegrationTest.java @@ -0,0 +1,35 @@ +package com.baeldung.scope; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.factorybean.FactoryBeanAppConfig; +import com.baeldung.scope.prototype.PrototypeBean; +import com.baeldung.scope.singletone.SingletonFunctionBean; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = FactoryBeanAppConfig.class) +public class PrototypeFunctionBeanIntegrationTest { + + + @Test + public void givenPrototypeInjection_WhenFunction_ThenNewInstanceReturn() { + + AbstractApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class); + + SingletonFunctionBean firstContext = context.getBean(SingletonFunctionBean.class); + SingletonFunctionBean secondContext = context.getBean(SingletonFunctionBean.class); + + PrototypeBean firstInstance = firstContext.getPrototypeInstance("instance1"); + PrototypeBean secondInstance = secondContext.getPrototypeInstance("instance2"); + + Assert.assertTrue("New instance expected", firstInstance != secondInstance); + } + +} From 588f84aa83d83da90f08144f9a6d8e98e6a43a36 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 24 Jun 2018 20:02:31 +0300 Subject: [PATCH 005/298] separate configs --- .../baeldung/{ => config}/scope/AppConfigFunctionBean.java | 3 +-- .../src/main/java/com/baeldung/scope/AppConfig.java | 2 +- .../scope/PrototypeFunctionBeanIntegrationTest.java | 7 +++---- 3 files changed, 5 insertions(+), 7 deletions(-) rename spring-core/src/main/java/com/baeldung/{ => config}/scope/AppConfigFunctionBean.java (89%) diff --git a/spring-core/src/main/java/com/baeldung/scope/AppConfigFunctionBean.java b/spring-core/src/main/java/com/baeldung/config/scope/AppConfigFunctionBean.java similarity index 89% rename from spring-core/src/main/java/com/baeldung/scope/AppConfigFunctionBean.java rename to spring-core/src/main/java/com/baeldung/config/scope/AppConfigFunctionBean.java index 80779b62fd..a3c5445698 100644 --- a/spring-core/src/main/java/com/baeldung/scope/AppConfigFunctionBean.java +++ b/spring-core/src/main/java/com/baeldung/config/scope/AppConfigFunctionBean.java @@ -1,8 +1,7 @@ -package com.baeldung.scope; +package com.baeldung.config.scope; import java.util.function.Function; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; diff --git a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java index 18c53fee15..948cd60375 100644 --- a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java +++ b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java @@ -13,7 +13,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; @Configuration -@ComponentScan("com.baeldung.scope") +@ComponentScan(value="com.baeldung.scope") public class AppConfig { @Bean diff --git a/spring-core/src/test/java/com/baeldung/scope/PrototypeFunctionBeanIntegrationTest.java b/spring-core/src/test/java/com/baeldung/scope/PrototypeFunctionBeanIntegrationTest.java index 6c2309d86f..1e3c652599 100644 --- a/spring-core/src/test/java/com/baeldung/scope/PrototypeFunctionBeanIntegrationTest.java +++ b/spring-core/src/test/java/com/baeldung/scope/PrototypeFunctionBeanIntegrationTest.java @@ -9,19 +9,18 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; -import com.baeldung.factorybean.FactoryBeanAppConfig; +import com.baeldung.config.scope.AppConfigFunctionBean; import com.baeldung.scope.prototype.PrototypeBean; import com.baeldung.scope.singletone.SingletonFunctionBean; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = FactoryBeanAppConfig.class) +@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = AppConfigFunctionBean.class) public class PrototypeFunctionBeanIntegrationTest { - @Test public void givenPrototypeInjection_WhenFunction_ThenNewInstanceReturn() { - AbstractApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class); + AbstractApplicationContext context = new AnnotationConfigApplicationContext(AppConfigFunctionBean.class); SingletonFunctionBean firstContext = context.getBean(SingletonFunctionBean.class); SingletonFunctionBean secondContext = context.getBean(SingletonFunctionBean.class); From 679336f3e9a83676389c9412d43bbe579c8adaec Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 24 Jun 2018 21:18:34 +0300 Subject: [PATCH 006/298] Update AppConfig.java --- spring-core/src/main/java/com/baeldung/scope/AppConfig.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java index 948cd60375..33a9c5c21e 100644 --- a/spring-core/src/main/java/com/baeldung/scope/AppConfig.java +++ b/spring-core/src/main/java/com/baeldung/scope/AppConfig.java @@ -5,7 +5,6 @@ import com.baeldung.scope.singletone.SingletonAppContextBean; import com.baeldung.scope.singletone.SingletonBean; import com.baeldung.scope.singletone.SingletonObjectFactoryBean; import com.baeldung.scope.singletone.SingletonProviderBean; - import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -13,7 +12,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; @Configuration -@ComponentScan(value="com.baeldung.scope") +@ComponentScan("com.baeldung.scope") public class AppConfig { @Bean From 429bbbbaf14a8016c09f0fba0c8ff347e6270f26 Mon Sep 17 00:00:00 2001 From: db Date: Tue, 26 Jun 2018 01:41:28 +0100 Subject: [PATCH 007/298] Server Sent Events example using Spring Webflux and React --- .../sse/controller/EventController.java | 26 ++++++++++++ .../reactive/sse/model/EventSubscription.java | 22 ++++++++++ .../service/EventSubscriptionsService.java | 41 +++++++++++++++++++ .../service/emitter/DateEmitterService.java | 27 ++++++++++++ .../src/main/resources/static/app.js | 36 ++++++++++++++++ .../src/main/resources/static/sse-index.html | 19 +++++++++ .../reactive/sse/ServerSentEventsTest.java | 39 ++++++++++++++++++ 7 files changed, 210 insertions(+) create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/sse/controller/EventController.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/sse/model/EventSubscription.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/EventSubscriptionsService.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/emitter/DateEmitterService.java create mode 100644 spring-5-reactive/src/main/resources/static/app.js create mode 100644 spring-5-reactive/src/main/resources/static/sse-index.html create mode 100644 spring-5-reactive/src/test/java/com/baeldung/reactive/sse/ServerSentEventsTest.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/controller/EventController.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/controller/EventController.java new file mode 100644 index 0000000000..e692aa3a74 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/controller/EventController.java @@ -0,0 +1,26 @@ +package com.baeldung.reactive.sse.controller; + + +import com.baeldung.reactive.sse.service.EventSubscriptionsService; +import org.springframework.http.MediaType; +import org.springframework.http.codec.ServerSentEvent; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Flux; + +@RestController +public class EventController { + + private EventSubscriptionsService eventSubscriptionsService; + + public EventController(EventSubscriptionsService eventSubscriptionsService) { + this.eventSubscriptionsService = eventSubscriptionsService; + } + + @GetMapping( + produces = MediaType.TEXT_EVENT_STREAM_VALUE, + value = "/sse/events") + public Flux events() { + return eventSubscriptionsService.subscribe(); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/model/EventSubscription.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/model/EventSubscription.java new file mode 100644 index 0000000000..4d3ce27156 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/model/EventSubscription.java @@ -0,0 +1,22 @@ +package com.baeldung.reactive.sse.model; + +import org.springframework.http.codec.ServerSentEvent; +import reactor.core.publisher.DirectProcessor; +import reactor.core.publisher.Flux; + +public class EventSubscription { + + private DirectProcessor directProcessor; + + public EventSubscription() { + this.directProcessor = DirectProcessor.create(); + } + + public void emit(ServerSentEvent e) { + directProcessor.onNext(e); + } + + public Flux subscribe() { + return directProcessor; + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/EventSubscriptionsService.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/EventSubscriptionsService.java new file mode 100644 index 0000000000..f245ce6184 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/EventSubscriptionsService.java @@ -0,0 +1,41 @@ +package com.baeldung.reactive.sse.service; + +import com.baeldung.reactive.sse.model.EventSubscription; +import org.springframework.http.codec.ServerSentEvent; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Flux; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +@Service +public class EventSubscriptionsService { + + private List listeners; + + public EventSubscriptionsService() { + this.listeners = new ArrayList<>(); + } + + public Flux subscribe() { + EventSubscription e = new EventSubscription(); + listeners.add(e); + + return e.subscribe(); + } + + public void sendDateEvent(Date date) { + for (EventSubscription e : listeners) { + try { + e.emit(ServerSentEvent.builder(date) + .event("date") + .id(UUID.randomUUID().toString()) + .build()); + } catch (Exception ex) { + listeners.remove(e); + } + } + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/emitter/DateEmitterService.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/emitter/DateEmitterService.java new file mode 100644 index 0000000000..29b70865dc --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/emitter/DateEmitterService.java @@ -0,0 +1,27 @@ +package com.baeldung.reactive.sse.service.emitter; + +import com.baeldung.reactive.sse.service.EventSubscriptionsService; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Flux; + +import javax.annotation.PostConstruct; +import java.time.Duration; +import java.util.Date; +import java.util.stream.Stream; + +@Service +public class DateEmitterService { + + private EventSubscriptionsService eventSubscriptionsService; + + public DateEmitterService(EventSubscriptionsService eventSubscriptionsService) { + this.eventSubscriptionsService = eventSubscriptionsService; + } + + @PostConstruct + public void init() { + Flux.fromStream(Stream.generate(Date::new)) + .delayElements(Duration.ofSeconds(1)) + .subscribe(data -> eventSubscriptionsService.sendDateEvent(new Date())); + } +} diff --git a/spring-5-reactive/src/main/resources/static/app.js b/spring-5-reactive/src/main/resources/static/app.js new file mode 100644 index 0000000000..2af2ae5844 --- /dev/null +++ b/spring-5-reactive/src/main/resources/static/app.js @@ -0,0 +1,36 @@ +let Clock = React.createClass({ + + getInitialState: function() { + const self = this; + const ev = new EventSource("http://localhost:8080/sse/events"); + + self.setState({currentDate : moment(new Date()).format("MMMM Do YYYY, h:mm:ss a")}); + + ev.addEventListener("date", function(e) { + self.setState({currentDate : moment(JSON.parse(e.data).date).format("MMMM Do YYYY, h:mm:ss a")}); + }, false); + + return {currentDate: moment(new Date()).format("MMMM Do YYYY, h:mm:ss a") }; + }, + + render() { + return ( +

+ Current time: {this.state.currentDate} +

+ ); + } + +}); + +let App = React.createClass({ + render() { + return ( +
+ +
+ ); + } +}); + +ReactDOM.render(, document.getElementById('root') ); \ No newline at end of file diff --git a/spring-5-reactive/src/main/resources/static/sse-index.html b/spring-5-reactive/src/main/resources/static/sse-index.html new file mode 100644 index 0000000000..875c8176af --- /dev/null +++ b/spring-5-reactive/src/main/resources/static/sse-index.html @@ -0,0 +1,19 @@ + + + + + React + Spring + + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/sse/ServerSentEventsTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/sse/ServerSentEventsTest.java new file mode 100644 index 0000000000..48e8c23c37 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/sse/ServerSentEventsTest.java @@ -0,0 +1,39 @@ +package com.baeldung.reactive.sse; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class ServerSentEventsTest { + + @Autowired + private WebTestClient webClient; + + @Test + public void contextLoads() { + } + + @Test + public void givenValidRequest_shouldReceiveOk() throws Exception { + + webClient.get().uri("/events").accept(MediaType.TEXT_EVENT_STREAM) + .exchange() + .expectStatus().isOk(); + } + + @Test + public void givenInvalidHttpVerb_shouldReceiveMethodNotAllowedError() throws Exception { + + webClient.post().uri("/events").accept(MediaType.TEXT_EVENT_STREAM) + .exchange() + .expectStatus().isEqualTo(HttpStatus.METHOD_NOT_ALLOWED); + } + +} From 172642e190d47c76a14a40b7053a6df9524c746f Mon Sep 17 00:00:00 2001 From: Philippe Date: Tue, 26 Jun 2018 01:10:00 -0300 Subject: [PATCH 008/298] BAEL-1474 Take2 --- .../src/docker/docker-compose.yml | 23 -- .../spring/amqp/AmqpReactiveController.java | 307 ++++++++++++++++++ .../amqp/MessageListenerContainerFactory.java | 29 ++ 3 files changed, 336 insertions(+), 23 deletions(-) delete mode 100755 spring-webflux-amqp/src/docker/docker-compose.yml create mode 100644 spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/AmqpReactiveController.java create mode 100644 spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/MessageListenerContainerFactory.java diff --git a/spring-webflux-amqp/src/docker/docker-compose.yml b/spring-webflux-amqp/src/docker/docker-compose.yml deleted file mode 100755 index 03292aeb63..0000000000 --- a/spring-webflux-amqp/src/docker/docker-compose.yml +++ /dev/null @@ -1,23 +0,0 @@ -## -## Create a simple RabbitMQ environment with multiple clients -## -version: "3" - -services: - -## -## RabitMQ server -## - rabbitmq: - image: rabbitmq:3 - hostname: rabbit - environment: - RABBITMQ_ERLANG_COOKIE: test - ports: - - "5672:5672" - volumes: - - rabbitmq-data:/var/lib/rabbitmq - -volumes: - rabbitmq-data: - diff --git a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/AmqpReactiveController.java b/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/AmqpReactiveController.java new file mode 100644 index 0000000000..52f6d924fa --- /dev/null +++ b/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/AmqpReactiveController.java @@ -0,0 +1,307 @@ +package org.baeldung.spring.amqp; + +import java.time.Duration; +import java.util.Date; + +import javax.annotation.PostConstruct; + +import org.baeldung.spring.amqp.DestinationsConfig.DestinationInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.amqp.core.AmqpAdmin; +import org.springframework.amqp.core.AmqpTemplate; +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.BindingBuilder; +import org.springframework.amqp.core.Exchange; +import org.springframework.amqp.core.ExchangeBuilder; +import org.springframework.amqp.core.MessageListener; +import org.springframework.amqp.core.Queue; +import org.springframework.amqp.core.QueueBuilder; +import org.springframework.amqp.rabbit.listener.MessageListenerContainer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; + +@RestController +public class AmqpReactiveController { + + private static Logger log = LoggerFactory.getLogger(AmqpReactiveController.class); + + @Autowired + private AmqpTemplate amqpTemplate; + + @Autowired + private AmqpAdmin amqpAdmin; + + @Autowired + private DestinationsConfig destinationsConfig; + + @Autowired + private MessageListenerContainerFactory messageListenerContainerFactory; + + @PostConstruct + public void setupQueueDestinations() { + + log.info("[I48] Creating Destinations..."); + + destinationsConfig.getQueues() + .forEach((key, destination) -> { + + log.info("[I54] Creating directExchange: key={}, name={}, routingKey={}", key, destination.getExchange(), destination.getRoutingKey()); + + Exchange ex = ExchangeBuilder.directExchange(destination.getExchange()) + .durable(true) + .build(); + + amqpAdmin.declareExchange(ex); + + Queue q = QueueBuilder.durable(destination.getRoutingKey()) + .build(); + + amqpAdmin.declareQueue(q); + + Binding b = BindingBuilder.bind(q) + .to(ex) + .with(destination.getRoutingKey()) + .noargs(); + + amqpAdmin.declareBinding(b); + + log.info("[I70] Binding successfully created."); + + }); + } + + @PostConstruct + public void setupTopicDestinations() { + + // For topic each consumer will have its own Queue, so no binding + destinationsConfig.getTopics() + .forEach((key, destination) -> { + + log.info("[I98] Creating TopicExchange: name={}, exchange={}", key, destination.getExchange()); + + Exchange ex = ExchangeBuilder.topicExchange(destination.getExchange()) + .durable(true) + .build(); + + amqpAdmin.declareExchange(ex); + + log.info("[I107] Topic Exchange successfully created."); + + }); + } + + @PostMapping(value = "/queue/{name}") + public Mono> sendMessageToQueue(@PathVariable String name, @RequestBody String payload) { + + // Lookup exchange details + final DestinationInfo d = destinationsConfig.getQueues() + .get(name); + + if (d == null) { + // Destination not found. + return Mono.just(ResponseEntity.notFound() + .build()); + } + + return Mono.fromCallable(() -> { + + log.info("[I51] sendMessageToQueue: queue={}, routingKey={}", d.getExchange(), d.getRoutingKey()); + amqpTemplate.convertAndSend(d.getExchange(), d.getRoutingKey(), payload); + + return ResponseEntity.accepted() + .build(); + + }); + + } + + /** + * Receive messages for the given queue + * @param name + * @param errorHandler + * @return + */ + @GetMapping(value = "/queue/{name}", produces = MediaType.TEXT_EVENT_STREAM_VALUE) + public Flux receiveMessagesFromQueue(@PathVariable String name) { + + DestinationInfo d = destinationsConfig.getQueues() + .get(name); + + if (d == null) { + return Flux.just(ResponseEntity.notFound() + .build()); + } + + MessageListenerContainer mlc = messageListenerContainerFactory.createMessageListenerContainer(d.getRoutingKey()); + + Flux f = Flux. create(emitter -> { + + log.info("[I168] Adding listener, queue={}", d.getRoutingKey()); + mlc.setupMessageListener((MessageListener) m -> { + + String qname = m.getMessageProperties() + .getConsumerQueue(); + + log.info("[I137] Message received, queue={}", qname); + + if (emitter.isCancelled()) { + log.info("[I166] cancelled, queue={}", qname); + mlc.stop(); + return; + } + + String payload = new String(m.getBody()); + emitter.next(payload); + + log.info("[I176] Message sent to client, queue={}", qname); + + }); + + emitter.onRequest(v -> { + log.info("[I171] Starting container, queue={}", d.getRoutingKey()); + mlc.start(); + }); + + emitter.onDispose(() -> { + log.info("[I176] onDispose: queue={}", d.getRoutingKey()); + mlc.stop(); + }); + + log.info("[I171] Container started, queue={}", d.getRoutingKey()); + + }); + + + return Flux.interval(Duration.ofSeconds(5)) + .map(v -> { + log.info("[I209] sending keepalive message..."); + return "No news is good news"; + }) + .mergeWith(f); + } + + /** + * send message to a given topic + * @param name + * @param payload + * @return + */ + @PostMapping(value = "/topic/{name}") + public Mono> sendMessageToTopic(@PathVariable String name, @RequestBody String payload) { + + // Lookup exchange details + final DestinationInfo d = destinationsConfig.getTopics() + .get(name); + if (d == null) { + // Destination not found. + return Mono.just(ResponseEntity.notFound() + .build()); + } + + return Mono.fromCallable(() -> { + + log.info("[I51] sendMessageToTopic: topic={}, routingKey={}", d.getExchange(), d.getRoutingKey()); + amqpTemplate.convertAndSend(d.getExchange(), d.getRoutingKey(), payload); + + return ResponseEntity.accepted() + .build(); + + }); + } + + @GetMapping(value = "/topic/{name}", produces = MediaType.TEXT_EVENT_STREAM_VALUE) + public Flux receiveMessagesFromTopic(@PathVariable String name) { + + DestinationInfo d = destinationsConfig.getTopics() + .get(name); + + if (d == null) { + return Flux.just(ResponseEntity.notFound() + .build()); + } + + Queue topicQueue = createTopicQueue(d); + String qname = topicQueue.getName(); + + MessageListenerContainer mlc = messageListenerContainerFactory.createMessageListenerContainer(qname); + + Flux f = Flux. create(emitter -> { + + log.info("[I168] Adding listener, queue={}", qname); + + mlc.setupMessageListener((MessageListener) m -> { + + log.info("[I137] Message received, queue={}", qname); + + if (emitter.isCancelled()) { + log.info("[I166] cancelled, queue={}", qname); + mlc.stop(); + return; + } + + String payload = new String(m.getBody()); + emitter.next(payload); + + log.info("[I176] Message sent to client, queue={}", qname); + + }); + + emitter.onRequest(v -> { + log.info("[I171] Starting container, queue={}", qname); + mlc.start(); + }); + + emitter.onDispose(() -> { + log.info("[I176] onDispose: queue={}", qname); + amqpAdmin.deleteQueue(qname); + mlc.stop(); + }); + + log.info("[I171] Container started, queue={}", qname); + + }); + + return Flux.interval(Duration.ofSeconds(5)) + .map(v -> { + log.info("[I209] sending keepalive message..."); + return "No news is good news"; + }) + .mergeWith(f); + + } + + private Queue createTopicQueue(DestinationInfo destination) { + + Exchange ex = ExchangeBuilder.topicExchange(destination.getExchange()) + .durable(true) + .build(); + + amqpAdmin.declareExchange(ex); + + Queue q = QueueBuilder.nonDurable() + .build(); + + amqpAdmin.declareQueue(q); + + Binding b = BindingBuilder.bind(q) + .to(ex) + .with(destination.getRoutingKey()) + .noargs(); + + amqpAdmin.declareBinding(b); + + return q; + } + +} diff --git a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/MessageListenerContainerFactory.java b/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/MessageListenerContainerFactory.java new file mode 100644 index 0000000000..29b8d28a80 --- /dev/null +++ b/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/MessageListenerContainerFactory.java @@ -0,0 +1,29 @@ +package org.baeldung.spring.amqp; + +import org.springframework.amqp.core.AcknowledgeMode; +import org.springframework.amqp.rabbit.connection.ConnectionFactory; +import org.springframework.amqp.rabbit.listener.MessageListenerContainer; +import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class MessageListenerContainerFactory { + + @Autowired + private ConnectionFactory connectionFactory; + + public MessageListenerContainerFactory() { + } + + public MessageListenerContainer createMessageListenerContainer(String queueName) { + + SimpleMessageListenerContainer mlc = new SimpleMessageListenerContainer(connectionFactory); + + mlc.addQueueNames(queueName); + mlc.setAcknowledgeMode(AcknowledgeMode.AUTO); + + return mlc; + } + +} From 53201b46ef3ca9bdda922e90ed8e060ce8ecf98b Mon Sep 17 00:00:00 2001 From: fanatixan Date: Fri, 29 Jun 2018 14:48:22 +0200 Subject: [PATCH 009/298] custom exception with @ResponseStatus --- .../java/com/baeldung/annotations/CustomException.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 spring-mvc-java/src/main/java/com/baeldung/annotations/CustomException.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomException.java b/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomException.java new file mode 100644 index 0000000000..4502a45301 --- /dev/null +++ b/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomException.java @@ -0,0 +1,8 @@ +package com.baeldung.annotations; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ResponseStatus(code = HttpStatus.BAD_REQUEST) +public class CustomException extends RuntimeException { +} From 913c95cfbb7f78bc6f30cd0b979f808975c4750b Mon Sep 17 00:00:00 2001 From: fanatixan Date: Fri, 29 Jun 2018 16:14:59 +0200 Subject: [PATCH 010/298] ResponseEntity builder examples --- .../CustomResponseWithBuilderController.java | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 spring-mvc-java/src/main/java/com/baeldung/annotations/CustomResponseWithBuilderController.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomResponseWithBuilderController.java b/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomResponseWithBuilderController.java new file mode 100644 index 0000000000..9a77029128 --- /dev/null +++ b/spring-mvc-java/src/main/java/com/baeldung/annotations/CustomResponseWithBuilderController.java @@ -0,0 +1,52 @@ +package com.baeldung.annotations; + +import java.time.Year; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@Controller +@RequestMapping("/customResponseWithBuilder") +public class CustomResponseWithBuilderController { + + @GetMapping("/hello") + public ResponseEntity hello() { + return ResponseEntity.ok("Hello World!"); + } + + @GetMapping("/age") + public ResponseEntity age(@RequestParam("yearOfBirth") int yearOfBirth) { + if (isInFuture(yearOfBirth)) { + return ResponseEntity.badRequest() + .body("Year of birth cannot be in the future"); + } + + return ResponseEntity.status(HttpStatus.OK) + .body("Your age is " + calculateAge(yearOfBirth)); + } + + private int calculateAge(int yearOfBirth) { + return currentYear() - yearOfBirth; + } + + private boolean isInFuture(int year) { + return currentYear() < year; + } + + private int currentYear() { + return Year.now() + .getValue(); + } + + @GetMapping("/customHeader") + public ResponseEntity customHeader() { + return ResponseEntity.ok() + .header("Custom-Header", "foo") + .body("Custom header set"); + } + +} From 652cf1e49c2be1a74b38b20319a374cc13f72678 Mon Sep 17 00:00:00 2001 From: Philippe Date: Sat, 30 Jun 2018 00:14:05 +0200 Subject: [PATCH 011/298] Remove extra code --- .../amqp/SpringWebfluxAmqpApplication.java | 255 ------------------ 1 file changed, 255 deletions(-) diff --git a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java b/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java index eb3b858ddc..30614e7ee6 100755 --- a/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java +++ b/spring-webflux-amqp/src/main/java/org/baeldung/spring/amqp/SpringWebfluxAmqpApplication.java @@ -1,270 +1,15 @@ package org.baeldung.spring.amqp; -import java.util.stream.Stream; - -import org.baeldung.spring.amqp.DestinationsConfig.DestinationInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.amqp.AmqpException; -import org.springframework.amqp.core.AmqpAdmin; -import org.springframework.amqp.core.AmqpTemplate; -import org.springframework.amqp.core.Binding; -import org.springframework.amqp.core.BindingBuilder; -import org.springframework.amqp.core.Exchange; -import org.springframework.amqp.core.ExchangeBuilder; -import org.springframework.amqp.core.Queue; -import org.springframework.amqp.core.QueueBuilder; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; @SpringBootApplication @EnableConfigurationProperties(DestinationsConfig.class) -@RestController public class SpringWebfluxAmqpApplication { - private static Logger log = LoggerFactory.getLogger(SpringWebfluxAmqpApplication.class); - - @Autowired - private AmqpTemplate amqpTemplate; - - @Autowired - private AmqpAdmin amqpAdmin; - - @Autowired - private DestinationsConfig destinationsConfig; - - public static void main(String[] args) { SpringApplication.run(SpringWebfluxAmqpApplication.class, args); } - - @Bean - public CommandLineRunner setupQueueDestinations(AmqpAdmin amqpAdmin,DestinationsConfig destinationsConfig) { - - return (args) -> { - - log.info("[I48] Creating Destinations..."); - - destinationsConfig.getQueues() - .forEach((key, destination) -> { - - log.info("[I54] Creating directExchange: key={}, name={}, routingKey={}", key, destination.getExchange(), destination.getRoutingKey()); - - Exchange ex = ExchangeBuilder - .directExchange(destination.getExchange()) - .durable(true) - .build(); - - amqpAdmin.declareExchange(ex); - - Queue q = QueueBuilder - .durable(destination.getRoutingKey()) - .build(); - - amqpAdmin.declareQueue(q); - - Binding b = BindingBuilder.bind(q) - .to(ex) - .with(destination.getRoutingKey()) - .noargs(); - amqpAdmin.declareBinding(b); - - log.info("[I70] Binding successfully created."); - - }); - - }; - - } - - @Bean - public CommandLineRunner setupTopicDestinations(AmqpAdmin amqpAdmin, DestinationsConfig destinationsConfig) { - - return (args) -> { - - // For topic each consumer will have its own Queue, so no binding - destinationsConfig.getTopics() - .forEach((key, destination) -> { - - log.info("[I98] Creating TopicExchange: name={}, exchange={}", key, destination.getExchange()); - - Exchange ex = ExchangeBuilder.topicExchange(destination.getExchange()) - .durable(true) - .build(); - - amqpAdmin.declareExchange(ex); - - log.info("[I107] Topic Exchange successfully created."); - - }); - }; - } - - @PostMapping(value = "/queue/{name}") - public Mono> sendMessageToQueue(@PathVariable String name, @RequestBody String payload) { - - // Lookup exchange details - final DestinationInfo d = destinationsConfig.getQueues() - .get(name); - if (d == null) { - // Destination not found. - return Mono.just(ResponseEntity.notFound().build()); - } - - return Mono.fromCallable(() -> { - - log.info("[I51] sendMessageToQueue: queue={}, routingKey={}", d.getExchange(), d.getRoutingKey()); - amqpTemplate.convertAndSend(d.getExchange(), d.getRoutingKey(), payload); - - return ResponseEntity.accepted().build(); - - }); - - } - - - /** - * Receive messages for the given queue - * @param name - * @return - */ - @GetMapping(value = "/queue/{name}", produces = MediaType.TEXT_EVENT_STREAM_VALUE) - public Flux receiveMessagesFromQueue(@PathVariable String name) { - - final DestinationInfo d = destinationsConfig.getQueues().get(name); - - if (d == null) { - return Flux.just(ResponseEntity.notFound().build()); - } - - Stream s = Stream.generate(() -> { - String queueName = d.getRoutingKey(); - - log.info("[I137] Polling {}", queueName); - - Object payload = amqpTemplate.receiveAndConvert(queueName,5000); - if ( payload == null ) { - payload = "No news is good news..."; - } - - return payload.toString(); - }); - - - return Flux - .fromStream(s) - .subscribeOn(Schedulers.elastic()); - - } - - /** - * send message to a given topic - * @param name - * @param payload - * @return - */ - @PostMapping(value = "/topic/{name}") - public Mono> sendMessageToTopic(@PathVariable String name, @RequestBody String payload) { - - // Lookup exchange details - final DestinationInfo d = destinationsConfig.getTopics().get(name); - if (d == null) { - // Destination not found. - return Mono.just(ResponseEntity.notFound().build()); - } - - return Mono.fromCallable(() -> { - - log.info("[I51] sendMessageToTopic: topic={}, routingKey={}", d.getExchange(), d.getRoutingKey()); - amqpTemplate.convertAndSend(d.getExchange(), d.getRoutingKey(), payload); - - return ResponseEntity.accepted().build(); - - }); - } - - - @GetMapping(value = "/topic/{name}", produces = MediaType.TEXT_EVENT_STREAM_VALUE) - public Flux receiveMessagesFromTopic(@PathVariable String name) { - - DestinationInfo d = destinationsConfig.getTopics().get(name); - - if (d == null) { - return Flux.just(ResponseEntity.notFound().build()); - } - - final Queue topicQueue = createTopicQueue(d); - - Stream s = Stream.generate(() -> { - String queueName = topicQueue.getName(); - - log.info("[I137] Polling {}", queueName); - - try { - Object payload = amqpTemplate.receiveAndConvert(queueName,5000); - if ( payload == null ) { - payload = "No news is good news..."; - } - - return payload.toString(); - } - catch(AmqpException ex) { - log.warn("[W247] Received an AMQP Exception: {}", ex.getMessage()); - return null; - } - }); - - - return Flux.fromStream(s) - .doOnCancel(() -> { - log.info("[I250] doOnCancel()"); - amqpAdmin.deleteQueue(topicQueue.getName()); - }) - .subscribeOn(Schedulers.elastic()); - - - } - - - private Queue createTopicQueue(DestinationInfo destination) { - - Exchange ex = ExchangeBuilder.topicExchange(destination.getExchange()) - .durable(true) - .build(); - - amqpAdmin.declareExchange(ex); - - // Create a durable queue - Queue q = QueueBuilder - .durable() - .build(); - - amqpAdmin.declareQueue(q); - - Binding b = BindingBuilder.bind(q) - .to(ex) - .with(destination.getRoutingKey()) - .noargs(); - - amqpAdmin.declareBinding(b); - - return q; - } - } From cf4623957b8a8ab38aaa5d349db7f6e5a3b398b0 Mon Sep 17 00:00:00 2001 From: Kirti Deo Date: Tue, 3 Jul 2018 13:15:12 +0530 Subject: [PATCH 012/298] Kirti Deo : Sample Spring Webflux Client and Server Example --- spring-webflux/.gitignore | 25 ++ spring-webflux/.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 47610 bytes .../.mvn/wrapper/maven-wrapper.properties | 1 + spring-webflux/mvnw | 225 ++++++++++++++++++ spring-webflux/mvnw.cmd | 143 +++++++++++ spring-webflux/pom.xml | 55 +++++ .../client/SpringWebfluxClientApp.java | 36 +++ .../example/springwebflux/events/Train.java | 30 +++ .../server/SpringWebfluxServerApp.java | 38 +++ .../src/main/resources/application.properties | 0 .../SpringWebfluxApplicationTests.java | 16 ++ .../server/SpringWebfluxServerAppTest.java | 31 +++ 12 files changed, 600 insertions(+) create mode 100644 spring-webflux/.gitignore create mode 100644 spring-webflux/.mvn/wrapper/maven-wrapper.jar create mode 100644 spring-webflux/.mvn/wrapper/maven-wrapper.properties create mode 100644 spring-webflux/mvnw create mode 100644 spring-webflux/mvnw.cmd create mode 100644 spring-webflux/pom.xml create mode 100644 spring-webflux/src/main/java/com/example/springwebflux/client/SpringWebfluxClientApp.java create mode 100644 spring-webflux/src/main/java/com/example/springwebflux/events/Train.java create mode 100644 spring-webflux/src/main/java/com/example/springwebflux/server/SpringWebfluxServerApp.java create mode 100644 spring-webflux/src/main/resources/application.properties create mode 100644 spring-webflux/src/test/java/com/example/springwebflux/SpringWebfluxApplicationTests.java create mode 100644 spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java diff --git a/spring-webflux/.gitignore b/spring-webflux/.gitignore new file mode 100644 index 0000000000..82eca336e3 --- /dev/null +++ b/spring-webflux/.gitignore @@ -0,0 +1,25 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/spring-webflux/.mvn/wrapper/maven-wrapper.jar b/spring-webflux/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..9cc84ea9b4d95453115d0c26488d6a78694e0bc6 GIT binary patch literal 47610 zcmbTd1CXW7vMxN+wr$(CZCk5to71*!+jjS~ZJX1!ds=tCefGhB{(HVS`>u$J^~PFn zW>r>YRc2N`sUQsug7OUl0^-}ZZ-jr^e|{kUJj#ly2+~T*iO~apQ;-J#>z!{v|9nH? zexD9D~4A70;F%I|$?{aX9)~)7!NMGs_XtoO(D2z3Q#5Lmj zOYWk1b{iMmsdX30UFmYyZk1gWICVeOtk^$+{3U2(8gx?WA2F!EfBPf&|1?AJ|5Z>M zfUAk^zcf#n|9^4|J34286~NKrUt&c5cZ~iqE?PH7fW5tm3-qG$) z56%`QPSn!0RMV3)jjXfG^UQ}*^yBojH!}58lPlDclX5iUhf*|DV=~e*bl;(l$Wn@r zPE*iH(NK!e9KQcU$rRM}aJc?-&H1PO&vOs*=U+QVvwuk-=zr1x>;XpRCjSyC;{TWQ z|824V8t*^*{x=5yn^pP#-?k<5|7|4y&Pd44&e_TN&sxg@ENqpX0glclj&w%W04Jwp zwJ}#@ag^@h5VV4H5U@i7V#A*a;4bzM-y_rd{0WG#jRFPJU}(#&o8vo@uM+B+$>Tiq zei^5$wg8CVf{+_#Vh`yPx-6TmB~zT_nocS_Rb6&EYp*KjbN#-aP<~3j=NVuR)S1wm zdy3AWx2r9uww3eNJxT>{tdmY4#pLw`*`_fIwSu;yzFYP)=W6iawn`s*omzNbR?E&LyC17rFcjWp!M~p?;{v!78DTxtF85BK4dT< zA5p)Z%6O}mP?<%Z{>nZmbVEbomm zLgy;;N&!y>Dma2sqmbvz&KY-j&s~dd#mWGlNF%7}vS7yt>Dm{P=X zG>Pyv2D!ba0CcTI*G6-v?!0}`EWm1d?K)DgZIQk9eucI&lBtR))NxqVz)+hBR1b|7 zgv&^46cI?mgCvp>lY9W(nJT#^<*kY3o#Php1RZLY@ffmLLq3A!Yd}O~n@BhXVp`<5 zJx`BjR%Svv)Sih_8TFg-9F-Gg3^kQrpDGej@uT5%y_9NSsk5SW>7{>&11u(JZHsZO zZweI|!&qHl0;7qxijraQo=oV^Pi~bNlzx;~b2+hXreonWGD%C$fyHs+8d1kKN>TgB z{Mu?~E{=l1osx|_8P*yC>81_GB7>NS7UA+x2k_c*cU-$gQjR{+IU)z069Ic$<)ci< zb?+V#^-MK!0s~wRP|grx?P^8EZ(9Jt0iA{`uVS6fNo>b@as5_-?e766V}&)8ZOEVtKB z*HtHAqat+2lbJbEI#fl~`XKNIF&J?PHKq)A!z(#j%)Uby=5d!bQP)-Mr!0#J=FV%@9G#Cby%r#(S=23H#9d)5Ndy>pIXJ%si!D=m*-QQZ(O9~#Jhx#AS3 z&Vs+*E5>d+{ib4>FEd#L15-ovl*zV%SYSWF>Z}j!vGn=g%w0~3XvAK&$Dl@t5hiUa#mT(4s9-JF1l zPi5d2YmuFJ4S(O>g~H)5l_`%h3qm?+8MmhXA>GRN}7GX;$4(!WTkYZB=TA^8ZFh^d9_@x$fK4qenP!zzaqQ1^(GQ- zjC$P$B5o{q&-H8UH_$orJTv0}#|9ja(vW9gA%l|@alYk+Uth1ey*ax8wmV7U?^Z9? zsQMrEzP8|_s0=bii4wDWa7te&Vmh9T>fcUXJS|dD3Y$A`s-7kY!+idEa`zB) zaW*%xb+#}9INSa62(M1kwL=m_3E2T|l5Sm9QmON8ewxr#QR`;vOGCgyMsA8$O(;=U z#sEw)37duzeM#9_7l!ly#5c+Mu3{;<9%O{e z`+0*{COEF^py;f6)y6NX)gycj`uU9pdZMum9h(bS!zu1gDXdmF4{Og{u;d(Dr~Co1 z1tm@i#5?>oL}-weK1zJRlLv*+M?l=eI~Sp9vg{R6csq=3tYSB2pqB8 z=#p`us7r|uH=cZnGj|juceAu8J#vb+&UFLFmGn~9O|TNeGH>sboBl%JI9v(@^|45? zLvr2ha)NWP4yxV8K%dU(Ae=zl)qdGyz={$my;Vs6?4?2*1?&u!OFyFbAquv6@1e)~&Rp#Ww9O88!mrze((=@F?&BPl_u9gK4VlHo@4gLK_pGtEA(gO4YpIIWTrFN zqVi%Q{adXq^Ez~dZ0VUC>DW`pGtpTY<9tMd;}WZUhT1iy+S^TfHCWXGuDwAv1Ik85 zh3!tSlWU3*aLtmdf?g(#WnLvVCXW$>gnT_{(%VilR=#2VKh~S}+Po#ha9C*<-l~Fx z$EK{1SO8np&{JC)7hdM8O+C( zF^s3HskJz@p3ot`SPKA92PG!PmC2d|9xA!CZxR!rK9-QYYBGAM-Gj zCqzBaIjtOZ6gu+lA%**RI7to$x^s8xIx}VF96=<29CjWtsl;tmNbuHgrCyB^VzEIB zt@sqnl8Vg`pnMppL6vbjNNKc?BrH<)fxiZ|WrYW%cnz-FMENGzMI+)@l7dit?oP|Wu zg-oLcv~79=fdqEM!zK%lI=R7S!Do!HBaD+*h^ULWVB}4jr^e5oUqY`zA&NUvzseI% z+XCvzS+n|m7WJoyjXXk(PE8;i^r$#Pq|NFd!{g~m2OecA1&>$7SYFw z;}Q{`F3LCE34Z>5;5dDtz&2Z&w|B9fwvU<@S<BBo(L4SbDV#X3%uS+<2q7iH+0baiGzlVP5n0fBDP z7kx+7|Cws+?T|cw-pt~SIa7BRDI_ATZ9^aQS^1I?WfnfEHZ*sGlT#Wk9djDL?dWLA zk%(B?<8L?iV*1m803UW|*sU$raq<(!N!CrQ&y7?7_g zF2!aAfw5cWqO}AX)+v)5_GvQ$1W8MV8bTMr3P{^!96Q4*YhS}9ne|+3GxDJmZEo zqh;%RqD5&32iTh7kT>EEo_%`8BeK&)$eXQ-o+pFIP!?lee z&kos;Q)_afg1H&{X|FTQ0V z@yxv4KGGN)X|n|J+(P6Q`wmGB;J}bBY{+LKVDN9#+_w9s$>*$z)mVQDOTe#JG)Zz9*<$LGBZ-umW@5k5b zbIHp=SJ13oX%IU>2@oqcN?)?0AFN#ovwS^|hpf5EGk0#N<)uC{F}GG}%;clhikp2* zu6ra2gL@2foI>7sL`(x5Q)@K2$nG$S?g`+JK(Q0hNjw9>kDM|Gpjmy=Sw5&{x5$&b zE%T6x(9i|z4?fMDhb%$*CIe2LvVjuHca`MiMcC|+IU51XfLx(BMMdLBq_ z65RKiOC$0w-t)Cyz0i-HEZpkfr$>LK%s5kga^FIY_|fadzu*r^$MkNMc!wMAz3b4P+Z3s(z^(%(04}dU>ef$Xmof(A|XXLbR z2`&3VeR1&jjKTut_i?rR_47Z`|1#$NE$&x#;NQM|hxDZ>biQ*+lg5E62o65ILRnOOOcz%Q;X$MJ?G5dYmk$oL_bONX4 zT^0yom^=NsRO^c$l02#s0T^dAAS&yYiA=;rLx;{ro6w08EeTdVF@j^}Bl;o=`L%h! zMKIUv(!a+>G^L3{z7^v3W$FUUHA+-AMv~<}e?2?VG|!itU~T>HcOKaqknSog zE}yY1^VrdNna1B6qA`s?grI>Y4W%)N;~*MH35iKGAp*gtkg=FE*mFDr5n2vbhwE|4 zZ!_Ss*NMZdOKsMRT=uU{bHGY%Gi=K{OD(YPa@i}RCc+mExn zQogd@w%>14cfQrB@d5G#>Lz1wEg?jJ0|(RwBzD74Eij@%3lyoBXVJpB{q0vHFmE7^ zc91!c%pt&uLa|(NyGF2_L6T{!xih@hpK;7B&bJ#oZM0`{T6D9)J2IXxP?DODPdc+T zC>+Zq8O%DXd5Gog2(s$BDE3suv=~s__JQnX@uGt+1r!vPd^MM}=0((G+QopU?VWgR zqj8EF0?sC`&&Nv-m-nagB}UhXPJUBn-UaDW9;(IX#)uc zL*h%hG>ry@a|U=^=7%k%V{n=eJ%Nl0Oqs!h^>_PgNbD>m;+b)XAk+4Cp=qYxTKDv& zq1soWt*hFf%X8}MpQZL-Lg7jc0?CcWuvAOE(i^j1Km^m8tav)lMx1GF{?J#*xwms2 z3N_KN-31f;@JcW(fTA`J5l$&Q8x{gb=9frpE8K0*0Rm;yzHnDY0J{EvLRF0 zRo6ca)gfv6C)@D#1I|tgL~uHJNA-{hwJQXS?Kw=8LU1J$)nQ-&Jhwxpe+%WeL@j0q z?)92i;tvzRki1P2#poL;YI?9DjGM4qvfpsHZQkJ{J^GNQCEgUn&Sg=966 zq?$JeQT+vq%zuq%%7JiQq(U!;Bsu% zzW%~rSk1e+_t89wUQOW<8%i|5_uSlI7BcpAO20?%EhjF%s%EE8aY15u(IC za2lfHgwc;nYnES7SD&Lf5IyZvj_gCpk47H}e05)rRbfh(K$!jv69r5oI| z?){!<{InPJF6m|KOe5R6++UPlf(KUeb+*gTPCvE6! z(wMCuOX{|-p(b~)zmNcTO%FA z$-6}lkc*MKjIJ(Fyj^jkrjVPS);3Qyq~;O$p+XT+m~0$HsjB@}3}r*h(8wGbH9ktQ zbaiiMSJf`6esxC3`u@nNqvxP1nBwerm|KN)aBzu$8v_liZ0(G8}*jB zv<8J%^S2E_cu+Wp1;gT66rI$>EwubN4I(Lo$t8kzF@?r0xu8JX`tUCpaZi(Q0~_^K zs6pBkie9~06l>(Jpy*d&;ZH{HJ^Ww6>Hs!DEcD{AO42KX(rTaj)0ox`;>}SRrt)N5 zX)8L4Fg)Y6EX?He?I`oHeQiGJRmWOAboAC4Jaf;FXzspuG{+3!lUW8?IY>3%)O546 z5}G94dk)Y>d_%DcszEgADP z8%?i~Ak~GQ!s(A4eVwxPxYy3|I~3I=7jf`yCDEk_W@yfaKjGmPdM}($H#8xGbi3l3 z5#?bjI$=*qS~odY6IqL-Q{=gdr2B5FVq7!lX}#Lw**Pyk!`PHN7M3Lp2c=T4l}?kn zVNWyrIb(k&`CckYH;dcAY7-kZ^47EPY6{K(&jBj1Jm>t$FD=u9U z#LI%MnI3wPice+0WeS5FDi<>~6&jlqx=)@n=g5TZVYdL@2BW3w{Q%MkE%sx}=1ihvj(HDjpx!*qqta?R?| zZ(Ju_SsUPK(ZK*&EdAE(Fj%eABf2+T>*fZ6;TBP%$xr(qv;}N@%vd5iGbzOgyMCk* z3X|-CcAz%}GQHalIwd<-FXzA3btVs-_;!9v7QP)V$ruRAURJhMlw7IO@SNM~UD)2= zv}eqKB^kiB))Yhh%v}$ubb#HBQHg3JMpgNF+pN*QbIx(Rx1ofpVIL5Y{)0y&bMO(@ zyK1vv{8CJQidtiI?rgYVynw{knuc!EoQ5-eete(AmM`32lI7{#eS#!otMBRl21|g^SVHWljl8jU?GU@#pYMIqrt3mF|SSYI&I+Vz|%xuXv8;pHg zlzFl!CZ>X%V#KWL3+-743fzYJY)FkKz>GJ<#uKB)6O8NbufCW%8&bQ^=8fHYfE(lY z1Fl@4l%|iaTqu=g7tTVk)wxjosZf2tZ2`8xs9a$b1X29h!9QP#WaP#~hRNL>=IZO@SX4uYQR_c0pSt89qQR@8gJhL*iXBTSBDtlsiNvc_ewvY-cm%bd&sJTnd@hE zwBGvqGW$X^oD~%`b@yeLW%An*as@4QzwdrpKY9-E%5PLqvO6B+bf>ph+TWiPD?8Ju z-V}p@%LcX{e)?*0o~#!S%XU<+9j>3{1gfU=%sHXhukgH+9z!)AOH_A{H3M}wmfmU8 z&9jjfwT-@iRwCbIEwNP4zQHvX3v-d*y87LoudeB9Jh5+mf9Mnj@*ZCpwpQ*2Z9kBWdL19Od7q|Hdbwv+zP*FuY zQc4CJ6}NIz7W+&BrB5V%{4Ty$#gf#V<%|igk)b@OV`0@<)cj(tl8~lLtt^c^l4{qP z=+n&U0LtyRpmg(_8Qo|3aXCW77i#f{VB?JO3nG!IpQ0Y~m!jBRchn`u>HfQuJwNll zVAMY5XHOX8T?hO@7Vp3b$H)uEOy{AMdsymZ=q)bJ%n&1;>4%GAjnju}Osg@ac*O?$ zpu9dxg-*L(%G^LSMhdnu=K)6ySa|}fPA@*Saj}Z>2Dlk~3%K(Py3yDG7wKij!7zVp zUZ@h$V0wJ|BvKc#AMLqMleA*+$rN%#d95$I;;Iy4PO6Cih{Usrvwt2P0lh!XUx~PGNySbq#P%`8 zb~INQw3Woiu#ONp_p!vp3vDl^#ItB06tRXw88L}lJV)EruM*!ZROYtrJHj!X@K$zJ zp?Tb=Dj_x1^)&>e@yn{^$B93%dFk~$Q|0^$=qT~WaEU-|YZZzi`=>oTodWz>#%%Xk z(GpkgQEJAibV%jL#dU)#87T0HOATp~V<(hV+CcO?GWZ_tOVjaCN13VQbCQo=Dt9cG znSF9X-~WMYDd66Rg8Ktop~CyS7@Pj@Vr<#Ja4zcq1}FIoW$@3mfd;rY_Ak^gzwqqD z^4<_kC2Eyd#=i8_-iZ&g_e#$P`;4v zduoZTdyRyEZ-5WOJwG-bfw*;7L7VXUZ8aIA{S3~?()Yly@ga|-v%?@2vQ;v&BVZlo7 z49aIo^>Cv=gp)o?3qOraF_HFQ$lO9vHVJHSqq4bNNL5j%YH*ok`>ah?-yjdEqtWPo z+8i0$RW|$z)pA_vvR%IVz4r$bG2kSVM&Z;@U*{Lug-ShiC+IScOl?O&8aFYXjs!(O z^xTJ|QgnnC2!|xtW*UOI#vInXJE!ZpDob9x`$ox|(r#A<5nqbnE)i<6#(=p?C~P-7 zBJN5xp$$)g^l};@EmMIe;PnE=vmPsTRMaMK;K`YTPGP0na6iGBR8bF%;crF3>ZPoLrlQytOQrfTAhp;g){Mr$zce#CA`sg^R1AT@tki!m1V zel8#WUNZfj(Fa#lT*nT>^pY*K7LxDql_!IUB@!u?F&(tfPspwuNRvGdC@z&Jg0(-N z(oBb3QX4em;U=P5G?Y~uIw@E7vUxBF-Ti*ccU05WZ7`m=#4?_38~VZvK2{MW*3I#fXoFG3?%B;ki#l%i#$G_bwYQR-4w>y;2` zMPWDvmL6|DP1GVXY)x+z8(hqaV5RloGn$l&imhzZEZP6v^d4qAgbQ~bHZEewbU~Z2 zGt?j~7`0?3DgK+)tAiA8rEst>p#;)W=V+8m+%}E$p-x#)mZa#{c^3pgZ9Cg}R@XB) zy_l7jHpy(u;fb+!EkZs6@Z?uEK+$x3Ehc8%~#4V?0AG0l(vy{8u@Md5r!O+5t zsa{*GBn?~+l4>rChlbuT9xzEx2yO_g!ARJO&;rZcfjzxpA0Chj!9rI_ZD!j` z6P@MWdDv&;-X5X8o2+9t%0f1vJk3R~7g8qL%-MY9+NCvQb)%(uPK4;>y4tozQ2Dl* zEoR_1#S~oFrd9s%NOkoS8$>EQV|uE<9U*1uqAYWCZigiGlMK~vSUU}f5M9o{<*WW? z$kP)2nG$My*fUNX3SE!g7^r#zTT^mVa#A*5sBP8kz4se+o3y}`EIa)6)VpKmto6Ew z1J-r2$%PM4XUaASlgVNv{BBeL{CqJfFO|+QpkvsvVBdCA7|vlwzf1p$Vq50$Vy*O+ z5Eb85s^J2MMVj53l4_?&Wpd1?faYE-X1ml-FNO-|a;ZRM*Vp!(ods{DY6~yRq%{*< zgq5#k|KJ70q47aO1o{*gKrMHt)6+m(qJi#(rAUw0Uy8~z8IX)>9&PTxhLzh#Oh*vZ zPd1b$Z&R{yc&TF^x?iQCw#tV}la&8^W)B*QZ${19LlRYgu#nF7Zj`~CtO^0S#xp+r zLYwM~si$I>+L}5gLGhN=dyAKO)KqPNXUOeFm#o+3 z&#!bD%aTBT@&;CD_5MMC&_Yi+d@nfuxWSKnYh0%~{EU`K&DLx}ZNI2osu#(gOF2}2 zZG#DdQ|k0vXj|PxxXg-MYSi9gI|hxI%iP)YF2$o< zeiC8qgODpT?j!l*pj_G(zXY2Kevy~q=C-SyPV$~s#f-PW2>yL}7V+0Iu^wH;AiI$W zcZDeX<2q%!-;Ah!x_Ld;bR@`bR4<`FTXYD(%@CI#biP z5BvN;=%AmP;G0>TpInP3gjTJanln8R9CNYJ#ziKhj(+V33zZorYh0QR{=jpSSVnSt zGt9Y7Bnb#Ke$slZGDKti&^XHptgL7 zkS)+b>fuz)B8Lwv&JV*};WcE2XRS63@Vv8V5vXeNsX5JB?e|7dy$DR9*J#J= zpKL@U)Kx?Y3C?A3oNyJ5S*L+_pG4+X*-P!Er~=Tq7=?t&wwky3=!x!~wkV$Ufm(N| z1HY?`Ik8?>%rf$6&0pxq8bQl16Jk*pwP`qs~x~Trcstqe-^hztuXOG zrYfI7ZKvK$eHWi9d{C${HirZ6JU_B`f$v@SJhq?mPpC-viPMpAVwE;v|G|rqJrE5p zRVf904-q{rjQ=P*MVKXIj7PSUEzu_jFvTksQ+BsRlArK&A*=>wZPK3T{Ki-=&WWX= z7x3VMFaCV5;Z=X&(s&M^6K=+t^W=1>_FFrIjwjQtlA|-wuN7&^v1ymny{51gZf4-V zU8|NSQuz!t<`JE%Qbs||u-6T*b*>%VZRWsLPk&umJ@?Noo5#{z$8Q0oTIv00`2A`# zrWm^tAp}17z72^NDu^95q1K)6Yl`Wvi-EZA+*i&8%HeLi*^9f$W;f1VF^Y*W;$3dk|eLMVb_H{;0f*w!SZMoon+#=CStnG-7ZU8V>Iy( zmk;42e941mi7!e>J0~5`=NMs5g)WrdUo^7sqtEvwz8>H$qk=nj(pMvAb4&hxobPA~p&-L5a_pTs&-0XCm zKXZ8BkkriiwE)L2CN$O-`#b15yhuQO7f_WdmmG<-lKeTBq_LojE&)|sqf;dt;llff znf|C$@+knhV_QYVxjq*>y@pDK|DuZg^L{eIgMZnyTEoe3hCgVMd|u)>9knXeBsbP_$(guzw>eV{?5l$ z063cqIysrx82-s6k;vE?0jxzV{@`jY3|*Wp?EdNUMl0#cBP$~CHqv$~sB5%50`m(( zSfD%qnxbGNM2MCwB+KA?F>u__Ti>vD%k0#C*Unf?d)bBG6-PYM!!q;_?YWptPiHo} z8q3M~_y9M6&&0#&uatQD6?dODSU)%_rHen`ANb z{*-xROTC1f9d!8`LsF&3jf{OE8~#;>BxHnOmR}D80c2Eh zd867kq@O$I#zEm!CCZJw8S`mCx}HrCl_Rh4Hsk{Cb_vJ4VA3GK+icku z%lgw)Y@$A0kzEV^#=Zj8i6jPk&Mt_bKDD!jqY3&W(*IPbzYu$@x$|3*aP{$bz-~xE^AOxtbyWvzwaCOHv6+99llI&xT_8)qX3u|y|0rDV z(Hu*#5#cN0mw4OSdY$g_xHo-zyZ-8WW&4r%qW(=5N>0O-t{k;#G9X81F~ynLV__Kz zbW1MA>Pjg0;3V?iV+-zQsll_0jimGuD|0GNW^av|4yes(PkR1bGZwO6xvgCy}ThR7?d&$N`kA3N!Xn5uSKKCT-`{lE1ZYYy?GzL}WF+mh|sgT6K2Z*c9YB zFSpGRNgYvk&#<2@G(vUM5GB|g?gk~-w+I4C{vGu{`%fiNuZIeu@V1qt`-x$E?OR;zu866Y@2^et5GTNCpX#3D=|jD5>lT^vD$ zr}{lRL#Lh4g45Yj43Vs7rxUb*kWC?bpKE1@75OJQ=XahF z5(C0DyF;at%HtwMTyL!*vq6CLGBi^Ey}Mx39TC2$a)UmekKDs&!h>4Hp2TmSUi!xo zWYGmyG)`$|PeDuEL3C6coVtit>%peYQ6S1F4AcA*F`OA;qM+1U6UaAI(0VbW#!q9* zz82f@(t35JH!N|P4_#WKK6Rc6H&5blD6XA&qXahn{AP=oKncRgH!&=b6WDz?eexo* z9pzh}_aBc_R&dZ+OLk+2mK-5UhF`>}{KN7nOxb{-1 zd`S-o1wgCh7k0u%QY&zoZH}!<;~!)3KTs-KYRg}MKP3Vl%p$e6*MOXLKhy)<1F5L* z+!IH!RHQKdpbT8@NA+BFd=!T==lzMU95xIyJ13Z6zysYQ1&zzH!$BNU(GUm1QKqm< zTo#f%;gJ@*o;{#swM4lKC(QQ<%@;7FBskc7$5}W9Bi=0heaVvuvz$Ml$TR8@}qVn>72?6W1VAc{Mt}M zkyTBhk|?V}z`z$;hFRu8Vq;IvnChm+no@^y9C1uugsSU`0`46G#kSN9>l_ozgzyqc zZnEVj_a-?v@?JmH1&c=~>-v^*zmt`_@3J^eF4e))l>}t2u4L`rueBR=jY9gZM;`nV z>z(i<0eedu2|u-*#`SH9lRJ7hhDI=unc z?g^30aePzkL`~hdH*V7IkDGnmHzVr%Q{d7sfb7(|)F}ijXMa7qg!3eHex)_-$X;~* z>Zd8WcNqR>!`m#~Xp;r4cjvfR{i04$&f1)7sgen9i>Y|3)DCt^f)`uq@!(SG?w|tdSLS+<;ID74 zTq8FJYHJHrhSwvKL|O1ZnSbG-=l6Eg-Suv60Xc;*bq~g+LYk*Q&e)tR_h3!(y)O}$ zLi*i5ec^uHkd)fz2KWiR;{RosL%peU`TxM7w*M9m#rAiG`M)FTB>=X@|A`7x)zn5- z$MB5>0qbweFB249EI@!zL~I7JSTZbzjSMMJ=!DrzgCS!+FeaLvx~jZXwR`BFxZ~+A z=!Pifk?+2awS3DVi32fgZRaqXZq2^->izZpIa1sEog@01#TuEzq%*v359787rZoC( z9%`mDR^Hdxb%XzUt&cJN3>Cl{wmv{@(h>R38qri1jLKds0d|I?%Mmhu2pLy=< zOkKo4UdS`E9Y~z3z{5_K+j~i7Ou}q0?Qv4YebBya1%VkkWzR%+oB!c?9(Ydaka32! zTEv*zgrNWs`|~Q{h?O|8s0Clv{Kg0$&U}?VFLkGg_y=0Qx#=P${6SNQFp!tDsTAPV z0Ra{(2I7LAoynS0GgeQ6_)?rYhUy}AE^$gwmg?i!x#<9eP=0N=>ZgB#LV9|aH8q#B za|O-vu(GR|$6Ty!mKtIfqWRS-RO4M0wwcSr9*)2A5`ZyAq1`;6Yo)PmDLstI zL2%^$1ikF}0w^)h&000z8Uc7bKN6^q3NBfZETM+CmMTMU`2f^a#BqoYm>bNXDxQ z`3s6f6zi5sj70>rMV-Mp$}lP|jm6Zxg}Sa*$gNGH)c-upqOC7vdwhw}e?`MEMdyaC zP-`+83ke+stJPTsknz0~Hr8ea+iL>2CxK-%tt&NIO-BvVt0+&zsr9xbguP-{3uW#$ z<&0$qcOgS{J|qTnP;&!vWtyvEIi!+IpD2G%Zs>;k#+d|wbodASsmHX_F#z?^$)zN5 zpQSLH`x4qglYj*{_=8p>!q39x(y`B2s$&MFQ>lNXuhth=8}R}Ck;1}MI2joNIz1h| zjlW@TIPxM_7 zKBG{Thg9AP%B2^OFC~3LG$3odFn_mr-w2v**>Ub7da@>xY&kTq;IGPK5;^_bY5BP~ z2fiPzvC&osO@RL)io905e4pY3Yq2%j&)cfqk|($w`l`7Pb@407?5%zIS9rDgVFfx! zo89sD58PGBa$S$Lt?@8-AzR)V{@Q#COHi-EKAa5v!WJtJSa3-Wo`#TR%I#UUb=>j2 z7o-PYd_OrbZ~3K`pn*aw2)XKfuZnUr(9*J<%z@WgC?fexFu%UY!Yxi6-63kAk7nsM zlrr5RjxV45AM~MPIJQqKpl6QmABgL~E+pMswV+Knrn!0T)Ojw{<(yD8{S|$(#Z!xX zpH9_Q>5MoBKjG%zzD*b6-v>z&GK8Dfh-0oW4tr(AwFsR(PHw_F^k((%TdkglzWR`iWX>hT1rSX;F90?IN4&}YIMR^XF-CEM(o(W@P#n?HF z!Ey(gDD_0vl+{DDDhPsxspBcks^JCEJ$X74}9MsLt=S?s3)m zQ0cSrmU*<u;KMgi1(@Ip7nX@4Zq>yz;E<(M8-d0ksf0a2Ig8w2N-T69?f}j}ufew}LYD zxr7FF3R7yV0Gu^%pXS^49){xT(nPupa(8aB1>tfKUxn{6m@m1lD>AYVP=<)fI_1Hp zIXJW9gqOV;iY$C&d=8V)JJIv9B;Cyp7cE}gOoz47P)h)Y?HIE73gOHmotX1WKFOvk z5(t$Wh^13vl;+pnYvJGDz&_0Hd3Z4;Iwa-i3p|*RN7n?VJ(whUPdW>Z-;6)Re8n2# z-mvf6o!?>6wheB9q}v~&dvd0V`8x&pQkUuK_D?Hw^j;RM-bi_`5eQE5AOIzG0y`Hr zceFx7x-<*yfAk|XDgPyOkJ?){VGnT`7$LeSO!n|o=;?W4SaGHt4ngsy@=h-_(^qX)(0u=Duy02~Fr}XWzKB5nkU$y`$67%d^(`GrAYwJ? zN75&RKTlGC%FP27M06zzm}Y6l2(iE*T6kdZPzneMK9~m)s7J^#Q=B(Okqm1xB7wy< zNC>)8Tr$IG3Q7?bxF%$vO1Y^Qhy>ZUwUmIW5J4=ZxC|U)R+zg4OD$pnQ{cD`lp+MM zS3RitxImPC0)C|_d18Shpt$RL5iIK~H z)F39SLwX^vpz;Dcl0*WK*$h%t0FVt`Wkn<=rQ6@wht+6|3?Yh*EUe+3ISF zbbV(J6NNG?VNIXC)AE#(m$5Q?&@mjIzw_9V!g0#+F?)2LW2+_rf>O&`o;DA!O39Rg ziOyYKXbDK!{#+cj_j{g;|IF`G77qoNBMl8r@EIUBf+7M|eND2#Y#-x=N_k3a52*fi zp-8K}C~U4$$76)@;@M@6ZF*IftXfwyZ0V+6QESKslI-u!+R+?PV=#65d04(UI%}`r z{q6{Q#z~xOh}J=@ZN<07>bOdbSI(Tfcu|gZ?{YVVcOPTTVV52>&GrxwumlIek}OL? zeGFo#sd|C_=JV#Cu^l9$fSlH*?X|e?MdAj8Uw^@Dh6+eJa?A?2Z#)K zvr7I|GqB~N_NU~GZ?o1A+fc@%HlF$71Bz{jOC{B*x=?TsmF0DbFiNcnIuRENZA43a zfFR89OAhqSn|1~L4sA9nVHsFV4xdIY_Ix>v0|gdP(tJ^7ifMR_2i4McL#;94*tSY) zbwcRqCo$AnpV)qGHZ~Iw_2Q1uDS2XvFff#5BXjO!w&1C^$Pv^HwXT~vN0l}QsTFOz zp|y%Om9}{#!%cPR8d8sc4Y@BM+smy{aU#SHY>>2oh1pK+%DhPqc2)`!?wF{8(K$=~ z<4Sq&*`ThyQETvmt^NaN{Ef2FQ)*)|ywK%o-@1Q9PQ_)$nJqzHjxk4}L zJRnK{sYP4Wy(5Xiw*@M^=SUS9iCbSS(P{bKcfQ(vU?F~)j{~tD>z2I#!`eFrSHf;v zquo)*?AW$#+qP}n$%<{;wr$()*yw5N`8_rOTs^kOqyY;dIjsdw*6k_mL}v2V9C_*sK<_L8 za<3)C%4nRybn^plZ(y?erFuRVE9g%mzsJzEi5CTx?wwx@dpDFSOAubRa_#m+=AzZ~ z^0W#O2zIvWEkxf^QF660(Gy8eyS`R$N#K)`J732O1rK4YHBmh|7zZ`!+_91uj&3d} zKUqDuDQ8YCmvx-Jv*$H%{MrhM zw`g@pJYDvZp6`2zsZ(dm)<*5p3nup(AE6}i#Oh=;dhOA=V7E}98CO<1Lp3*+&0^`P zs}2;DZ15cuT($%cwznqmtTvCvzazAVu5Ub5YVn#Oo1X|&MsVvz8c5iwRi43-d3T%tMhcK#ke{i-MYad@M~0B_p`Iq){RLadp-6!peP^OYHTq~^vM zqTr5=CMAw|k3QxxiH;`*;@GOl(PXrt(y@7xo$)a3Fq4_xRM_3+44!#E zO-YL^m*@}MVI$5PM|N8Z2kt-smM>Jj@Dkg5%`lYidMIbt4v=Miqj4-sEE z)1*5VCqF1I{KZVw`U0Wa!+)|uiOM|=gM65??+k|{E6%76MqT>T+;z{*&^5Q9ikL2D zN2}U$UY)=rIyUnWo=yQ@55#sCZeAC}cQA(tg5ZhqLtu*z>4}mbfoZ>JOj-|a2fR$L zQ(7N$spJL_BHb6Bf%ieO10~pQX%@^WKmQOQNOUe4h|M}XOTRL`^QVpN$MjJ7t+UdP zDdzcK3e7_fdv)PPR>O|-`kVC1_O08_WGcQXj*W5d?}3yE?-fZ_@mE-zcq6^Mn49!; zDDcus*@4dFIyZ%_d3*MO=kk3$MQ^?zaDR1-o<<7T=;`8 zz2(w>U9IQ+pZ<*B;4dE@LnlF7YwNG>la#rQ@mC4u@@0_pf40+<&t)+9(YOgCP9(aJ z5v7SRi(y4;fWR)oHRxf2|Va=?P zXq&7GtTYd+3U{Wm5?#e7gDwz#OFbvHL4Jq{BGhNYzh|U!1$_WEJef&NKDD9)*$d+e ztXF1-rvO5OBm{g9Mo8x?^YB;J|G*~3m@2y%Fyx6eb*O^lW- z`JUL?!exvd&SL_w89KoQxw5ZZ}7$FD4s>z`!3R}6vcFf0lWNYjH$#P z<)0DiPN%ASTkjWqlBB;8?RX+X+y>z*$H@l%_-0-}UJ>9l$`=+*lIln9lMi%Q7CK-3 z;bsfk5N?k~;PrMo)_!+-PO&)y-pbaIjn;oSYMM2dWJMX6tsA5>3QNGQII^3->manx z(J+2-G~b34{1^sgxplkf>?@Me476Wwog~$mri{^`b3K0p+sxG4oKSwG zbl!m9DE87k>gd9WK#bURBx%`(=$J!4d*;!0&q;LW82;wX{}KbPAZtt86v(tum_1hN z0{g%T0|c(PaSb+NAF^JX;-?=e$Lm4PAi|v%(9uXMU>IbAlv*f{Ye3USUIkK`^A=Vn zd))fSFUex3D@nsdx6-@cfO1%yfr4+0B!uZ)cHCJdZNcsl%q9;#%k@1jh9TGHRnH2(ef0~sB(`82IC_71#zbg=NL$r=_9UD-~ z8c54_zA@jEhkJpL?U`$p&|XF}OpRvr`~}+^BYBtiFB1!;FX;a3=7jkFSET)41C@V` zxhfS)O-$jRJ|R}CL{=N{{^0~c8WuLOC?`>JKmFGi?dlfss4Y^AAtV#FoLvWoHsEeg zAAOc+PXl@WoSOOu_6Tz~K=>OK@KL#^re(1oPrhcen@+#ouGG|g(;A5(SVuE~rp$?# zR$o(46m}O~QtU{!N-s}RfYh+?*m9v#w@;=DEXI;!CEf0bHEgI<~T7&VnIvtG%o=s@3c zG1AT(J>!bph%Z1^xT_aO>@%jWnTW=8Z^2k0?aJ(8R5VA}H+mDh>$b9ua{)I5X9$%b z&O%F;3AIW&9j3=Q1#8uL%4_2mc3xX2AdzYJi%#Q#PEY3lk<#u=Pc?EJ7qt4WZX)bH481F8hwMr^9C^N8KUiWIgcVa=V` z4_7By=0Fkq>M6N?Bis+nc$YOqN4Qs@KDdQCy0TTi;SQ7^#<wi9E4T)##ZVvS(SK4#6j^QjHIUh<0_ZD2Yl+t?Z2;4zA zvI<(>jLvJae#sIA`qHl0lnkcU$>Rrkcnp{E;VZwW`cucIIWi{hftjEx-7>xXWRsa4VH(CCyuleyG8a+wOY8l*y>n@ zxZb}o=p9lR)9N^FKfkvPH-t2{qDE=hG8Z!`JO>6aJ^hKJVyIV&qGo*YSpoU(d)&OE ziv2#o`&W>(IK~sH{_5aPL;qcn{2%Gae+r5G4yMl5U)EB>ZidEo|F@f)70WN%Pxo`= zQ+U-W9}iLlF=`VeGD0*EpI!(lVJHy(%9yFZkS_GMSF?J*$bq+2vW37rwn;9?9%g(Jhwc<`lHvf6@SfnQaA&aF=los z0>hw9*P}3mWaZ|N5+NXIqz#8EtCtYf-szHPI`%!HhjmeCnZCim3$IX?5Il%muqrPr zyUS#WRB(?RNxImUZHdS&sF8%5wkd0RIb*O#0HH zeH~m^Rxe1;4d(~&pWGyPBxAr}E(wVwlmCs*uyeB2mcsCT%kwX|8&Pygda=T}x{%^7 z)5lE5jl0|DKd|4N*_!(ZLrDL5Lp&WjO7B($n9!_R3H(B$7*D zLV}bNCevduAk2pJfxjpEUCw;q$yK=X-gH^$2f}NQyl(9ymTq>xq!x0a7-EitRR3OY zOYS2Qh?{_J_zKEI!g0gz1B=_K4TABrliLu6nr-`w~g2#zb zh7qeBbkWznjeGKNgUS8^^w)uLv*jd8eH~cG-wMN+{*42Z{m(E{)>K7O{rLflN(vC~ zRcceKP!kd)80=8ttH@14>_q|L&x0K^N0Ty{9~+c>m0S<$R@e11>wu&=*Uc^^`dE9RnW+)N$re2(N@%&3A?!JdI?Vx;X=8&1+=;krE8o%t z32Gi2=|qi=F?kmSo19LqgEPC5kGeJ5+<3TpUXV3Yik_6(^;SJw=Cz`dq(LN)F9G<$ za-aTiEiE}H(a>WITnJ+qG$3eCqrKgXFRiIv=@1C4zGNV!+ z{{7_AulEPXdR+~$sJ+yHA73j_w^4>UHZFnK$xsp}YtpklHa57+9!NfhOuU7m4@WQp z5_qb`)p|6atW#^b;KIj?8mWxF(!eN<#8h=Ohzw&bagGAS4;O^;d-~#Ct0*gpp_4&( ztwlS2Jf#9i>=e5+X8QSy**-JE&6{$GlkjNzNJY;K5&h|iDT-6%4@g;*JK&oA8auCovoA0+S(t~|vpG$yI+;aKSa{{Y(Tnm{ zzWuo^wgB?@?S9oKub=|NZNEDc;5v@IL*DBqaMkgn@z+IeaE^&%fZ0ZGLFYEubRxP0WG`S| zRCRXWt+ArtBMCRqB725odpDu(qdG;jez|6*MZE_Ml<4ehK_$06#r3*=zC9q}YtZ*S zBEb2?=5|Tt;&QV^qXpaf?<;2>07JVaR^L9-|MG6y=U9k{8-^iS4-l_D(;~l=zLoq% zVw05cIVj1qTLpYcQH0wS1yQ47L4OoP;otb02V!HGZhPnzw`@TRACZZ_pfB#ez4wObPJYcc%W>L8Z*`$ZPypyFuHJRW>NAha3z?^PfHsbP*-XPPq|`h} zljm&0NB7EFFgWo%0qK`TAhp220MRLHof1zNXAP6At4n#(ts2F+B`SaIKOHzEBmCJ3 z$7Z&kYcKWH&T!=#s5C8C_UMQ4F^CFeacQ{e0bG?p5J~*mOvg>zy_C{A4sbf!JT+JK z>9kMi=5@{1To&ILA)1wwVpOJ&%@yfuRwC9cD2`0CmsURi5pr2nYb6oBY&EmL9Gd@i zj{F}h!T*#a<@6mKzogszCSUCq5pxGeCq-w2|M>ZzLft79&A-&!AH~#ER1?Z=ZavC0 z)V05~!^Nl{E5wrkBLnrxLoO|AG&hoOa6AV2{KWL#X*UItj_W`}DEbIUxa;huN0S#` zUtXHi+cPyg-=Gad`2Aw-HWO*;`_&j9B3GHLy(f^@Do@Wu*5{FANC+>M*e6(YAz4k^ zcb_n4oJgrykBM1T!VN(2`&(rNBh+UcE}oL@A~Fj}xf0|qtJK?WzUk{t=M15p!)i7k zM!`qg^o;xR*VM49 zcY_1Yv0?~;V7`h7c&Rj;yapzw2+H%~-AhagWAfI0U`2d7$SXt=@8SEV_hpyni~8B| zmy7w?04R$7leh>WYSu8)oxD`88>7l=AWWJmm9iWfRO z!Aa*kd7^Z-3sEIny|bs9?8<1f)B$Xboi69*|j5E?lMH6PhhFTepWbjvh*7 zJEKyr89j`X>+v6k1O$NS-`gI;mQ(}DQdT*FCIIppRtRJd2|J?qHPGQut66-~F>RWs=TMIYl6K=k7`n1c%*gtLMgJM2|D;Hc|HNidlC>-nKm5q2 zBXyM)6euzXE&_r%C06K*fES5`6h-_u>4PZs^`^{bxR?=s!7Ld0`}aJ?Z6)7x1^ zt3Yi`DVtZ*({C;&E-sJ1W@dK29of-B1lIm)MV4F?HkZ_3t|LrpIuG~IZdWO@(2S6& zB2jA7qiiGi%HO2fU5|yY#aC<57DNc7T%q9L>B_Qh@v#)x(?}*zr1f4C4p8>~v2JFR z8=g|BIpG$W)QEc#GV1A}_(>v&=KTqZbfm)rqdM>}3n%;mv2z*|8%@%u)nQWi>X=%m?>Thn;V**6wQEj#$rU&_?y|xoCLe4=2`e&7P16L7LluN^#&f1#Gsf<{` z>33Bc8LbllJfhhAR?d7*ej*Rty)DHwVG)3$&{XFKdG?O-C=-L9DG$*)_*hQicm`!o zib(R-F%e@mD*&V`$#MCK=$95r$}E<4%o6EHLxM0&K$=;Z#6Ag0Tcl9i+g`$Pcz&tP zgds)TewipwlXh0T)!e~d+ES8zuwFIChK+c4;{!RC4P(|E4$^#0V*HhXG80C;ZD-no z!u+uQ;GCpm^iAW&odDVeo+LJU6qc$4+CJ6b6T&Y^K3(O_bN{@A{&*c6>f6y@EJ+34 zscmnr_m{V`e8HdZ>xs*=g6DK)q2H5Xew?8h;k{)KBl;fO@c_1uRV>l#Xr+^vzgsub zMUo8k!cQ>m1BnO>TQ<)|oBHVATk|}^c&`sg>V5)u-}xK*TOg%E__w<*=|;?? z!WptKGk*fFIEE-G&d8-jh%~oau#B1T9hDK;1a*op&z+MxJbO!Bz8~+V&p-f8KYw!B zIC4g_&BzWI98tBn?!7pt4|{3tm@l+K-O>Jq08C6x(uA)nuJ22n`meK;#J`UK0b>(e z2jhQ{rY;qcOyNJR9qioLiRT51gfXchi2#J*wD3g+AeK>lm_<>4jHCC>*)lfiQzGtl zPjhB%U5c@-(o}k!hiTtqIJQXHiBc8W8yVkYFSuV_I(oJ|U2@*IxKB1*8gJCSs|PS+EIlo~NEbD+RJ^T1 z@{_k(?!kjYU~8W&!;k1=Q+R-PDVW#EYa(xBJ2s8GKOk#QR92^EQ_p-?j2lBlArQgT z0RzL+zbx-Y>6^EYF-3F8`Z*qwIi_-B5ntw#~M}Q)kE% z@aDhS7%)rc#~=3b3TW~c_O8u!RnVEE10YdEBa!5@&)?!J0B{!Sg}Qh$2`7bZR_atZ zV0Nl8TBf4BfJ*2p_Xw+h;rK@{unC5$0%X}1U?=9!fc2j_qu13bL+5_?jg+f$u%)ZbkVg2a`{ZwQCdJhq%STYsK*R*aQKU z=lOv?*JBD5wQvdQIObh!v>HG3T&>vIWiT?@cp$SwbDoV(?STo3x^DR4Yq=9@L5NnN z_C?fdf!HDWyv(?Uw={r`jtv_67bQ5WLFEsf@p!P3pKvnKh_D}X@WTX^xml)D^Sj8Er?RRo2GLWxu`-Bsc ztZ*OU?k$jdB|C6uJtJ#yFm{8!oAQj<0X}2I(9uuw#fiv5bdF$ZBOl@h<#V401H;_` zu5-9V`$k1Mk44+9|F}wIIjra8>7jLUQF|q zIi8JCWez)_hj3aHBMn6(scZd9q#I<3MZzv}Yjc^t_gtGunP?|mAs+s!nGtNlDQ?ZO zgtG2b3s#J8Wh#0z1E|n_(y*F5-s7_LM0Rj3atDhs4HqmZc|?8LDFFu}YWZ}^8D`Yi z`AgJWbQ)dK(Qn?%Z=YDi#f%pLZu_kRnLrC2Qu|V>iD=z=8Y%}YY=g8bb~&dj;h7(T zPhji+7=m2hP~Xw`%Ma7o#?jo#+{IY&YkSeg^os)9>3?ZB z|Bt1-;uj0%|M_9k;#6c+)a)0oA}8+=h^#A_o=QR@jX^|y`YIR9V8ppGX>)FS%X>eB zD&v$!{eebt&-}u8z2t`KZLno>+UPceqXzuZe2u zHYz7U9}_Sw2da@ugQjBJCp(MNp~mVSk>b9nN*8UE`)88xXr88KXWmTa;FKKrd{Zy> zqL}@fo*7-ImF(Ad!5W7Z#;QLsABck0s8aWQohc@PmX3TK#f$`734%ifVd{M!J1;%A z)qjpf=kxPgv5NpUuUyc=C%MzLufCgTEFXQawxJo)rv4xG&{TKfV;V#ggkxefi`{sS zX+NQ8yc>qcdU zUuLM~0x32S& z|NdQ-wE6O{{U-(dCn@}Ty2i=)pJeb-?bP+BGRkLHp&;`Vup!}`pJdth`04rFPy;$a zkU=wWy;P$BMzf+0DM(IbYh`Dk*60l?3LAU;z3I^tHbXtB5H$Op=VEPL8!mydG>$T@S9;?^}mmDK)+x*TCN_Z`%SG{Hv0;P*>(P@^xe2%mUldaqF9$ zG+Oq<5)pQ+V4%%R>bK|~veGY4T&ALmnT@W*I)aT~2(zk>&L9PVG9&;LdC%xAUA`gC4KOGLHiqxbxMTA^!+T*7G;rF z;7ZNc3t&xd!^{e|E(7-FHu@!VrWQ8CB=pP;#jG#yi6(!BfCV(rrY~7D)0vCp_Ra@9 zSuu)to5ArdCAYX}MU&4u6}*{oe=Ipe09Z7|z41Y&lh`olz{lmO>wZpnwx+x4!~7@37|N~@wr=Tqf*+}4H{7GE*BvptMyhTAwu?VYEaj~BiJm7 zQw98FiwJTx0`qY8Y+268mkV#!grHt3S_69w?1TRi-P^2iNv=ajmQIkoX7OkY=Cpvk zs;-Gv?R(YEAb(%@0tNz)_r8bwE zPh75RwYWr?wPZ0rkG<5WwX|fjqCBP4^etDs4{ZF9+|c#@Y60nB)I_U5Z$FYe=SLXI zn}7T@%LLA>*fWf9X?vSD3tpXSEk%H{*`ZmRik>=se}`HWHKL|HHiXovNzTS~-4e?1 zgVLCWv@)(($B*C3rGn`N#nzUyVrSw>OiD;4`i15QHhdicm}A(CP)UO>PO(3!(=v-x zrsKIUCbJMb>=IB}20b{69IdU(vQ%Ti0Zm?VLQoL++HK(G%^P{wuH;|@Cn7Ncybw%D zDhWh??1)6j5j7RbEy-{rVefvMhV|Su8n9`m>4LU^TanMzUIy>S&UbSKJW56C(K5NX z*Ypzh@KaMD=ank_G}Di5SaDTz3@Ze;5$pkK$7Pz?SBj&njRD4so5e0Msp_p}|D8aq zDvU@2s@T_?)?f5XEWS3j_%6%AK-4aXU5!Xzk{fL%mI~AYWP?q}8X}}ZV3ZzKLFvmm zOHWR3OY0l)pZ#y@qGPkjS~mGj&J8uJnU<~+n?qrBTsf>8jN~i17c~Ry=4wM6YrgqZ@h`8`?iL&$8#fYrt7MinX)gEl7Sh_TS zOW{AyVh%SzW|QYBJo8iEVrA!yL(Lm&j6GB0|c?~N{~?Qyj^qjbs>E~lpWo!q!lNwfr(DPZVe zaazh2J{{o=*AQ|Wxz*!pBwYx_9+G$12{5G3V!0F=yB=tPa zEgh47ryFGZc;E%A{m4lJoik6@^k%E0{99pIL1gE;NqT!1dl5UV>RkEWtP)3f_5hG6 zs%M}qX?DNaI+4HN*-wn`HOjlEz0}K{o0fG~_%%c8sDq)6Z2)6msormgjhmtdzv;Hy{BwHXKp&3Bf9paw+J4r-E zBoWmEr6%r3t?F`38eCyr+)`In1&qS9`gcQ|rHBP`LlCl=_x?ck0lISju@hW*d~EQ) zU2sgl#~^(ye%SeZR%gZ=&?1ZxeU1v@44;`}yi^j0*Efg1lIFcC*xEj}Y~k|(I&}7z zXXi2xe>mc_cC`K=v8&-5p%=m=z47Z6HQUzNi5=oCeJ$-Bo#B0=i}CemYbux7I~B*e z3hSneMn$KHNXf4;wr5fkuA+)IzWs8gJ%$o0Q^vfnXQLnABJW;NRN(83Dcbu9dLnvo z6mweq2@yPK%0|R9vT)B$&|S!QO6f(~J^Z+b`G(j1;HKOq_fG$-36zvBI$`hvA94i( zGPGVo&Y%nRsodWyzn0bD0VZlG?=0M23Mc2V1_7>R^3`|z_5B;}JnIp0FI}9XNKJ^o z7xYKOFdYxX?UW~4PC!hVz86aP+dsOkBA(sz3J+6$KL`SU4tRwWnnCQN z&+C92x#?WNBaxf?Q^Q}@QD5rC=@aj8SIg;(QG06k^C5bZFwmiAyFl|qPX^@e2*J%m z1Fu_Jk5oZEB&%YN54Y8;?#l#GYHr->Q>-?72QSIc+Gx^C%;!$ezH>t<=o$&#w*Y_Y7=|PH*+o57yb>b&zpTUQv)0raRzrkL=hA-Z(10vNYDiT487% zzp2zr4ujA#rQ;Hxh7moX(VldzylrhKvPnl9Fb?LCt#|==!=?2aiZ`$Wx*^Lv@5r_ySpQ_vQ{h2_>I`Wd|GjXY?!>=X8v}wmTc+Nqi-?ln zQa28}pDfvjpheaM2>AYDC2x`+&QYH(jGqHDYLi}w55O5^e9s=Ui^hQ~xG*&TU8I}Y zeH~7!$!=a+1_RZe{6G$BICI6R2PKE{gYW8_ss!VY*4uXw8`?o>p=fC>n&DGzxJ$&w zoIxdMA4I503p(>m9*FnFeEJQ5Nd^WK*>I_79(IA)e#hr2qZ8Y!RMcbS}R z(2;{C#FXUv_o-0C=w18S!7fh!MXAN-iF!Oq4^n#Q{ktGsqj0nd~}H&v#Brb}6cd=q75>E;O8p?6a;CR4FiN zxyB?rmw)!Kxrh&7DbPei$lj)r+fDY&=qH+ zKX`VtQ=2fc?BwarW+heGX&C!Qk;F;mEuPC*8 z0Tv0h2v&J#wCU_0q-Wq9SHLOvx@F!QQQN+qN^-r-OgGRYhpu%J-L~SiU7o@0&q6t( zxtimUlrTO)Zk6SnXsm8l$`GW-ZHKNo1a}<%U4Ng z(k8=jTPjoZZ%$(tdr@17t|MV8uhdF4s|HbPO)SF`++T%r=cNRx&$BkW7|$)u%Anm; zGOv)GmwW*J5DzeI8Vk_HZ4v?Mmz$vpL#M%+vyeiW;BK6w|_S0 z{pqGZxI%-~r~b@=F#^|^+pwQE*qc8+b7!b}A$8OjqA%6=i?yI;3BcDP1xU_UVYa?^ z3o-aYI`X%p!w>>cRe_3rtp}@f1d&AQZ_2eeB;1_+9(`jpC22z+w%(kh6G3}Rz&~U_ z5_LxI)7~`nP=ZdVO&`rUP8`b-t^Vqi;Yt~Ckxauk>cj@W0v=E}$00?Jq(sxBcQHKc z(W}uAA*+e%Q)ybLANOe7gb4w^eX#gI%i56{GJz6NVMA{tQ! z3-}Mdjxfy6C#;%_-{5h|d0xP0YQ!qQ^uV*Y&_F9pP!A;qx#0w*)&xPF0?%{;8t+uWA#vrZ|CBD0wz@?M=ge(^#$y< zIEBv1wmL`NKAe&)7@UC9H^t0E0$}Odd>u4cQGdKdlfCn0`goK~uQ0xrP*{VJ*TjR; za16!CM>-msM@KcxU|HsEGgn{v>uy1R?slG}XL5)*rLTNHdYowI*;qe~TZH z|1Ez0TXrc@khWdmgZJKV6+aJVlFsv5z~PhdC>=^tL5BC|3tyMuXSdsEC3L0qw60S>ecX zi&`-rZ=GqxfrH{+JvkuOY?{d?;HZmv z2@4+ep(g+yG6W%NrdJe2%miVnb8nX{yXK>?5DC#GA6IIXU-`!?8+xm(8r)Vi;=?g! zmOK)$jQv~nakv-|`0=Z`-Ir1%2q8~>T7-k=DyG^Rjk7|!y(QO&)cBEKdBrv~E$7_y z&?K!6DP;Qr_0fbbj86^W(4M{lqGx6Mb;`H;>IDqqGG@3I+oZg_)nb=k|ItMkuX2Y@ zYzDmMV~3{y43}y%IT+)nBCIzi^Cr1gEfyrjrQ7gXAmE$4Hj(&CuyWXjDrkV~uP>9T zCX5cXn!1oEjO!P#71iyGh#q+8qrD8)h#wE#x;bz+a^sQyAntO(UhxFVUqR^dux8 zOsN=Nzw5imC7U~@t^#gLo}j#vge3C6o(%0V5<0d~1qlxe4%yD~{EDGzZ40)ZIXytB zg3^NFa(98n#OwV!DJqgy;xitYp)Q(W$(J0<0Xr5DHFYO$zuUkC(4}Zv2uB`O@_TR7 zG3Ehp!K;YLl%2&*oz3`{p|hj`Bzd(@BMVVA2ruucGsD0mj`^a1Qw3WsT7_z)c_<&j zvy(u5yod#@5~XT5KRPqKKp*2Q`rN!6gd#Wdh9;806oaWGi6~pB78)SYEhIYZDo*^} z-93olUg^Vh29G^}wQ8p(BK0(<7R6(8><}Bia@h%62o%ONE`~PiaIdfy!HGUm0GZdJ z&^aK^@JP|8YL`L(zI6Y#c%Q{6*APf`DU#$22PjfSP@T4xKHW~A(vL$pvf+~p{QLdx^j4sUA;?IZ zVWID3OA_VkZ_3?~Yy1yn?4Ev^r}1~c!n9;Z7pRn*D$^J%4QyWNvPkKF5{{bMBefvT zFZu|hco!0Me-__dyLe6S!}>m?I-x%1{Zr3_Qi!(T@)hh%zBE1my2AWl^XY#v%TSX3 z;?rn8Chf+?>SQ|v8gl$*f5dpix{i;?651ezum2tQCU`9sKxuZG2A9o(M~}G`*q2m#iW# z?0fJS+j_XxOk1fb+Nx6$rZqhg!x}eO!3nMy6a@4doqY&?(c`8$^B?0InG4T&{mu*3 zpcYaf)z__Dgr%+6UFYYXSu(oRrPYGviL~FKc{0X%tnt+9slAC|W0F8l^(@8qDXks~ zOZgs?O-6e-12Q>w5d?|E$P&oyah^mqd(Cu#uNtjCpp&F}G&biuW49LGkFCDEYe0S* zo-W_}-yR$%Z^03i8{&R&oU1BbY9$ER3RR5LjocL5er=CclJwCH>M6ge$R*Wi zd3zUoE*~?a1owq&DiT2#_Q)~tr$;Q=BJrMHrG@j3^J=#U3 zmd)ubgUu(9g(qmjx~7+!$9^%~fpi9$*n=+HfX&<>a}qkD;Ky@piqolGdF>VEX?(!DuO z{=7v}0Y|$@o3c`s^K3&3uMD0T1NMMrgwn$+g{=Tr&IHH@S`Aj4zn z{Mpln$!B->uUYTFe+75e!ee*euX`W%xA&g!-%s-YJ-sJP*(~t=44RSN6K5u7}a9;40`KN#fg#N>-s?YE6*qS9zkP2*=!a%O&aJ4>)JR>{O6n)(@ z$2mBny!kLLgnPgrX&!fTVnSXLEY}ZR{fLL4Jw;uI;)DhJJ<;%5&X%lg5)mYwwyHK=W zS`3yPe&Ncy_OA!;HvQV1TI3}7jib>EhqT!PZIoDg_Wm4OraFX|nGmCsXj|{&g!(_; z;(_uG68gxxy{T#wPPuETHggw6G8nCyc`=x89;arkuB%&7rbL&VzCm|jQFg8me78tu z2l-K|IsFgX@am)(c=1IWYX5fhCjIZ&9MBs9(Qg*`U5T`@H2xqzQxj`1bK#2gmDn2=yI!n0*6A2{JuA3~uX7 zsXocdxHHMV^?dsW+s}S8j8Mq!pjB8=NytY%-MEgx+HnavDcotwYmA{J%RzlLhZ{?t-W6 zr-JA(qw%OVMtv?N?75aid-cY`ZJLFT`fh-fZ0()^P(3wyQ`wDHG$9cUmEr^~!;iGV z#ukG&nXeLHarXD$=({)#Es!?%=2*`or!FE4N6XWEo>>`}ocE?kmQb+2JP;-))sn0V zoC6&be>gf!XD#yJO`FCF(Ts|~ zUbO#y44!V-U|&SEr1#r^_fJ1Ql3isjfCVAfvNga7OBJG^YAP`r8d{))?5D{xm+FB~ z*>D&s+(Z(o*)gx|EpJAYlnk@A&=zpkYvak{W~Y}~8M_p7Uu1bY#7m{Mq-#4-xw3lH z{(8=+O+WrU)^C(;qRm%NiKnO+<0W6EF|>n#fw%OKxr!@d%dWHOmv~#M2{eIlxaRW% z;k6v=< zZ{5W}@ik?!__~T?0QX0xX^^}Isw8Ey-yXCwQkS!)xT-ZdV6A`#HdMECf78X){%6)7 znLSKwqK}!hdkVk2QjAZ?j%&Id%WY~^<$ntL2p8J;eq$VCp%Cg{)oW&%Z3vp6ihm9D zIlPC#zVE^>62fNwZqsk)mt+E#rrU@%4vWtkYK)Qv$a*}$T2ZJCtTFI`tuLb*7j`!^eR`?d9h2TjF-h2Yr+ z){T|kWBNyrA5vpZE{Ez_)pG7Zf%QXqW)R@(<_0oOP?cwg&gib`IjKTzN_R*5A)G>_ z1r#qXr5i)U$$wv(kXfodOg=h$UZk78c@50K^wOMcKCx26s{q}vdOioj1n!&if0FRY zSi@$}gn4KW;2<;+lY?&>M6GNrRtfUTEIzqih@yLMQA2(17m3)hLTa@zlj=oHqaCG5 zYg71D3e}v36DjH++<*=MXgd2q&dP^6f&^KctfDe(SQrvy5JXC@BG#|N_^XbfxhcV) z>KV$aMxcL*ISc0|0;+<2ix7U7xq8m48=~j!a`g?SzE5}(Y;hxqEHJg_+qB99$}py7 z*ZPXL?FKLA>0uVicvq3okpoLZE#OG@fv^+k0{35pf`XdVT)1< z#mV4mcikkivZcE(=0rgfv&#+yZJrAOX&VDL(}Zx8@&$yi4Y1kmEK&uL<}ZqWr05mr zcSwaqH=squnLs+UCn@yp#WNQuIv$~B*sN_NAACD>N3k_$E(j~}Uvqda!_ zZcu7UrsR_q-P2YTrg|lijt8kyqL>T@ab#-a7i>%#*eoxFfgx(FoPa(y1nDI{z#Pz^ zfF~)6RBc?#ivEF<@XVD*#9r^r-;*<^(tE%UtWw^oom83;$5d{UoUbmAP(3Z)14YTK zMXQ#mz9yw>*8D^82vL^|%lyo|ZiQPd&{<*wCZI%up=wadl~C~cRJ!=Hjc&F)FNlnd zgNI|iSIMyqh=qV(z+HbldU4}!sqMs1R?t*RV!S*WW>qW_GF4NJ&vb-{2sJjiTIpL; z{bC@V&EhO|>GuDv7`%$kO<-P@^VI+y zl0tXGm|eISy)fiY3m8_Yaz>`Q=B(Yi8EH71{wfM*8ziS3BIju?26ujw==Xh4x5rH71h?Z859IWq(i#9 zLt0wt?(QBsL(q4yCv&g4t0jJvu^@FtJJk`8YXb{{(OdTS%rGxnPR)xY#6=?AWjD5M2n z5GZ@@ulO|JN34J-2y*-Nh@6|?RkFHwSj$e}p}mbc3Y}*el{O31RU0Z_E48@5O~5n;kDJy}a$x&Lc;27DTvAd@s^9>IA@$q{m6K?eZqOJGKpgCT!Zhld>#d^DAK+MDP}|3h zZ{i!ENw;mW62Pq^|FY#w?@8U6Nvjgi(sKW}&uvgjz0YIS>%Sxk1`5 z`qk`C2*bWd|0I4L=_~s(^2F$Bv7OTjo*G+gBD=Rq-~$7t{Bo|mmck(d6ywQ*UbIjkS>qtkH~Zs(sq zEYNB4xxdYmy+G=${gOjGGfSQQLi1D*{&en*3{wyd7U3M)y^FX(+d)eFi?9oMy@64c zwL?!q#*eJ$eayb4lc!B$W%M4B$4dH>9eFXwjfk5U@}6vXOWDiiLMYP3^VYlG$yDjaC({9tyL4NxPb{x=ADdJ7Bl5EHzU6h-Cbke zwi+34LGVF=G%>d5Q7C>n!)%!LT`UZ0v^YN1WrcjC(pS!&vek-SK#kj^EL9!l?TvY% zOkz%!#5Cf^2JFrvNeU5ZL1_aI(M~e4?~kId$T!A@Z$?f40q#~5HuElkRMQV+6r0>J zK9y=%I^m-_xwRNyO<2Zq-0W6!frE$jT$C3Qi3d>0911QPc`Ky6`~Y<)?mMy*u`nz8 z={b()Z;8DqbWJ?MdOsaF6Zn)$d>DQpRHM~bD3cq=Rw_fzWpiwtJFY`BF}hTFCeh+C zs-4A}MCP}`EInNzh3hRoZ6L1a`J7}T&wh9#HItmHBCRwefpQ97*u{--QH=5>MSZud zv_%DacJS+lsxlJ0q=40vs-8P$Q$_Pt)JM=)|1dcFO&JWY8KwhiP$a&Ua*Z z$BTW#lu4QZna#vZECq#Q?Up_(@`0#(@~0?mG{qA#^rZDq^&6T=pbGL8nU?BY-TwKE zPmMqhP_w?q1B~|43T5=Hl(Bi-+{yY;Acv4i9u}oWC+@^i*}l}=dg`Y~E%dTn;rqj5 z&3pLFHjC62jcxW_a@Jj2Ce%eToCB!6OV*6I0!XF9Hq7orpm-RpizSSHx890&_kCQ% z$cKVw-`WnDvv5Lq?L!qGDcUPtgmotX=C`~Smjg&oM5V?}gAzL%WkRwLmNZyrCbKwC zcsUD3O0ruLr%s`B5W)IYjzLTXcAqinas75T_j&1_m!m!^ORvk6_bYvK||DIVE@IUjWQ z0dQ(H9=a-c`@{Q=uj?JC8g`r$a>)gR#=2%vuea5B_BAp;*QX&I;N?>jHYFR=q?8sq zatBJBYX`tr1BQxIgACJ==*ivk$UjW^Maod6-=SzI3MMUbCqu!3wVHt!Be?M@)2aK+$Rv(?iH18-}e+rDznPRv< zi!{-5NNHE)eqVEeYl>F5S{6w^8L$0p7l|M;(^c+Ei|{V7!!8;xiDx@QK4Pl8Iel7N z*9%$ISyQPK_+5tc2c9jhX%sfIOCZf-E%K9X7Z6N0Nvp!~v(KAZvWnaHK^SQSragIF zVIC_7tGTXeU(TRqj?owTmj{SXNtf7;9evoBURMB5R`8R1$@$}FCS%ugA{4igxOhRi z*q_y$&&!mHF1$S}2279&m0^nFxDV#WvV&?Pphq(craPjcBtveg0Nqdm9tXL4lN{t= z?BLepVnp$U5KskjvVX-GjEf=M3mOTZb|Z$Hp*yytey0C^{cH*v>gqF&-j?gcEj4)l)cdGBmB(^HrSe_)qzf z+TZ^Yo4|GWz=Oi3m`r(hV`iZHb_mu63g(JXPMW4p9JhL_(tg+XQnmR0&52UUA|nZI zvjwOx(fNtZ`8!#|4$7GoJPQ`;T?hKOi`^`kFOyX;C4KfC(U-(CX?Qh2!RTe!4raMP zjLaC7qL_tJ?^0!T9ibZe!m-x!u7o%2dHK{uYZ~#+vERAv-G-MQeYQ*~DILuFpu02u z(Qc)=bHqb4{fs+hdKa5etlX z3EW#vlbEZmWT>X{3WbgW)8~u=8IGuRc<=?KoDXg5V`jf%i^Ai`Cd9=&FH6d|N9uJl z>QhxtW_{}H10BF}GQNitk~V=GnB%NI1Xv-6-OeaI&Amg0s{4i4;HhP$6oc(L-}yHt zej63({`5VLSoIef7D3Z9BA5x<9$^x?PhV=6A@Nu=QiJo@*o?M@*6-UA@EdV@bQCR< z9>{N%eK;Y#U-@XDBBCT^j=?<|y|lsAWrXsf`t%4VT{)63oxQe^u_5NuOq{rsrRd}Z zOx&OldRtR4leEX#r$9`gPJtbHccH!JgZK&3x`tJ<_{kv)E?$LhZ?brv`Cc}X%cWC7<@6yqM2O&m(rB`1v-TiqcQmA5n$rbGJ4zs({=R-I%6}*^UQ)wi9WuzW%Ri%&5 zTdd%>+GvADk+4q#3s5qne99`MC)X_#=p1!d?(mcKDW=Efc31Jso)9M49O0OMeP&7~ zIm!vorpxBSbvSiczr^?WP&e&-!3GLxCIaR5?PGeLgwYT;lYu9UE8SwmXR(D?A^s`7 z^F4di(+oHh%$DZjj7F3_-Y9}k^uCKeSC?Jd7h>RZIDZ{wcbh|9w4)p$dmv7|gX1n& zkrYjSso~;~qMMzZUQ5AC+GUvuj@y{4E&&v(+OE-rS^J7iE~Yz1 zCQ9hAI&0X2_H8CKZMqo00MsxtwjvM{`AdSaZ8#Y?5zPI;a+0`JF52!uVwr@5Ufctm zm;5G%gI&utfGa~fv6!jHh9d1r3TYD zEOlrbyFnDl5J%sEO>HErK~WWE6I$_eXp!dbphDf zc;~oWDQylVa=y?q;c>SKzvZ~R(ZE2csFwf@10@zaZxFAYWaV9TFMh(QuqxNhPUav~ zzCkoe8-lM{?vh}kdM6EMCH(eLK3Rt{HsEJ+4fve=xAVq(cUc9fO9g1%zI+QfFOb@0 zePFU(&?Np9w3&xs)ZwPnQniC0%xs8(Hyx{7*Ot51*`9&2^h7@!nmzuF`3pl8ep#Ls z<)nk7ts}`9tGgaVJWC-3w;B~$juY6m+7XgfzjR4I=oV}E9LRGf4@cI>d3z%CYyURI z7lRn11g!D34zI6|26>?CELeIh?cEv_GCCMd5&g<=9-)pe8iXINQ}4IljYsQyfRz|( z<%w=HN4ZOQKJ9e7DOUhjA7A%-xcR%2`@1?U&u}rvqNc_8l9dUT_S`4TKJ;yezIdp} z?qDAfx6IHQ7YlO;EAP%d4U2O7jU`Uh(um!J`hJ_3&mmQez8AqWLQEftYJuMdCj27t zoV#b!c0d8al0j1yveY6)U#kPCh%OfL>P=%WE^LQew^k-QqZ{rjX6PqOd2K7>1^VUB z`&H@+vW=wH0UY>88nXCH@RKCY&?bR%8-53b{;@>|;uzDd5f`Z% zaSC<8OLh|b@ZnBET?My38fV9~ku2cPfcWZl7nW|pkQKfFlp@xRt+K0Tj@gdvVAQXP z?i45RNE4W#Kf0%Pp2=?hESkG}EK557cwn0r1{uWeG53_tb!9bg&R8R_d4s5N0poc- zr>1g0W~1oha&#@_irbqnL)jJ@Z=y7J3fCQ@qlr{6(%rSs2rpkS1QIU^tieJ-xq%nd ze-C=#{@E+Kzb&SJ2KM~9q^4Yk^jyXa#{;P)y`YsFvfzX?%V~r6GciP4eX~$vk{-C? zeipAYsMSp`Z~&-Jc*dt}m-A_w&cnb#~sIdbU{uCayd>nWKDxQ9!%R zTrgS~+>TqXgrN~e2&eeWdPhuHP2*#K1=f^B@UGZBjFq- z;mtKYyul9ZNuq89XEoeSg7^qld5^R}FHpbyRyk1pRPMDO$_Kqi*sp1hk&UpUKc!V! zJZpCQc!)@X+%qOQMP)CU@Qe|=IG@|DZ~o#j>TBFQxH>8rJ#0y`XO9ukvc)kJ6LY3$ zY}{(tri#32!LjVY^exC3Ky)i$NY6v^*>X5y8F65pYYjt^T^X<=zm=)Cr=>dcId>?I zR^0I?)=)|}ak7wG)&Ar#A&60BRp}&NWFPy7zt)yl3aObS?sB8fxfU9ayR{$#%S<#3 zrsbmi#bDSP)@w%iYS%&wyyIB??LJ0Q%aD^!XXYk3)tQt~x_YU?y4KVKl{MJ)KSz&f zV;tJ1smY(dLM6zZXVAWND3L|(W=q~HjA6OkjQ+kx-EuqtaaQQPaa=2_wwuW@G*1>e z_TqB;+1@yuHg}YYpEJL&Sw~jD3Xeb(Wo(-nz6`#gbP7?agYT>j_R%+^h{1>7W&cP{s8epLY9Ky6mU*u*!QBn zI7T~WL-_qj+~Hdpr}qtfjZmD;eI%H0SP~~ifqoD59-q)R9_Z zKr6OeoZT!Za#k5yo&CCmzLbGP*6ggJ@2QPhIY^aMXjVjQ@D+-E#qmAjuL{o@NCUDF zFy)B~$j`rK7Iz$L>_Jl~O?IJu2P3 zlHQ@${Jgcvp`PKu7p;6Fr=4y1?8nJ;=~jls^gx4&_O4+)C-OGc5)L0+R!&uI&qQID zhV&ZQ@+2={Z|2F%WoOu9Ljt}|0r;!e zCBx(uAViqOffibUBOVEH_IlV=57ZQSQ~Te5(wmsO+o_CCNAgCJzZ3ly84J34_Zf#SwQ9q8i41 zE>u$JuO$kQq*W6MDo$Eu?3jJAFUt&>Qy#K{lT-Vx z6=kceU^v`;vBRoFxQED5TL+=>QJ!iaxV^Z2r#%CaaEWgbs1ysT$&~sem&74AEC!;< zcGDH;CENBJ&hfI!@G5ezCK!sXzdB@m#a(q8KeX;U=yl6AujNz z{}huJlo1yL$DlAsi{12aS?CJ*{xuIIV4wf-V6E?L4E!5BWMQ0Zh4uel*xZJ}QQuPE z-u#DdD6hH6`;nVJ>O}8iuWxH>Z2vc>a;iFbm)nrbj$ps$6aa4TjfVZVZr7dK+E_E# z+S`ErJDM9i{HX815lax33Wl(;H~m|sF28cs+hB$%2pjyXgubo5p_%ay3!*?212bxX z@1{$rzY6~DK*{`5@oRm0>(9INQX61!{Ip#NymIM*g~u=D)UFH!NcfQ(AsZXVOPv5) zX?=4bI9>9;>HvTACiBNDt)x;_}tsJousTuWrG- zDUSM9|4|IRSy@PhdB$sAk4b;vRr>Nt@t3OB<#_*dl_7P>FGcFF3-DA?KBW00A<;2=*&`^P8}cEZW!GSO9(+{;-V@ zd%%C8KEDYD$pC#x%zb4bfVJ|kgWcG0-UNZT9@2=R|Wz+H2iJ2A29LV z#Dye7Qn~^KUqOIS)8EGZC9w+k*Sq|}?ze$| zKpJrq7cvL=dV^7%ejE4Cn@aE>Q}b^ELnd#EUUf703IedX{*S;n6P|BELgooxW`$lE z2;lhae}w#VCPR>N+{A=T+qyn;-Jk!Dn2`C1H{l?&Wv&mW{)_(?+|T+JGMPf)s$;=d z5J27Mw}F4!tB`@`mkAnI1_G4%{WjW<(=~4PFy#B)>ubz@;O|2J^F9yq(EB<9e9})4 z{&vv)&j^s`f|tKquM7lG$@pD_AFY;q=hx31Z;lY;$;aa>NbnT| kh{^d0>dn0}#6IV5TMroUdkH8gdhnkj_&0LYo6ArC2O!h?t^fc4 literal 0 HcmV?d00001 diff --git a/spring-webflux/.mvn/wrapper/maven-wrapper.properties b/spring-webflux/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..b573bb50d5 --- /dev/null +++ b/spring-webflux/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/spring-webflux/mvnw b/spring-webflux/mvnw new file mode 100644 index 0000000000..5bf251c077 --- /dev/null +++ b/spring-webflux/mvnw @@ -0,0 +1,225 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Migwn, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +echo $MAVEN_PROJECTBASEDIR +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/spring-webflux/mvnw.cmd b/spring-webflux/mvnw.cmd new file mode 100644 index 0000000000..019bd74d76 --- /dev/null +++ b/spring-webflux/mvnw.cmd @@ -0,0 +1,143 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" + +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/spring-webflux/pom.xml b/spring-webflux/pom.xml new file mode 100644 index 0000000000..fca75456f5 --- /dev/null +++ b/spring-webflux/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + com.example + spring-webflux + 0.0.1-SNAPSHOT + jar + + spring-webflux + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-webflux + + + + org.springframework.boot + spring-boot-starter-test + test + + + io.projectreactor + reactor-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-webflux/src/main/java/com/example/springwebflux/client/SpringWebfluxClientApp.java b/spring-webflux/src/main/java/com/example/springwebflux/client/SpringWebfluxClientApp.java new file mode 100644 index 0000000000..6546c53120 --- /dev/null +++ b/spring-webflux/src/main/java/com/example/springwebflux/client/SpringWebfluxClientApp.java @@ -0,0 +1,36 @@ +package com.example.springwebflux.client; + +import java.util.Collections; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.http.MediaType; +import org.springframework.web.reactive.function.client.WebClient; + +import com.example.springwebflux.events.Train; + +import reactor.core.Disposable; + +@SpringBootApplication +public class SpringWebfluxClientApp { + + @Bean + WebClient client() { + return WebClient.create("http://localhost:8080"); + } + + @Bean + Disposable demoClient(WebClient client) { + return client().get().uri("/trainschedule").accept(MediaType.TEXT_EVENT_STREAM).exchange() + .flatMapMany(response -> response.bodyToFlux(Train.class)).subscribe(System.out::println); + } + + public static void main(String[] args) { + SpringApplication app = new SpringApplication(SpringWebfluxClientApp.class); + app.setDefaultProperties(Collections.singletonMap("server.port", "7777")); + app.run(args); + + } + +} diff --git a/spring-webflux/src/main/java/com/example/springwebflux/events/Train.java b/spring-webflux/src/main/java/com/example/springwebflux/events/Train.java new file mode 100644 index 0000000000..5d077550b1 --- /dev/null +++ b/spring-webflux/src/main/java/com/example/springwebflux/events/Train.java @@ -0,0 +1,30 @@ +package com.example.springwebflux.events; + +import java.util.Date; + +public class Train { + private String trainName; + private Date trainTime; + + public Train(String trainName, Date trainTime) { + this.trainName = trainName; + this.trainTime = trainTime; + } + + public String getTrainName() { + return trainName; + } + + public void setTrainName(String trainName) { + this.trainName = trainName; + } + + public Date getTrainTime() { + return trainTime; + } + + public void setTrainTime(Date trainTime) { + this.trainTime = trainTime; + } + +} diff --git a/spring-webflux/src/main/java/com/example/springwebflux/server/SpringWebfluxServerApp.java b/spring-webflux/src/main/java/com/example/springwebflux/server/SpringWebfluxServerApp.java new file mode 100644 index 0000000000..562a8bd011 --- /dev/null +++ b/spring-webflux/src/main/java/com/example/springwebflux/server/SpringWebfluxServerApp.java @@ -0,0 +1,38 @@ +package com.example.springwebflux.server; + +import java.time.Duration; +import java.util.Date; +import java.util.stream.Stream; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +import com.example.springwebflux.events.Train; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@SpringBootApplication +@RestController +public class SpringWebfluxServerApp { + + @GetMapping("/trainschedule/{trainName}") + Mono getTrainSchByName(@PathVariable String trainName) { + return Mono.just(new Train(trainName, new Date())); + } + + @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE, value = "/trainschedule") + Flux getTrainSch() { + Flux trainFlux = Flux.fromStream(Stream.generate(() -> new Train("Heartbeat: ", new Date()))); + Flux durationFlux = Flux.interval(Duration.ofSeconds(1)); + return Flux.zip(trainFlux, durationFlux).map(t -> t.getT1()); + } + + public static void main(String[] args) { + SpringApplication.run(SpringWebfluxServerApp.class, args); + } +} diff --git a/spring-webflux/src/main/resources/application.properties b/spring-webflux/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-webflux/src/test/java/com/example/springwebflux/SpringWebfluxApplicationTests.java b/spring-webflux/src/test/java/com/example/springwebflux/SpringWebfluxApplicationTests.java new file mode 100644 index 0000000000..28934514e4 --- /dev/null +++ b/spring-webflux/src/test/java/com/example/springwebflux/SpringWebfluxApplicationTests.java @@ -0,0 +1,16 @@ +package com.example.springwebflux; + +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 SpringWebfluxApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java b/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java new file mode 100644 index 0000000000..111735ddb1 --- /dev/null +++ b/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java @@ -0,0 +1,31 @@ +package com.example.springwebflux.server; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +@SpringBootTest +@RunWith(SpringRunner.class) +public class SpringWebfluxServerAppTest { + + private WebTestClient webTestClient; + + @Before + public void before() { + this.webTestClient = WebTestClient.bindToServer().baseUrl("http://localhost:8080").build(); + } + + @Test + public void testGetTrainSchByName() { + this.webTestClient.get() + .uri("/trainschedule/Heartbeat:") + .accept(MediaType.APPLICATION_JSON_UTF8) + .exchange() + .expectStatus().isOk(); + } + +} From b7d4a00dacdcddc877e1726832c4aeec378b6ed8 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Tue, 3 Jul 2018 22:55:47 +0400 Subject: [PATCH 013/298] A simple Real Time streaming example with Spring Webflux. 1. Added an API to generate a real time stream returning numbers. 2. Added Test case to consume that API with a webTestClient. 3. Added a client to consume that API, over the network. --- .../pom.xml | 70 +++++++++++++++++ .../java/com/springwebflux/sample/Client.java | 29 +++++++ .../src/main/resources/application.properties | 1 + springflux-5-reactive-ranjeetkaur/pom.xml | 76 +++++++++++++++++++ .../springwebflux/controller/Controller.java | 28 +++++++ .../com/springwebflux/sample/Application.java | 17 +++++ .../src/main/resources/application.properties | 1 + .../sample/ApplicationTests.java | 36 +++++++++ 8 files changed, 258 insertions(+) create mode 100644 springflux-5-reactive-client-ranjeetkaur/pom.xml create mode 100644 springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java create mode 100644 springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties create mode 100644 springflux-5-reactive-ranjeetkaur/pom.xml create mode 100644 springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java create mode 100644 springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java create mode 100644 springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties create mode 100644 springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java diff --git a/springflux-5-reactive-client-ranjeetkaur/pom.xml b/springflux-5-reactive-client-ranjeetkaur/pom.xml new file mode 100644 index 0000000000..bb832ae055 --- /dev/null +++ b/springflux-5-reactive-client-ranjeetkaur/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + com.springboot + sample + 0.0.1-SNAPSHOT + jar + + client + SpringFlux Sample Client + + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-webflux + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + --spring.profiles.active=dev + + + + + + + + + spring-releases + https://repo.spring.io/libs-release + + + + + spring-releases + https://repo.spring.io/libs-release + + + + diff --git a/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java b/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java new file mode 100644 index 0000000000..5846969803 --- /dev/null +++ b/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java @@ -0,0 +1,29 @@ +package com.springwebflux.sample; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.web.reactive.function.client.WebClient; + +/** + * @author ranjeetkaur + * + */ +@SpringBootApplication(scanBasePackages = "com.springwebflux.*") +@EnableAsync +public class Client { + + public static void main(String[] args) throws InterruptedException { + + WebClient webClient = WebClient.builder() + .baseUrl("http://localhost:8090") + .build(); + + webClient.get() + .uri("/v1/dice") + .retrieve() + .bodyToFlux(Integer.class) + .log(); + + Thread.sleep(10000); + } +} \ No newline at end of file diff --git a/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties b/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties new file mode 100644 index 0000000000..f667a68bc2 --- /dev/null +++ b/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port =8091 \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/pom.xml b/springflux-5-reactive-ranjeetkaur/pom.xml new file mode 100644 index 0000000000..3fe4156360 --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + com.springboot + sample + 0.0.1-SNAPSHOT + jar + + webflux-server + SpringFlux Sample Server + + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-webflux + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + --spring.profiles.active=dev + + + + + + + + + spring-releases + https://repo.spring.io/libs-release + + + + + spring-releases + https://repo.spring.io/libs-release + + + + diff --git a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java new file mode 100644 index 0000000000..fa3070640e --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java @@ -0,0 +1,28 @@ +package com.springwebflux.controller; + +import java.time.Duration; +import java.util.Random; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import reactor.core.publisher.Flux; + +/** + * @author ranjeetkaur + * + */ +@RestController +@RequestMapping(value = "/v1") +public class Controller { + + private static Random random = new Random(); + + @GetMapping("/dice") + public Flux rollDice() { + return Flux.interval(Duration.ofSeconds(1)) + .map(pulse -> random.nextInt(5) + 1); + } + +} diff --git a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java new file mode 100644 index 0000000000..1641885f41 --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java @@ -0,0 +1,17 @@ +package com.springwebflux.sample; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author ranjeetkaur + * + */ +@SpringBootApplication(scanBasePackages = "com.springwebflux.*") +public class Application { + + public static void main(String[] args) { + + SpringApplication.run(Application.class, args); + } +} \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties b/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties new file mode 100644 index 0000000000..91f7491179 --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port = 8090 \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java b/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java new file mode 100644 index 0000000000..ce09d9ae37 --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java @@ -0,0 +1,36 @@ +package com.springwebflux.sample; + +import java.time.Duration; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class ApplicationTests { + + @Autowired + private WebTestClient webTestClient; + + @Before + private void setUp() { + webTestClient = webTestClient.mutate() + .responseTimeout(Duration.ofMillis(10000)) + .build(); + } + + @Test + public void rollDice() throws InterruptedException { + webTestClient.get() + .uri("/v1/dice") + .exchange() + .expectStatus() + .isOk() + .expectBodyList(Integer.class); + } +} \ No newline at end of file From 487557faf23383906909830070dc2c71cd32f628 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Wed, 4 Jul 2018 12:32:22 +0200 Subject: [PATCH 014/298] A short example of real-time event streaming using Spring Webflux --- .../client/CpuUsageEventConsumer.java | 31 ++++++++++++++++++ .../controller/CpuUsageEventProducer.java | 24 ++++++++++++++ .../reactive/model/CpuUsageEvent.java | 17 ++++++++++ .../com/baeldung/reactive/utils/CpuUtils.java | 14 ++++++++ .../CpuUsageEventProducerIntegrationTest.java | 32 +++++++++++++++++++ .../baeldung/reactive/utils/CpuUtilsTest.java | 24 ++++++++++++++ 6 files changed, 142 insertions(+) create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java new file mode 100644 index 0000000000..3b9fbf7838 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java @@ -0,0 +1,31 @@ +package com.baeldung.reactive.client; + +import com.baeldung.reactive.model.CpuUsageEvent; +import org.springframework.boot.CommandLineRunner; +import org.springframework.context.annotation.Bean; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClient; + +/** + * @author Krzysztof Majewski + */ +@Component +public class CpuUsageEventConsumer { + + @Bean + WebClient client() { + return WebClient.create("http://localhost:8080"); + } + + @Bean + CommandLineRunner eventsConsumer(WebClient client) { + return args -> client.get() + .uri("/events/stream") + .accept(MediaType.TEXT_EVENT_STREAM) + .exchange() + .flatMapMany(cr -> cr.bodyToFlux(CpuUsageEvent.class)) + .subscribe(System.out::println); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java new file mode 100644 index 0000000000..5271debb84 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java @@ -0,0 +1,24 @@ +package com.baeldung.reactive.controller; + +import com.baeldung.reactive.model.CpuUsageEvent; +import com.baeldung.reactive.utils.CpuUtils; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.stream.Stream; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Flux; +import reactor.util.function.Tuple2; + +@RestController +public class CpuUsageEventProducer { + + @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE, value = "/events/stream") + Flux events() { + Flux eventFlux = Flux + .fromStream(Stream.generate(() -> new CpuUsageEvent(CpuUtils.getUsage(), LocalDateTime.now()))); + Flux durationFlux = Flux.interval(Duration.ofSeconds(5)); + return Flux.zip(eventFlux, durationFlux).map(Tuple2::getT1); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java new file mode 100644 index 0000000000..1ad41be65c --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java @@ -0,0 +1,17 @@ +package com.baeldung.reactive.model; + +import java.time.LocalDateTime; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.ToString; + +@Data +@ToString +@AllArgsConstructor +public class CpuUsageEvent { + + private Double cpuUsage; + + private LocalDateTime time; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java new file mode 100644 index 0000000000..c70aad9d2e --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java @@ -0,0 +1,14 @@ +package com.baeldung.reactive.utils; + +import com.sun.management.OperatingSystemMXBean; +import java.lang.management.ManagementFactory; + +public class CpuUtils { + + private static OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); + + public static Double getUsage() { + return (operatingSystemMXBean.getSystemCpuLoad() / operatingSystemMXBean.getAvailableProcessors()) * 100; + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java new file mode 100644 index 0000000000..81897cd8d6 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java @@ -0,0 +1,32 @@ +package com.baeldung.reactive.controller; + +import com.baeldung.reactive.Spring5ReactiveApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class) +public class CpuUsageEventProducerIntegrationTest { + + @Autowired + private WebTestClient webTestClient; + + @Test + public void whenGetCpuUsageEvents_thenReturns200() { + webTestClient.get() + .uri("/events/stream") + .accept(MediaType.TEXT_EVENT_STREAM) + .exchange() + .expectStatus().isOk() + .expectHeader().contentType(MediaType.APPLICATION_JSON_UTF8) + .expectBody() + .jsonPath("$.cpuUsage").isNotEmpty() + .jsonPath("$.time").isNotEmpty(); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java new file mode 100644 index 0000000000..a36f9c8528 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java @@ -0,0 +1,24 @@ +package com.baeldung.reactive.utils; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +import com.baeldung.reactive.Spring5ReactiveApplication; +import org.hamcrest.Matchers; +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(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class) +public class CpuUtilsTest { + + @Test + public void whenGetUsage_returnCorrectValue() { + Double usage = CpuUtils.getUsage(); + assertNotNull(usage); + assertThat(usage, Matchers.lessThanOrEqualTo(100d)); + } + +} From 76d17d75a8fe3227bcba5776dff4eccc56cca28c Mon Sep 17 00:00:00 2001 From: Imre Balassa Date: Sat, 7 Jul 2018 01:38:35 +0200 Subject: [PATCH 015/298] Delete the root element from the tree. --- .../src/main/java/com/baeldung/tree/BinaryTree.java | 2 +- ...{BinaryTreeTest.java => BinaryTreeUnitTest.java} | 13 ++++++++++++- .../trie/{TrieTest.java => TrieUnitTest.java} | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) rename data-structures/src/test/java/com/baeldung/tree/{BinaryTreeTest.java => BinaryTreeUnitTest.java} (90%) rename data-structures/src/test/java/com/baeldung/trie/{TrieTest.java => TrieUnitTest.java} (98%) diff --git a/data-structures/src/main/java/com/baeldung/tree/BinaryTree.java b/data-structures/src/main/java/com/baeldung/tree/BinaryTree.java index e3179dca32..f435e41afa 100644 --- a/data-structures/src/main/java/com/baeldung/tree/BinaryTree.java +++ b/data-structures/src/main/java/com/baeldung/tree/BinaryTree.java @@ -57,7 +57,7 @@ public class BinaryTree { } public void delete(int value) { - deleteRecursive(root, value); + root = deleteRecursive(root, value); } private Node deleteRecursive(Node current, int value) { diff --git a/data-structures/src/test/java/com/baeldung/tree/BinaryTreeTest.java b/data-structures/src/test/java/com/baeldung/tree/BinaryTreeUnitTest.java similarity index 90% rename from data-structures/src/test/java/com/baeldung/tree/BinaryTreeTest.java rename to data-structures/src/test/java/com/baeldung/tree/BinaryTreeUnitTest.java index 99e656fe28..f81247b74d 100644 --- a/data-structures/src/test/java/com/baeldung/tree/BinaryTreeTest.java +++ b/data-structures/src/test/java/com/baeldung/tree/BinaryTreeUnitTest.java @@ -6,7 +6,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; -public class BinaryTreeTest { +public class BinaryTreeUnitTest { @Test public void givenABinaryTree_WhenAddingElements_ThenTreeNotEmpty() { @@ -70,6 +70,17 @@ public class BinaryTreeTest { assertEquals(initialSize, bt.getSize()); } + @Test + public void it_deletes_the_root() { + int value = 12; + BinaryTree bt = new BinaryTree(); + bt.add(value); + + assertTrue(bt.containsNode(value)); + bt.delete(value); + assertFalse(bt.containsNode(value)); + } + @Test public void givenABinaryTree_WhenTraversingInOrder_ThenPrintValues() { diff --git a/data-structures/src/test/java/com/baeldung/trie/TrieTest.java b/data-structures/src/test/java/com/baeldung/trie/TrieUnitTest.java similarity index 98% rename from data-structures/src/test/java/com/baeldung/trie/TrieTest.java rename to data-structures/src/test/java/com/baeldung/trie/TrieUnitTest.java index be7e5575d8..3dd3f27a60 100644 --- a/data-structures/src/test/java/com/baeldung/trie/TrieTest.java +++ b/data-structures/src/test/java/com/baeldung/trie/TrieUnitTest.java @@ -5,7 +5,7 @@ import org.junit.Test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -public class TrieTest { +public class TrieUnitTest { @Test public void whenEmptyTrie_thenNoElements() { From 69bb8daf0c0a5532df785670929cf1159107a420 Mon Sep 17 00:00:00 2001 From: db Date: Fri, 13 Jul 2018 22:16:18 +0100 Subject: [PATCH 016/298] spring security custom AuthenticationFailureHandler --- spring-boot-security/pom.xml | 23 ++++- .../SpringBootSecurityApplication.java | 12 +++ .../configuration/SecurityConfiguration.java | 40 +++++++++ .../CustomAuthenticationFailureHandler.java | 28 ++++++ .../form_login/FormLoginIntegrationTest.java | 87 +++++++++++++++++++ 5 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/SpringBootSecurityApplication.java create mode 100644 spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java create mode 100644 spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/security/CustomAuthenticationFailureHandler.java create mode 100644 spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginIntegrationTest.java diff --git a/spring-boot-security/pom.xml b/spring-boot-security/pom.xml index 8763c210c8..b10f8e6e47 100644 --- a/spring-boot-security/pom.xml +++ b/spring-boot-security/pom.xml @@ -10,9 +10,10 @@ Spring Boot Security Auto-Configuration - com.baeldung - parent-modules - 1.0.0-SNAPSHOT + org.springframework.boot + spring-boot-starter-parent + 1.5.9.RELEASE + @@ -55,6 +56,11 @@ spring-security-test test + + org.springframework.security + spring-security-test + test + @@ -62,6 +68,16 @@ org.springframework.boot spring-boot-maven-plugin + + + + repackage + + + com.baeldung.springbootsecurity.basic_auth.SpringBootSecurityApplication + + + @@ -69,6 +85,7 @@ UTF-8 UTF-8 + 1.8 diff --git a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/SpringBootSecurityApplication.java b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/SpringBootSecurityApplication.java new file mode 100644 index 0000000000..9f4796e1f9 --- /dev/null +++ b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/SpringBootSecurityApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.springbootsecurity.form_login; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication(scanBasePackages = "com.baeldung.springbootsecurity.form_login") +public class SpringBootSecurityApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootSecurityApplication.class, args); + } +} diff --git a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java new file mode 100644 index 0000000000..1f5c53eb2b --- /dev/null +++ b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java @@ -0,0 +1,40 @@ +package com.baeldung.springbootsecurity.form_login.configuration; + +import com.baeldung.springbootsecurity.form_login.security.CustomAuthenticationFailureHandler; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; + +@Configuration +@EnableWebSecurity +public class SecurityConfiguration extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + auth + .inMemoryAuthentication() + .withUser("baeldung") + .password("baeldung") + .roles("USER"); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http + .authorizeRequests() + .anyRequest() + .authenticated() + .and() + .formLogin() + .failureHandler(customAuthenticationFailureHandler()); + } + + @Bean + public AuthenticationFailureHandler customAuthenticationFailureHandler() { + return new CustomAuthenticationFailureHandler(); + } +} diff --git a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/security/CustomAuthenticationFailureHandler.java b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/security/CustomAuthenticationFailureHandler.java new file mode 100644 index 0000000000..2617c1f475 --- /dev/null +++ b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/security/CustomAuthenticationFailureHandler.java @@ -0,0 +1,28 @@ +package com.baeldung.springbootsecurity.form_login.security; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.http.HttpStatus; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; + +public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler { + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { + response.setStatus(HttpStatus.UNAUTHORIZED.value()); + Map data = new HashMap<>(); + data.put("timestamp", Calendar.getInstance().getTime()); + data.put("exception", exception.getMessage()); + + response.getOutputStream().println(objectMapper.writeValueAsString(data)); + } +} diff --git a/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginIntegrationTest.java b/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginIntegrationTest.java new file mode 100644 index 0000000000..d5b5d8637b --- /dev/null +++ b/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginIntegrationTest.java @@ -0,0 +1,87 @@ +package com.baeldung.springbootsecurity.form_login; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import javax.servlet.Filter; + +import static org.junit.Assert.assertTrue; +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.formLogin; +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; +import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated; +import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.unauthenticated; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = com.baeldung.springbootsecurity.form_login.SpringBootSecurityApplication.class) +public class FormLoginIntegrationTest { + + @Autowired + private WebApplicationContext context; + + @Autowired + private Filter springSecurityFilterChain; + + private MockMvc mvc; + + @Before + public void setup() { + mvc = MockMvcBuilders + .webAppContextSetup(context) + .addFilters(springSecurityFilterChain) + .build(); + } + + @Test + public void givenRequestWithoutSessionOrCsrfToken_shouldFailWith403() throws Exception { + mvc + .perform(post("/")) + .andExpect(status().isForbidden()); + } + + @Test + public void givenRequestWithInvalidCsrfToken_shouldFailWith403() throws Exception { + mvc + .perform(post("/").with(csrf().useInvalidToken())) + .andExpect(status().isForbidden()); + } + + @Test + public void givenRequestWithValidCsrfTokenAndWithoutSessionToken_shouldReceive302WithLocationHeaderToLoginPage() throws Exception { + MvcResult mvcResult = mvc.perform(post("/").with(csrf())).andReturn(); + assertTrue(mvcResult.getResponse().getStatus() == 302); + assertTrue(mvcResult.getResponse().getHeader("Location").contains("login")); + } + + @Test + public void givenValidRequestWithValidCredentials_shouldLoginSuccessfully() throws Exception { + mvc + .perform(formLogin().user("baeldung").password("baeldung")) + .andExpect(status().isFound()) + .andExpect(redirectedUrl("/")) + .andExpect(authenticated().withUsername("baeldung")); + } + + @Test + public void givenValidRequestWithInvalidCredentials_shouldFailWith401() throws Exception { + MvcResult result = mvc + .perform(formLogin().user("random").password("random")) + .andExpect(status().isUnauthorized()) + .andDo(print()) + .andExpect(unauthenticated()) + .andReturn(); + + assertTrue(result.getResponse().getContentAsString().contains("Bad credentials")); + } +} From a9a0a3978ec55b695dbf073f768dbe831cf72621 Mon Sep 17 00:00:00 2001 From: db Date: Sat, 14 Jul 2018 16:01:28 +0100 Subject: [PATCH 017/298] refactor --- spring-boot-security/pom.xml | 20 ++++--------- .../configuration/SecurityConfiguration.java | 29 ++++++++++++++++++- .../CustomAuthenticationFailureHandler.java | 28 ------------------ 3 files changed, 33 insertions(+), 44 deletions(-) delete mode 100644 spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/security/CustomAuthenticationFailureHandler.java diff --git a/spring-boot-security/pom.xml b/spring-boot-security/pom.xml index b10f8e6e47..130bd52235 100644 --- a/spring-boot-security/pom.xml +++ b/spring-boot-security/pom.xml @@ -10,10 +10,9 @@ Spring Boot Security Auto-Configuration - org.springframework.boot - spring-boot-starter-parent - 1.5.9.RELEASE - + com.baeldung + parent-modules + 1.0.0-SNAPSHOT @@ -21,7 +20,7 @@ org.springframework.boot spring-boot-dependencies - 1.5.9.RELEASE + ${spring-boot.version} pom import @@ -68,16 +67,6 @@ org.springframework.boot spring-boot-maven-plugin - - - - repackage - - - com.baeldung.springbootsecurity.basic_auth.SpringBootSecurityApplication - - - @@ -86,6 +75,7 @@ UTF-8 UTF-8 1.8 + 1.5.9.RELEASE diff --git a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java index 1f5c53eb2b..6ab522ef00 100644 --- a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java +++ b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java @@ -1,14 +1,24 @@ package com.baeldung.springbootsecurity.form_login.configuration; -import com.baeldung.springbootsecurity.form_login.security.CustomAuthenticationFailureHandler; +import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatus; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.AuthenticationFailureHandler; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; + @Configuration @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @@ -37,4 +47,21 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { public AuthenticationFailureHandler customAuthenticationFailureHandler() { return new CustomAuthenticationFailureHandler(); } + + /** + * Custom AuthenticationFailureHandler + */ + public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler { + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Override + public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { + response.setStatus(HttpStatus.UNAUTHORIZED.value()); + Map data = new HashMap<>(); + data.put("timestamp", Calendar.getInstance().getTime()); + data.put("exception", exception.getMessage()); + + response.getOutputStream().println(objectMapper.writeValueAsString(data)); + } + } } diff --git a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/security/CustomAuthenticationFailureHandler.java b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/security/CustomAuthenticationFailureHandler.java deleted file mode 100644 index 2617c1f475..0000000000 --- a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/security/CustomAuthenticationFailureHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.springbootsecurity.form_login.security; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.http.HttpStatus; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.AuthenticationFailureHandler; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Calendar; -import java.util.HashMap; -import java.util.Map; - -public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler { - private final ObjectMapper objectMapper = new ObjectMapper(); - - @Override - public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { - response.setStatus(HttpStatus.UNAUTHORIZED.value()); - Map data = new HashMap<>(); - data.put("timestamp", Calendar.getInstance().getTime()); - data.put("exception", exception.getMessage()); - - response.getOutputStream().println(objectMapper.writeValueAsString(data)); - } -} From f18ad815a3af6666e4b7ca2c62401e0e5d59fb43 Mon Sep 17 00:00:00 2001 From: db Date: Sat, 14 Jul 2018 16:10:57 +0100 Subject: [PATCH 018/298] moved SSE to branch --- .../sse/controller/EventController.java | 26 ------------ .../reactive/sse/model/EventSubscription.java | 22 ---------- .../service/EventSubscriptionsService.java | 41 ------------------- .../service/emitter/DateEmitterService.java | 27 ------------ .../src/main/resources/static/app.js | 36 ---------------- .../src/main/resources/static/sse-index.html | 19 --------- .../reactive/sse/ServerSentEventsTest.java | 39 ------------------ 7 files changed, 210 deletions(-) delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/sse/controller/EventController.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/sse/model/EventSubscription.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/EventSubscriptionsService.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/emitter/DateEmitterService.java delete mode 100644 spring-5-reactive/src/main/resources/static/app.js delete mode 100644 spring-5-reactive/src/main/resources/static/sse-index.html delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/reactive/sse/ServerSentEventsTest.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/controller/EventController.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/controller/EventController.java deleted file mode 100644 index e692aa3a74..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/controller/EventController.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.reactive.sse.controller; - - -import com.baeldung.reactive.sse.service.EventSubscriptionsService; -import org.springframework.http.MediaType; -import org.springframework.http.codec.ServerSentEvent; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; -import reactor.core.publisher.Flux; - -@RestController -public class EventController { - - private EventSubscriptionsService eventSubscriptionsService; - - public EventController(EventSubscriptionsService eventSubscriptionsService) { - this.eventSubscriptionsService = eventSubscriptionsService; - } - - @GetMapping( - produces = MediaType.TEXT_EVENT_STREAM_VALUE, - value = "/sse/events") - public Flux events() { - return eventSubscriptionsService.subscribe(); - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/model/EventSubscription.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/model/EventSubscription.java deleted file mode 100644 index 4d3ce27156..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/model/EventSubscription.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.reactive.sse.model; - -import org.springframework.http.codec.ServerSentEvent; -import reactor.core.publisher.DirectProcessor; -import reactor.core.publisher.Flux; - -public class EventSubscription { - - private DirectProcessor directProcessor; - - public EventSubscription() { - this.directProcessor = DirectProcessor.create(); - } - - public void emit(ServerSentEvent e) { - directProcessor.onNext(e); - } - - public Flux subscribe() { - return directProcessor; - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/EventSubscriptionsService.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/EventSubscriptionsService.java deleted file mode 100644 index f245ce6184..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/EventSubscriptionsService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.reactive.sse.service; - -import com.baeldung.reactive.sse.model.EventSubscription; -import org.springframework.http.codec.ServerSentEvent; -import org.springframework.stereotype.Service; -import reactor.core.publisher.Flux; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -@Service -public class EventSubscriptionsService { - - private List listeners; - - public EventSubscriptionsService() { - this.listeners = new ArrayList<>(); - } - - public Flux subscribe() { - EventSubscription e = new EventSubscription(); - listeners.add(e); - - return e.subscribe(); - } - - public void sendDateEvent(Date date) { - for (EventSubscription e : listeners) { - try { - e.emit(ServerSentEvent.builder(date) - .event("date") - .id(UUID.randomUUID().toString()) - .build()); - } catch (Exception ex) { - listeners.remove(e); - } - } - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/emitter/DateEmitterService.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/emitter/DateEmitterService.java deleted file mode 100644 index 29b70865dc..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/sse/service/emitter/DateEmitterService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.reactive.sse.service.emitter; - -import com.baeldung.reactive.sse.service.EventSubscriptionsService; -import org.springframework.stereotype.Service; -import reactor.core.publisher.Flux; - -import javax.annotation.PostConstruct; -import java.time.Duration; -import java.util.Date; -import java.util.stream.Stream; - -@Service -public class DateEmitterService { - - private EventSubscriptionsService eventSubscriptionsService; - - public DateEmitterService(EventSubscriptionsService eventSubscriptionsService) { - this.eventSubscriptionsService = eventSubscriptionsService; - } - - @PostConstruct - public void init() { - Flux.fromStream(Stream.generate(Date::new)) - .delayElements(Duration.ofSeconds(1)) - .subscribe(data -> eventSubscriptionsService.sendDateEvent(new Date())); - } -} diff --git a/spring-5-reactive/src/main/resources/static/app.js b/spring-5-reactive/src/main/resources/static/app.js deleted file mode 100644 index 2af2ae5844..0000000000 --- a/spring-5-reactive/src/main/resources/static/app.js +++ /dev/null @@ -1,36 +0,0 @@ -let Clock = React.createClass({ - - getInitialState: function() { - const self = this; - const ev = new EventSource("http://localhost:8080/sse/events"); - - self.setState({currentDate : moment(new Date()).format("MMMM Do YYYY, h:mm:ss a")}); - - ev.addEventListener("date", function(e) { - self.setState({currentDate : moment(JSON.parse(e.data).date).format("MMMM Do YYYY, h:mm:ss a")}); - }, false); - - return {currentDate: moment(new Date()).format("MMMM Do YYYY, h:mm:ss a") }; - }, - - render() { - return ( -

- Current time: {this.state.currentDate} -

- ); - } - -}); - -let App = React.createClass({ - render() { - return ( -
- -
- ); - } -}); - -ReactDOM.render(, document.getElementById('root') ); \ No newline at end of file diff --git a/spring-5-reactive/src/main/resources/static/sse-index.html b/spring-5-reactive/src/main/resources/static/sse-index.html deleted file mode 100644 index 875c8176af..0000000000 --- a/spring-5-reactive/src/main/resources/static/sse-index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - React + Spring - - - -
- - - - - - - - - - \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/sse/ServerSentEventsTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/sse/ServerSentEventsTest.java deleted file mode 100644 index 48e8c23c37..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/sse/ServerSentEventsTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.reactive.sse; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.reactive.server.WebTestClient; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class ServerSentEventsTest { - - @Autowired - private WebTestClient webClient; - - @Test - public void contextLoads() { - } - - @Test - public void givenValidRequest_shouldReceiveOk() throws Exception { - - webClient.get().uri("/events").accept(MediaType.TEXT_EVENT_STREAM) - .exchange() - .expectStatus().isOk(); - } - - @Test - public void givenInvalidHttpVerb_shouldReceiveMethodNotAllowedError() throws Exception { - - webClient.post().uri("/events").accept(MediaType.TEXT_EVENT_STREAM) - .exchange() - .expectStatus().isEqualTo(HttpStatus.METHOD_NOT_ALLOWED); - } - -} From 509998a7c6b769ee4ff66bbe352d6b9afef47181 Mon Sep 17 00:00:00 2001 From: db Date: Sun, 15 Jul 2018 09:24:32 +0100 Subject: [PATCH 019/298] remove pom properties --- spring-boot-security/pom.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/spring-boot-security/pom.xml b/spring-boot-security/pom.xml index 130bd52235..1f904d0a67 100644 --- a/spring-boot-security/pom.xml +++ b/spring-boot-security/pom.xml @@ -72,9 +72,6 @@ - UTF-8 - UTF-8 - 1.8 1.5.9.RELEASE From 7beadb7d706d546590745235c02ea5f90d6c8501 Mon Sep 17 00:00:00 2001 From: Kirti Deo Date: Sun, 15 Jul 2018 20:19:50 +0530 Subject: [PATCH 020/298] Kirti Deo "Spring Webflux" --- .../springwebflux/server/SpringWebfluxServerAppTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java b/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java index 111735ddb1..1d12aedff4 100644 --- a/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java +++ b/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java @@ -20,7 +20,7 @@ public class SpringWebfluxServerAppTest { } @Test - public void testGetTrainSchByName() { + public void whenGetTrainSchByNameIsCalled_ThenReturnScheduleForTheTrain() { this.webTestClient.get() .uri("/trainschedule/Heartbeat:") .accept(MediaType.APPLICATION_JSON_UTF8) From d0c619a0ad084433514d9b36ddf679b55db91c9b Mon Sep 17 00:00:00 2001 From: shreyashthakare Date: Tue, 17 Jul 2018 00:32:13 +0530 Subject: [PATCH 021/298] BAEL-1960: Custom appender for log4j --- logging-modules/log4j2/pom.xml | 219 +++++++++--------- .../logging/log4j2/appender/MapAppender.java | 58 +++++ .../appender/MapAppenderIntegrationTest.java | 35 +++ .../log4j2/src/test/resources/log4j2.xml | 174 +++++++------- 4 files changed, 297 insertions(+), 189 deletions(-) create mode 100644 logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java create mode 100644 logging-modules/log4j2/src/test/java/com/baeldung/logging/log4j2/appender/MapAppenderIntegrationTest.java diff --git a/logging-modules/log4j2/pom.xml b/logging-modules/log4j2/pom.xml index 89d37e789c..b577931f0f 100644 --- a/logging-modules/log4j2/pom.xml +++ b/logging-modules/log4j2/pom.xml @@ -1,117 +1,126 @@ - - 4.0.0 - log4j2 + + 4.0.0 + log4j2 - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../../ - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + - - - - org.apache.logging.log4j - log4j-core - ${log4j-core.version} - + + + + org.apache.logging.log4j + log4j-core + ${log4j-core.version} + - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - + + + org.apache.logging.log4j + log4j-api + ${log4j-core.version} + - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - - - - com.h2database - h2 - ${h2.version} - - - org.apache.commons - commons-dbcp2 - ${commons-dbcp2.version} - + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + - - - org.apache.logging.log4j - log4j-core - ${log4j-core.version} - test-jar - test - - + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - none - - - - + + + com.h2database + h2 + ${h2.version} + + + org.apache.commons + commons-dbcp2 + ${commons-dbcp2.version} + - - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - **/*LiveTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - - - - - - - json - ${java.io.tmpdir}/${maven.build.timestamp}/logfile.json - - - - - - - + + + org.apache.logging.log4j + log4j-core + ${log4j-core.version} + test-jar + test + + - - 2.9.5 - 1.4.193 - 2.1.1 - 2.11.0 - yyyyMMddHHmmss - + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + none + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + **/*LiveTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + json + ${java.io.tmpdir}/${maven.build.timestamp}/logfile.json + + + + + + + + + + 2.9.5 + 1.4.193 + 2.1.1 + 2.11.0 + yyyyMMddHHmmss + diff --git a/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java b/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java new file mode 100644 index 0000000000..160ba58395 --- /dev/null +++ b/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java @@ -0,0 +1,58 @@ +/** + * + */ +package com.baeldung.logging.log4j2.appender; + +import java.io.Serializable; +import java.time.Instant; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +import org.apache.logging.log4j.core.Appender; +import org.apache.logging.log4j.core.Core; +import org.apache.logging.log4j.core.Filter; +import org.apache.logging.log4j.core.Layout; +import org.apache.logging.log4j.core.LogEvent; +import org.apache.logging.log4j.core.appender.AbstractAppender; +import org.apache.logging.log4j.core.config.plugins.Plugin; +import org.apache.logging.log4j.core.config.plugins.PluginAttribute; +import org.apache.logging.log4j.core.config.plugins.PluginElement; +import org.apache.logging.log4j.core.config.plugins.PluginFactory; +import org.apache.logging.log4j.core.layout.PatternLayout; + +@Plugin(name = "MapAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject = true) +public class MapAppender extends AbstractAppender { + + private ConcurrentMap eventMap = new ConcurrentHashMap<>(); + + protected MapAppender(String name, Filter filter, Layout layout) { + super(name, filter, layout); + } + + @PluginFactory + public static MapAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Layout") Layout layout, @PluginElement("Filter") final Filter filter) { + if (name == null) { + LOGGER.error("No name provided for MapAppender"); + return null; + } + if (layout == null) { + layout = PatternLayout.createDefaultLayout(); + } + return new MapAppender(name, filter, layout); + } + + @Override + public void append(LogEvent event) { + eventMap.put(Instant.now() + .toString(), event); + } + + public ConcurrentMap getEventMap() { + return eventMap; + } + + public void setEventMap(ConcurrentMap eventMap) { + this.eventMap = eventMap; + } + +} diff --git a/logging-modules/log4j2/src/test/java/com/baeldung/logging/log4j2/appender/MapAppenderIntegrationTest.java b/logging-modules/log4j2/src/test/java/com/baeldung/logging/log4j2/appender/MapAppenderIntegrationTest.java new file mode 100644 index 0000000000..020aaafc74 --- /dev/null +++ b/logging-modules/log4j2/src/test/java/com/baeldung/logging/log4j2/appender/MapAppenderIntegrationTest.java @@ -0,0 +1,35 @@ +package com.baeldung.logging.log4j2.appender; + +import static org.junit.Assert.assertEquals; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.config.Configuration; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class MapAppenderIntegrationTest { + + private Logger logger; + + @Before + public void setup() { + logger = LogManager.getLogger(MapAppenderIntegrationTest.class); + } + + @Test + public void whenLoggerEmitsLoggingEvent_thenAppenderReceivesEvent() throws Exception { + logger.info("Test from {}", this.getClass() + .getSimpleName()); + LoggerContext context = LoggerContext.getContext(false); + Configuration config = context.getConfiguration(); + MapAppender appender = config.getAppender("MapAppender"); + assertEquals(appender.getEventMap() + .size(), 1); + } + +} diff --git a/logging-modules/log4j2/src/test/resources/log4j2.xml b/logging-modules/log4j2/src/test/resources/log4j2.xml index 83b664a507..d0fd0d088f 100644 --- a/logging-modules/log4j2/src/test/resources/log4j2.xml +++ b/logging-modules/log4j2/src/test/resources/log4j2.xml @@ -1,87 +1,93 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + packages="com.baeldung" status="WARN"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From a461fc35b6cf3909e2c840295943bca26edb9ad0 Mon Sep 17 00:00:00 2001 From: Anderson Barbosa Date: Tue, 17 Jul 2018 13:26:01 -0300 Subject: [PATCH 022/298] Update README.md server port in application.properties is 8082 FooController mapping is "/auth/foos" --- spring-rest-full/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-rest-full/README.md b/spring-rest-full/README.md index 23b0b0435b..0dd25b276b 100644 --- a/spring-rest-full/README.md +++ b/spring-rest-full/README.md @@ -41,5 +41,5 @@ mysql -u root -p ### Use the REST Service ``` -curl http://localhost:8080/spring-rest-full/foos +curl http://localhost:8082/spring-rest-full/auth/foos ``` From aa0af30497bfc2b8699ba5a890d6ba6494f441d6 Mon Sep 17 00:00:00 2001 From: db Date: Wed, 18 Jul 2018 12:40:56 +0100 Subject: [PATCH 023/298] moved AuthenticationFailureHandler example to spring-security-mvc-login --- .../SpringBootSecurityApplication.java | 12 --- .../configuration/SecurityConfiguration.java | 67 -------------- .../form_login/FormLoginIntegrationTest.java | 87 ------------------- .../form_login/FormLoginUnitTest.java | 87 ------------------- .../CustomAuthenticationFailureHandler.java | 22 +++++ .../baeldung/spring/SecSecurityConfig.java | 51 ++++++----- .../src/main/resources/webSecurityConfig.xml | 8 +- .../baeldung/security/FormLoginUnitTest.java | 63 ++++++++++++++ 8 files changed, 119 insertions(+), 278 deletions(-) delete mode 100644 spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/SpringBootSecurityApplication.java delete mode 100644 spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java delete mode 100644 spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginIntegrationTest.java delete mode 100644 spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginUnitTest.java create mode 100644 spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAuthenticationFailureHandler.java create mode 100644 spring-security-mvc-login/src/test/java/org/baeldung/security/FormLoginUnitTest.java diff --git a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/SpringBootSecurityApplication.java b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/SpringBootSecurityApplication.java deleted file mode 100644 index 9f4796e1f9..0000000000 --- a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/SpringBootSecurityApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.springbootsecurity.form_login; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication(scanBasePackages = "com.baeldung.springbootsecurity.form_login") -public class SpringBootSecurityApplication { - - public static void main(String[] args) { - SpringApplication.run(SpringBootSecurityApplication.class, args); - } -} diff --git a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java b/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java deleted file mode 100644 index 6ab522ef00..0000000000 --- a/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/form_login/configuration/SecurityConfiguration.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.baeldung.springbootsecurity.form_login.configuration; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatus; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.AuthenticationFailureHandler; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Calendar; -import java.util.HashMap; -import java.util.Map; - -@Configuration -@EnableWebSecurity -public class SecurityConfiguration extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception { - auth - .inMemoryAuthentication() - .withUser("baeldung") - .password("baeldung") - .roles("USER"); - } - - @Override - protected void configure(HttpSecurity http) throws Exception { - http - .authorizeRequests() - .anyRequest() - .authenticated() - .and() - .formLogin() - .failureHandler(customAuthenticationFailureHandler()); - } - - @Bean - public AuthenticationFailureHandler customAuthenticationFailureHandler() { - return new CustomAuthenticationFailureHandler(); - } - - /** - * Custom AuthenticationFailureHandler - */ - public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler { - private final ObjectMapper objectMapper = new ObjectMapper(); - - @Override - public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { - response.setStatus(HttpStatus.UNAUTHORIZED.value()); - Map data = new HashMap<>(); - data.put("timestamp", Calendar.getInstance().getTime()); - data.put("exception", exception.getMessage()); - - response.getOutputStream().println(objectMapper.writeValueAsString(data)); - } - } -} diff --git a/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginIntegrationTest.java b/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginIntegrationTest.java deleted file mode 100644 index d5b5d8637b..0000000000 --- a/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginIntegrationTest.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.baeldung.springbootsecurity.form_login; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.MvcResult; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.context.WebApplicationContext; - -import javax.servlet.Filter; - -import static org.junit.Assert.assertTrue; -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.formLogin; -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; -import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated; -import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.unauthenticated; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = com.baeldung.springbootsecurity.form_login.SpringBootSecurityApplication.class) -public class FormLoginIntegrationTest { - - @Autowired - private WebApplicationContext context; - - @Autowired - private Filter springSecurityFilterChain; - - private MockMvc mvc; - - @Before - public void setup() { - mvc = MockMvcBuilders - .webAppContextSetup(context) - .addFilters(springSecurityFilterChain) - .build(); - } - - @Test - public void givenRequestWithoutSessionOrCsrfToken_shouldFailWith403() throws Exception { - mvc - .perform(post("/")) - .andExpect(status().isForbidden()); - } - - @Test - public void givenRequestWithInvalidCsrfToken_shouldFailWith403() throws Exception { - mvc - .perform(post("/").with(csrf().useInvalidToken())) - .andExpect(status().isForbidden()); - } - - @Test - public void givenRequestWithValidCsrfTokenAndWithoutSessionToken_shouldReceive302WithLocationHeaderToLoginPage() throws Exception { - MvcResult mvcResult = mvc.perform(post("/").with(csrf())).andReturn(); - assertTrue(mvcResult.getResponse().getStatus() == 302); - assertTrue(mvcResult.getResponse().getHeader("Location").contains("login")); - } - - @Test - public void givenValidRequestWithValidCredentials_shouldLoginSuccessfully() throws Exception { - mvc - .perform(formLogin().user("baeldung").password("baeldung")) - .andExpect(status().isFound()) - .andExpect(redirectedUrl("/")) - .andExpect(authenticated().withUsername("baeldung")); - } - - @Test - public void givenValidRequestWithInvalidCredentials_shouldFailWith401() throws Exception { - MvcResult result = mvc - .perform(formLogin().user("random").password("random")) - .andExpect(status().isUnauthorized()) - .andDo(print()) - .andExpect(unauthenticated()) - .andReturn(); - - assertTrue(result.getResponse().getContentAsString().contains("Bad credentials")); - } -} diff --git a/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginUnitTest.java b/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginUnitTest.java deleted file mode 100644 index d518f3b0c2..0000000000 --- a/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/form_login/FormLoginUnitTest.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.baeldung.springbootsecurity.form_login; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.MvcResult; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.context.WebApplicationContext; - -import javax.servlet.Filter; - -import static org.junit.Assert.assertTrue; -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.formLogin; -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; -import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated; -import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.unauthenticated; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = com.baeldung.springbootsecurity.form_login.SpringBootSecurityApplication.class) -public class FormLoginUnitTest { - - @Autowired - private WebApplicationContext context; - - @Autowired - private Filter springSecurityFilterChain; - - private MockMvc mvc; - - @Before - public void setup() { - mvc = MockMvcBuilders - .webAppContextSetup(context) - .addFilters(springSecurityFilterChain) - .build(); - } - - @Test - public void givenRequestWithoutSessionOrCsrfToken_shouldFailWith403() throws Exception { - mvc - .perform(post("/")) - .andExpect(status().isForbidden()); - } - - @Test - public void givenRequestWithInvalidCsrfToken_shouldFailWith403() throws Exception { - mvc - .perform(post("/").with(csrf().useInvalidToken())) - .andExpect(status().isForbidden()); - } - - @Test - public void givenRequestWithValidCsrfTokenAndWithoutSessionToken_shouldReceive302WithLocationHeaderToLoginPage() throws Exception { - MvcResult mvcResult = mvc.perform(post("/").with(csrf())).andReturn(); - assertTrue(mvcResult.getResponse().getStatus() == 302); - assertTrue(mvcResult.getResponse().getHeader("Location").contains("login")); - } - - @Test - public void givenValidRequestWithValidCredentials_shouldLoginSuccessfully() throws Exception { - mvc - .perform(formLogin().user("baeldung").password("baeldung")) - .andExpect(status().isFound()) - .andExpect(redirectedUrl("/")) - .andExpect(authenticated().withUsername("baeldung")); - } - - @Test - public void givenValidRequestWithInvalidCredentials_shouldFailWith401() throws Exception { - MvcResult result = mvc - .perform(formLogin().user("random").password("random")) - .andExpect(status().isUnauthorized()) - .andDo(print()) - .andExpect(unauthenticated()) - .andReturn(); - - assertTrue(result.getResponse().getContentAsString().contains("Bad credentials")); - } -} diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAuthenticationFailureHandler.java b/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAuthenticationFailureHandler.java new file mode 100644 index 0000000000..5eddf3883e --- /dev/null +++ b/spring-security-mvc-login/src/main/java/org/baeldung/security/CustomAuthenticationFailureHandler.java @@ -0,0 +1,22 @@ +package org.baeldung.security; + +import org.springframework.http.HttpStatus; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Calendar; + +public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler { + + @Override + public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException { + httpServletResponse.setStatus(HttpStatus.UNAUTHORIZED.value()); + + String jsonPayload = "{\"message\" : \"%s\", \"timestamp\" : \"%s\" }"; + httpServletResponse.getOutputStream().println(String.format(jsonPayload, e.getMessage(), Calendar.getInstance().getTime())); + } +} diff --git a/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java index d9a43d48d0..accc7c9afd 100644 --- a/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-mvc-login/src/main/java/org/baeldung/spring/SecSecurityConfig.java @@ -1,6 +1,7 @@ package org.baeldung.spring; import org.baeldung.security.CustomAccessDeniedHandler; +import org.baeldung.security.CustomAuthenticationFailureHandler; import org.baeldung.security.CustomLogoutSuccessHandler; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -10,6 +11,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.web.access.AccessDeniedHandler; +import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; @Configuration @@ -26,11 +28,11 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter { protected void configure(final AuthenticationManagerBuilder auth) throws Exception { // @formatter:off auth.inMemoryAuthentication() - .withUser("user1").password("user1Pass").roles("USER") - .and() - .withUser("user2").password("user2Pass").roles("USER") - .and() - .withUser("admin").password("adminPass").roles("ADMIN"); + .withUser("user1").password("user1Pass").roles("USER") + .and() + .withUser("user2").password("user2Pass").roles("USER") + .and() + .withUser("admin").password("adminPass").roles("ADMIN"); // @formatter:on } @@ -38,23 +40,24 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter { protected void configure(final HttpSecurity http) throws Exception { // @formatter:off http - .csrf().disable() - .authorizeRequests() - .antMatchers("/admin/**").hasRole("ADMIN") - .antMatchers("/anonymous*").anonymous() - .antMatchers("/login*").permitAll() - .anyRequest().authenticated() - .and() - .formLogin() - .loginPage("/login.html") - .loginProcessingUrl("/perform_login") - .defaultSuccessUrl("/homepage.html",true) - .failureUrl("/login.html?error=true") - .and() - .logout() - .logoutUrl("/perform_logout") - .deleteCookies("JSESSIONID") - .logoutSuccessHandler(logoutSuccessHandler()); + .csrf().disable() + .authorizeRequests() + .antMatchers("/admin/**").hasRole("ADMIN") + .antMatchers("/anonymous*").anonymous() + .antMatchers("/login*").permitAll() + .anyRequest().authenticated() + .and() + .formLogin() + .loginPage("/login.html") + .loginProcessingUrl("/perform_login") + .defaultSuccessUrl("/homepage.html", true) + //.failureUrl("/login.html?error=true") + .failureHandler(authenticationFailureHandler()) + .and() + .logout() + .logoutUrl("/perform_logout") + .deleteCookies("JSESSIONID") + .logoutSuccessHandler(logoutSuccessHandler()); //.and() //.exceptionHandling().accessDeniedPage("/accessDenied"); //.exceptionHandling().accessDeniedHandler(accessDeniedHandler()); @@ -71,4 +74,8 @@ public class SecSecurityConfig extends WebSecurityConfigurerAdapter { return new CustomAccessDeniedHandler(); } + @Bean + public AuthenticationFailureHandler authenticationFailureHandler() { + return new CustomAuthenticationFailureHandler(); + } } diff --git a/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml b/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml index f0fa956934..189522889f 100644 --- a/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml +++ b/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml @@ -15,20 +15,22 @@ - + - + + + diff --git a/spring-security-mvc-login/src/test/java/org/baeldung/security/FormLoginUnitTest.java b/spring-security-mvc-login/src/test/java/org/baeldung/security/FormLoginUnitTest.java new file mode 100644 index 0000000000..4b3a091e6c --- /dev/null +++ b/spring-security-mvc-login/src/test/java/org/baeldung/security/FormLoginUnitTest.java @@ -0,0 +1,63 @@ +package org.baeldung.security; + +import org.baeldung.spring.SecSecurityConfig; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import javax.servlet.Filter; + +import static org.junit.Assert.assertTrue; +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.formLogin; +import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {SecSecurityConfig.class}) +@WebAppConfiguration +public class FormLoginUnitTest { + + @Autowired + private WebApplicationContext context; + + @Autowired + private Filter springSecurityFilterChain; + + private MockMvc mvc; + + @Before + public void setup() { + mvc = MockMvcBuilders + .webAppContextSetup(context) + .addFilters(springSecurityFilterChain) + .build(); + } + + @Test + public void givenValidRequestWithValidCredentials_shouldLoginSuccessfully() throws Exception { + mvc + .perform(formLogin("/perform_login").user("user1").password("user1Pass")) + .andExpect(status().isFound()) + .andExpect(authenticated().withUsername("user1")); + } + + @Test + public void givenValidRequestWithInvalidCredentials_shouldFailWith401() throws Exception { + MvcResult result = mvc + .perform(formLogin("/perform_login").user("random").password("random")).andReturn(); + /*.andExpect(status().isUnauthorized()) + .andDo(print()) + .andExpect(unauthenticated()) + .andReturn();*/ + + assertTrue(result.getResponse().getContentAsString().contains("Bad credentials")); + } +} From ec4deec034a94904c6fe0bc90b623e15391a4bbc Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Wed, 18 Jul 2018 20:16:22 +0200 Subject: [PATCH 024/298] added link --- spring-security-react/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-security-react/README.md b/spring-security-react/README.md index a86cd6e7c4..1a845f0daa 100644 --- a/spring-security-react/README.md +++ b/spring-security-react/README.md @@ -2,12 +2,14 @@ ## Spring Security React Example Project -###The Course +### The Course The "Learn Spring Security" Classes: http://github.learnspringsecurity.com ### Relevant Articles: +* [Spring Security Login Page with React](http://www.baeldung.com/spring-security-login-react) + ### Build the Project ``` From c9a9a9614d44dc244183fe40c63eacfe145f0783 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Thu, 19 Jul 2018 10:03:07 +0200 Subject: [PATCH 025/298] BAEL-1912 --- .../com/baeldung/random/RandomNumberTest.kt | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt new file mode 100644 index 0000000000..ac851c97d2 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt @@ -0,0 +1,45 @@ + +import org.junit.jupiter.api.Test +import java.util.concurrent.ThreadLocalRandom + +class RandomNumberTest { + + @Test + fun givenUsingJavaUtilMath_whenGeneratingRandomNumber_thenCorrect() { + val randomNumber = Math.random() + println(randomNumber) + } + + @Test + fun givenUsingThreadLocalRandom_whenGeneratingRandomNumber_thenCorrect() { + val randomDouble = ThreadLocalRandom.current().nextDouble() + val randomInteger = ThreadLocalRandom.current().nextInt() + val randomLong = ThreadLocalRandom.current().nextLong() + println(randomDouble) + println(randomInteger) + println(randomLong) + } + + @Test + fun givenUsingKotlinJsMath_whenGeneratingRandomNumber_thenCorrect() { + val randomDouble = Math.random() + println(randomDouble) + } + + @Test + fun givenUsingKotlinNumberRange_whenGeneratingRandomNumberInGivenRange_thenCorrect() { + val randomInteger = (1..12).shuffled().first() + println(randomInteger) + } + + @Test + fun givenUsingThreadLocalRandom_whenGeneratingRandomNumberInGivenRange_thenCorrect() { + val randomDouble = ThreadLocalRandom.current().nextDouble(1.0, 10.0) + val randomInteger = ThreadLocalRandom.current().nextInt(1, 10) + val randomLong = ThreadLocalRandom.current().nextLong(1, 10) + println(randomDouble) + println(randomInteger) + println(randomLong) + } + +} \ No newline at end of file From 1a7cb15c7156f10896abde94de2424d3ce338fbe Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Wed, 4 Jul 2018 12:32:22 +0200 Subject: [PATCH 026/298] A short example of real-time event streaming using Spring Webflux --- .../client/CpuUsageEventConsumer.java | 31 ++++++++++++++++++ .../controller/CpuUsageEventProducer.java | 24 ++++++++++++++ .../reactive/model/CpuUsageEvent.java | 17 ++++++++++ .../com/baeldung/reactive/utils/CpuUtils.java | 14 ++++++++ .../CpuUsageEventProducerIntegrationTest.java | 32 +++++++++++++++++++ .../baeldung/reactive/utils/CpuUtilsTest.java | 24 ++++++++++++++ 6 files changed, 142 insertions(+) create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java new file mode 100644 index 0000000000..3b9fbf7838 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java @@ -0,0 +1,31 @@ +package com.baeldung.reactive.client; + +import com.baeldung.reactive.model.CpuUsageEvent; +import org.springframework.boot.CommandLineRunner; +import org.springframework.context.annotation.Bean; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClient; + +/** + * @author Krzysztof Majewski + */ +@Component +public class CpuUsageEventConsumer { + + @Bean + WebClient client() { + return WebClient.create("http://localhost:8080"); + } + + @Bean + CommandLineRunner eventsConsumer(WebClient client) { + return args -> client.get() + .uri("/events/stream") + .accept(MediaType.TEXT_EVENT_STREAM) + .exchange() + .flatMapMany(cr -> cr.bodyToFlux(CpuUsageEvent.class)) + .subscribe(System.out::println); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java new file mode 100644 index 0000000000..5271debb84 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java @@ -0,0 +1,24 @@ +package com.baeldung.reactive.controller; + +import com.baeldung.reactive.model.CpuUsageEvent; +import com.baeldung.reactive.utils.CpuUtils; +import java.time.Duration; +import java.time.LocalDateTime; +import java.util.stream.Stream; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Flux; +import reactor.util.function.Tuple2; + +@RestController +public class CpuUsageEventProducer { + + @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE, value = "/events/stream") + Flux events() { + Flux eventFlux = Flux + .fromStream(Stream.generate(() -> new CpuUsageEvent(CpuUtils.getUsage(), LocalDateTime.now()))); + Flux durationFlux = Flux.interval(Duration.ofSeconds(5)); + return Flux.zip(eventFlux, durationFlux).map(Tuple2::getT1); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java new file mode 100644 index 0000000000..1ad41be65c --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java @@ -0,0 +1,17 @@ +package com.baeldung.reactive.model; + +import java.time.LocalDateTime; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.ToString; + +@Data +@ToString +@AllArgsConstructor +public class CpuUsageEvent { + + private Double cpuUsage; + + private LocalDateTime time; + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java new file mode 100644 index 0000000000..c70aad9d2e --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java @@ -0,0 +1,14 @@ +package com.baeldung.reactive.utils; + +import com.sun.management.OperatingSystemMXBean; +import java.lang.management.ManagementFactory; + +public class CpuUtils { + + private static OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); + + public static Double getUsage() { + return (operatingSystemMXBean.getSystemCpuLoad() / operatingSystemMXBean.getAvailableProcessors()) * 100; + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java new file mode 100644 index 0000000000..81897cd8d6 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java @@ -0,0 +1,32 @@ +package com.baeldung.reactive.controller; + +import com.baeldung.reactive.Spring5ReactiveApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class) +public class CpuUsageEventProducerIntegrationTest { + + @Autowired + private WebTestClient webTestClient; + + @Test + public void whenGetCpuUsageEvents_thenReturns200() { + webTestClient.get() + .uri("/events/stream") + .accept(MediaType.TEXT_EVENT_STREAM) + .exchange() + .expectStatus().isOk() + .expectHeader().contentType(MediaType.APPLICATION_JSON_UTF8) + .expectBody() + .jsonPath("$.cpuUsage").isNotEmpty() + .jsonPath("$.time").isNotEmpty(); + } + +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java new file mode 100644 index 0000000000..a36f9c8528 --- /dev/null +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java @@ -0,0 +1,24 @@ +package com.baeldung.reactive.utils; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; + +import com.baeldung.reactive.Spring5ReactiveApplication; +import org.hamcrest.Matchers; +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(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class) +public class CpuUtilsTest { + + @Test + public void whenGetUsage_returnCorrectValue() { + Double usage = CpuUtils.getUsage(); + assertNotNull(usage); + assertThat(usage, Matchers.lessThanOrEqualTo(100d)); + } + +} From 182a8837429708eada10f310c2ee23ee3c684f48 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Thu, 19 Jul 2018 10:03:07 +0200 Subject: [PATCH 027/298] BAEL-1912 --- .../com/baeldung/random/RandomNumberTest.kt | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt new file mode 100644 index 0000000000..ac851c97d2 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt @@ -0,0 +1,45 @@ + +import org.junit.jupiter.api.Test +import java.util.concurrent.ThreadLocalRandom + +class RandomNumberTest { + + @Test + fun givenUsingJavaUtilMath_whenGeneratingRandomNumber_thenCorrect() { + val randomNumber = Math.random() + println(randomNumber) + } + + @Test + fun givenUsingThreadLocalRandom_whenGeneratingRandomNumber_thenCorrect() { + val randomDouble = ThreadLocalRandom.current().nextDouble() + val randomInteger = ThreadLocalRandom.current().nextInt() + val randomLong = ThreadLocalRandom.current().nextLong() + println(randomDouble) + println(randomInteger) + println(randomLong) + } + + @Test + fun givenUsingKotlinJsMath_whenGeneratingRandomNumber_thenCorrect() { + val randomDouble = Math.random() + println(randomDouble) + } + + @Test + fun givenUsingKotlinNumberRange_whenGeneratingRandomNumberInGivenRange_thenCorrect() { + val randomInteger = (1..12).shuffled().first() + println(randomInteger) + } + + @Test + fun givenUsingThreadLocalRandom_whenGeneratingRandomNumberInGivenRange_thenCorrect() { + val randomDouble = ThreadLocalRandom.current().nextDouble(1.0, 10.0) + val randomInteger = ThreadLocalRandom.current().nextInt(1, 10) + val randomLong = ThreadLocalRandom.current().nextLong(1, 10) + println(randomDouble) + println(randomInteger) + println(randomLong) + } + +} \ No newline at end of file From 760ff1561b1fc2e6a98f662433e6c46e3c6efafd Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Thu, 19 Jul 2018 10:27:30 +0200 Subject: [PATCH 028/298] remove --- .../client/CpuUsageEventConsumer.java | 31 ------------------ .../controller/CpuUsageEventProducer.java | 24 -------------- .../reactive/model/CpuUsageEvent.java | 17 ---------- .../com/baeldung/reactive/utils/CpuUtils.java | 14 -------- .../CpuUsageEventProducerIntegrationTest.java | 32 ------------------- .../baeldung/reactive/utils/CpuUtilsTest.java | 24 -------------- 6 files changed, 142 deletions(-) delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java delete mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java delete mode 100644 spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java deleted file mode 100644 index 3b9fbf7838..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/client/CpuUsageEventConsumer.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.reactive.client; - -import com.baeldung.reactive.model.CpuUsageEvent; -import org.springframework.boot.CommandLineRunner; -import org.springframework.context.annotation.Bean; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.client.WebClient; - -/** - * @author Krzysztof Majewski - */ -@Component -public class CpuUsageEventConsumer { - - @Bean - WebClient client() { - return WebClient.create("http://localhost:8080"); - } - - @Bean - CommandLineRunner eventsConsumer(WebClient client) { - return args -> client.get() - .uri("/events/stream") - .accept(MediaType.TEXT_EVENT_STREAM) - .exchange() - .flatMapMany(cr -> cr.bodyToFlux(CpuUsageEvent.class)) - .subscribe(System.out::println); - } - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java deleted file mode 100644 index 5271debb84..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/controller/CpuUsageEventProducer.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.reactive.controller; - -import com.baeldung.reactive.model.CpuUsageEvent; -import com.baeldung.reactive.utils.CpuUtils; -import java.time.Duration; -import java.time.LocalDateTime; -import java.util.stream.Stream; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; -import reactor.core.publisher.Flux; -import reactor.util.function.Tuple2; - -@RestController -public class CpuUsageEventProducer { - - @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE, value = "/events/stream") - Flux events() { - Flux eventFlux = Flux - .fromStream(Stream.generate(() -> new CpuUsageEvent(CpuUtils.getUsage(), LocalDateTime.now()))); - Flux durationFlux = Flux.interval(Duration.ofSeconds(5)); - return Flux.zip(eventFlux, durationFlux).map(Tuple2::getT1); - } -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java deleted file mode 100644 index 1ad41be65c..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/model/CpuUsageEvent.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.reactive.model; - -import java.time.LocalDateTime; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.ToString; - -@Data -@ToString -@AllArgsConstructor -public class CpuUsageEvent { - - private Double cpuUsage; - - private LocalDateTime time; - -} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java deleted file mode 100644 index c70aad9d2e..0000000000 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/utils/CpuUtils.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.reactive.utils; - -import com.sun.management.OperatingSystemMXBean; -import java.lang.management.ManagementFactory; - -public class CpuUtils { - - private static OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); - - public static Double getUsage() { - return (operatingSystemMXBean.getSystemCpuLoad() / operatingSystemMXBean.getAvailableProcessors()) * 100; - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java deleted file mode 100644 index 81897cd8d6..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/controller/CpuUsageEventProducerIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.reactive.controller; - -import com.baeldung.reactive.Spring5ReactiveApplication; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.reactive.server.WebTestClient; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class) -public class CpuUsageEventProducerIntegrationTest { - - @Autowired - private WebTestClient webTestClient; - - @Test - public void whenGetCpuUsageEvents_thenReturns200() { - webTestClient.get() - .uri("/events/stream") - .accept(MediaType.TEXT_EVENT_STREAM) - .exchange() - .expectStatus().isOk() - .expectHeader().contentType(MediaType.APPLICATION_JSON_UTF8) - .expectBody() - .jsonPath("$.cpuUsage").isNotEmpty() - .jsonPath("$.time").isNotEmpty(); - } - -} diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java deleted file mode 100644 index a36f9c8528..0000000000 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/utils/CpuUtilsTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.reactive.utils; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; - -import com.baeldung.reactive.Spring5ReactiveApplication; -import org.hamcrest.Matchers; -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(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Spring5ReactiveApplication.class) -public class CpuUtilsTest { - - @Test - public void whenGetUsage_returnCorrectValue() { - Double usage = CpuUtils.getUsage(); - assertNotNull(usage); - assertThat(usage, Matchers.lessThanOrEqualTo(100d)); - } - -} From bc9558b5fc3095a1de2ed0946e39c2f2bcbaaafa Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 19 Jul 2018 21:09:18 +0300 Subject: [PATCH 029/298] change exc handling --- .../util/serealization/AvroDeSerealizer.java | 42 ++++++----- .../util/serealization/AvroSerealizer.java | 62 ++++++++-------- .../AvroSerealizerDeSerealizerTest.java | 70 ++++++++++--------- 3 files changed, 97 insertions(+), 77 deletions(-) diff --git a/apache-avro/src/main/java/com/baeldung/avro/util/serealization/AvroDeSerealizer.java b/apache-avro/src/main/java/com/baeldung/avro/util/serealization/AvroDeSerealizer.java index d2219a45f2..7d30c3d1ee 100644 --- a/apache-avro/src/main/java/com/baeldung/avro/util/serealization/AvroDeSerealizer.java +++ b/apache-avro/src/main/java/com/baeldung/avro/util/serealization/AvroDeSerealizer.java @@ -5,29 +5,37 @@ import org.apache.avro.io.DatumReader; import org.apache.avro.io.Decoder; import org.apache.avro.io.DecoderFactory; import org.apache.avro.specific.SpecificDatumReader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; public class AvroDeSerealizer { -public AvroHttpRequest deSerealizeAvroHttpRequestJSON(byte[] data){ - DatumReader reader = new SpecificDatumReader<>(AvroHttpRequest.class); - Decoder decoder = null; - try { - decoder = DecoderFactory.get().jsonDecoder(AvroHttpRequest.getClassSchema(), new String(data)); - return reader.read(null, decoder); - } catch (IOException e) { - return null; - } -} + private static Logger logger = LoggerFactory.getLogger(AvroDeSerealizer.class); -public AvroHttpRequest deSerealizeAvroHttpRequestBinary(byte[] data){ - DatumReader employeeReader = new SpecificDatumReader<>(AvroHttpRequest.class); - Decoder decoder = DecoderFactory.get().binaryDecoder(data, null); - try { - return employeeReader.read(null, decoder); - } catch (IOException e) { + public AvroHttpRequest deSerealizeAvroHttpRequestJSON(byte[] data) { + DatumReader reader = new SpecificDatumReader<>(AvroHttpRequest.class); + Decoder decoder = null; + try { + decoder = DecoderFactory.get() + .jsonDecoder(AvroHttpRequest.getClassSchema(), new String(data)); + return reader.read(null, decoder); + } catch (IOException e) { + logger.error("Deserialization error" + e.getMessage()); + } + return null; + } + + public AvroHttpRequest deSerealizeAvroHttpRequestBinary(byte[] data) { + DatumReader employeeReader = new SpecificDatumReader<>(AvroHttpRequest.class); + Decoder decoder = DecoderFactory.get() + .binaryDecoder(data, null); + try { + return employeeReader.read(null, decoder); + } catch (IOException e) { + logger.error("Deserialization error" + e.getMessage()); + } return null; } } -} diff --git a/apache-avro/src/main/java/com/baeldung/avro/util/serealization/AvroSerealizer.java b/apache-avro/src/main/java/com/baeldung/avro/util/serealization/AvroSerealizer.java index f56c89e201..767b688dea 100644 --- a/apache-avro/src/main/java/com/baeldung/avro/util/serealization/AvroSerealizer.java +++ b/apache-avro/src/main/java/com/baeldung/avro/util/serealization/AvroSerealizer.java @@ -3,42 +3,48 @@ package com.baeldung.avro.util.serealization; import com.baeldung.avro.util.model.AvroHttpRequest; import org.apache.avro.io.*; import org.apache.avro.specific.SpecificDatumWriter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.ByteArrayOutputStream; import java.io.IOException; public class AvroSerealizer { -public byte[] serealizeAvroHttpRequestJSON(AvroHttpRequest request){ - DatumWriter writer = new SpecificDatumWriter<>(AvroHttpRequest.class); - byte[] data = new byte[0]; - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - Encoder jsonEncoder = null; - try { - jsonEncoder = EncoderFactory.get().jsonEncoder(AvroHttpRequest.getClassSchema(), stream); - writer.write(request, jsonEncoder); - jsonEncoder.flush(); - data = stream.toByteArray(); - } catch (IOException e) { - data =null; - } - return data; -} + private static final Logger logger = LoggerFactory.getLogger(AvroSerealizer.class); -public byte[] serealizeAvroHttpRequestBinary(AvroHttpRequest request){ - DatumWriter writer = new SpecificDatumWriter<>(AvroHttpRequest.class); - byte[] data = new byte[0]; - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - Encoder jsonEncoder = EncoderFactory.get().binaryEncoder(stream,null); - try { - writer.write(request, jsonEncoder); - jsonEncoder.flush(); - data = stream.toByteArray(); - } catch (IOException e) { - data = null; + public byte[] serealizeAvroHttpRequestJSON(AvroHttpRequest request) { + DatumWriter writer = new SpecificDatumWriter<>(AvroHttpRequest.class); + byte[] data = new byte[0]; + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + Encoder jsonEncoder = null; + try { + jsonEncoder = EncoderFactory.get() + .jsonEncoder(AvroHttpRequest.getClassSchema(), stream); + writer.write(request, jsonEncoder); + jsonEncoder.flush(); + data = stream.toByteArray(); + } catch (IOException e) { + logger.error("Serialization error " + e.getMessage()); + } + return data; } - return data; -} + public byte[] serealizeAvroHttpRequestBinary(AvroHttpRequest request) { + DatumWriter writer = new SpecificDatumWriter<>(AvroHttpRequest.class); + byte[] data = new byte[0]; + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + Encoder jsonEncoder = EncoderFactory.get() + .binaryEncoder(stream, null); + try { + writer.write(request, jsonEncoder); + jsonEncoder.flush(); + data = stream.toByteArray(); + } catch (IOException e) { + logger.error("Serialization error " + e.getMessage()); + } + + return data; + } } 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/AvroSerealizerDeSerealizerTest.java index 937a4ae650..59eca1d924 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/AvroSerealizerDeSerealizerTest.java @@ -24,8 +24,10 @@ public class AvroSerealizerDeSerealizerTest { serealizer = new AvroSerealizer(); deSerealizer = new AvroDeSerealizer(); - ClientIdentifier clientIdentifier = ClientIdentifier.newBuilder(). - setHostName("localhost").setIpAddress("255.255.255.0").build(); + ClientIdentifier clientIdentifier = ClientIdentifier.newBuilder() + .setHostName("localhost") + .setIpAddress("255.255.255.0") + .build(); List employees = new ArrayList(); employees.add("James"); @@ -33,43 +35,47 @@ public class AvroSerealizerDeSerealizerTest { employees.add("David"); employees.add("Han"); - request = AvroHttpRequest.newBuilder().setRequestTime(01l) - .setActive(Active.YES).setClientIdentifier(clientIdentifier) - .setEmployeeNames(employees).build(); + request = AvroHttpRequest.newBuilder() + .setRequestTime(01l) + .setActive(Active.YES) + .setClientIdentifier(clientIdentifier) + .setEmployeeNames(employees) + .build(); } @After public void tearDown() throws Exception { } -@Test -public void WhenSerialized_UsingJSONEncoder_ObjectGetsSerialized(){ - byte[] data = serealizer.serealizeAvroHttpRequestJSON(request); - assertTrue(Objects.nonNull(data)); - assertTrue(data.length > 0); -} + @Test + public void WhenSerialized_UsingJSONEncoder_ObjectGetsSerialized() { + byte[] data = serealizer.serealizeAvroHttpRequestJSON(request); + assertTrue(Objects.nonNull(data)); + assertTrue(data.length > 0); + } -@Test -public void WhenSerialized_UsingBinaryEncoder_ObjectGetsSerialized(){ - byte[] data = serealizer.serealizeAvroHttpRequestBinary(request); - assertTrue(Objects.nonNull(data)); - assertTrue(data.length > 0); -} + @Test + public void WhenSerialized_UsingBinaryEncoder_ObjectGetsSerialized() { + byte[] data = serealizer.serealizeAvroHttpRequestBinary(request); + assertTrue(Objects.nonNull(data)); + assertTrue(data.length > 0); + } -@Test -public void WhenDeserialize_UsingJSONDecoder_ActualAndExpectedObjectsAreEqual(){ - byte[] data = serealizer.serealizeAvroHttpRequestJSON(request); - AvroHttpRequest actualRequest = deSerealizer.deSerealizeAvroHttpRequestJSON(data); - assertEquals(actualRequest,request); - assertTrue(actualRequest.getRequestTime().equals(request.getRequestTime())); -} + @Test + public void WhenDeserialize_UsingJSONDecoder_ActualAndExpectedObjectsAreEqual() { + byte[] data = serealizer.serealizeAvroHttpRequestJSON(request); + AvroHttpRequest actualRequest = deSerealizer.deSerealizeAvroHttpRequestJSON(data); + assertEquals(actualRequest, request); + assertTrue(actualRequest.getRequestTime() + .equals(request.getRequestTime())); + } -@Test -public void WhenDeserialize_UsingBinaryecoder_ActualAndExpectedObjectsAreEqual(){ - byte[] data = serealizer.serealizeAvroHttpRequestBinary(request); - AvroHttpRequest actualRequest = deSerealizer.deSerealizeAvroHttpRequestBinary(data); - assertEquals(actualRequest,request); - assertTrue(actualRequest.getRequestTime().equals(request.getRequestTime())); + @Test + public void WhenDeserialize_UsingBinaryecoder_ActualAndExpectedObjectsAreEqual() { + byte[] data = serealizer.serealizeAvroHttpRequestBinary(request); + AvroHttpRequest actualRequest = deSerealizer.deSerealizeAvroHttpRequestBinary(data); + assertEquals(actualRequest, request); + assertTrue(actualRequest.getRequestTime() + .equals(request.getRequestTime())); + } } -} - From f33f81d2129283afdec91f80dfaf0898ef5e2f2f Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 20 Jul 2018 23:03:25 +0300 Subject: [PATCH 030/298] Update AvroSerealizerDeSerealizerTest.java --- .../avro/util/serealization/AvroSerealizerDeSerealizerTest.java | 1 + 1 file changed, 1 insertion(+) 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/AvroSerealizerDeSerealizerTest.java index 59eca1d924..8ac4ec00fb 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/AvroSerealizerDeSerealizerTest.java @@ -79,3 +79,4 @@ public class AvroSerealizerDeSerealizerTest { .equals(request.getRequestTime())); } } + From 40dde25b799f03be6135c640b2e16661d5b11c59 Mon Sep 17 00:00:00 2001 From: Philippe Date: Fri, 20 Jul 2018 18:37:02 -0300 Subject: [PATCH 031/298] BAEL-1992 --- mqtt/pom.xml | 23 ++++ .../mqtt/EngineTemperatureSensor.java | 49 ++++++++ .../mqtt/EngineTemperatureSensorLiveTest.java | 108 ++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 mqtt/pom.xml create mode 100644 mqtt/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java create mode 100644 mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java diff --git a/mqtt/pom.xml b/mqtt/pom.xml new file mode 100644 index 0000000000..346433aa69 --- /dev/null +++ b/mqtt/pom.xml @@ -0,0 +1,23 @@ + + 4.0.0 + org.baeldung + mqtt + 0.0.1-SNAPSHOT + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + 1.2.0 + + + + + diff --git a/mqtt/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java b/mqtt/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java new file mode 100644 index 0000000000..98111edb94 --- /dev/null +++ b/mqtt/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java @@ -0,0 +1,49 @@ +package com.baeldung.mqtt; + +import java.util.Random; +import java.util.concurrent.Callable; + +import org.eclipse.paho.client.mqttv3.IMqttClient; +import org.eclipse.paho.client.mqttv3.MqttMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class EngineTemperatureSensor implements Callable { + + private static final Logger log = LoggerFactory.getLogger(EngineTemperatureSensor.class); + public static final String TOPIC = "engine/temperature"; + + private IMqttClient client; + private Random rnd = new Random(); + + public EngineTemperatureSensor(IMqttClient client) { + this.client = client; + } + + @Override + public Void call() throws Exception { + + if ( !client.isConnected()) { + log.info("[I31] Client not connected."); + return null; + } + + MqttMessage msg = readEngineTemp(); + msg.setQos(0); + msg.setRetained(true); + client.publish(TOPIC,msg); + + return null; + } + + /** + * This method simulates reading the engine temperature + * @return + */ + private MqttMessage readEngineTemp() { + double temp = 80 + rnd.nextDouble() * 20.0; + byte[] payload = String.format("T:%04.2f",temp).getBytes(); + MqttMessage msg = new MqttMessage(payload); + return msg; + } +} \ No newline at end of file diff --git a/mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java b/mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java new file mode 100644 index 0000000000..94031b5415 --- /dev/null +++ b/mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java @@ -0,0 +1,108 @@ +package com.baeldung.mqtt; + + + +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import org.eclipse.paho.client.mqttv3.MqttClient; +import org.eclipse.paho.client.mqttv3.MqttConnectOptions; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class EngineTemperatureSensorLiveTest { + + private static Logger log = LoggerFactory.getLogger(EngineTemperatureSensorLiveTest.class); + + @Test + public void whenSendSingleMessage_thenSuccess() throws Exception { + + String senderId = UUID.randomUUID().toString(); + MqttClient sender = new MqttClient("tcp://iot.eclipse.org:1883",senderId); + + String receiverId = UUID.randomUUID().toString(); + MqttClient receiver = new MqttClient("tcp://iot.eclipse.org:1883",receiverId); + + + MqttConnectOptions options = new MqttConnectOptions(); + options.setAutomaticReconnect(true); + options.setCleanSession(true); + options.setConnectionTimeout(10); + + + receiver.connect(options); + sender.connect(options); + + CountDownLatch receivedSignal = new CountDownLatch(1); + + receiver.subscribe(EngineTemperatureSensor.TOPIC, (topic, msg) -> { + log.info("[I41] Message received: topic={}, payload={}", topic, new String(msg.getPayload())); + receivedSignal.countDown(); + }); + + + Callable target = new EngineTemperatureSensor(sender); + target.call(); + + receivedSignal.await(1, TimeUnit.MINUTES); + + log.info("[I51] Success !"); + } + + @Test + public void whenSendMultipleMessages_thenSuccess() throws Exception { + + String senderId = UUID.randomUUID().toString(); + MqttClient sender = new MqttClient("tcp://iot.eclipse.org:1883",senderId); + + String receiverId = UUID.randomUUID().toString(); + MqttClient receiver = new MqttClient("tcp://iot.eclipse.org:1883",receiverId); + + + MqttConnectOptions options = new MqttConnectOptions(); + options.setAutomaticReconnect(true); + options.setCleanSession(true); + options.setConnectionTimeout(10); + + + sender.connect(options); + receiver.connect(options); + + CountDownLatch receivedSignal = new CountDownLatch(10); + + receiver.subscribe(EngineTemperatureSensor.TOPIC, (topic, msg) -> { + log.info("[I41] Message received: topic={}, payload={}", topic, new String(msg.getPayload())); + receivedSignal.countDown(); + }); + + + Callable target = new EngineTemperatureSensor(sender); + + ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); + executor.scheduleAtFixedRate(() -> { + try { + target.call(); + } + catch(Exception ex) { + throw new RuntimeException(ex); + } + }, 1, 1, TimeUnit.SECONDS); + + + receivedSignal.await(1, TimeUnit.DAYS); + executor.shutdown(); + + assertTrue(receivedSignal.getCount() == 0 , "Countdown should be zero"); + + log.info("[I51] Success !"); + } + + +} From db40325e83dc7f38077c941bde757c5a8e653b8f Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 21 Jul 2018 16:47:46 +0300 Subject: [PATCH 032/298] Update AvroSerealizerDeSerealizerTest.java --- .../serealization/AvroSerealizerDeSerealizerTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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/AvroSerealizerDeSerealizerTest.java index 8ac4ec00fb..a1c2e88f57 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/AvroSerealizerDeSerealizerTest.java @@ -48,21 +48,21 @@ public class AvroSerealizerDeSerealizerTest { } @Test - public void WhenSerialized_UsingJSONEncoder_ObjectGetsSerialized() { + public void WhenSerializedUsingJSONEncoder_thenObjectGetsSerialized() { byte[] data = serealizer.serealizeAvroHttpRequestJSON(request); assertTrue(Objects.nonNull(data)); assertTrue(data.length > 0); } @Test - public void WhenSerialized_UsingBinaryEncoder_ObjectGetsSerialized() { + public void WhenSerializedUsingBinaryEncoder_thenObjectGetsSerialized() { byte[] data = serealizer.serealizeAvroHttpRequestBinary(request); assertTrue(Objects.nonNull(data)); assertTrue(data.length > 0); } @Test - public void WhenDeserialize_UsingJSONDecoder_ActualAndExpectedObjectsAreEqual() { + public void WhenDeserializeUsingJSONDecoder_thenActualAndExpectedObjectsAreEqual() { byte[] data = serealizer.serealizeAvroHttpRequestJSON(request); AvroHttpRequest actualRequest = deSerealizer.deSerealizeAvroHttpRequestJSON(data); assertEquals(actualRequest, request); @@ -71,7 +71,7 @@ public class AvroSerealizerDeSerealizerTest { } @Test - public void WhenDeserialize_UsingBinaryecoder_ActualAndExpectedObjectsAreEqual() { + public void WhenDeserializeUsingBinaryecoder_thenActualAndExpectedObjectsAreEqual() { byte[] data = serealizer.serealizeAvroHttpRequestBinary(request); AvroHttpRequest actualRequest = deSerealizer.deSerealizeAvroHttpRequestBinary(data); assertEquals(actualRequest, request); From 9b05faa15f333e1022fb276fb888fb8ba7d5c2b2 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Mon, 23 Jul 2018 07:54:10 +0200 Subject: [PATCH 033/298] BAEL-1912 fix --- .../com/baeldung/random/RandomNumberTest.kt | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt index ac851c97d2..2956a35f8a 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/random/RandomNumberTest.kt @@ -1,45 +1,55 @@ import org.junit.jupiter.api.Test import java.util.concurrent.ThreadLocalRandom +import kotlin.test.assertTrue class RandomNumberTest { @Test - fun givenUsingJavaUtilMath_whenGeneratingRandomNumber_thenCorrect() { + fun whenRandomNumberWithJavaUtilMath_thenResultIsBetween0And1() { val randomNumber = Math.random() - println(randomNumber) + assertTrue { randomNumber >=0 } + assertTrue { randomNumber <= 1 } } @Test - fun givenUsingThreadLocalRandom_whenGeneratingRandomNumber_thenCorrect() { + fun whenRandomNumberWithJavaThreadLocalRandom_thenResultsInDefaultRanges() { val randomDouble = ThreadLocalRandom.current().nextDouble() val randomInteger = ThreadLocalRandom.current().nextInt() val randomLong = ThreadLocalRandom.current().nextLong() - println(randomDouble) - println(randomInteger) - println(randomLong) + assertTrue { randomDouble >= 0 } + assertTrue { randomDouble <= 1 } + assertTrue { randomInteger >= Integer.MIN_VALUE } + assertTrue { randomInteger <= Integer.MAX_VALUE } + assertTrue { randomLong >= Long.MIN_VALUE } + assertTrue { randomLong <= Long.MAX_VALUE } } @Test - fun givenUsingKotlinJsMath_whenGeneratingRandomNumber_thenCorrect() { + fun whenRandomNumberWithKotlinJSMath_thenResultIsBetween0And1() { val randomDouble = Math.random() - println(randomDouble) + assertTrue { randomDouble >=0 } + assertTrue { randomDouble <= 1 } } @Test - fun givenUsingKotlinNumberRange_whenGeneratingRandomNumberInGivenRange_thenCorrect() { + fun whenRandomNumberWithKotlinNumberRange_thenResultInGivenRange() { val randomInteger = (1..12).shuffled().first() - println(randomInteger) + assertTrue { randomInteger >= 1 } + assertTrue { randomInteger <= 12 } } @Test - fun givenUsingThreadLocalRandom_whenGeneratingRandomNumberInGivenRange_thenCorrect() { + fun whenRandomNumberWithJavaThreadLocalRandom_thenResultsInGivenRanges() { val randomDouble = ThreadLocalRandom.current().nextDouble(1.0, 10.0) val randomInteger = ThreadLocalRandom.current().nextInt(1, 10) val randomLong = ThreadLocalRandom.current().nextLong(1, 10) - println(randomDouble) - println(randomInteger) - println(randomLong) + assertTrue { randomDouble >= 1 } + assertTrue { randomDouble <= 10 } + assertTrue { randomInteger >= 1 } + assertTrue { randomInteger <= 10 } + assertTrue { randomLong >= 1 } + assertTrue { randomLong <= 10 } } } \ No newline at end of file From dacf049162a8d898849697811db3d781d2c76e24 Mon Sep 17 00:00:00 2001 From: Ganesh Pagade Date: Mon, 23 Jul 2018 23:38:46 +0530 Subject: [PATCH 034/298] vaadin spring --- vaadin-spring/pom.xml | 63 ++++++++++ .../main/java/com/baeldung/Application.java | 29 +++++ .../src/main/java/com/baeldung/Employee.java | 51 ++++++++ .../java/com/baeldung/EmployeeEditor.java | 117 ++++++++++++++++++ .../java/com/baeldung/EmployeeRepository.java | 10 ++ .../src/main/java/com/baeldung/MainView.java | 78 ++++++++++++ 6 files changed, 348 insertions(+) create mode 100644 vaadin-spring/pom.xml create mode 100644 vaadin-spring/src/main/java/com/baeldung/Application.java create mode 100644 vaadin-spring/src/main/java/com/baeldung/Employee.java create mode 100644 vaadin-spring/src/main/java/com/baeldung/EmployeeEditor.java create mode 100644 vaadin-spring/src/main/java/com/baeldung/EmployeeRepository.java create mode 100644 vaadin-spring/src/main/java/com/baeldung/MainView.java diff --git a/vaadin-spring/pom.xml b/vaadin-spring/pom.xml new file mode 100644 index 0000000000..3f411cc7a1 --- /dev/null +++ b/vaadin-spring/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + com.baeldung + vaadin-spring + 0.1.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.vaadin + vaadin-spring-boot-starter + + + com.h2database + h2 + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + com.vaadin + vaadin-bom + 10.0.1 + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/vaadin-spring/src/main/java/com/baeldung/Application.java b/vaadin-spring/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..1d3084723a --- /dev/null +++ b/vaadin-spring/src/main/java/com/baeldung/Application.java @@ -0,0 +1,29 @@ +package com.baeldung; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class Application { + + private static final Logger log = LoggerFactory.getLogger(Application.class); + + public static void main(String[] args) { + SpringApplication.run(Application.class); + } + + @Bean + public CommandLineRunner loadData(EmployeeRepository repository) { + return (args) -> { + repository.save(new Employee("Bill", "Gates")); + repository.save(new Employee("Mark", "Zuckerberg")); + repository.save(new Employee("Sundar", "Pichai")); + repository.save(new Employee("Jeff", "Bezos")); + }; + } +} diff --git a/vaadin-spring/src/main/java/com/baeldung/Employee.java b/vaadin-spring/src/main/java/com/baeldung/Employee.java new file mode 100644 index 0000000000..726f0838b6 --- /dev/null +++ b/vaadin-spring/src/main/java/com/baeldung/Employee.java @@ -0,0 +1,51 @@ +package com.baeldung; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class Employee { + + @Id + @GeneratedValue + private Long id; + + private String firstName; + + private String lastName; + + protected Employee() { + } + + public Employee(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public Long getId() { + return id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + @Override + public String toString() { + return String.format("Employee[id=%d, firstName='%s', lastName='%s']", id, firstName, lastName); + } + +} diff --git a/vaadin-spring/src/main/java/com/baeldung/EmployeeEditor.java b/vaadin-spring/src/main/java/com/baeldung/EmployeeEditor.java new file mode 100644 index 0000000000..c10c88978b --- /dev/null +++ b/vaadin-spring/src/main/java/com/baeldung/EmployeeEditor.java @@ -0,0 +1,117 @@ +package com.baeldung; + +import com.vaadin.flow.component.Key; +import com.vaadin.flow.component.KeyNotifier; +import com.vaadin.flow.component.button.Button; +import com.vaadin.flow.component.icon.VaadinIcon; +import com.vaadin.flow.component.orderedlayout.HorizontalLayout; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.component.textfield.TextField; +import com.vaadin.flow.data.binder.Binder; +import com.vaadin.flow.spring.annotation.SpringComponent; +import com.vaadin.flow.spring.annotation.UIScope; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * A simple example to introduce building forms. As your real application is probably much + * more complicated than this example, you could re-use this form in multiple places. This + * example component is only used in MainView. + *

+ * In a real world application you'll most likely using a common super class for all your + * forms - less code, better UX. + */ +@SpringComponent +@UIScope +public class EmployeeEditor extends VerticalLayout implements KeyNotifier { + + private final EmployeeRepository repository; + + /** + * The currently edited employee + */ + private Employee employee; + + /* Fields to edit properties in Employee entity */ + TextField firstName = new TextField("First name"); + TextField lastName = new TextField("Last name"); + + /* Action buttons */ + // TODO why more code? + Button save = new Button("Save", VaadinIcon.CHECK.create()); + Button cancel = new Button("Cancel"); + Button delete = new Button("Delete", VaadinIcon.TRASH.create()); + HorizontalLayout actions = new HorizontalLayout(save, cancel, delete); + + Binder binder = new Binder<>(Employee.class); + private ChangeHandler changeHandler; + + @Autowired + public EmployeeEditor(EmployeeRepository repository) { + this.repository = repository; + + add(firstName, lastName, actions); + + // bind using naming convention + binder.bindInstanceFields(this); + + // Configure and style components + setSpacing(true); + + save.getElement().getThemeList().add("primary"); + delete.getElement().getThemeList().add("error"); + + addKeyPressListener(Key.ENTER, e -> save()); + + // wire action buttons to save, delete and reset + save.addClickListener(e -> save()); + delete.addClickListener(e -> delete()); + cancel.addClickListener(e -> editEmployee(employee)); + setVisible(false); + } + + void delete() { + repository.delete(employee); + changeHandler.onChange(); + } + + void save() { + repository.save(employee); + changeHandler.onChange(); + } + + public interface ChangeHandler { + void onChange(); + } + + public final void editEmployee(Employee c) { + if (c == null) { + setVisible(false); + return; + } + final boolean persisted = c.getId() != null; + if (persisted) { + // Find fresh entity for editing + employee = repository.findById(c.getId()).get(); + } else { + employee = c; + } + cancel.setVisible(persisted); + + // Bind employee properties to similarly named fields + // Could also use annotation or "manual binding" or programmatically + // moving values from fields to entities before saving + binder.setBean(employee); + + setVisible(true); + + // Focus first name initially + firstName.focus(); + } + + public void setChangeHandler(ChangeHandler h) { + // ChangeHandler is notified when either save or delete + // is clicked + changeHandler = h; + } + +} diff --git a/vaadin-spring/src/main/java/com/baeldung/EmployeeRepository.java b/vaadin-spring/src/main/java/com/baeldung/EmployeeRepository.java new file mode 100644 index 0000000000..66b5f329d7 --- /dev/null +++ b/vaadin-spring/src/main/java/com/baeldung/EmployeeRepository.java @@ -0,0 +1,10 @@ +package com.baeldung; + +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface EmployeeRepository extends JpaRepository { + + List findByLastNameStartsWithIgnoreCase(String lastName); +} diff --git a/vaadin-spring/src/main/java/com/baeldung/MainView.java b/vaadin-spring/src/main/java/com/baeldung/MainView.java new file mode 100644 index 0000000000..0233f52781 --- /dev/null +++ b/vaadin-spring/src/main/java/com/baeldung/MainView.java @@ -0,0 +1,78 @@ +package com.baeldung; + +import com.vaadin.flow.component.button.Button; +import com.vaadin.flow.component.grid.Grid; +import com.vaadin.flow.component.icon.VaadinIcon; +import com.vaadin.flow.component.orderedlayout.HorizontalLayout; +import com.vaadin.flow.component.orderedlayout.VerticalLayout; +import com.vaadin.flow.component.textfield.TextField; +import com.vaadin.flow.data.value.ValueChangeMode; +import com.vaadin.flow.router.Route; +import com.vaadin.flow.spring.annotation.UIScope; +import org.springframework.util.StringUtils; + +@Route +public class MainView extends VerticalLayout { + + private final EmployeeRepository employeeRepository; + + private final EmployeeEditor editor; + + final Grid grid; + + final TextField filter; + + private final Button addNewBtn; + + public MainView(EmployeeRepository repo, EmployeeEditor editor) { + this.employeeRepository = repo; + this.editor = editor; + this.grid = new Grid<>(Employee.class); + this.filter = new TextField(); + this.addNewBtn = new Button("New employee", VaadinIcon.PLUS.create()); + + // build layout + HorizontalLayout actions = new HorizontalLayout(filter, addNewBtn); + add(actions, grid, editor); + + grid.setHeight("200px"); + grid.setColumns("id", "firstName", "lastName"); + grid.getColumnByKey("id").setWidth("50px").setFlexGrow(0); + + filter.setPlaceholder("Filter by last name"); + + // Hook logic to components + + // Replace listing with filtered content when user changes filter + filter.setValueChangeMode(ValueChangeMode.EAGER); + filter.addValueChangeListener(e -> listEmployees(e.getValue())); + + // Connect selected Employee to editor or hide if none is selected + grid.asSingleSelect().addValueChangeListener(e -> { + editor.editEmployee(e.getValue()); + }); + + // Instantiate and edit new Employee the new button is clicked + addNewBtn.addClickListener(e -> editor.editEmployee(new Employee("", ""))); + + // Listen changes made by the editor, refresh data from backend + editor.setChangeHandler(() -> { + editor.setVisible(false); + listEmployees(filter.getValue()); + }); + + // Initialize listing + listEmployees(null); + } + + // tag::listEmployees[] + void listEmployees(String filterText) { + if (StringUtils.isEmpty(filterText)) { + grid.setItems(employeeRepository.findAll()); + } else { + grid.setItems(employeeRepository.findByLastNameStartsWithIgnoreCase(filterText)); + } + } + // end::listEmployees[] + +} From 35c92fae5f0519b1f077bca8cbf7dc11004c8b4f Mon Sep 17 00:00:00 2001 From: Ganesh Pagade Date: Mon, 23 Jul 2018 23:43:11 +0530 Subject: [PATCH 035/298] format --- .../java/com/baeldung/EmployeeEditor.java | 29 +------------------ .../java/com/baeldung/EmployeeRepository.java | 4 +-- .../src/main/java/com/baeldung/MainView.java | 15 ++-------- 3 files changed, 5 insertions(+), 43 deletions(-) diff --git a/vaadin-spring/src/main/java/com/baeldung/EmployeeEditor.java b/vaadin-spring/src/main/java/com/baeldung/EmployeeEditor.java index c10c88978b..ee312786d1 100644 --- a/vaadin-spring/src/main/java/com/baeldung/EmployeeEditor.java +++ b/vaadin-spring/src/main/java/com/baeldung/EmployeeEditor.java @@ -12,31 +12,17 @@ import com.vaadin.flow.spring.annotation.SpringComponent; import com.vaadin.flow.spring.annotation.UIScope; import org.springframework.beans.factory.annotation.Autowired; -/** - * A simple example to introduce building forms. As your real application is probably much - * more complicated than this example, you could re-use this form in multiple places. This - * example component is only used in MainView. - *

- * In a real world application you'll most likely using a common super class for all your - * forms - less code, better UX. - */ @SpringComponent @UIScope public class EmployeeEditor extends VerticalLayout implements KeyNotifier { private final EmployeeRepository repository; - /** - * The currently edited employee - */ private Employee employee; - /* Fields to edit properties in Employee entity */ TextField firstName = new TextField("First name"); TextField lastName = new TextField("Last name"); - /* Action buttons */ - // TODO why more code? Button save = new Button("Save", VaadinIcon.CHECK.create()); Button cancel = new Button("Cancel"); Button delete = new Button("Delete", VaadinIcon.TRASH.create()); @@ -51,10 +37,8 @@ public class EmployeeEditor extends VerticalLayout implements KeyNotifier { add(firstName, lastName, actions); - // bind using naming convention binder.bindInstanceFields(this); - // Configure and style components setSpacing(true); save.getElement().getThemeList().add("primary"); @@ -62,7 +46,6 @@ public class EmployeeEditor extends VerticalLayout implements KeyNotifier { addKeyPressListener(Key.ENTER, e -> save()); - // wire action buttons to save, delete and reset save.addClickListener(e -> save()); delete.addClickListener(e -> delete()); cancel.addClickListener(e -> editEmployee(employee)); @@ -90,28 +73,18 @@ public class EmployeeEditor extends VerticalLayout implements KeyNotifier { } final boolean persisted = c.getId() != null; if (persisted) { - // Find fresh entity for editing employee = repository.findById(c.getId()).get(); } else { employee = c; } + cancel.setVisible(persisted); - - // Bind employee properties to similarly named fields - // Could also use annotation or "manual binding" or programmatically - // moving values from fields to entities before saving binder.setBean(employee); - setVisible(true); - - // Focus first name initially firstName.focus(); } public void setChangeHandler(ChangeHandler h) { - // ChangeHandler is notified when either save or delete - // is clicked changeHandler = h; } - } diff --git a/vaadin-spring/src/main/java/com/baeldung/EmployeeRepository.java b/vaadin-spring/src/main/java/com/baeldung/EmployeeRepository.java index 66b5f329d7..044160da78 100644 --- a/vaadin-spring/src/main/java/com/baeldung/EmployeeRepository.java +++ b/vaadin-spring/src/main/java/com/baeldung/EmployeeRepository.java @@ -1,9 +1,9 @@ package com.baeldung; -import org.springframework.data.jpa.repository.JpaRepository; - import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; + public interface EmployeeRepository extends JpaRepository { List findByLastNameStartsWithIgnoreCase(String lastName); diff --git a/vaadin-spring/src/main/java/com/baeldung/MainView.java b/vaadin-spring/src/main/java/com/baeldung/MainView.java index 0233f52781..6d4c0aaa88 100644 --- a/vaadin-spring/src/main/java/com/baeldung/MainView.java +++ b/vaadin-spring/src/main/java/com/baeldung/MainView.java @@ -1,5 +1,7 @@ package com.baeldung; +import org.springframework.util.StringUtils; + import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.grid.Grid; import com.vaadin.flow.component.icon.VaadinIcon; @@ -8,8 +10,6 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.data.value.ValueChangeMode; import com.vaadin.flow.router.Route; -import com.vaadin.flow.spring.annotation.UIScope; -import org.springframework.util.StringUtils; @Route public class MainView extends VerticalLayout { @@ -31,7 +31,6 @@ public class MainView extends VerticalLayout { this.filter = new TextField(); this.addNewBtn = new Button("New employee", VaadinIcon.PLUS.create()); - // build layout HorizontalLayout actions = new HorizontalLayout(filter, addNewBtn); add(actions, grid, editor); @@ -41,31 +40,23 @@ public class MainView extends VerticalLayout { filter.setPlaceholder("Filter by last name"); - // Hook logic to components - - // Replace listing with filtered content when user changes filter filter.setValueChangeMode(ValueChangeMode.EAGER); filter.addValueChangeListener(e -> listEmployees(e.getValue())); - // Connect selected Employee to editor or hide if none is selected grid.asSingleSelect().addValueChangeListener(e -> { editor.editEmployee(e.getValue()); }); - // Instantiate and edit new Employee the new button is clicked addNewBtn.addClickListener(e -> editor.editEmployee(new Employee("", ""))); - // Listen changes made by the editor, refresh data from backend editor.setChangeHandler(() -> { editor.setVisible(false); listEmployees(filter.getValue()); }); - // Initialize listing listEmployees(null); } - // tag::listEmployees[] void listEmployees(String filterText) { if (StringUtils.isEmpty(filterText)) { grid.setItems(employeeRepository.findAll()); @@ -73,6 +64,4 @@ public class MainView extends VerticalLayout { grid.setItems(employeeRepository.findByLastNameStartsWithIgnoreCase(filterText)); } } - // end::listEmployees[] - } From 380dce8e6e629c7546222cd07ede44099c58608e Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Jul 2018 00:21:47 +0530 Subject: [PATCH 036/298] Changes as per suggestion to BAEL-1960 --- .../logging/log4j2/appender/MapAppender.java | 26 ++++++++----------- .../log4j2/src/test/resources/log4j2.xml | 5 +--- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java b/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java index 160ba58395..e9c025f480 100644 --- a/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java +++ b/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java @@ -3,46 +3,42 @@ */ package com.baeldung.logging.log4j2.appender; -import java.io.Serializable; import java.time.Instant; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Core; import org.apache.logging.log4j.core.Filter; -import org.apache.logging.log4j.core.Layout; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.appender.AbstractAppender; import org.apache.logging.log4j.core.config.plugins.Plugin; import org.apache.logging.log4j.core.config.plugins.PluginAttribute; import org.apache.logging.log4j.core.config.plugins.PluginElement; import org.apache.logging.log4j.core.config.plugins.PluginFactory; -import org.apache.logging.log4j.core.layout.PatternLayout; -@Plugin(name = "MapAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject = true) +@Plugin(name = "MapAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject = false) public class MapAppender extends AbstractAppender { private ConcurrentMap eventMap = new ConcurrentHashMap<>(); - protected MapAppender(String name, Filter filter, Layout layout) { - super(name, filter, layout); + protected MapAppender(String name, Filter filter) { + super(name, filter, null); } @PluginFactory - public static MapAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Layout") Layout layout, @PluginElement("Filter") final Filter filter) { - if (name == null) { - LOGGER.error("No name provided for MapAppender"); - return null; - } - if (layout == null) { - layout = PatternLayout.createDefaultLayout(); - } - return new MapAppender(name, filter, layout); + public static MapAppender createAppender(@PluginAttribute("name") String name, @PluginElement("Filter") final Filter filter) { + return new MapAppender(name, filter); } @Override public void append(LogEvent event) { + if (event.getLevel() + .isLessSpecificThan(Level.WARN)) { + error("Unable to log less than WARN level."); + return; + } eventMap.put(Instant.now() .toString(), event); } diff --git a/logging-modules/log4j2/src/test/resources/log4j2.xml b/logging-modules/log4j2/src/test/resources/log4j2.xml index d0fd0d088f..eefa00e1ba 100644 --- a/logging-modules/log4j2/src/test/resources/log4j2.xml +++ b/logging-modules/log4j2/src/test/resources/log4j2.xml @@ -51,10 +51,7 @@ - - - + Date: Wed, 25 Jul 2018 23:24:03 +0530 Subject: [PATCH 037/298] Changes as [er review for BAEL-1960 --- logging-modules/log4j2/pom.xml | 216 +++++++++--------- .../logging/log4j2/appender/MapAppender.java | 2 +- 2 files changed, 108 insertions(+), 110 deletions(-) diff --git a/logging-modules/log4j2/pom.xml b/logging-modules/log4j2/pom.xml index b577931f0f..9d8a523462 100644 --- a/logging-modules/log4j2/pom.xml +++ b/logging-modules/log4j2/pom.xml @@ -1,25 +1,24 @@ - - 4.0.0 - log4j2 + + 4.0.0 + log4j2 - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../../ - - - - - - org.apache.logging.log4j - log4j-core - ${log4j-core.version} - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + + + + + org.apache.logging.log4j + log4j-core + ${log4j-core.version} + + org.apache.logging.log4j @@ -27,100 +26,99 @@ ${log4j-core.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - + + + com.h2database + h2 + ${h2.version} + + + org.apache.commons + commons-dbcp2 + ${commons-dbcp2.version} + - - - com.h2database - h2 - ${h2.version} - - - org.apache.commons - commons-dbcp2 - ${commons-dbcp2.version} - + + + org.apache.logging.log4j + log4j-core + ${log4j-core.version} + test-jar + test + + - - - org.apache.logging.log4j - log4j-core - ${log4j-core.version} - test-jar - test - - + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + none + + + + - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - none - - - - + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + **/*LiveTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + json + ${java.io.tmpdir}/${maven.build.timestamp}/logfile.json + + + + + + + - - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - **/*LiveTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - - - - - - - json - ${java.io.tmpdir}/${maven.build.timestamp}/logfile.json - - - - - - - + + 2.9.5 + 1.4.193 + 2.1.1 + 2.11.0 + yyyyMMddHHmmss + - - 2.9.5 - 1.4.193 - 2.1.1 - 2.11.0 - yyyyMMddHHmmss - - - + \ No newline at end of file diff --git a/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java b/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java index e9c025f480..2015b6d573 100644 --- a/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java +++ b/logging-modules/log4j2/src/main/java/com/baeldung/logging/log4j2/appender/MapAppender.java @@ -18,7 +18,7 @@ import org.apache.logging.log4j.core.config.plugins.PluginAttribute; import org.apache.logging.log4j.core.config.plugins.PluginElement; import org.apache.logging.log4j.core.config.plugins.PluginFactory; -@Plugin(name = "MapAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject = false) +@Plugin(name = "MapAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE) public class MapAppender extends AbstractAppender { private ConcurrentMap eventMap = new ConcurrentHashMap<>(); From 73bd03a331ac2e6f2e6b1e7e9263fe81b275ca6a Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Jul 2018 23:27:14 +0530 Subject: [PATCH 038/298] Changes for formatting as per suggestion. --- logging-modules/log4j2/pom.xml | 213 +++++++++++++++++---------------- 1 file changed, 107 insertions(+), 106 deletions(-) diff --git a/logging-modules/log4j2/pom.xml b/logging-modules/log4j2/pom.xml index 9d8a523462..f6b3fea227 100644 --- a/logging-modules/log4j2/pom.xml +++ b/logging-modules/log4j2/pom.xml @@ -1,24 +1,25 @@ - - 4.0.0 - log4j2 + + 4.0.0 + log4j2 - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../../ - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + + + + + + org.apache.logging.log4j + log4j-core + ${log4j-core.version} + - - - - org.apache.logging.log4j - log4j-core - ${log4j-core.version} - - org.apache.logging.log4j @@ -26,99 +27,99 @@ ${log4j-core.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + - - - com.h2database - h2 - ${h2.version} - - - org.apache.commons - commons-dbcp2 - ${commons-dbcp2.version} - + + + com.h2database + h2 + ${h2.version} + + + org.apache.commons + commons-dbcp2 + ${commons-dbcp2.version} + - - - org.apache.logging.log4j - log4j-core - ${log4j-core.version} - test-jar - test - - + + + org.apache.logging.log4j + log4j-core + ${log4j-core.version} + test-jar + test + + - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - none - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + none + + + + - - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - **/*LiveTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - - - - - - - json - ${java.io.tmpdir}/${maven.build.timestamp}/logfile.json - - - - - - - + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + **/*LiveTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + json + ${java.io.tmpdir}/${maven.build.timestamp}/logfile.json + + + + + + + - - 2.9.5 - 1.4.193 - 2.1.1 - 2.11.0 - yyyyMMddHHmmss - + + 2.9.5 + 1.4.193 + 2.1.1 + 2.11.0 + yyyyMMddHHmmss + \ No newline at end of file From 74787e9026ef52645fcc3178869624b91bfee6c6 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Jul 2018 23:30:08 +0530 Subject: [PATCH 039/298] BAEL-1960. Copied pom.xml from master and pasted my changes against it. --- logging-modules/log4j2/pom.xml | 213 ++++++++++++++++----------------- 1 file changed, 106 insertions(+), 107 deletions(-) diff --git a/logging-modules/log4j2/pom.xml b/logging-modules/log4j2/pom.xml index f6b3fea227..9d8a523462 100644 --- a/logging-modules/log4j2/pom.xml +++ b/logging-modules/log4j2/pom.xml @@ -1,25 +1,24 @@ - - 4.0.0 - log4j2 + + 4.0.0 + log4j2 - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../../ - - - - - - org.apache.logging.log4j - log4j-core - ${log4j-core.version} - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + + + + + org.apache.logging.log4j + log4j-core + ${log4j-core.version} + + org.apache.logging.log4j @@ -27,99 +26,99 @@ ${log4j-core.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + - - - com.h2database - h2 - ${h2.version} - - - org.apache.commons - commons-dbcp2 - ${commons-dbcp2.version} - + + + com.h2database + h2 + ${h2.version} + + + org.apache.commons + commons-dbcp2 + ${commons-dbcp2.version} + - - - org.apache.logging.log4j - log4j-core - ${log4j-core.version} - test-jar - test - - + + + org.apache.logging.log4j + log4j-core + ${log4j-core.version} + test-jar + test + + - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - none - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + none + + + + - - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - **/*LiveTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - - - - - - - json - ${java.io.tmpdir}/${maven.build.timestamp}/logfile.json - - - - - - - + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + **/*LiveTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + json + ${java.io.tmpdir}/${maven.build.timestamp}/logfile.json + + + + + + + - - 2.9.5 - 1.4.193 - 2.1.1 - 2.11.0 - yyyyMMddHHmmss - + + 2.9.5 + 1.4.193 + 2.1.1 + 2.11.0 + yyyyMMddHHmmss + \ No newline at end of file From 8d7058026125cac487df8f255dacec145e44ad45 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Wed, 25 Jul 2018 22:34:32 +0200 Subject: [PATCH 040/298] added readme --- persistence-modules/java-jpa/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 persistence-modules/java-jpa/README.md diff --git a/persistence-modules/java-jpa/README.md b/persistence-modules/java-jpa/README.md new file mode 100644 index 0000000000..e9aabaaa74 --- /dev/null +++ b/persistence-modules/java-jpa/README.md @@ -0,0 +1,3 @@ +# Relevant Articles + +* [A Guide to SqlResultSetMapping](http://www.baeldung.com/jpa-sql-resultset-mapping) From 62acfaea4431d12460b98fa6feac5789d77d3f24 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Wed, 25 Jul 2018 22:43:03 +0200 Subject: [PATCH 041/298] added link --- testing-modules/spring-testing/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/spring-testing/README.md b/testing-modules/spring-testing/README.md index a96ddccabb..aed330d260 100644 --- a/testing-modules/spring-testing/README.md +++ b/testing-modules/spring-testing/README.md @@ -1,2 +1,3 @@ ### Relevant Articles: +* [Mockito.mock() vs @Mock vs @MockBean](http://www.baeldung.com/java-spring-mockito-mock-mockbean) From cd4dbef187d546940ed816c685d84d54b18f6ccf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Jul 2018 12:49:30 +0530 Subject: [PATCH 042/298] Chnages for spaces instead of tabs. --- logging-modules/log4j2/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/logging-modules/log4j2/pom.xml b/logging-modules/log4j2/pom.xml index 9d8a523462..65da318636 100644 --- a/logging-modules/log4j2/pom.xml +++ b/logging-modules/log4j2/pom.xml @@ -19,12 +19,12 @@ ${log4j-core.version} - - - org.apache.logging.log4j - log4j-api - ${log4j-core.version} - + + + org.apache.logging.log4j + log4j-api + ${log4j-core.version} + From 2f0b1b46c9feb66ecc7ec622f03626bf824352a3 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Jul 2018 12:54:28 +0530 Subject: [PATCH 043/298] Changes for spaces instead of tabs. --- .../log4j2/src/test/resources/log4j2.xml | 175 +++++++++--------- 1 file changed, 87 insertions(+), 88 deletions(-) diff --git a/logging-modules/log4j2/src/test/resources/log4j2.xml b/logging-modules/log4j2/src/test/resources/log4j2.xml index eefa00e1ba..246ffb0707 100644 --- a/logging-modules/log4j2/src/test/resources/log4j2.xml +++ b/logging-modules/log4j2/src/test/resources/log4j2.xml @@ -1,90 +1,89 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From a92283f0ddbf94af8cbcf424631df15451f239ce Mon Sep 17 00:00:00 2001 From: Sjmillington Date: Thu, 26 Jul 2018 16:19:07 +0100 Subject: [PATCH 044/298] BAEL-2042 JavaFaker unit tests --- java-faker/pom.xml | 29 +++++ .../test/java/com/baeldung/JavaFakerTest.java | 115 ++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 java-faker/pom.xml create mode 100644 java-faker/src/test/java/com/baeldung/JavaFakerTest.java diff --git a/java-faker/pom.xml b/java-faker/pom.xml new file mode 100644 index 0000000000..4ac5368e24 --- /dev/null +++ b/java-faker/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + com.baeldung + java-faker + 1.0-SNAPSHOT + + + + com.github.javafaker + javafaker + 0.15 + + + + + junit + junit + 4.12 + test + + + + + + diff --git a/java-faker/src/test/java/com/baeldung/JavaFakerTest.java b/java-faker/src/test/java/com/baeldung/JavaFakerTest.java new file mode 100644 index 0000000000..8d89fa0ab2 --- /dev/null +++ b/java-faker/src/test/java/com/baeldung/JavaFakerTest.java @@ -0,0 +1,115 @@ +package com.baeldung; + +import com.github.javafaker.Faker; +import com.github.javafaker.service.FakeValuesService; +import com.github.javafaker.service.FakerIDN; +import com.github.javafaker.service.LocaleDoesNotExistException; +import com.github.javafaker.service.RandomService; +import javafx.scene.Parent; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import java.util.Locale; +import java.util.Random; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +public class JavaFakerTest { + + private Faker faker; + + @Before + public void setUp() throws Exception { + faker = new Faker(); + } + + @Test + public void givenJavaFaker_whenAddressObjectCalled_checkValidAddressInfoGiven() throws Exception { + + Faker faker = new Faker(); + + String streetName = faker.address().streetName(); + String number = faker.address().buildingNumber(); + String city = faker.address().city(); + String country = faker.address().country(); + + System.out.println(String.format("%s\n%s\n%s\n%s", + number, + streetName, + city, + country)); + + } + + @Test + public void givenJavaFakersWithSameSeed_whenNameCalled_CheckSameName() throws Exception { + + Faker faker1 = new Faker(new Random(24)); + Faker faker2 = new Faker(new Random(24)); + + assertEquals(faker1.name().firstName(), faker2.name().firstName()); + } + + @Test + public void givenJavaFakersWithDifferentLocals_checkZipCodesMatchRegex() throws Exception { + + Faker ukFaker = new Faker(new Locale("en-GB")); + Faker usFaker = new Faker(new Locale("en-US")); + + System.out.println(String.format("American zipcode: %s", usFaker.address().zipCode())); + System.out.println(String.format("British postcode: %s", ukFaker.address().zipCode())); + + Pattern ukPattern = Pattern.compile("([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z]))))\\s?[0-9][A-Za-z]{2})"); + Matcher ukMatcher = ukPattern.matcher(ukFaker.address().zipCode()); + + assertTrue(ukMatcher.find()); + + Matcher usMatcher = Pattern.compile("^\\d{5}(?:[-\\s]\\d{4})?$").matcher(usFaker.address().zipCode()); + + assertTrue(usMatcher.find()); + + } + + @Test + public void givenJavaFakerService_testFakersCreated() throws Exception { + + RandomService randomService = new RandomService(); + + System.out.println(randomService.nextBoolean()); + System.out.println(randomService.nextDouble()); + + Faker faker = new Faker(new Random(randomService.nextLong())); + + System.out.println(faker.address().city()); + + } + + @Test + public void testFakeValuesService() throws Exception { + + FakeValuesService fakeValuesService = new FakeValuesService(new Locale("en-GB"), new RandomService()); + + String email = fakeValuesService.bothify("????##@gmail.com"); + Matcher emailMatcher = Pattern.compile("\\w{4}\\d{2}@gmail.com").matcher(email); + assertTrue(emailMatcher.find()); + + String alphaNumericString = fakeValuesService.regexify("[a-z1-9]{10}"); + Matcher alphaNumericMatcher = Pattern.compile("[a-z1-9]{10}").matcher(alphaNumericString); + assertTrue(alphaNumericMatcher.find()); + + } + + + @Test(expected = LocaleDoesNotExistException.class) + public void givenWrongLocale_whenFakerIsInitialised_testLocaleDoesNotExistExceptionIsThrown() throws Exception { + + Faker wrongLocaleFaker = new Faker(new Locale("en-seaWorld")); + + } +} From 015240a99e54780f391ac3784557c3ce3a219c31 Mon Sep 17 00:00:00 2001 From: Sjmillington Date: Thu, 26 Jul 2018 19:17:51 +0100 Subject: [PATCH 045/298] Moved javafaker unit tests to testing-modules --- {java-faker => testing-modules/java-faker}/pom.xml | 0 .../java-faker}/src/test/java/com/baeldung/JavaFakerTest.java | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {java-faker => testing-modules/java-faker}/pom.xml (100%) rename {java-faker => testing-modules/java-faker}/src/test/java/com/baeldung/JavaFakerTest.java (100%) diff --git a/java-faker/pom.xml b/testing-modules/java-faker/pom.xml similarity index 100% rename from java-faker/pom.xml rename to testing-modules/java-faker/pom.xml diff --git a/java-faker/src/test/java/com/baeldung/JavaFakerTest.java b/testing-modules/java-faker/src/test/java/com/baeldung/JavaFakerTest.java similarity index 100% rename from java-faker/src/test/java/com/baeldung/JavaFakerTest.java rename to testing-modules/java-faker/src/test/java/com/baeldung/JavaFakerTest.java From 729f1efd8998d875cae64f7894fc5e0e62fded9e Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 26 Jul 2018 22:35:35 +0300 Subject: [PATCH 046/298] Update PushController.java --- .../com/baeldung/spring/controller/push/PushController.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/push/PushController.java b/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/push/PushController.java index b557c65c93..88448d4885 100644 --- a/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/push/PushController.java +++ b/spring-mvc-simple/src/main/java/com/baeldung/spring/controller/push/PushController.java @@ -11,9 +11,7 @@ public class PushController { @GetMapping(path = "/demoWithPush") public String demoWithPush(PushBuilder pushBuilder) { if (null != pushBuilder) { - pushBuilder.path("resources/logo.png") - .addHeader("Content-Type", "image/png") - .push(); + pushBuilder.path("resources/logo.png").push(); } return "demo"; } @@ -22,4 +20,4 @@ public class PushController { public String demoWithoutPush() { return "demo"; } -} \ No newline at end of file +} From 2a773d637cb456908990a7aec1c0b7eedf24d62a Mon Sep 17 00:00:00 2001 From: db Date: Fri, 27 Jul 2018 02:33:14 +0100 Subject: [PATCH 047/298] PrincipalExtractor and AuthoritiesExtractor example --- spring-security-sso/pom.xml | 1 + .../pom.xml | 53 +++++++++++++++++++ .../main/java/org/baeldung/Application.java | 18 +++++++ .../configuration/SecurityConfig.java | 38 +++++++++++++ .../extractor/CustomAuthoritiesExtractor.java | 27 ++++++++++ .../extractor/CustomPrincipalExtractor.java | 13 +++++ .../src/main/resources/application.yml | 14 +++++ .../src/main/resources/templates/index.html | 21 ++++++++ .../src/test/java/ApplicationUnitTest.java | 53 +++++++++++++++++++ 9 files changed, 238 insertions(+) create mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/pom.xml create mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/Application.java create mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/configuration/SecurityConfig.java create mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomAuthoritiesExtractor.java create mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomPrincipalExtractor.java create mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/application.yml create mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/templates/index.html create mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/src/test/java/ApplicationUnitTest.java diff --git a/spring-security-sso/pom.xml b/spring-security-sso/pom.xml index 764e899640..0cf468c2e3 100644 --- a/spring-security-sso/pom.xml +++ b/spring-security-sso/pom.xml @@ -19,6 +19,7 @@ spring-security-sso-auth-server spring-security-sso-ui spring-security-sso-ui-2 + spring-security-principal-authorities-extractor diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/pom.xml b/spring-security-sso/spring-security-principal-authorities-extractor/pom.xml new file mode 100644 index 0000000000..5bd8de9c16 --- /dev/null +++ b/spring-security-sso/spring-security-principal-authorities-extractor/pom.xml @@ -0,0 +1,53 @@ + + + + spring-security-sso + org.baeldung + 1.0.0-SNAPSHOT + + 4.0.0 + + spring-security-principal-authorities-extractor + + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.security.oauth.boot + spring-security-oauth2-autoconfigure + ${oauth-auto.version} + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.thymeleaf.extras + thymeleaf-extras-springsecurity4 + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.security + spring-security-test + test + + + \ No newline at end of file diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/Application.java b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/Application.java new file mode 100644 index 0000000000..0dfbbef86e --- /dev/null +++ b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/Application.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@SpringBootApplication +public class Application { + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + + @GetMapping("/") + public String homePage(Model model) { + return "index"; + } +} diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/configuration/SecurityConfig.java b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/configuration/SecurityConfig.java new file mode 100644 index 0000000000..4de1932392 --- /dev/null +++ b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/configuration/SecurityConfig.java @@ -0,0 +1,38 @@ +package org.baeldung.configuration; + +import org.baeldung.extractor.CustomAuthoritiesExtractor; +import org.baeldung.extractor.CustomPrincipalExtractor; +import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; +import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor; +import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +@EnableOAuth2Sso +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.antMatcher("/**") + .authorizeRequests() + .antMatchers("/login**") + .permitAll() + .anyRequest() + .authenticated() + .and() + .formLogin().disable(); + } + + @Bean + public PrincipalExtractor principalExtractor() { + return new CustomPrincipalExtractor(); + } + + @Bean + public AuthoritiesExtractor authoritiesExtractor() { + return new CustomAuthoritiesExtractor(); + } +} diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomAuthoritiesExtractor.java b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomAuthoritiesExtractor.java new file mode 100644 index 0000000000..c1a78634aa --- /dev/null +++ b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomAuthoritiesExtractor.java @@ -0,0 +1,27 @@ +package org.baeldung.extractor; + +import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.AuthorityUtils; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +public class CustomAuthoritiesExtractor implements AuthoritiesExtractor { + private static final List GITHUB_FREE_AUTHORITIES = AuthorityUtils.commaSeparatedStringToAuthorityList("GITHUB_USER,GITHUB_USER_FREE"); + private static final List GITHUB_SUBSCRIBED_AUTHORITIES = AuthorityUtils.commaSeparatedStringToAuthorityList("GITHUB_USER,GITHUB_USER_SUBSCRIBED"); + + @Override + public List extractAuthorities(Map map) { + if (Objects.nonNull(map.get("plan"))) { + if (!((LinkedHashMap) map.get("plan")) + .get("name") + .equals("free")) { + return GITHUB_SUBSCRIBED_AUTHORITIES; + } + } + return GITHUB_FREE_AUTHORITIES; + } +} diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomPrincipalExtractor.java b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomPrincipalExtractor.java new file mode 100644 index 0000000000..d356c07e3b --- /dev/null +++ b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomPrincipalExtractor.java @@ -0,0 +1,13 @@ +package org.baeldung.extractor; + +import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor; + +import java.util.Map; + +public class CustomPrincipalExtractor implements PrincipalExtractor { + + @Override + public Object extractPrincipal(Map map) { + return map.get("login"); + } +} diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/application.yml b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/application.yml new file mode 100644 index 0000000000..324df694df --- /dev/null +++ b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/application.yml @@ -0,0 +1,14 @@ +security: + oauth2: + client: + clientId: 89a7c4facbb3434d599d + clientSecret: 9b3b08e4a340bd20e866787e4645b54f73d74b6a + accessTokenUri: https://github.com/login/oauth/access_token + userAuthorizationUri: https://github.com/login/oauth/authorize + clientAuthenticationScheme: form + scope: read:user,user:email + resource: + userInfoUri: https://api.github.com/user +spring: + thymeleaf: + cache: false \ No newline at end of file diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/templates/index.html b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/templates/index.html new file mode 100644 index 0000000000..414dd54a42 --- /dev/null +++ b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/templates/index.html @@ -0,0 +1,21 @@ + + + + + Spring Security Principal and Authorities extractor + + + + +

+
+

Secured Page

+ Authenticated username: +
+ Authorities: +
+
+
+ + \ No newline at end of file diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/test/java/ApplicationUnitTest.java b/spring-security-sso/spring-security-principal-authorities-extractor/src/test/java/ApplicationUnitTest.java new file mode 100644 index 0000000000..c14cbc9866 --- /dev/null +++ b/spring-security-sso/spring-security-principal-authorities-extractor/src/test/java/ApplicationUnitTest.java @@ -0,0 +1,53 @@ +import org.baeldung.Application; +import org.baeldung.configuration.SecurityConfig; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import javax.servlet.Filter; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ContextConfiguration(classes = {SecurityConfig.class}) +public class ApplicationUnitTest { + + @Autowired + private WebApplicationContext context; + + @Autowired + private Filter springSecurityFilterChain; + + private MockMvc mvc; + + @Before + public void setup() { + mvc = MockMvcBuilders + .webAppContextSetup(context) + .addFilters(springSecurityFilterChain) + .build(); + } + + @Test + public void contextLoads() throws Exception { + } + + @Test + public void givenValidRequestWithoutAuthentication_shouldFailWith302() throws Exception { + mvc + .perform(get("/")) + .andExpect(status().isFound()) + .andReturn(); + } + +} From 0a1e10b128551eb0a5b459893d443cc3b28c6818 Mon Sep 17 00:00:00 2001 From: Eugen Paraschiv Date: Fri, 27 Jul 2018 22:56:18 +0300 Subject: [PATCH 048/298] commenting out problematic modules in the integration-lite build --- pom.xml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 06ec82e5f0..7386eed4a6 100644 --- a/pom.xml +++ b/pom.xml @@ -906,7 +906,7 @@ linkrest logging-modules/log-mdc logging-modules/log4j - logging-modules/log4j2 + logging-modules/logback lombok mapstruct @@ -962,19 +962,19 @@ spring-cucumber spring-ejb spring-aop - spring-data-couchbase-2 + persistence-modules/spring-data-dynamodb 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 @@ -1041,13 +1041,13 @@ testing-modules/testing testing-modules/testng video-tutorials - xml + xmlunit-2 struts-2 apache-velocity apache-solrj rabbitmq - vertx + persistence-modules/spring-data-gemfire mybatis spring-drools @@ -1082,6 +1082,13 @@ ejb persistence-modules/java-cassandra persistence-modules/spring-data-cassandra + logging-modules/log4j2 + spring-data-couchbase-2 + persistence-modules/spring-data-redis + spring-hibernate4 + xml + vertx + --> From 738e3af007bbf81bbe3432e69975283f86b8242f Mon Sep 17 00:00:00 2001 From: Eugen Paraschiv Date: Fri, 27 Jul 2018 23:32:13 +0300 Subject: [PATCH 049/298] integratio-lite profile work --- pom.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 7386eed4a6..2fea45e612 100644 --- a/pom.xml +++ b/pom.xml @@ -877,7 +877,7 @@ spring-static-resources hazelcast hbase - httpclient + hystrix image-processing immutables @@ -910,7 +910,7 @@ logging-modules/logback lombok mapstruct - metrics + maven mesos-marathon msf4j @@ -1088,7 +1088,8 @@ spring-hibernate4 xml vertx - + metrics + httpclient --> From 25fb0c94c281d2e8119ff7a38a66aae3088b49c0 Mon Sep 17 00:00:00 2001 From: Eugen Paraschiv Date: Sat, 28 Jul 2018 00:17:37 +0300 Subject: [PATCH 050/298] integration-lite work --- pom.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2fea45e612..263e4df637 100644 --- a/pom.xml +++ b/pom.xml @@ -980,7 +980,7 @@ spring-integration spring-jenkins-pipeline spring-jersey - jmeter + spring-jms spring-jooq persistence-modules/spring-jpa @@ -1090,6 +1090,8 @@ vertx metrics httpclient + + jmeter --> From bac0c0714c2c4c7fe450acb9087bddcb4799046a Mon Sep 17 00:00:00 2001 From: DOHA Date: Sat, 28 Jul 2018 02:27:47 +0300 Subject: [PATCH 051/298] update spring data elasticsearch --- spring-data-elasticsearch/pom.xml | 103 ++++++++++-------- .../spring/data/es/config/Config.java | 47 +++----- .../spring/data/es/model/Article.java | 10 +- .../data/es/service/ArticleService.java | 4 +- .../data/es/service/ArticleServiceImpl.java | 6 +- .../src/main/resources/log4j2.properties | 6 + .../src/main/resources/logback.xml | 19 ---- .../ElasticSearchManualTest.java | 61 ++++++----- .../GeoQueriesIntegrationTest.java | 60 +++++----- .../data/es/ElasticSearchIntegrationTest.java | 37 ++++--- .../es/ElasticSearchQueryIntegrationTest.java | 49 +++++---- 11 files changed, 208 insertions(+), 194 deletions(-) create mode 100644 spring-data-elasticsearch/src/main/resources/log4j2.properties delete mode 100644 spring-data-elasticsearch/src/main/resources/logback.xml diff --git a/spring-data-elasticsearch/pom.xml b/spring-data-elasticsearch/pom.xml index 572fed2403..99d8a70807 100644 --- a/spring-data-elasticsearch/pom.xml +++ b/spring-data-elasticsearch/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-4 + ../parent-spring-5 @@ -19,50 +19,20 @@ org.springframework spring-core ${spring.version} - - - commons-logging - commons-logging - - + + + org.springframework + spring-context + ${spring.version} + + org.springframework.data spring-data-elasticsearch ${spring-data-elasticsearch.version} - - com.spatial4j - spatial4j - ${spatial4j.version} - - - - com.vividsolutions - jts - ${jts.version} - - - xerces - xercesImpl - - - - - - org.springframework - spring-test - ${spring.version} - test - - - net.java.dev.jna - jna - ${jna.version} - test - - org.elasticsearch elasticsearch @@ -73,17 +43,62 @@ fastjson ${fastjson.version} + + + org.locationtech.spatial4j + spatial4j + ${spatial4j.version} + + + + com.vividsolutions + jts + ${jts.version} + + + xerces + xercesImpl + + + + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + + org.elasticsearch.client + transport + ${elasticsearch.version} + + + + org.springframework + spring-test + ${spring.version} + test + + + + net.java.dev.jna + jna + ${jna.version} + test + 1.8 1.8 - 2.0.5.RELEASE - 4.2.2 - 2.4.2 - 1.2.21 - 0.4.1 + 3.0.8.RELEASE + 4.5.2 + 5.6.0 + 1.2.47 + 0.6 1.13 + 2.9.1
\ No newline at end of file diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java index 37e9fd46eb..e6ce795b45 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java @@ -1,15 +1,13 @@ package com.baeldung.spring.data.es.config; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.net.InetAddress; +import java.net.UnknownHostException; import org.elasticsearch.client.Client; +import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.node.NodeBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.elasticsearch.common.transport.InetSocketTransportAddress; +import org.elasticsearch.transport.client.PreBuiltTransportClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -23,35 +21,26 @@ import org.springframework.data.elasticsearch.repository.config.EnableElasticsea @ComponentScan(basePackages = { "com.baeldung.spring.data.es.service" }) public class Config { - @Value("${elasticsearch.home:/usr/local/Cellar/elasticsearch/2.3.2}") + @Value("${elasticsearch.home:/usr/local/Cellar/elasticsearch/5.6.0}") private String elasticsearchHome; - private static Logger logger = LoggerFactory.getLogger(Config.class); + @Value("${elasticsearch.cluster.name:elasticsearch}") + private String clusterName; @Bean public Client client() { + TransportClient client = null; try { - final Path tmpDir = Files.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir")), "elasticsearch_data"); - logger.debug(tmpDir.toAbsolutePath().toString()); - - // @formatter:off - - final Settings.Builder elasticsearchSettings = - Settings.settingsBuilder().put("http.enabled", "false") - .put("path.data", tmpDir.toAbsolutePath().toString()) - .put("path.home", elasticsearchHome); - - return new NodeBuilder() - .local(true) - .settings(elasticsearchSettings) - .node() - .client(); - - // @formatter:on - } catch (final IOException ioex) { - logger.error("Cannot create temp dir", ioex); - throw new RuntimeException(); + final Settings elasticsearchSettings = Settings.builder() + .put("client.transport.sniff", true) + .put("path.home", elasticsearchHome) + .put("cluster.name", clusterName).build(); + client = new PreBuiltTransportClient(elasticsearchSettings); + client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300)); + } catch (UnknownHostException e) { + e.printStackTrace(); } + return client; } @Bean diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java index 01330a6c9c..e901d0d0ed 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java @@ -1,8 +1,8 @@ package com.baeldung.spring.data.es.model; -import static org.springframework.data.elasticsearch.annotations.FieldIndex.not_analyzed; +import static org.springframework.data.elasticsearch.annotations.FieldType.Keyword; import static org.springframework.data.elasticsearch.annotations.FieldType.Nested; -import static org.springframework.data.elasticsearch.annotations.FieldType.String; +import static org.springframework.data.elasticsearch.annotations.FieldType.Text; import java.util.Arrays; import java.util.List; @@ -19,13 +19,13 @@ public class Article { @Id private String id; - @MultiField(mainField = @Field(type = String), otherFields = { @InnerField(index = not_analyzed, suffix = "verbatim", type = String) }) + @MultiField(mainField = @Field(type = Text, fielddata = true), otherFields = { @InnerField(suffix = "verbatim", type = Keyword) }) private String title; - @Field(type = Nested) + @Field(type = Nested, includeInParent = true) private List authors; - @Field(type = String, index = not_analyzed) + @Field(type = Keyword) private String[] tags; public Article() { diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java index 63e2d91fa7..a0f72aa5f7 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java @@ -1,5 +1,7 @@ package com.baeldung.spring.data.es.service; +import java.util.Optional; + import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -8,7 +10,7 @@ import com.baeldung.spring.data.es.model.Article; public interface ArticleService { Article save(Article article); - Article findOne(String id); + Optional
findOne(String id); Iterable
findAll(); diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java index 0908ffa70e..5064f16508 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java @@ -1,5 +1,7 @@ package com.baeldung.spring.data.es.service; +import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -24,8 +26,8 @@ public class ArticleServiceImpl implements ArticleService { } @Override - public Article findOne(String id) { - return articleRepository.findOne(id); + public Optional
findOne(String id) { + return articleRepository.findById(id); } @Override diff --git a/spring-data-elasticsearch/src/main/resources/log4j2.properties b/spring-data-elasticsearch/src/main/resources/log4j2.properties new file mode 100644 index 0000000000..fced116e6b --- /dev/null +++ b/spring-data-elasticsearch/src/main/resources/log4j2.properties @@ -0,0 +1,6 @@ +appender.console.type = Console +appender.console.name = console +appender.console.layout.type = PatternLayout + +rootLogger.level = info +rootLogger.appenderRef.console.ref = console \ No newline at end of file diff --git a/spring-data-elasticsearch/src/main/resources/logback.xml b/spring-data-elasticsearch/src/main/resources/logback.xml deleted file mode 100644 index ec0dc2469a..0000000000 --- a/spring-data-elasticsearch/src/main/resources/logback.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - web - %date [%thread] %-5level %logger{36} - %message%n - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java b/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java index 285c164869..fbf4e5ab99 100644 --- a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java +++ b/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/ElasticSearchManualTest.java @@ -1,45 +1,49 @@ package com.baeldung.elasticsearch; -import com.alibaba.fastjson.JSON; -import org.elasticsearch.action.delete.DeleteResponse; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.node.Node; -import org.elasticsearch.search.SearchHit; -import org.junit.Before; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.stream.Collectors; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.elasticsearch.action.DocWriteResponse.Result; +import org.elasticsearch.action.delete.DeleteResponse; +import org.elasticsearch.action.index.IndexResponse; +import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.action.search.SearchType; +import org.elasticsearch.client.Client; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.transport.InetSocketTransportAddress; +import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.common.xcontent.XContentFactory; +import org.elasticsearch.common.xcontent.XContentType; +import org.elasticsearch.index.query.QueryBuilders; +import org.elasticsearch.search.SearchHit; +import org.elasticsearch.transport.client.PreBuiltTransportClient; +import org.junit.Before; +import org.junit.Test; + +import com.alibaba.fastjson.JSON; public class ElasticSearchManualTest { private List listOfPersons = new ArrayList<>(); private Client client = null; @Before - public void setUp() { + public void setUp() throws UnknownHostException { Person person1 = new Person(10, "John Doe", new Date()); Person person2 = new Person(25, "Janette Doe", new Date()); listOfPersons.add(person1); listOfPersons.add(person2); - Node node = nodeBuilder() - .clusterName("elasticsearch") - .client(true) - .node(); - client = node.client(); + + client = new PreBuiltTransportClient(Settings.builder().put("client.transport.sniff", true) + .put("cluster.name","elasticsearch").build()) + .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300)); } @Test @@ -47,11 +51,12 @@ public class ElasticSearchManualTest { String jsonObject = "{\"age\":20,\"dateOfBirth\":1471466076564,\"fullName\":\"John Doe\"}"; IndexResponse response = client .prepareIndex("people", "Doe") - .setSource(jsonObject) + .setSource(jsonObject, XContentType.JSON) .get(); String index = response.getIndex(); String type = response.getType(); - assertTrue(response.isCreated()); + + assertEquals(Result.CREATED, response.getResult()); assertEquals(index, "people"); assertEquals(type, "Doe"); } @@ -61,13 +66,14 @@ public class ElasticSearchManualTest { String jsonObject = "{\"age\":10,\"dateOfBirth\":1471455886564,\"fullName\":\"Johan Doe\"}"; IndexResponse response = client .prepareIndex("people", "Doe") - .setSource(jsonObject) + .setSource(jsonObject, XContentType.JSON) .get(); String id = response.getId(); DeleteResponse deleteResponse = client .prepareDelete("people", "Doe", id) .get(); - assertTrue(deleteResponse.isFound()); + + assertEquals(Result.DELETED,deleteResponse.getResult()); } @Test @@ -142,6 +148,7 @@ public class ElasticSearchManualTest { .prepareIndex("people", "Doe") .setSource(builder) .get(); - assertTrue(response.isCreated()); + + assertEquals(Result.CREATED, response.getResult()); } } diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java b/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java index 304cf2e62d..1f55379418 100644 --- a/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java +++ b/spring-data-elasticsearch/src/test/java/com/baeldung/elasticsearch/GeoQueriesIntegrationTest.java @@ -1,13 +1,21 @@ package com.baeldung.elasticsearch; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; -import com.baeldung.spring.data.es.config.Config; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; +import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.common.geo.ShapeRelation; -import org.elasticsearch.common.geo.builders.ShapeBuilder; +import org.elasticsearch.common.geo.builders.ShapeBuilders; import org.elasticsearch.common.unit.DistanceUnit; +import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.SearchHit; @@ -20,11 +28,8 @@ import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.junit.Assert.assertTrue; +import com.baeldung.spring.data.es.config.Config; +import com.vividsolutions.jts.geom.Coordinate; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = Config.class) @@ -43,7 +48,7 @@ public class GeoQueriesIntegrationTest { public void setUp() { String jsonObject = "{\"Wonders\":{\"properties\":{\"name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"region\":{\"type\":\"geo_shape\",\"tree\":\"quadtree\",\"precision\":\"1m\"},\"location\":{\"type\":\"geo_point\"}}}}"; CreateIndexRequest req = new CreateIndexRequest(WONDERS_OF_WORLD); - req.mapping(WONDERS, jsonObject); + req.mapping(WONDERS, jsonObject, XContentType.JSON); client.admin() .indices() .create(req) @@ -51,31 +56,36 @@ public class GeoQueriesIntegrationTest { } @Test - public void givenGeoShapeData_whenExecutedGeoShapeQuery_thenResultNonEmpty() { - String jsonObject = "{\"name\":\"Agra\",\"region\":{\"type\":\"envelope\",\"coordinates\":[[75,25],[80.1,30.2]]}}"; + public void givenGeoShapeData_whenExecutedGeoShapeQuery_thenResultNonEmpty() throws IOException{ + String jsonObject = "{\"name\":\"Agra\",\"region\":{\"type\":\"envelope\",\"coordinates\":[[75,30.2],[80.1, 25]]}}"; IndexResponse response = client.prepareIndex(WONDERS_OF_WORLD, WONDERS) - .setSource(jsonObject) + .setSource(jsonObject, XContentType.JSON) .get(); + String tajMahalId = response.getId(); client.admin() .indices() .prepareRefresh(WONDERS_OF_WORLD) .get(); - QueryBuilder qb = QueryBuilders.geoShapeQuery("region", ShapeBuilder.newEnvelope() - .topLeft(74.00, 24.0) - .bottomRight(81.1, 31.2)) - .relation(ShapeRelation.WITHIN); + Coordinate topLeft =new Coordinate(74, 31.2); + Coordinate bottomRight =new Coordinate(81.1, 24); + QueryBuilder qb = QueryBuilders + .geoShapeQuery("region", ShapeBuilders.newEnvelope(topLeft, bottomRight)) + .relation(ShapeRelation.WITHIN); + SearchResponse searchResponse = client.prepareSearch(WONDERS_OF_WORLD) .setTypes(WONDERS) .setQuery(qb) .execute() .actionGet(); + List ids = Arrays.stream(searchResponse.getHits() .getHits()) .map(SearchHit::getId) .collect(Collectors.toList()); + assertTrue(ids.contains(tajMahalId)); } @@ -83,7 +93,7 @@ public class GeoQueriesIntegrationTest { public void givenGeoPointData_whenExecutedGeoBoundingBoxQuery_thenResultNonEmpty() { String jsonObject = "{\"name\":\"Pyramids of Giza\",\"location\":[31.131302,29.976480]}"; IndexResponse response = client.prepareIndex(WONDERS_OF_WORLD, WONDERS) - .setSource(jsonObject) + .setSource(jsonObject, XContentType.JSON) .get(); String pyramidsOfGizaId = response.getId(); client.admin() @@ -92,9 +102,8 @@ public class GeoQueriesIntegrationTest { .get(); QueryBuilder qb = QueryBuilders.geoBoundingBoxQuery("location") - .bottomLeft(28, 30) - .topRight(31, 32); - + .setCorners(31,30,28,32); + SearchResponse searchResponse = client.prepareSearch(WONDERS_OF_WORLD) .setTypes(WONDERS) .setQuery(qb) @@ -111,7 +120,7 @@ public class GeoQueriesIntegrationTest { public void givenGeoPointData_whenExecutedGeoDistanceQuery_thenResultNonEmpty() { String jsonObject = "{\"name\":\"Lighthouse of alexandria\",\"location\":[31.131302,29.976480]}"; IndexResponse response = client.prepareIndex(WONDERS_OF_WORLD, WONDERS) - .setSource(jsonObject) + .setSource(jsonObject, XContentType.JSON) .get(); String lighthouseOfAlexandriaId = response.getId(); client.admin() @@ -139,7 +148,7 @@ public class GeoQueriesIntegrationTest { public void givenGeoPointData_whenExecutedGeoPolygonQuery_thenResultNonEmpty() { String jsonObject = "{\"name\":\"The Great Rann of Kutch\",\"location\":[69.859741,23.733732]}"; IndexResponse response = client.prepareIndex(WONDERS_OF_WORLD, WONDERS) - .setSource(jsonObject) + .setSource(jsonObject, XContentType.JSON) .get(); String greatRannOfKutchid = response.getId(); client.admin() @@ -147,10 +156,11 @@ public class GeoQueriesIntegrationTest { .prepareRefresh(WONDERS_OF_WORLD) .get(); - QueryBuilder qb = QueryBuilders.geoPolygonQuery("location") - .addPoint(22.733, 68.859) - .addPoint(24.733, 68.859) - .addPoint(23, 70.859); + List allPoints = new ArrayList(); + allPoints.add(new GeoPoint(22.733, 68.859)); + allPoints.add(new GeoPoint(24.733, 68.859)); + allPoints.add(new GeoPoint(23, 70.859)); + QueryBuilder qb = QueryBuilders.geoPolygonQuery("location", allPoints); SearchResponse searchResponse = client.prepareSearch(WONDERS_OF_WORLD) .setTypes(WONDERS) diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java index 60871e5eee..6ecb11cdbe 100644 --- a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java +++ b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchIntegrationTest.java @@ -1,9 +1,15 @@ package com.baeldung.spring.data.es; -import com.baeldung.spring.data.es.config.Config; -import com.baeldung.spring.data.es.model.Article; -import com.baeldung.spring.data.es.model.Author; -import com.baeldung.spring.data.es.service.ArticleService; +import static java.util.Arrays.asList; +import static org.elasticsearch.index.query.Operator.AND; +import static org.elasticsearch.index.query.QueryBuilders.fuzzyQuery; +import static org.elasticsearch.index.query.QueryBuilders.matchQuery; +import static org.elasticsearch.index.query.QueryBuilders.regexpQuery; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.List; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -16,15 +22,10 @@ import org.springframework.data.elasticsearch.core.query.SearchQuery; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.List; - -import static java.util.Arrays.asList; -import static org.elasticsearch.index.query.MatchQueryBuilder.Operator.AND; -import static org.elasticsearch.index.query.QueryBuilders.fuzzyQuery; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; -import static org.elasticsearch.index.query.QueryBuilders.regexpQuery; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import com.baeldung.spring.data.es.config.Config; +import com.baeldung.spring.data.es.model.Article; +import com.baeldung.spring.data.es.model.Author; +import com.baeldung.spring.data.es.service.ArticleService; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = Config.class) @@ -81,25 +82,25 @@ public class ElasticSearchIntegrationTest { public void givenPersistedArticles_whenSearchByAuthorsName_thenRightFound() { final Page
articleByAuthorName = articleService - .findByAuthorName(johnSmith.getName(), new PageRequest(0, 10)); + .findByAuthorName(johnSmith.getName(), PageRequest.of(0, 10)); assertEquals(2L, articleByAuthorName.getTotalElements()); } @Test public void givenCustomQuery_whenSearchByAuthorsName_thenArticleIsFound() { - final Page
articleByAuthorName = articleService.findByAuthorNameUsingCustomQuery("Smith", new PageRequest(0, 10)); + final Page
articleByAuthorName = articleService.findByAuthorNameUsingCustomQuery("Smith", PageRequest.of(0, 10)); assertEquals(2L, articleByAuthorName.getTotalElements()); } @Test public void givenTagFilterQuery_whenSearchByTag_thenArticleIsFound() { - final Page
articleByAuthorName = articleService.findByFilteredTagQuery("elasticsearch", new PageRequest(0, 10)); + final Page
articleByAuthorName = articleService.findByFilteredTagQuery("elasticsearch", PageRequest.of(0, 10)); assertEquals(3L, articleByAuthorName.getTotalElements()); } @Test public void givenTagFilterQuery_whenSearchByAuthorsName_thenArticleIsFound() { - final Page
articleByAuthorName = articleService.findByAuthorsNameAndFilteredTagQuery("Doe", "elasticsearch", new PageRequest(0, 10)); + final Page
articleByAuthorName = articleService.findByAuthorsNameAndFilteredTagQuery("Doe", "elasticsearch", PageRequest.of(0, 10)); assertEquals(2L, articleByAuthorName.getTotalElements()); } @@ -125,7 +126,7 @@ public class ElasticSearchIntegrationTest { article.setTitle(newTitle); articleService.save(article); - assertEquals(newTitle, articleService.findOne(article.getId()).getTitle()); + assertEquals(newTitle, articleService.findOne(article.getId()).get().getTitle()); } @Test diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java index c6af93bb62..2348c49830 100644 --- a/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java +++ b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchQueryIntegrationTest.java @@ -1,9 +1,20 @@ package com.baeldung.spring.data.es; -import com.baeldung.spring.data.es.config.Config; -import com.baeldung.spring.data.es.model.Article; -import com.baeldung.spring.data.es.model.Author; -import com.baeldung.spring.data.es.service.ArticleService; +import static java.util.Arrays.asList; +import static java.util.stream.Collectors.toList; +import static org.elasticsearch.index.query.Operator.AND; +import static org.elasticsearch.index.query.QueryBuilders.boolQuery; +import static org.elasticsearch.index.query.QueryBuilders.matchPhraseQuery; +import static org.elasticsearch.index.query.QueryBuilders.matchQuery; +import static org.elasticsearch.index.query.QueryBuilders.multiMatchQuery; +import static org.elasticsearch.index.query.QueryBuilders.nestedQuery; +import static org.elasticsearch.index.query.QueryBuilders.termQuery; +import static org.junit.Assert.assertEquals; + +import java.util.List; +import java.util.Map; + +import org.apache.lucene.search.join.ScoreMode; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; import org.elasticsearch.common.unit.Fuzziness; @@ -14,7 +25,7 @@ import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; import org.elasticsearch.search.aggregations.bucket.terms.StringTerms; import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder; +import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -25,20 +36,10 @@ import org.springframework.data.elasticsearch.core.query.SearchQuery; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import static java.util.Arrays.asList; -import static java.util.stream.Collectors.toList; -import static org.elasticsearch.index.query.MatchQueryBuilder.Operator.AND; -import static org.elasticsearch.index.query.QueryBuilders.boolQuery; -import static org.elasticsearch.index.query.QueryBuilders.matchPhraseQuery; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; -import static org.elasticsearch.index.query.QueryBuilders.multiMatchQuery; -import static org.elasticsearch.index.query.QueryBuilders.nestedQuery; -import static org.elasticsearch.index.query.QueryBuilders.termQuery; -import static org.junit.Assert.assertEquals; +import com.baeldung.spring.data.es.config.Config; +import com.baeldung.spring.data.es.model.Article; +import com.baeldung.spring.data.es.model.Author; +import com.baeldung.spring.data.es.service.ArticleService; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = Config.class) @@ -124,7 +125,7 @@ public class ElasticSearchQueryIntegrationTest { @Test public void givenNestedObject_whenQueryByAuthorsName_thenFoundArticlesByThatAuthor() { - final QueryBuilder builder = nestedQuery("authors", boolQuery().must(termQuery("authors.name", "smith"))); + final QueryBuilder builder = nestedQuery("authors", boolQuery().must(termQuery("authors.name", "smith")), ScoreMode.None); final SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(builder).build(); final List
articles = elasticsearchTemplate.queryForList(searchQuery, Article.class); @@ -134,7 +135,7 @@ public class ElasticSearchQueryIntegrationTest { @Test public void givenAnalyzedQuery_whenMakeAggregationOnTermCount_thenEachTokenCountsSeparately() { - final TermsBuilder aggregation = AggregationBuilders.terms("top_tags").field("title"); + final TermsAggregationBuilder aggregation = AggregationBuilders.terms("top_tags").field("title"); final SearchResponse response = client.prepareSearch("blog").setTypes("article").addAggregation(aggregation) .execute().actionGet(); @@ -150,8 +151,8 @@ public class ElasticSearchQueryIntegrationTest { @Test public void givenNotAnalyzedQuery_whenMakeAggregationOnTermCount_thenEachTermCountsIndividually() { - final TermsBuilder aggregation = AggregationBuilders.terms("top_tags").field("tags") - .order(Terms.Order.aggregation("_count", false)); + final TermsAggregationBuilder aggregation = AggregationBuilders.terms("top_tags").field("tags") + .order(Terms.Order.count(false)); final SearchResponse response = client.prepareSearch("blog").setTypes("article").addAggregation(aggregation) .execute().actionGet(); @@ -194,7 +195,7 @@ public class ElasticSearchQueryIntegrationTest { @Test public void givenBoolQuery_whenQueryByAuthorsName_thenFoundArticlesByThatAuthorAndFilteredTag() { - final QueryBuilder builder = boolQuery().must(nestedQuery("authors", boolQuery().must(termQuery("authors.name", "doe")))) + final QueryBuilder builder = boolQuery().must(nestedQuery("authors", boolQuery().must(termQuery("authors.name", "doe")), ScoreMode.None)) .filter(termQuery("tags", "elasticsearch")); final SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(builder) From fc02400f5f01084a82ba39a851e053dad946c49a Mon Sep 17 00:00:00 2001 From: Alejandro Gervasio Date: Sat, 28 Jul 2018 03:44:51 -0300 Subject: [PATCH 052/298] BAEL-1818 A Simple Guide to Connection Pooling in Java (#4823) * Initial Commit * Update parent pom.xml * Update BasicConnectionPool class * Update BasicConnectionPool class * BAEL-1818 removed code from core-java module, cleaned up a little pom files * BAEL-1818 moved the code from connectionpool.connectionpools package to connectionpool --- core-java-persistence/pom.xml | 59 ++++++ .../connectionpool}/BasicConnectionPool.java | 177 +++++++++--------- .../connectionpool}/C3poDataSource.java | 54 +++--- .../connectionpool}/ConnectionPool.java | 40 ++-- .../connectionpool}/DBCPDataSource.java | 50 ++--- .../connectionpool}/HikariCPDataSource.java | 56 +++--- .../BasicConnectionPoolUnitTest.java | 4 +- .../C3poDataSourceUnitTest.java | 1 - .../DBCPDataSourceUnitTest.java | 1 - .../HikariCPDataSourceUnitTest.java | 1 - core-java/pom.xml | 20 -- pom.xml | 25 ++- 12 files changed, 267 insertions(+), 221 deletions(-) create mode 100644 core-java-persistence/pom.xml rename {core-java/src/main/java/com/baeldung/connectionpool/connectionpools => core-java-persistence/src/main/java/com/baeldung/connectionpool}/BasicConnectionPool.java (93%) rename {core-java/src/main/java/com/baeldung/connectionpool/connectionpools => core-java-persistence/src/main/java/com/baeldung/connectionpool}/C3poDataSource.java (89%) rename {core-java/src/main/java/com/baeldung/connectionpool/connectionpools => core-java-persistence/src/main/java/com/baeldung/connectionpool}/ConnectionPool.java (66%) rename {core-java/src/main/java/com/baeldung/connectionpool/connectionpools => core-java-persistence/src/main/java/com/baeldung/connectionpool}/DBCPDataSource.java (88%) rename {core-java/src/main/java/com/baeldung/connectionpool/connectionpools => core-java-persistence/src/main/java/com/baeldung/connectionpool}/HikariCPDataSource.java (91%) rename {core-java => core-java-persistence}/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java (91%) rename {core-java => core-java-persistence}/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java (81%) rename {core-java => core-java-persistence}/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java (81%) rename {core-java => core-java-persistence}/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java (81%) diff --git a/core-java-persistence/pom.xml b/core-java-persistence/pom.xml new file mode 100644 index 0000000000..0cb142c7b8 --- /dev/null +++ b/core-java-persistence/pom.xml @@ -0,0 +1,59 @@ + + 4.0.0 + com.baeldung.core-java-persistence + core-java-persistence + 0.1.0-SNAPSHOT + jar + core-java-persistence + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + org.assertj + assertj-core + ${assertj-core.version} + test + + + com.h2database + h2 + ${h2database.version} + + + org.apache.commons + commons-dbcp2 + ${commons-dbcp2.version} + + + com.zaxxer + HikariCP + ${HikariCP.version} + + + com.mchange + c3p0 + ${c3p0.version} + + + + core-java-persistence + + + src/main/resources + true + + + + + 3.10.0 + 1.4.197 + 2.4.0 + 3.2.0 + 0.9.5.2 + + \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/BasicConnectionPool.java b/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java similarity index 93% rename from core-java/src/main/java/com/baeldung/connectionpool/connectionpools/BasicConnectionPool.java rename to core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java index 1934d0cfc2..289db18c53 100644 --- a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/BasicConnectionPool.java +++ b/core-java-persistence/src/main/java/com/baeldung/connectionpool/BasicConnectionPool.java @@ -1,85 +1,92 @@ -package com.baeldung.connectionpool.connectionpools; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -public class BasicConnectionPool implements ConnectionPool { - - private final String url; - private final String user; - private final String password; - private final List connectionPool; - private final List usedConnections = new ArrayList<>(); - private static final int INITIAL_POOL_SIZE = 10; - private final int MAX_POOL_SIZE = 20; - - public static BasicConnectionPool create(String url, String user, String password) throws SQLException { - List pool = new ArrayList<>(INITIAL_POOL_SIZE); - for (int i = 0; i < INITIAL_POOL_SIZE; i++) { - pool.add(createConnection(url, user, password)); - } - return new BasicConnectionPool(url, user, password, pool); - } - - private BasicConnectionPool(String url, String user, String password, List connectionPool) { - this.url = url; - this.user = user; - this.password = password; - this.connectionPool = connectionPool; - } - - @Override - public Connection getConnection() throws SQLException { - if (connectionPool.isEmpty()) { - if (usedConnections.size() < MAX_POOL_SIZE) { - connectionPool.add(createConnection(url, user, password)); - } else { - throw new RuntimeException("Maximum pool size reached, no available connections!"); - } - } - - Connection connection = connectionPool.remove(connectionPool.size() - 1); - usedConnections.add(connection); - return connection; - } - - @Override - public boolean releaseConnection(Connection connection) { - connectionPool.add(connection); - return usedConnections.remove(connection); - } - - private static Connection createConnection(String url, String user, String password) throws SQLException { - return DriverManager.getConnection(url, user, password); - } - - public int getSize() { - return connectionPool.size() + usedConnections.size(); - } - - @Override - public String getUrl() { - return url; - } - - @Override - public String getUser() { - return user; - } - - @Override - public String getPassword() { - return password; - } - - public void shutdown() throws SQLException { - usedConnections.forEach(this::releaseConnection); - for (Connection c : connectionPool) { - c.close(); - } - connectionPool.clear(); - } -} +package com.baeldung.connectionpool; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +public class BasicConnectionPool implements ConnectionPool { + + private final String url; + private final String user; + private final String password; + private final List connectionPool; + private final List usedConnections = new ArrayList<>(); + private static final int INITIAL_POOL_SIZE = 10; + private final int MAX_POOL_SIZE = 20; + + public static BasicConnectionPool create(String url, String user, String password) throws SQLException { + List pool = new ArrayList<>(INITIAL_POOL_SIZE); + for (int i = 0; i < INITIAL_POOL_SIZE; i++) { + pool.add(createConnection(url, user, password)); + } + return new BasicConnectionPool(url, user, password, pool); + } + + private BasicConnectionPool(String url, String user, String password, List connectionPool) { + this.url = url; + this.user = user; + this.password = password; + this.connectionPool = connectionPool; + } + + @Override + public Connection getConnection() throws SQLException { + if (connectionPool.isEmpty()) { + if (usedConnections.size() < MAX_POOL_SIZE) { + connectionPool.add(createConnection(url, user, password)); + } else { + throw new RuntimeException("Maximum pool size reached, no available connections!"); + } + } + + Connection connection = connectionPool.remove(connectionPool.size() - 1); + usedConnections.add(connection); + return connection; + } + + @Override + public boolean releaseConnection(Connection connection) { + connectionPool.add(connection); + return usedConnections.remove(connection); + } + + private static Connection createConnection(String url, String user, String password) throws SQLException { + return DriverManager.getConnection(url, user, password); + } + + @Override + public int getSize() { + return connectionPool.size() + usedConnections.size(); + } + + @Override + public List getConnectionPool() { + return connectionPool; + } + + @Override + public String getUrl() { + return url; + } + + @Override + public String getUser() { + return user; + } + + @Override + public String getPassword() { + return password; + } + + @Override + public void shutdown() throws SQLException { + usedConnections.forEach(this::releaseConnection); + for (Connection c : connectionPool) { + c.close(); + } + connectionPool.clear(); + } +} diff --git a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/C3poDataSource.java b/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java similarity index 89% rename from core-java/src/main/java/com/baeldung/connectionpool/connectionpools/C3poDataSource.java rename to core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java index 5b91f707a9..78642459d5 100644 --- a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/C3poDataSource.java +++ b/core-java-persistence/src/main/java/com/baeldung/connectionpool/C3poDataSource.java @@ -1,28 +1,28 @@ -package com.baeldung.connectionpool.connectionpools; - -import com.mchange.v2.c3p0.ComboPooledDataSource; -import java.beans.PropertyVetoException; -import java.sql.Connection; -import java.sql.SQLException; - -public class C3poDataSource { - - private static final ComboPooledDataSource cpds = new ComboPooledDataSource(); - - static { - try { - cpds.setDriverClass("org.h2.Driver"); - cpds.setJdbcUrl("jdbc:h2:mem:test"); - cpds.setUser("user"); - cpds.setPassword("password"); - } catch (PropertyVetoException e) { - e.printStackTrace(); - } - } - - public static Connection getConnection() throws SQLException { - return cpds.getConnection(); - } - - private C3poDataSource(){} +package com.baeldung.connectionpool; + +import com.mchange.v2.c3p0.ComboPooledDataSource; +import java.beans.PropertyVetoException; +import java.sql.Connection; +import java.sql.SQLException; + +public class C3poDataSource { + + private static final ComboPooledDataSource cpds = new ComboPooledDataSource(); + + static { + try { + cpds.setDriverClass("org.h2.Driver"); + cpds.setJdbcUrl("jdbc:h2:mem:test"); + cpds.setUser("user"); + cpds.setPassword("password"); + } catch (PropertyVetoException e) { + e.printStackTrace(); + } + } + + public static Connection getConnection() throws SQLException { + return cpds.getConnection(); + } + + private C3poDataSource(){} } \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/ConnectionPool.java b/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java similarity index 66% rename from core-java/src/main/java/com/baeldung/connectionpool/connectionpools/ConnectionPool.java rename to core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java index 3d5ad06c3d..fa9355721b 100644 --- a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/ConnectionPool.java +++ b/core-java-persistence/src/main/java/com/baeldung/connectionpool/ConnectionPool.java @@ -1,18 +1,24 @@ -package com.baeldung.connectionpool.connectionpools; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.List; - -public interface ConnectionPool { - - Connection getConnection() throws SQLException; - - boolean releaseConnection(Connection connection); - - String getUrl(); - - String getUser(); - - String getPassword(); +package com.baeldung.connectionpool; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.List; + +public interface ConnectionPool { + + Connection getConnection() throws SQLException; + + boolean releaseConnection(Connection connection); + + List getConnectionPool(); + + int getSize(); + + String getUrl(); + + String getUser(); + + String getPassword(); + + void shutdown() throws SQLException;; } \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/DBCPDataSource.java b/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java similarity index 88% rename from core-java/src/main/java/com/baeldung/connectionpool/connectionpools/DBCPDataSource.java rename to core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java index 2f33cde883..1e33a08d46 100644 --- a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/DBCPDataSource.java +++ b/core-java-persistence/src/main/java/com/baeldung/connectionpool/DBCPDataSource.java @@ -1,25 +1,25 @@ -package com.baeldung.connectionpool.connectionpools; - -import java.sql.Connection; -import java.sql.SQLException; -import org.apache.commons.dbcp2.BasicDataSource; - -public class DBCPDataSource { - - private static final BasicDataSource ds = new BasicDataSource(); - - static { - ds.setUrl("jdbc:h2:mem:test"); - ds.setUsername("user"); - ds.setPassword("password"); - ds.setMinIdle(5); - ds.setMaxIdle(10); - ds.setMaxOpenPreparedStatements(100); - } - - public static Connection getConnection() throws SQLException { - return ds.getConnection(); - } - - private DBCPDataSource(){} -} +package com.baeldung.connectionpool; + +import java.sql.Connection; +import java.sql.SQLException; +import org.apache.commons.dbcp2.BasicDataSource; + +public class DBCPDataSource { + + private static final BasicDataSource ds = new BasicDataSource(); + + static { + ds.setUrl("jdbc:h2:mem:test"); + ds.setUsername("user"); + ds.setPassword("password"); + ds.setMinIdle(5); + ds.setMaxIdle(10); + ds.setMaxOpenPreparedStatements(100); + } + + public static Connection getConnection() throws SQLException { + return ds.getConnection(); + } + + private DBCPDataSource(){} +} diff --git a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/HikariCPDataSource.java b/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java similarity index 91% rename from core-java/src/main/java/com/baeldung/connectionpool/connectionpools/HikariCPDataSource.java rename to core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java index 5ed2de181d..cc0cc24520 100644 --- a/core-java/src/main/java/com/baeldung/connectionpool/connectionpools/HikariCPDataSource.java +++ b/core-java-persistence/src/main/java/com/baeldung/connectionpool/HikariCPDataSource.java @@ -1,28 +1,28 @@ -package com.baeldung.connectionpool.connectionpools; - -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; -import java.sql.Connection; -import java.sql.SQLException; - -public class HikariCPDataSource { - - private static final HikariConfig config = new HikariConfig(); - private static final HikariDataSource ds; - - static { - config.setJdbcUrl("jdbc:h2:mem:test"); - config.setUsername("user"); - config.setPassword("password"); - config.addDataSourceProperty("cachePrepStmts", "true"); - config.addDataSourceProperty("prepStmtCacheSize", "250"); - config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); - ds = new HikariDataSource(config); - } - - public static Connection getConnection() throws SQLException { - return ds.getConnection(); - } - - private HikariCPDataSource(){} -} +package com.baeldung.connectionpool; + +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import java.sql.Connection; +import java.sql.SQLException; + +public class HikariCPDataSource { + + private static final HikariConfig config = new HikariConfig(); + private static final HikariDataSource ds; + + static { + config.setJdbcUrl("jdbc:h2:mem:test"); + config.setUsername("user"); + config.setPassword("password"); + config.addDataSourceProperty("cachePrepStmts", "true"); + config.addDataSourceProperty("prepStmtCacheSize", "250"); + config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + ds = new HikariDataSource(config); + } + + public static Connection getConnection() throws SQLException { + return ds.getConnection(); + } + + private HikariCPDataSource(){} +} diff --git a/core-java/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java b/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java similarity index 91% rename from core-java/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java rename to core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java index 5edc6bba94..479cd0db25 100644 --- a/core-java/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java +++ b/core-java-persistence/src/test/java/com/baeldung/connectionpool/BasicConnectionPoolUnitTest.java @@ -1,10 +1,8 @@ package com.baeldung.connectionpool; -import com.baeldung.connectionpool.connectionpools.BasicConnectionPool; -import com.baeldung.connectionpool.connectionpools.ConnectionPool; import java.sql.Connection; import java.sql.SQLException; -import java.util.List; + import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/core-java/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java b/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java similarity index 81% rename from core-java/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java rename to core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java index a02daa40f6..a07fa9e74b 100644 --- a/core-java/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java +++ b/core-java-persistence/src/test/java/com/baeldung/connectionpool/C3poDataSourceUnitTest.java @@ -1,6 +1,5 @@ package com.baeldung.connectionpool; -import com.baeldung.connectionpool.connectionpools.C3poDataSource; import java.sql.SQLException; import static org.junit.Assert.assertTrue; import org.junit.Test; diff --git a/core-java/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java b/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java similarity index 81% rename from core-java/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java rename to core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java index 9583eedf4b..43aaf330b6 100644 --- a/core-java/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java +++ b/core-java-persistence/src/test/java/com/baeldung/connectionpool/DBCPDataSourceUnitTest.java @@ -1,6 +1,5 @@ package com.baeldung.connectionpool; -import com.baeldung.connectionpool.connectionpools.DBCPDataSource; import java.sql.SQLException; import static org.junit.Assert.assertTrue; import org.junit.Test; diff --git a/core-java/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java b/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java similarity index 81% rename from core-java/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java rename to core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java index 6b78815797..b20ce70efd 100644 --- a/core-java/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java +++ b/core-java-persistence/src/test/java/com/baeldung/connectionpool/HikariCPDataSourceUnitTest.java @@ -1,6 +1,5 @@ package com.baeldung.connectionpool; -import com.baeldung.connectionpool.connectionpools.HikariCPDataSource; import java.sql.SQLException; import static org.junit.Assert.assertTrue; import org.junit.Test; diff --git a/core-java/pom.xml b/core-java/pom.xml index 0b69685e14..b83cb478d4 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -158,21 +158,6 @@ jmimemagic ${jmime-magic.version} - - org.apache.commons - commons-dbcp2 - ${commons-dbcp2.version} - - - com.zaxxer - HikariCP - ${HikariCP.version} - - - com.mchange - c3p0 - ${c3p0.version} - org.javassist @@ -544,11 +529,6 @@ 3.10.0 - - 2.4.0 - 3.2.0 - 0.9.5.2 - 2.19.1 4.3.4.RELEASE diff --git a/pom.xml b/pom.xml index 263e4df637..1730449509 100644 --- a/pom.xml +++ b/pom.xml @@ -312,6 +312,7 @@ core-java-collections core-java-io core-java-8 + core-java-persistence core-kotlin core-groovy core-java-concurrency @@ -877,7 +878,7 @@ spring-static-resources hazelcast hbase - + hystrix image-processing immutables @@ -906,11 +907,11 @@ linkrest logging-modules/log-mdc logging-modules/log4j - + logging-modules/logback lombok mapstruct - + maven mesos-marathon msf4j @@ -962,25 +963,25 @@ spring-cucumber spring-ejb spring-aop - + persistence-modules/spring-data-dynamodb spring-data-keyvalue spring-data-mongodb persistence-modules/spring-data-neo4j - + spring-data-rest persistence-modules/spring-data-solr spring-dispatcher-servlet spring-exceptions spring-freemarker persistence-modules/spring-hibernate-3 - + persistence-modules/spring-hibernate-5 persistence-modules/spring-data-eclipselink spring-integration spring-jenkins-pipeline spring-jersey - + spring-jms spring-jooq persistence-modules/spring-jpa @@ -1041,13 +1042,13 @@ testing-modules/testing testing-modules/testng video-tutorials - + xmlunit-2 struts-2 apache-velocity apache-solrj rabbitmq - + persistence-modules/spring-data-gemfire mybatis spring-drools @@ -1090,7 +1091,7 @@ vertx metrics httpclient - + jmeter --> @@ -1233,6 +1234,4 @@ 3.8 - - - + \ No newline at end of file From 9fee109ee9fb77ac1b3a1797fe8f5bf55742bfb9 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sat, 28 Jul 2018 09:35:39 +0200 Subject: [PATCH 053/298] added link --- spring-boot-ops/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-ops/README.md b/spring-boot-ops/README.md index 9760e73576..c125c96c36 100644 --- a/spring-boot-ops/README.md +++ b/spring-boot-ops/README.md @@ -8,4 +8,5 @@ - [A Quick Guide to Maven Wrapper](http://www.baeldung.com/maven-wrapper) - [Shutdown a Spring Boot Application](http://www.baeldung.com/spring-boot-shutdown) - [Spring Boot Console Application](http://www.baeldung.com/spring-boot-console-app) + - [Comparing Embedded Servlet Containers in Spring Boot](http://www.baeldung.com/spring-boot-servlet-containers) From 33889d0cd7bcb78efd3586e2d1082edf6d8487d2 Mon Sep 17 00:00:00 2001 From: Eugen Paraschiv Date: Sat, 28 Jul 2018 11:01:48 +0300 Subject: [PATCH 054/298] integration-lite trying out a few modules --- pom.xml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 1730449509..6f2351b56f 100644 --- a/pom.xml +++ b/pom.xml @@ -859,7 +859,7 @@ core-java-io core-java-8 core-groovy - core-java-concurrency + couchbase deltaspike dozer @@ -1078,6 +1078,12 @@ apache-meecrowave testing-modules/junit-abstract + spring-hibernate4 + xml + vertx + metrics + httpclient + @@ -1108,6 +1109,7 @@ core-java google-web-toolkit spring-security-mvc-custom + core-java-concurrency --> @@ -1170,7 +1172,7 @@ spring-security-mvc-custom hibernate5 spring-data-elasticsearch - + core-java-concurrency From d1f2917c3394157323a5b3668833953193228052 Mon Sep 17 00:00:00 2001 From: db Date: Sat, 28 Jul 2018 13:06:41 +0100 Subject: [PATCH 055/298] moved PrincipalExtractor and AuthoritiesExtractor example to spring-5-security module --- spring-5-security/pom.xml | 7 +++ .../ExtractorsApplication.java | 20 +++++++ .../configuration/SecurityConfig.java | 10 ++-- .../extractor/CustomAuthoritiesExtractor.java | 8 +-- .../extractor/CustomPrincipalExtractor.java | 2 +- .../application-oauth2-extractors.properties | 6 +++ .../templates/oauth2_extractors.html | 0 .../oauth2extractors/ExtractorsUnitTest.java | 9 ++-- spring-security-sso/pom.xml | 1 - .../pom.xml | 53 ------------------- .../main/java/org/baeldung/Application.java | 18 ------- .../src/main/resources/application.yml | 14 ----- 12 files changed, 50 insertions(+), 98 deletions(-) create mode 100644 spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java rename {spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung => spring-5-security/src/main/java/com/baeldung/oauth2extractors}/configuration/SecurityConfig.java (79%) rename {spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung => spring-5-security/src/main/java/com/baeldung/oauth2extractors}/extractor/CustomAuthoritiesExtractor.java (67%) rename {spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung => spring-5-security/src/main/java/com/baeldung/oauth2extractors}/extractor/CustomPrincipalExtractor.java (86%) create mode 100644 spring-5-security/src/main/resources/application-oauth2-extractors.properties rename spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/templates/index.html => spring-5-security/src/main/resources/templates/oauth2_extractors.html (100%) rename spring-security-sso/spring-security-principal-authorities-extractor/src/test/java/ApplicationUnitTest.java => spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java (85%) delete mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/pom.xml delete mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/Application.java delete mode 100644 spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/application.yml diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index 8cca2ed916..d0ea46928f 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -58,6 +58,13 @@ spring-security-test test + + + + org.springframework.security.oauth.boot + spring-security-oauth2-autoconfigure + 2.0.1.RELEASE + diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java new file mode 100644 index 0000000000..c9a18d1599 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java @@ -0,0 +1,20 @@ +package com.baeldung.oauth2extractors; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@SpringBootApplication +@Controller +public class ExtractorsApplication { + public static void main(String[] args) { + SpringApplication.run(ExtractorsApplication.class, args); + } + + @RequestMapping("/") + public String index() { + return "oauth2_extractors"; + } + +} diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/configuration/SecurityConfig.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java similarity index 79% rename from spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/configuration/SecurityConfig.java rename to spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java index 4de1932392..cc1258d14b 100644 --- a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/configuration/SecurityConfig.java +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java @@ -1,16 +1,18 @@ -package org.baeldung.configuration; +package com.baeldung.oauth2extractors.configuration; -import org.baeldung.extractor.CustomAuthoritiesExtractor; -import org.baeldung.extractor.CustomPrincipalExtractor; +import com.baeldung.oauth2extractors.extractor.CustomAuthoritiesExtractor; +import com.baeldung.oauth2extractors.extractor.CustomPrincipalExtractor; import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor; import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration +@PropertySource("application-oauth2-extractors.properties") @EnableOAuth2Sso public class SecurityConfig extends WebSecurityConfigurerAdapter { @@ -35,4 +37,4 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { public AuthoritiesExtractor authoritiesExtractor() { return new CustomAuthoritiesExtractor(); } -} +} \ No newline at end of file diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomAuthoritiesExtractor.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomAuthoritiesExtractor.java similarity index 67% rename from spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomAuthoritiesExtractor.java rename to spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomAuthoritiesExtractor.java index c1a78634aa..ad23f6c32f 100644 --- a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomAuthoritiesExtractor.java +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomAuthoritiesExtractor.java @@ -1,4 +1,4 @@ -package org.baeldung.extractor; +package com.baeldung.oauth2extractors.extractor; import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor; import org.springframework.security.core.GrantedAuthority; @@ -10,8 +10,10 @@ import java.util.Map; import java.util.Objects; public class CustomAuthoritiesExtractor implements AuthoritiesExtractor { - private static final List GITHUB_FREE_AUTHORITIES = AuthorityUtils.commaSeparatedStringToAuthorityList("GITHUB_USER,GITHUB_USER_FREE"); - private static final List GITHUB_SUBSCRIBED_AUTHORITIES = AuthorityUtils.commaSeparatedStringToAuthorityList("GITHUB_USER,GITHUB_USER_SUBSCRIBED"); + private List GITHUB_FREE_AUTHORITIES = AuthorityUtils + .commaSeparatedStringToAuthorityList("GITHUB_USER,GITHUB_USER_FREE"); + private List GITHUB_SUBSCRIBED_AUTHORITIES = AuthorityUtils + .commaSeparatedStringToAuthorityList("GITHUB_USER,GITHUB_USER_SUBSCRIBED"); @Override public List extractAuthorities(Map map) { diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomPrincipalExtractor.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomPrincipalExtractor.java similarity index 86% rename from spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomPrincipalExtractor.java rename to spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomPrincipalExtractor.java index d356c07e3b..c35522f0f3 100644 --- a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/extractor/CustomPrincipalExtractor.java +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomPrincipalExtractor.java @@ -1,4 +1,4 @@ -package org.baeldung.extractor; +package com.baeldung.oauth2extractors.extractor; import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor; diff --git a/spring-5-security/src/main/resources/application-oauth2-extractors.properties b/spring-5-security/src/main/resources/application-oauth2-extractors.properties new file mode 100644 index 0000000000..51d6ee7d6e --- /dev/null +++ b/spring-5-security/src/main/resources/application-oauth2-extractors.properties @@ -0,0 +1,6 @@ +security.oauth2.client.client-id=89a7c4facbb3434d599d +security.oauth2.client.client-secret=9b3b08e4a340bd20e866787e4645b54f73d74b6a +security.oauth2.client.access-token-uri=https://github.com/login/oauth/access_token +security.oauth2.client.user-authorization-uri=https://github.com/login/oauth/authorize +security.oauth2.client.scope=read:user,user:email +security.oauth2.resource.user-info-uri=https://api.github.com/user \ No newline at end of file diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/templates/index.html b/spring-5-security/src/main/resources/templates/oauth2_extractors.html similarity index 100% rename from spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/templates/index.html rename to spring-5-security/src/main/resources/templates/oauth2_extractors.html diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/test/java/ApplicationUnitTest.java b/spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java similarity index 85% rename from spring-security-sso/spring-security-principal-authorities-extractor/src/test/java/ApplicationUnitTest.java rename to spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java index c14cbc9866..164bc4933f 100644 --- a/spring-security-sso/spring-security-principal-authorities-extractor/src/test/java/ApplicationUnitTest.java +++ b/spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java @@ -1,5 +1,6 @@ -import org.baeldung.Application; -import org.baeldung.configuration.SecurityConfig; +package com.baeldung.oauth2extractors; + +import com.baeldung.oauth2extractors.configuration.SecurityConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -18,9 +19,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = ExtractorsApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ContextConfiguration(classes = {SecurityConfig.class}) -public class ApplicationUnitTest { +public class ExtractorsUnitTest { @Autowired private WebApplicationContext context; diff --git a/spring-security-sso/pom.xml b/spring-security-sso/pom.xml index 0cf468c2e3..764e899640 100644 --- a/spring-security-sso/pom.xml +++ b/spring-security-sso/pom.xml @@ -19,7 +19,6 @@ spring-security-sso-auth-server spring-security-sso-ui spring-security-sso-ui-2 - spring-security-principal-authorities-extractor diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/pom.xml b/spring-security-sso/spring-security-principal-authorities-extractor/pom.xml deleted file mode 100644 index 5bd8de9c16..0000000000 --- a/spring-security-sso/spring-security-principal-authorities-extractor/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - spring-security-sso - org.baeldung - 1.0.0-SNAPSHOT - - 4.0.0 - - spring-security-principal-authorities-extractor - - - - org.springframework.boot - spring-boot-starter-security - - - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - ${oauth-auto.version} - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - - org.thymeleaf.extras - thymeleaf-extras-springsecurity4 - - - - org.springframework.boot - spring-boot-starter-test - test - - - - org.springframework.security - spring-security-test - test - - - \ No newline at end of file diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/Application.java b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/Application.java deleted file mode 100644 index 0dfbbef86e..0000000000 --- a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/java/org/baeldung/Application.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.GetMapping; - -@SpringBootApplication -public class Application { - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - - @GetMapping("/") - public String homePage(Model model) { - return "index"; - } -} diff --git a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/application.yml b/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/application.yml deleted file mode 100644 index 324df694df..0000000000 --- a/spring-security-sso/spring-security-principal-authorities-extractor/src/main/resources/application.yml +++ /dev/null @@ -1,14 +0,0 @@ -security: - oauth2: - client: - clientId: 89a7c4facbb3434d599d - clientSecret: 9b3b08e4a340bd20e866787e4645b54f73d74b6a - accessTokenUri: https://github.com/login/oauth/access_token - userAuthorizationUri: https://github.com/login/oauth/authorize - clientAuthenticationScheme: form - scope: read:user,user:email - resource: - userInfoUri: https://api.github.com/user -spring: - thymeleaf: - cache: false \ No newline at end of file From 9940bf29608ce6cb0acafe046f30f77a96db0e90 Mon Sep 17 00:00:00 2001 From: db Date: Sat, 28 Jul 2018 13:09:46 +0100 Subject: [PATCH 056/298] removed comment on pom --- spring-5-security/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index d0ea46928f..7024e6f873 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -59,7 +59,6 @@ test - org.springframework.security.oauth.boot spring-security-oauth2-autoconfigure From a1d1d6b16f5e44e4fb7f3a693cc3c89d9cb47a34 Mon Sep 17 00:00:00 2001 From: Philippe Date: Sat, 28 Jul 2018 13:37:39 -0300 Subject: [PATCH 057/298] [refs#BAEL-1992] Minor refactoring --- mqtt/README.md | 4 ++ .../mqtt/EngineTemperatureSensorLiveTest.java | 45 ++++++++++--------- 2 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 mqtt/README.md diff --git a/mqtt/README.md b/mqtt/README.md new file mode 100644 index 0000000000..5a388aab4c --- /dev/null +++ b/mqtt/README.md @@ -0,0 +1,4 @@ +### Relevant Articles: +================================ + +- [MQTT Client in Java](http://www.baeldung.com/mqtt-client) diff --git a/mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java b/mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java index 94031b5415..b1c0002888 100644 --- a/mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java +++ b/mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java @@ -24,12 +24,11 @@ public class EngineTemperatureSensorLiveTest { @Test public void whenSendSingleMessage_thenSuccess() throws Exception { - String senderId = UUID.randomUUID().toString(); - MqttClient sender = new MqttClient("tcp://iot.eclipse.org:1883",senderId); - - String receiverId = UUID.randomUUID().toString(); - MqttClient receiver = new MqttClient("tcp://iot.eclipse.org:1883",receiverId); + String publisherId = UUID.randomUUID().toString(); + MqttClient publisher = new MqttClient("tcp://iot.eclipse.org:1883",publisherId); + String subscriberId = UUID.randomUUID().toString(); + MqttClient subscriber = new MqttClient("tcp://iot.eclipse.org:1883",subscriberId); MqttConnectOptions options = new MqttConnectOptions(); options.setAutomaticReconnect(true); @@ -37,33 +36,34 @@ public class EngineTemperatureSensorLiveTest { options.setConnectionTimeout(10); - receiver.connect(options); - sender.connect(options); + subscriber.connect(options); + publisher.connect(options); CountDownLatch receivedSignal = new CountDownLatch(1); - receiver.subscribe(EngineTemperatureSensor.TOPIC, (topic, msg) -> { - log.info("[I41] Message received: topic={}, payload={}", topic, new String(msg.getPayload())); + subscriber.subscribe(EngineTemperatureSensor.TOPIC, (topic, msg) -> { + byte[] payload = msg.getPayload(); + log.info("[I46] Message received: topic={}, payload={}", topic, new String(payload)); receivedSignal.countDown(); }); - Callable target = new EngineTemperatureSensor(sender); + Callable target = new EngineTemperatureSensor(publisher); target.call(); receivedSignal.await(1, TimeUnit.MINUTES); - log.info("[I51] Success !"); + log.info("[I56] Success !"); } @Test public void whenSendMultipleMessages_thenSuccess() throws Exception { - String senderId = UUID.randomUUID().toString(); - MqttClient sender = new MqttClient("tcp://iot.eclipse.org:1883",senderId); + String publisherId = UUID.randomUUID().toString(); + MqttClient publisher = new MqttClient("tcp://iot.eclipse.org:1883",publisherId); - String receiverId = UUID.randomUUID().toString(); - MqttClient receiver = new MqttClient("tcp://iot.eclipse.org:1883",receiverId); + String subscriberId = UUID.randomUUID().toString(); + MqttClient subscriber = new MqttClient("tcp://iot.eclipse.org:1883",subscriberId); MqttConnectOptions options = new MqttConnectOptions(); @@ -72,18 +72,19 @@ public class EngineTemperatureSensorLiveTest { options.setConnectionTimeout(10); - sender.connect(options); - receiver.connect(options); + publisher.connect(options); + subscriber.connect(options); CountDownLatch receivedSignal = new CountDownLatch(10); - receiver.subscribe(EngineTemperatureSensor.TOPIC, (topic, msg) -> { - log.info("[I41] Message received: topic={}, payload={}", topic, new String(msg.getPayload())); + subscriber.subscribe(EngineTemperatureSensor.TOPIC, (topic, msg) -> { + byte[] payload = msg.getPayload(); + log.info("[I82] Message received: topic={}, payload={}", topic, new String(payload)); receivedSignal.countDown(); }); - Callable target = new EngineTemperatureSensor(sender); + Callable target = new EngineTemperatureSensor(publisher); ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); executor.scheduleAtFixedRate(() -> { @@ -96,12 +97,12 @@ public class EngineTemperatureSensorLiveTest { }, 1, 1, TimeUnit.SECONDS); - receivedSignal.await(1, TimeUnit.DAYS); + receivedSignal.await(1, TimeUnit.MINUTES); executor.shutdown(); assertTrue(receivedSignal.getCount() == 0 , "Countdown should be zero"); - log.info("[I51] Success !"); + log.info("[I105] Success !"); } From 7ff4d2ea4c9d0e21091108d9e53824d2ed520e0e Mon Sep 17 00:00:00 2001 From: Dhrubajyoti Bhattacharjee Date: Sun, 29 Jul 2018 00:14:05 +0530 Subject: [PATCH 058/298] BAEL-1983 Intialize a HashMap in Java (#4819) --- .../maps/initialize/MapsInitializer.java | 33 ++++++++ .../java/map/initialize/MapInitializer.java | 80 +++++++++++++++++++ .../initialize/MapInitializerUnitTest.java | 27 +++++++ 3 files changed, 140 insertions(+) create mode 100644 core-java-9/src/main/java/com/baeldung/java9/maps/initialize/MapsInitializer.java create mode 100644 core-java-collections/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java create mode 100644 core-java-collections/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java diff --git a/core-java-9/src/main/java/com/baeldung/java9/maps/initialize/MapsInitializer.java b/core-java-9/src/main/java/com/baeldung/java9/maps/initialize/MapsInitializer.java new file mode 100644 index 0000000000..2a8ce588bb --- /dev/null +++ b/core-java-9/src/main/java/com/baeldung/java9/maps/initialize/MapsInitializer.java @@ -0,0 +1,33 @@ +package com.baeldung.java9.maps.initialize; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.Map; + +public class MapsInitializer { + + @SuppressWarnings("unused") + public void createMapWithMapOf() { + Map emptyMap = Map.of(); + Map singletonMap = Map.of("key1", "value"); + Map map = Map.of("key1","value1", "key2", "value2"); + } + + public void createMapWithMapEntries() { + Map map = Map.ofEntries( + new AbstractMap.SimpleEntry("name", "John"), + new AbstractMap.SimpleEntry("city", "budapest"), + new AbstractMap.SimpleEntry("zip", "000000"), + new AbstractMap.SimpleEntry("home", "1231231231") + ); + } + + @SuppressWarnings("unused") + public void createMutableMaps() { + Map map = new HashMap (Map.of("key1","value1", "key2", "value2")); + Map map2 = new HashMap ( Map.ofEntries( + new AbstractMap.SimpleEntry("name", "John"), + new AbstractMap.SimpleEntry("city", "budapest"))); + + } +} diff --git a/core-java-collections/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java b/core-java-collections/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java new file mode 100644 index 0000000000..4dbaceac62 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/java/map/initialize/MapInitializer.java @@ -0,0 +1,80 @@ +package com.baeldung.java.map.initialize; + +import java.util.AbstractMap; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class MapInitializer { + + public static Map articleMapOne; + static { + articleMapOne = new HashMap<>(); + articleMapOne.put("ar01", "Intro to Map"); + articleMapOne.put("ar02", "Some article"); + } + + public static Map createSingletonMap() { + Map passwordMap = Collections.singletonMap("username1", "password1"); + return passwordMap; + + } + + public Map createEmptyMap() { + Map emptyMap = Collections.emptyMap(); + return emptyMap; + } + + public Map createUsingDoubleBrace() { + Map doubleBraceMap = new HashMap() { + + /** + * + */ + private static final long serialVersionUID = 1L; + + { + put("key1", "value1"); + put("key2", "value2"); + } + }; + return doubleBraceMap; + } + + public Map createMapUsingStreamStringArray() { + Map map = Stream.of(new String[][] { { "Hello", "World" }, { "John", "Doe" }, }) + .collect(Collectors.toMap(data -> data[0], data -> data[1])); + + return map; + } + + public Map createMapUsingStreamObjectArray() { + Map map = Stream.of(new Object[][] { { "data1", 1 }, { "data2", 2 }, }) + .collect(Collectors.toMap(data -> (String) data[0], data -> (Integer) data[1])); + + return map; + } + + public Map createMapUsingStreamSimpleEntry() { + Map map = Stream.of(new AbstractMap.SimpleEntry<>("idea", 1), new AbstractMap.SimpleEntry<>("mobile", 2)) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + return map; + } + + public Map createMapUsingStreamSimpleImmutableEntry() { + Map map = Stream.of(new AbstractMap.SimpleImmutableEntry<>("idea", 1), new AbstractMap.SimpleImmutableEntry<>("mobile", 2)) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + return map; + } + + public Map createImmutableMapWithStreams() { + Map map = Stream.of(new String[][] { { "Hello", "World" }, { "John", "Doe" }, }) + .collect(Collectors.collectingAndThen(Collectors.toMap(data -> data[0], data -> data[1]), Collections:: unmodifiableMap)); + return map; + + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java b/core-java-collections/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java new file mode 100644 index 0000000000..80a8983d6f --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/java/map/initialize/MapInitializerUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.java.map.initialize; + +import static org.junit.Assert.assertEquals; + +import java.util.Map; + +import org.junit.Test; + +public class MapInitializerUnitTest { + + @Test + public void givenStaticMap_whenUpdated_thenCorrect() { + + MapInitializer.articleMapOne.put("NewArticle1", "Convert array to List"); + + assertEquals(MapInitializer.articleMapOne.get("NewArticle1"), "Convert array to List"); + + } + + @Test(expected=UnsupportedOperationException.class) + public void givenSingleTonMap_whenEntriesAdded_throwsException() { + + Map map = MapInitializer.createSingletonMap(); + map.put("username2", "password2"); + } + +} From 61860cf7b8c411f2715a8ba57459d81c3ae38ba4 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 28 Jul 2018 22:24:38 +0300 Subject: [PATCH 059/298] move mqtt project --- libraries/pom.xml | 5 ++++ .../mqtt/EngineTemperatureSensor.java | 0 .../mqtt/EngineTemperatureSensorLiveTest.java | 0 mqtt/README.md | 4 ---- mqtt/pom.xml | 23 ------------------- 5 files changed, 5 insertions(+), 27 deletions(-) rename {mqtt => libraries}/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java (100%) rename {mqtt => libraries}/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java (100%) delete mode 100644 mqtt/README.md delete mode 100644 mqtt/pom.xml diff --git a/libraries/pom.xml b/libraries/pom.xml index 163f5872ce..909be87083 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -771,6 +771,11 @@ ${hamcrest-all.version} test + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + 1.2.0 + diff --git a/mqtt/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java b/libraries/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java similarity index 100% rename from mqtt/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java rename to libraries/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java diff --git a/mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java b/libraries/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java similarity index 100% rename from mqtt/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java rename to libraries/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java diff --git a/mqtt/README.md b/mqtt/README.md deleted file mode 100644 index 5a388aab4c..0000000000 --- a/mqtt/README.md +++ /dev/null @@ -1,4 +0,0 @@ -### Relevant Articles: -================================ - -- [MQTT Client in Java](http://www.baeldung.com/mqtt-client) diff --git a/mqtt/pom.xml b/mqtt/pom.xml deleted file mode 100644 index 346433aa69..0000000000 --- a/mqtt/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - org.baeldung - mqtt - 0.0.1-SNAPSHOT - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - org.eclipse.paho - org.eclipse.paho.client.mqttv3 - 1.2.0 - - - - - From 02d0b127a23c1827fb21d5472f4d16f209f3ef84 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sat, 28 Jul 2018 22:51:29 +0200 Subject: [PATCH 060/298] added link --- core-kotlin/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-kotlin/README.md b/core-kotlin/README.md index 51a99ea20c..9bef17e0d4 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -36,3 +36,4 @@ - [Working with Enums in Kotlin](http://www.baeldung.com/kotlin-enum) - [Create a Java and Kotlin Project with Maven](http://www.baeldung.com/kotlin-maven-java-project) - [Reflection with Kotlin](http://www.baeldung.com/kotlin-reflection) +- [Get a Random Number in Kotlin](http://www.baeldung.com/kotlin-random-number) From 748c94f23123391bd1372858d17471d828bd69f6 Mon Sep 17 00:00:00 2001 From: Felipe Santiago Corro Date: Sun, 29 Jul 2018 01:38:51 -0300 Subject: [PATCH 061/298] Add items to list in core-java-collections (#4841) --- .../java/com/baeldung/java/list/Flower.java | 28 ++++++++ .../listoflist/AddElementsToListUnitTest.java | 69 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 core-java-collections/src/main/java/com/baeldung/java/list/Flower.java create mode 100644 core-java-collections/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java diff --git a/core-java-collections/src/main/java/com/baeldung/java/list/Flower.java b/core-java-collections/src/main/java/com/baeldung/java/list/Flower.java new file mode 100644 index 0000000000..eb897ea72f --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/java/list/Flower.java @@ -0,0 +1,28 @@ +package com.baeldung.java.list; + +public class Flower { + + private String name; + private int petals; + + public Flower(String name, int petals) { + this.name = name; + this.petals = petals; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getPetals() { + return petals; + } + + public void setPetals(int petals) { + this.petals = petals; + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java b/core-java-collections/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java new file mode 100644 index 0000000000..299a87026f --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/list/listoflist/AddElementsToListUnitTest.java @@ -0,0 +1,69 @@ +package com.baeldung.list.listoflist; + +import com.baeldung.java.list.Flower; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import java.util.*; +import static org.junit.Assert.*; + +public class AddElementsToListUnitTest { + + List flowers; + + @Before + public void init() { + this.flowers = new ArrayList<>(Arrays.asList( + new Flower("Poppy", 12), + new Flower("Anemone", 8), + new Flower("Catmint", 12))); + } + @Test + public void givenAList_whenTargetListIsEmpty_thenReturnTargetListWithNewItems() { + List anotherList = new ArrayList<>(); + anotherList.addAll(flowers); + assertEquals(anotherList.size(), flowers.size()); + Assert.assertTrue(anotherList.containsAll(flowers)); + } + @Test + public void givenAList_whenTargetListIsEmpty_thenReturnTargetListWithOneModifiedElementByConstructor() { + List anotherList = new ArrayList<>(); + anotherList.addAll(flowers); + Flower flower = anotherList.get(0); + flower.setPetals(flowers.get(0).getPetals() * 3); + assertEquals(anotherList.size(), flowers.size()); + Assert.assertTrue(anotherList.containsAll(flowers)); + } + @Test + public void givenAListAndElements_whenUseCollectionsAddAll_thenAddElementsToTargetList() { + List target = new ArrayList<>(); + Collections.addAll(target, flowers.get(0), flowers.get(1), flowers.get(2), flowers.get(0)); + assertEquals(target.size(), 4); + } + @Test + public void givenTwoList_whenSourceListDoesNotHaveNullElements_thenAddElementsToTargetListSkipFirstElementByStreamProcess() { + List flowerVase = new ArrayList<>(); + flowers.stream() + .skip(1) + .forEachOrdered(flowerVase::add); + assertEquals(flowerVase.size() + 1, flowers.size()); + assertFalse(flowerVase.containsAll(flowers)); + } + @Test + public void givenTwoList_whenSourceListDoesNotHaveNullElements_thenAddElementsToTargetListFilteringElementsByStreamProcess() { + List flowerVase = new ArrayList<>(); + flowers.stream() + .filter(f -> f.getPetals() > 10) + .forEachOrdered(flowerVase::add); + assertEquals(flowerVase.size() + 1, flowers.size()); + assertFalse(flowerVase.containsAll(flowers)); + } + @Test + public void givenAList_whenListIsNotNull_thenAddElementsToListByStreamProcessWihtOptional() { + List target = new ArrayList<>(); + Optional.ofNullable(flowers) + .ifPresent(target::addAll); + assertNotNull(target); + assertEquals(target.size(), 3); + } +} From 578bcb7f79bdf0410a0144f5a765eba00e14e120 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 29 Jul 2018 00:06:59 +0530 Subject: [PATCH 062/298] [BAEL-7608] - Fixed spring-5-reactive integration tests --- .../com/baeldung/functional/FormHandler.java | 3 +-- .../functional/FunctionalWebApplication.java | 25 +++++------------- .../FurtherCorsConfigsController.java | 2 +- .../controllers/RegularRestController.java | 2 +- ...Spring5URLPatternUsingRouterFunctions.java | 25 ++++++------------ .../webflux/EmployeeCreationEvent.java | 6 ++++- .../webflux/EmployeeWebSocketHandler.java | 2 +- .../ReactiveWebSocketConfiguration.java | 7 +++-- .../websocket/ReactiveWebSocketHandler.java | 2 +- ...nctionalWebApplicationIntegrationTest.java | 16 ++++++----- ...rnUsingRouterFunctionsIntegrationTest.java | 12 +++++---- .../security/SecurityIntegrationTest.java | 2 +- .../client/WebTestClientIntegrationTest.java | 2 +- .../src/test/resources/baeldung-weekly.png | Bin 0 -> 28106 bytes 14 files changed, 49 insertions(+), 57 deletions(-) create mode 100644 spring-5-reactive/src/test/resources/baeldung-weekly.png diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java index 05069735bb..c4f8c9f41f 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/FormHandler.java @@ -34,8 +34,7 @@ public class FormHandler { private AtomicLong extractData(List dataBuffers) { AtomicLong atomicLong = new AtomicLong(0); - dataBuffers.forEach(d -> atomicLong.addAndGet(d.asByteBuffer() - .array().length)); + dataBuffers.forEach(d -> atomicLong.addAndGet(d.readableByteCount())); return atomicLong; } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java index 5a7d70d3db..4e914ab65e 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java @@ -12,13 +12,9 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; -import org.apache.catalina.Context; -import org.apache.catalina.startup.Tomcat; -import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; -import org.springframework.boot.web.server.WebServer; import org.springframework.core.io.ClassPathResource; import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; +import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; @@ -26,6 +22,8 @@ import org.springframework.web.server.WebHandler; import org.springframework.web.server.adapter.WebHttpHandlerBuilder; import reactor.core.publisher.Flux; +import reactor.ipc.netty.NettyContext; +import reactor.ipc.netty.http.server.HttpServer; public class FunctionalWebApplication { @@ -50,24 +48,15 @@ public class FunctionalWebApplication { }); } - WebServer start() throws Exception { + NettyContext start() throws Exception { WebHandler webHandler = (WebHandler) toHttpHandler(routingFunction()); HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler(webHandler) .filter(new IndexRewriteFilter()) .build(); - Tomcat tomcat = new Tomcat(); - tomcat.setHostname("localhost"); - tomcat.setPort(9090); - Context rootContext = tomcat.addContext("", System.getProperty("java.io.tmpdir")); - ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); - Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet); - rootContext.addServletMappingDecoded("/", "httpHandlerServlet"); - - TomcatWebServer server = new TomcatWebServer(tomcat); - server.start(); - return server; - + ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); + HttpServer server = HttpServer.create("localhost", 9090); + return server.newHandler(adapter).block(); } public static void main(String[] args) { diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/FurtherCorsConfigsController.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/FurtherCorsConfigsController.java index b6341c9af1..4358326df8 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/FurtherCorsConfigsController.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/FurtherCorsConfigsController.java @@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Mono; -@RestController +@RestController("FurtherCorsConfigsController-cors-on-global-config-and-more") @RequestMapping("/cors-on-global-config-and-more") public class FurtherCorsConfigsController { diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/RegularRestController.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/RegularRestController.java index 5945cfc9f2..e57e573146 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/RegularRestController.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/RegularRestController.java @@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Mono; -@RestController +@RestController("RegularRestController-cors-on-global-config") @RequestMapping("/cors-on-global-config") public class RegularRestController { diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctions.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctions.java index 78f40be57a..0de1bcb539 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctions.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctions.java @@ -6,19 +6,18 @@ import static org.springframework.web.reactive.function.server.RouterFunctions.r import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; import static org.springframework.web.reactive.function.server.ServerResponse.ok; -import org.apache.catalina.Context; -import org.apache.catalina.startup.Tomcat; -import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; -import org.springframework.boot.web.server.WebServer; import org.springframework.core.io.ClassPathResource; import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; +import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; import org.springframework.web.server.WebHandler; import org.springframework.web.server.adapter.WebHttpHandlerBuilder; +import reactor.ipc.netty.NettyContext; +import reactor.ipc.netty.http.server.HttpServer; + public class ExploreSpring5URLPatternUsingRouterFunctions { private RouterFunction routingFunction() { @@ -30,23 +29,15 @@ public class ExploreSpring5URLPatternUsingRouterFunctions { .and(RouterFunctions.resources("/files/{*filepaths}", new ClassPathResource("files/"))); } - WebServer start() throws Exception { + NettyContext start() throws Exception { WebHandler webHandler = (WebHandler) toHttpHandler(routingFunction()); HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler(webHandler) .filter(new IndexRewriteFilter()) .build(); - Tomcat tomcat = new Tomcat(); - tomcat.setHostname("localhost"); - tomcat.setPort(9090); - Context rootContext = tomcat.addContext("", System.getProperty("java.io.tmpdir")); - ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); - Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet); - rootContext.addServletMappingDecoded("/", "httpHandlerServlet"); - - TomcatWebServer server = new TomcatWebServer(tomcat); - server.start(); - return server; + ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); + HttpServer server = HttpServer.create("localhost", 9090); + return server.newHandler(adapter).block(); } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeCreationEvent.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeCreationEvent.java index 7be088f073..7a66e1e147 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeCreationEvent.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeCreationEvent.java @@ -4,8 +4,12 @@ import lombok.AllArgsConstructor; import lombok.Data; @Data -@AllArgsConstructor public class EmployeeCreationEvent { private String employeeId; private String creationTime; + public EmployeeCreationEvent(String employeeId, String creationTime) { + super(); + this.employeeId = employeeId; + this.creationTime = creationTime; + } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketHandler.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketHandler.java index caa2a38b65..c696bc8215 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketHandler.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketHandler.java @@ -15,7 +15,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -@Component +@Component("EmployeeWebSocketHandler") public class EmployeeWebSocketHandler implements WebSocketHandler { ObjectMapper om = new ObjectMapper(); diff --git a/spring-5-reactive/src/main/java/com/baeldung/websocket/ReactiveWebSocketConfiguration.java b/spring-5-reactive/src/main/java/com/baeldung/websocket/ReactiveWebSocketConfiguration.java index ef8d81d3c2..43a98d068d 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/websocket/ReactiveWebSocketConfiguration.java +++ b/spring-5-reactive/src/main/java/com/baeldung/websocket/ReactiveWebSocketConfiguration.java @@ -1,19 +1,22 @@ package com.baeldung.websocket; +import java.util.HashMap; +import java.util.Map; + import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.HandlerMapping; import org.springframework.web.reactive.handler.SimpleUrlHandlerMapping; import org.springframework.web.reactive.socket.WebSocketHandler; import org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter; -import java.util.HashMap; -import java.util.Map; @Configuration public class ReactiveWebSocketConfiguration { @Autowired + @Qualifier("ReactiveWebSocketHandler") private WebSocketHandler webSocketHandler; @Bean diff --git a/spring-5-reactive/src/main/java/com/baeldung/websocket/ReactiveWebSocketHandler.java b/spring-5-reactive/src/main/java/com/baeldung/websocket/ReactiveWebSocketHandler.java index 5adad6bf15..f85f2c0424 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/websocket/ReactiveWebSocketHandler.java +++ b/spring-5-reactive/src/main/java/com/baeldung/websocket/ReactiveWebSocketHandler.java @@ -14,7 +14,7 @@ import java.time.Duration; import static java.time.LocalDateTime.now; import static java.util.UUID.randomUUID; -@Component +@Component("ReactiveWebSocketHandler") public class ReactiveWebSocketHandler implements WebSocketHandler { private static final ObjectMapper json = new ObjectMapper(); diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java index a7b951b930..e780589333 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java @@ -1,9 +1,13 @@ package com.baeldung.functional; +import static org.springframework.web.reactive.function.BodyInserters.fromObject; +import static org.springframework.web.reactive.function.BodyInserters.fromResource; + +import java.net.InetSocketAddress; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import org.springframework.boot.web.server.WebServer; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.http.MediaType; @@ -12,25 +16,25 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.reactive.function.BodyInserters; -import static org.springframework.web.reactive.function.BodyInserters.fromObject; -import static org.springframework.web.reactive.function.BodyInserters.fromResource; +import reactor.ipc.netty.NettyContext; public class FunctionalWebApplicationIntegrationTest { private static WebTestClient client; - private static WebServer server; + private static NettyContext server; @BeforeClass public static void setup() throws Exception { server = new FunctionalWebApplication().start(); + InetSocketAddress serverAddress = server.address(); client = WebTestClient.bindToServer() - .baseUrl("http://localhost:" + server.getPort()) + .baseUrl("http://" + serverAddress.getHostName() + ":" + serverAddress.getPort()) .build(); } @AfterClass public static void destroy() { - server.stop(); + server.dispose(); } @Test diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java index 21ba11616d..c9e1c59fdc 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java @@ -1,29 +1,31 @@ package com.baeldung.reactive.urlmatch; +import java.net.InetSocketAddress; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import org.springframework.boot.web.server.WebServer; import org.springframework.test.web.reactive.server.WebTestClient; -import com.baeldung.reactive.urlmatch.ExploreSpring5URLPatternUsingRouterFunctions; +import reactor.ipc.netty.NettyContext; public class ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest { private static WebTestClient client; - private static WebServer server; + private static NettyContext server; @BeforeClass public static void setup() throws Exception { server = new ExploreSpring5URLPatternUsingRouterFunctions().start(); + InetSocketAddress serverAddress = server.address(); client = WebTestClient.bindToServer() - .baseUrl("http://localhost:" + server.getPort()) + .baseUrl("http://" + serverAddress.getHostName() + ":" + serverAddress.getPort()) .build(); } @AfterClass public static void destroy() { - server.stop(); + server.dispose(); } @Test diff --git a/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java index a59ef57db8..341bd2a0c7 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java @@ -28,7 +28,7 @@ public class SecurityIntegrationTest { @Test public void whenNoCredentials_thenRedirectToLogin() { - this.rest.get().uri("/").exchange().expectStatus().is3xxRedirection(); + this.rest.get().uri("/").exchange().expectStatus().is4xxClientError(); } @Test diff --git a/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java index a1c0eecb8f..08bd883b0b 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java @@ -53,7 +53,7 @@ public class WebTestClientIntegrationTest { .uri("/resource") .exchange() .expectStatus() - .is3xxRedirection() + .isOk() .expectBody(); } diff --git a/spring-5-reactive/src/test/resources/baeldung-weekly.png b/spring-5-reactive/src/test/resources/baeldung-weekly.png new file mode 100644 index 0000000000000000000000000000000000000000..a1b7eebcabe64f27e1c4d5ec9948dd38165d331e GIT binary patch literal 28106 zcmeFZS5Q-J_%9lJL9hZMO$9-^Qlx{5(n3*sM?^qc=p6zU@B;)sKzi>Tq=uFRK|lyS zgh-8mlo079QbP8d?>}eGnK?J-;#}?7BTNQNvhuF=uIKr+hwv9#D)bj`U4%d&^lGZl zbRdwEA++!FXTfhS_4jarhqJGtD$gKP+P`dMQ9Ss~1y@yL5Adk^-?ws)qXGottfBVo ziJtGoDuwL9=99U$udqNj6L9&;=?nh6Ix}^nH5CSk35^(OS&u@W^(Iy_tS{Kz*4iaq z%ExYCE!|DtZqz}*g-`qC4)^)?Ycm15`uCF#Pn|!1`(3Z#&4^bh%c~LDAsm?aqVaH_ZON0v>+Sod6GQw&z2@508`}ry-E9EGKV6AR+x%ASWOYr!WY3 z_A9Z|kHP<^-GQ70FS+!8Uh@CpjKLVb`7EjK!{t$=FWh`=bR=}(UJQY_J#KDP#(XO) zj=OX2A%!#Rm{1tJjpY(45iB!`8&#Cg#|xvrvC=`>y1n&R)o|?|ogPoSL_2t6=4#R_rdG^R|PrqNy3eMDnX#BR>d_1OG z0rnjyFwvWWQ@$@`h#<)7I#Mp`^`9LY<%g2=PBg|k$0sC$$OI^D&QQ8s;icPJnBAf@<1-xtJQcaC+tzMd8Q=meha386^ z@bbdHJAw1@y{)@4ua(U@YV!^{aO4{ig07(_Ax@D2D7wagT$goWWt>+!ZW5=2GkCXINfRu{5wS8F2p_pMN99GG<+-AnCGP{6^ENa5=8* zlZ6rO{oI@DTE2SY0&0ly!?Qy%mle=#>4_XmZ};CVWDBe5H!U3O4<{vc5atLn`e}v* z(`V`hq6r6NNrq2K!SK0m8M6i#T($d;oIhVQC>w3HGR9tS_LuBYdX&M-$4|ZXahO>b zqFbcs#T{l|3tZ*<6-Lf-mzeG0h*J{@mdHQ_Rh=*qO-0$QI5>P~VPON|$&qNwL>$y^ z?ZsVye05&ihxnq%D_dx6Yl*uwbC$a~99O#9TZ^W@8%p%UP*I{ot^Cgn7QYBlWqqFi ziqEIqqmRpPtxI1p;8zN(yd++AG4>pktR5F3MrU}2zY4>JwtLvNYI#+>dx_UDv~Kr1 zz0&%ltg&FqT$Vw7FOGS%SgQ8L$m_C#B?Cx!SKdKO)v-SHke8}S-Pm;$t^0eELAq{z z%&|v%5SQo0>$0j?sXZ~cOg-AN+)>7!i|ERW%b#fFUlkZfE_%32vH5!s&SR(q`SB_= zb;a;t$pbz7r+q3BP1v5zhI`GD|NG5T@z$elC7UP=)grY-P^e*xLNP>-pwka4Y?&7g zkeuOiIss4pN+RzlGQ|)PhBL#2pxr754w&W4;Kt*~?y}}S@E>ei8N}vn>OrR>(QG|IUok2FvZ*3Ic>jpgs|0Po??ar?OR!<4 zgM_TQ4xVd^9e?;7c7{=HLbnbYr}y>lZ#A7TMRRbyiKw~-5eKC(P!fFpUO~$*3pevd}{i6Ccm(f+{GfWpQ<7coN zeZ^giJO-f!Ure8r^CJSAI)!hT51}oO@)nsEC1fNkgZ~~7gw8mtO;~O@Kc@C4AaL@- zMWFu7I4e}V;;uVt3A#t$tKMS-V~_5#KInFVS8VR9^^2UQUFusItd>U)q|;?ydi{;= zUdgyMlu}7|@j26uU-$UJFCn!c-4D$&u1d3Sjfy5wCc7fe&&WWyB2Q2kf>uBKN4h*IcyvWp5Bq@qE`~? zU@wDvqsS2s+x+*08h)#d6rgy_R~+Lei8{{kgv{dL7fmJ7pp3`6JST6)B}|XRj45QR zIC2_oZyG8P5**wG5~)ERuXmFh-^vx1wDpx%Zuj5HWTET@HAxugj%-N{mwBEi>Iv$vR6U_v974YXDmt-hK6O&VZKkqSpC?R^=AF*F| zJYS+1%Pql#FT0=jYTu_{z=XE*y5^=a@iI?i|D8~7(M!%0Nx~MCf9cb=J_1z$I#POt z=qaTiXI%W}OJ8S@_GLarc|$+2Zq-5a-6PwlwGmy`g;ft5x*l135W+qbR6YkiB#R9` zy!ErCK-fbJq0M7Fw;d>}0DI(Vm$d%Wlf=V6HIsTX>bar96SX+10j7}qO#3(4y@#9( z{E9-G^ZDgJRk)cR23gn(ba4yUH&%jOe!S;faZ|gIo5NCGEWjqjZ1qq7j9D$roT_eQ!qlI0$Evg{@0-GlI^pN zTp{dba*app)u#89)eY;8kUsO*kzN!obN0rZrqKO`>KFmd0c{~_3%pZM-`)G^Xz78MOPz zCveNWQzKW^NwL`4o0Uuw4Q4Cc6`=qI8OygUxzWCHi-sjOzb7mAN6On}c~ZqIli#7X z_D?`ut0o?v*qCUGl7%2lRgmxkYa8x5k*gj39u zldNv0G7L-&<5)j`G^png3avo<%_WtomkRp9)~`>P8wq4hmZ^|9j5w&gYId+F0aF%v zg9h(MOzRd5^^vT?uzj`elm$-QqCPRU`P`Q^sIECY0q(tX4nVxt?LVpANSl1?eXj!F zBU*b;nAJA4Fo`}cItOpC&891VD-v)elKWqF_)2FiQC!EJB6^&I>GTg zr?3F*s+wH-9PBoyzfiDnAD5O3;Ij$CziwQWV$;k`r4Y!PpRDbd{oR~L06{L7W|^}( z#pX-UUCXk3_`%cf@Et2Z?63FdSNE@(!0tJ*H#NzXC^d_<3bCZH8g53og`L6@v~J(b z$}*BTySewY-8P+Jsq`8zbV8*?TuSV&+O3QvZ&03TT6EeyB9=_k-^p$J;BWU9iD=UZ>T+|WBp?^IuK zB7#a3Edms0x1CtlhFq#z^JsTbR_Eu&%FFdDy^m{|a;=1(b)>fL9-Dz%%tJoO5Qzf! zs$`l%o%o%uKHNK2|5~C_f0b{HwX#{py!^^7YJ-`!;5TcQupH2GCCph{b2cKvZ--sd zJY%=hBCx(3IEYv$OtrTjuVI35{hOKkRd>MJML~yFAhTlT zY{oky2&FF@MbpQ}E#)>=-2Xar!0;{oMKm5Y753CxcJ$dR2mQ!mb160kic1W2*PYj8 za#=G7>tPH)1OUh74*RXI+)gq;Al^!l@6oSsh6z{P#2Q(?$UAtSD%&7S2-uB2*$3$I z)e~1_2Y6TQ#KmPxb#W>QtAl2l`z_*HJMnvBU#w3+Zl5@L+dDsTHd;1u;1mQh_9xl6 z4e;xqxBhpc*)UnuGOYq7HXKf3g9lk^I;6pQE&4}WpO zdt$SXKqEg`a)H<8P+HQ3DOEAY+V0ZV2(_B03wL7dg8NyselG>JD3TV&?;Z5aGGB*b z|A#MIO_FA>i2HO=_IBf4%+jf-ri;MGDe(gZ4b)ug?G?Y9a)F{D|*PIQsfCg8QktpZAtf z2*ali9n9>nzJJ<>AN*fWm+yEWSbtLH_X{^$E1koEjUoYTmX+UO`%a+W^h`bnmxz#x zMN+qCOXh{<;1iIsD-bKX#O@P3)5xRGe-DG&g7b<;+`1$i35#f3_bzeSG~LA9ht;ly1RQN^liB>&h*0 z%2!SF`V%&WPX!ll0{|M)J>NPEfk44~(hHd9TO_IY*-IzxB@wj^!$gFLOE15~io}FI z42t_Q3pGrY#I-w;=IPHujFcfCosERgS-X9nQ8uCGclPiYaOMfN_(CmNA&_e)t~?q+ zcM81MbNX7C^#;lIIpG2qpfd$)&JalAPj{hTtG~Sh^iy<8b3dP4$hQT%K^N#576?OF z5p>vBW7t>ko2#nFY>2H=?X669><|s5^S-&+6%D8C6PrqZ23Cd@+PyBA{d z3$b^AX2E|g@-6I6HVxztYCHIP>wOU80&u%ww+YmuTdC~&Zpu&ESIhfOdrPsYF@~Tr zaAQgWR&{nYBE;>k_019)#8Ys&d!d+@2I^sf!d2;7MR%)<0bJ}lrF$!d9ShJ85Kv&4 zrj&%ZoRz7IfDj4zbnf4kz7ZZO!O7qd2-i7) z_^`_sZU;{LMeH_h;Zt>NHbrkLn|V5I?q7>~dxvRE&s9189Up!F=TgU9A84ftEXfq0 zIIz~2-s*`px;0-GHDkLM61x{(igV~nF&W&i$?j>Z<2j|fl6FgvFq)ma`7?+NZ%o(H zU;I*Xw@B{{aUVm7;Yc!#HPV|kGKzm^AJwm28jx#<1XsN)H~q)tM@Zvy=9K0mes zqMGu#kMZYQg^OB+V|3*CFxLHh1P9erhW=9fug?w7!tUR=P;o4aFr-#}qE30r|E!fy z+Ob(`%D3!@VUVvXO|SVld9=3DvT|!3Iln|iiL+NoWrww!U^gAWH3b)!1?8!x6Z9mC zn-54bpmmm=>Ytp*7#ACNxdjoU5Y@>A_XIgI65{Oboo4)jT=Cnx>AJ;~jvRcU(ALyf zb1cU2iGQY+9>+-Kdk1N}bW$q<#U@5!Deb8k>M7+)y`)8Yx~?xl-@p%Z5*`8-9rs&* z*|+oC#}oLay`H5#KF|?%&q(+O;`w&9=vUG*p#x3jJI(#r^7Xzj-SK&fKt9e^Jdxg#cNGaDWE>92KDDc;T z1&x(?wr>5KyIDM;?6N{ygQi~8;0-LN)zHGhB^PaK&`6b)06A?@6GziR3~Nl`=4tFW?F8pjY~fxy>gPCxaWjaIt>HXV)Iohk?zqrYxI zBaA@qKxHehTAKslQn1K$()1XtT{*^QQxZG+=6*2fIeoYFO9m%=9mUK`vx28NIP$vP)p$EPY}+O(G$CE9S;=)4{6b z))>d{t=uGyeX7V3xWX_~Kj`laFUTYu<`*~S$U#Z{PNi z-{rwyR%?DZ)nMI`)iFDiQ==?z;xn>iJAPy)pbx08KhNQ=*0w!#DRpvTEPnU0z2)Yb zrhLOBaSTX*t9%m$&>+o&^6fv-=?m-bGG28@AzJ#Jnm0e<=Y0-$9xqt2-yhGT$v0gQ z>(87xtRa$aInu^n&#E}!R?v2WIv)o*bNcWjN2PrA%94TbU+A=7Pw{|I5;lKFZSpO? zl;^&yK=$K5e`De; znr!m;Juo{Xs3M_+^ZrHqJ7Miv+`HPB?RmuQnx}OzexjmBL_pysr`HZ%qL^)a z%^JPl!ZGFf*K~Jg=?hUi2ASLbx%J~@!J*D>WS-)G|Irkyq|!?!;gm#vtZ%Ltlewmo z3bQ!&-_cf_13o}Rch%CKLQWAY$N1JdtL(fgY^Y=<&;RRUGMl^8q;-0+Tz($oxkM`3 zqg7?Nao_hJ89JYRfz_I?l-`Y$H7Hh_0sW@QtXDbTPj`1EhZ%8{%N*4Wbn!RM=DCnY zBdUm-FDdJmPF7F;_1Yk#loL({6Sjs=>Mi7Va={H~>ND&rwd>iDS2oc93=~(Iw9QN6 z6h#iJuCb{N0|E1^oUVUfZ%yQG2ZbO>nS1zVxq`&$T$<4S;1YDUny2dN8aKY85>q8Q zZTkjhHoqM|5e}A?12oLZnsrahR14{i^pQZv%ZIMg8UAhr?4-A*AclV|@-TDa;Vdt& z1Qac`r-Yq-)H7jOqayMrKwXP>*hawhhU6XI%MYT`_lq6iIdtgLxP-**42Lz_xZvfSW=<}7H|uAZW{$!u zrj{kvhsMyQQ||1wzDhMOOJ;5$fBr>En7-pIS7^8=G#ReRhgy1KSvsX_~3BMVR)l2`DAQ%IztgCF!2hg(ki_-9##@39fza{a_c|t<%6JO_ZAek!Z>#emyR(+@?T9;b^4AM7}ZbScLkP=ZnKT<&y=mC{K0FyHHh`qvq&-o3V$i4 zYUDWXESB6XUZx68MVW~og(EBa%erLH5zt!AIT|ZbB~Q+@Kk1BW)RE%@yxLIdWk$gm zW}fkrr}Nk6*l*(jTS2Ze8UB7$u}P-mL^jaT!7DIJiet(U4IS&vwU4#EiGjoWQ3Jac zO?jSOp03JDVq8F79NL|I1XOvlCORKe8|k%Y&|yh_h6em?e`@Aqux^^6eThJidRf~@ z(tGUeXzW%{;iNX8WN8?e>8lqLZE<^`835uA|4L=iPwkW2Yn0>v@dN*BXCo2$iOa(} zG1|)BU^w-}kkgSRbtn5$#}MFfg-W%(TXx*OF3_<{AqHbq_H>q)QvORCFMy)9zV6p2 z{u3Gr{ULD~Q4;L$yAS2V%^SMe=Ik-98ziU+0Khk<+rl}vUfCMZy{^*=mq#AH#4f%1 z@dD%e3Fyuej})5%Yk{7j?`IIskhCtwZfE*$W>FsFp;zTnZ(=$Z@YMWwhv*8IRHyzS zMHOBil^&}tz^4EOy70u;M^)}kbzf2@TGg>64g9lp^9;ROeIR8NR=DIWzdznRT3<^Z z=ZyH2h^b6pN9GzbC=?ylO?^D1)pve~!ID98!f1fh(BwpK~8GA`}q6Z z!+O)V_FqTn|F}v4k1EAA?Xgs&oNXm&Dtt^`zmdZ`?}(500AC=(0)Yz>ig%gONxsza zU{uy-hQ4)-`%>9FH8I)iRF&k_@4c6P?RHUDd#fG=MFVi|Vop`9vV=oHCkB8;fQ??@ z)_*$WSgaOhuU8iIo;spmt5Ns*K)0;E*XWL|J-<|5usm57i48OXR3Au?{I??c+2|c# z!_^JXrtWGJS}UOxyk<;yH~Y|Fn#DBvaXZd{Pa>x z8*K0u88Z8MQrN(BW0I;}dyQ6{IO58XsU~O2nqxJ?8+DzS;1X)Hy;}A=qE*n?W<3!V z$1>+3S#UT)GscMCgdMXH#h`7+3{q2hb<>42Tz5L>+`!%CrM*M!NF3ZP+eTvpr8a*z z00%SLjFe)S-Nm>!>2Zj0^J-w$qWve>9JmRfv*nXKze{CumFZ}k(W?76bq#z~Kefm-M zIMKC~+r#?A(5&n78?U*|lCVpZwO&~VcA_}Fk7U^7uJMvFc4@24nfVy_vkYI>H2+H0 z(rx>%jr_Hji-Pjj=b8)Nx6zS zykv5-$R_~myZ$@G{-p*2Tc93a*((FB4MwwHe`AwP2?=FsP(vR(-|QZ<&hgH~FEr)J z{&3oj30-b4wHfa_nGI0hu(KrN8DbMj>#^~*@aN)n%0j4-^1E2!@@;uTjV!!6^I>I* zu!LcPDXO%s5B0>o&&CGu3izl)lRgH`cv8xqIa>spH zpzfJ0S6_L&$AmYP5#g#Xwx6}LcT`$RY&|E8*kj}s7L$+?%XRS=Hl0}->iZ{E!~X|p zhXoUfMy$iq7l5b~OkP0qOz~9u>foqi8YaKS0xxk@jty&J$D${WNr6+vn8G1dDQ zpmzcbQijSWx?wzQf>{fLFW@GX1tOaXfXcuFm;Dy<-`txL25|r%!x>Hf$1bC76{#WN z1MF3pya+(~gkr~5Y<0Q0SWRz%Pq!FwP7`1n& za0wWXLEXr65`GDV*WV6QJ>;3`3q?5s>P17H5xdw6PmrJNgs=D#m6apsO4h4wM=;AFvH%Yr*$6)Fb62_XtL8=XDfjY z&N!i%yK0Ix5B@5G)gqDzO#;A`W~;x}cg^cmOS%>=`SW(h#ewqi)K*Ndm$-p*ws#&_PaXH-h2314cpSO^ z{pgFmd2i{I=*mgh6`>HHl#baKTIz}3jHAn{`wGx_{xQ)9^7;F&w`YwC^t2;@e1m7h z>e$)uxhy53;Z>7)5r1@6MaHfDhkwH4<4+ZqS(jf5p$T41*L}EltFAH}6rRN;X9wg1 zFrihXyXk8NB&m^0zv@i}M}kT)j)GNoZ@dGQy7_Njun&Zb&T1;TDZl$q5fbF8wPy9_ z5a9h;Uc@c1@9*@SscTQ>_fX*PwShRK!lsjW${dcM4 zPp4ANtkYj)s?jBK1GYUnThrw%oe7{|%CRT3>`rUlI?*}6l1}Kx(9C&YCaz1$mEwhw zet1;A-P2lNm}xZb)eWxd`g!-HKL1wXNj2e<3lfR^p4%+*vpjF1hxxtMZsA))_^!LO zV8;V-aK0+T6+jcR_k>ODAZe%P$JEcTfff*)03S%0a9jEHRRC%Q6^}KRXUfTlgM$T8 zWaU!9!m>-|--W%PMX{|5A*_DuQm50F$buFjkz#Z-Xbhq~*v%`ZIX3wn;*c@m0B=Xv zBIGU6_5!-3w?zvgP2dR$Zx~CY@*a1lgp&1sK;HlvExhfEy^oE(!G94S_yuUBNdWTs`OW9?SK-_Jjm zGt!lBd*Cv*n`40WaPfK4&rWM}#lj++Q5FC#7u0`R_p+RktLjY`#lix`ph6oq#-09+ zi;eGN{{^g{*xR=26)D0RmIJ(xaz*()E=lj{k zk}RX}syXvaqk;T!S&w}zSZ>z?_?!a%ukjy1#KE!qBl?~}@3$|uj3V%d$$=Mm9f-9i zmxpx7>oOR0ikCKl-X2vKFz1&Kn^!*_Gn(jNq4;$%KS^5id3FM17Tckv4?9b@8Cj#x!em=vjc!kD*bNvfrKuK|uf%io;UL|at zBt%ZPvCF`80&9iQCQAkyXi3s>21CCC_Y)6)8(2!_^!DFGL2_*h9?b|O60aZmP|#LX zX&lR(Ou3-`Ye$pb!DYD8E7&qopBsn;qR=zhc!mmC{I%ykAG(PsyUgx}pyLb}EyM-) z*k5fKVPp$`jstNu`eeD{dGj~hU3w>Vs=>Zw)vg|spkWnsEQ}FFO zfI7aNPk>lS>n-LUcX1nkl8-n4ko+6>8uyr8oQ<|yg8Z9jUjmVd^kHmpjBS12+)WyN zcyl&~=~vjFfAShg9HrayUIDv#9|oQMXV<}o1?jC~ABPu!N#%v0B6IlF5`zXXSAnqO%p2La%%H;S4t#Zo9da{Y!u$Hz$Lu1UF9p+4YI1}t&PwmAx!j>Gpjf`{Vk~8 z$7Dz0Z_E)NcdRf=GFY!ChY_qarkwk^f;E1^$gHaIDi#16f>>78UwQZGCtGW2KLN5A zoQ`tYi=6E__!M_B7|;`1C1pt-dGpGIruLrWNy2pA$X{|^+5g#<{?1HQjijhbL|_~csu4f){qeQINV_=)S5s^@)PGk@{TP|y}cRTY27?Z z$hT%Zr-=wEU(0XiIS>zE?i!-+yOdTbfD}M0gUm~u)lHzbKNMnWjd!G`WPYkHuB2~R zo_G~GC5-5;h3aLPR@RhXW6XDfrN08WL<`5(V(ql6zD-AyR*P$=nG@!A%lM1T^qXw> zG5q5@H^%|78dVs}808l?KyxN>V{^S-%zV6UuWqkT1YL(rYa#A3X+0~O)^&_(D*3^u z`7;W^ZTsD;fZ7b|jJ*^5wP{N@kOKf&xA!gXFB`4@#)RDxiT_6QA_>daA6h|uMz}oY zWe5S!&F7KiKWz&M;O5c9gd}@WQ|mW`#@N|LGf$t1s}Ri1ybm!cQSq)`PX$S)+KO&$ zui&pv3D1`GlI`2qBEgm?;M#Wnb=URKz})aN;{Y7?Dh0^rlQWD?H^V9~H>`lz76}%= zsQJ>~Huj(hKyT_|#|h}X<@z~LKfuv3?|MjkrE+CP2~9RY1pivsKD^5C<j ztoRV1@P8zCd3mv6!cSCM%kE&70TJ8(E) zf!n(q4Br&-2hO$whgKz%wLZ*GC!Rh&BRRRRZ^l*JNoM~Zh2yZ*dN}%g2+$|Z4H|l` zX+g`i%#uy5(-X#jUr+-}F3VrJ>fHIcC%kPmb$7|2wAHKI-oP4$d|f<08|+3e!rjG^M}wcdPxb?po7+J zRtiFlsw5;ZrXXo;;5j`}&s90oa{@Ve6n;GW2MuoG_AP>NhKB))Gafms?j2eR- z^FgJ9iyM-dlry-B1M7TN18dRjUlDDr>xO2zVKB)*b%zl?6HuVDqjR@ zt@+=t7Kt6RU#HAH0w8rG?l&WZxu@gwGIeY2br*Zp>0VAVJKx`Kn_KxtfMif9DeEN< zXg;~mKUw}dg_R-1pv4=gfYi}!Z{{)BA8C{2QW)#1Xoh}JT_9S)fpVAFt!U!*IOg7Y zX8c)~oFpwNM+rdW58mH`b}+-pTkqC+*?Kp;x4Ruc?!p$R7C}D`LgD^@ zpJSaJxA}1|j1Y1IjxBXDUVPUgx&Mrau~O{{1on$mENaAm&*PJ3S{)s^s_wm-O^r`^ z7W=F5sv-GVRsrN@xJrdQ{F($80L`~RY)V}E!8J>#)yvPBH3Ga#-7z?)&8eMcWNE*4 zrKnQ35dxqR{@F(~Utr=DbVO1ul*R7=YprNPChLARZg+Y~OLHKREGZq_pKQ zG6=6hZi=nMey|C+9)^D5`Gh^s+|=7*N1NV6IPvHi<-;Ug>3Y<2$$Dk-NPhKUXL4v_ zUupX9E{riduL58L#LakQmub*ZK@YR;I~J@niOxYVcnk>nTK-KV{}JVD!D}G3?p3p* zs&l9b?5(L8Ud>9`{*P$-iK{0z3OmQOTDHn|Bdx36g8d9k7m%-|Nz`%r`F4A9h3l*E z?<4Tnn?KoWg(~!XePq&U#e3%_U^j!SL9d}CX6HhjwI}TE>@UjWpGUj+1$|?NHc;bb zjGD=r(%s6o-H+s~{ceZj&OMU3n(yM!rbG4@e{{vnxM0v+CPIb z=mt;N-)RM`6_crz*n%lcYez6CyO|Tfh-8!`N7CfZqD}ZDv8GOEWJKC!VX;cC<-2>N z3EaQZUGTGA*5z}FgzlbSUx<4^#eA6AuO z&tTm&M_!kF>A_$xbm*l@>JLgP*f&Xx*gWKJh?)_14ztuQQ!8uJ8#)rMeZXZ2+*>@e zM=7IAgZcxu z5j%EE5;06g6Hy^j{1Uk36Uqpe&?rDiK@94VIQ%c%_`q3Bj>8b}Hqh+V8mD8oC>K9| zkiiGoOgqL;E;O{Z4?laQuKUg&Tz{-gdECy^`FNU4cP(1?zqDOfksxv{n(^M3vxT2% zZYPld{G4SFrY{8{Eu5@G_P*;225FErcxmiiy_fW7eDvfwFv_r!x~yNX#`Pn-S82ku z4hn?kQAvqnfVhEC0FG4Pr%MaY%0KriJdDk!LmIA?v8J{-tDJt^@xZfr6-qf;#!Lo3 zc{q1acsP=ZCb6wQWLHWC_Fon!wc12khW2Jnu8-+r&opJg0L9l&G|vSC8~GQVP0Sta zfQU}PDkXNUO%0SEB0S1fwEy@Ic`9}bTrQERdJ59ZspmBWZeHNG{hlzlS$12<5E%Vx zgAk-CG;&vCkCz>CSQHjF0q1)=#yrYRnJT}i!bMZ5;hr1PSZ6wr$1p-Su`~f`+7Vt2 z@)yfaoM@vE4I}vp|Yl89>NW6>@PJ_(xKw?uE zE&b#W&AaPEH+%+z*HvHe6Wd1Y_Sj_ zTUs9b0F&mm@|2F!6L0mx0@jqMgX{${%J?Q{+RQI-js+P}+HXM0Z+s2Y-nE+ibO=OY zn&n*0KdG}KcHIWNElm*hBwz#=sB!;~5hsMBuiN2~Hg}gcPvl9iyX3>o4*6u)EzX{< z+1L+ozI$VzHbx)rT-nfT@TIrz?sd-!_pR8tk1B;FG#C73Gp z1D)e)$qWLednM-dKP~WS59OKZaeVS zyR$qfGr)tp76&93i=gQsw`l@di@^zsk4~sIH#nDsh?@SA^ZV>~lZzfrqzH*@}A1U5uyJ_5c>Qt8@07>wRK^Q2D?y zdj>1v#s0s$p9i&9zz5YtVAOLzci7$xiyci``Fr#`ta%@}0vDf`SIK-GPU8TV4x}k) zvjq#?4q$&dCe768?MPo?SgD7)z%c!jZ988rTK+2QbbE-Qn*Hur{W2#8v~a5V+Xjlp zU670aW)EG*X@TXX&S%BV0$tSHBvLkMoiF07rt58KT z6R4kY&x=906pW(fDVhZkMtW`mdVNrUcw~O)AS0Crbh;9N764xsoksn9Q!$YcmqITG zcN_DuF#f0`4Hsv_lI^ ztkJWgNpww}bE@R?7+l6g!;-s4Yqxu3;P#8jAWMGhO*6$Zup{!vLz{%A$x*Qkl*xSp zZ~7E-gy1r5%7-Q1zpe*N6di0W`cXC~4lnSgo3FS`jLHzefykx`Kys+KU?{}JevssW z9^bjB3RMQ9Y>L9iZu(@|M|RzxPqb1#zzfjE?0M5NMh%9C5k9=gK8?PA%4{0VEqyG- z*{R+wAh&C2>90$3>&xdtwnp3qsjEYO09Bs?-f_c%aM?`H6Rfcr{d2Fxb(m~d^9@Ok zYQ5LCT%o>Im+MP?93EfBv0>NVn=}b(jTiyH31~!-NW8e4z>adg(ffPD->(2SA+`0Q zSM=`NmU~$L=9IJ$RL>LW?zgTbUIh0qPt6@7I*U@j$Fw>E+MQZP?Z{jP8HDjbQdhd< zm(StS-fM!y^i6yGY)z2NiyB_y8YOi3J!mVtnu81ZFtY|7fLQ^CG2!1I1zO5jY_yQe z1>*xb;P^qU>r)X;k9U#zUirH0*5(t2BiUd+j9-KBle-AmqXU~TAT_*c3Xp_-_X5RC zm~4p$VJwIH<+XJYBPM|80GFB=cumY)WX~K6Ha|y|V!=pXZvFsqP^Zpl zKl>oo;Zsqz0^4jtmi7u6S}CKpbZQs2|Ni#!yAiE?BO>g^`A_1avW4$btUz3H>jX*# zOa&H;7HNRgVXsyX80gaENKz60q)RvawY~ZuS`;&d6%V4AKxA`j)XE)SYLIJr_B`cG z@17lhe-eKTR!B)lifQbrczI9T7v;q+i3jrKnLWqOoFqhiWdJoxg*vixwwxxJ0me>S5s7=A(&iVt??!yTn|k@2 z1Y`0Ts23D)4!}f|Q~XjYuui~O0%)fRNr`z=qfRz|v0#DV%jRvhzTf8dqoST)bv%nj zqhjM#)%)S}mLlv7pTOzWOS3GP>pKY&DG4i@v0!SW?;nAi3=U3kogm#)4q$4)c0D9P z)TU?VbP>Qd8HPE)b_7X85Zk?jo)iFDKiC|ug5>}$0Uz{#!l4}ffhv;z4UJ(_mqD8N zPa)7#6-~LmOs|1b0xR{c;|4R8=C#VxRIf$C-}h&|i`ga5g69noJyR@_rfc{$^AlWB5{ruvu7BJZz5-GTa}2=wdA0rUhoiT{&rhEzB-hsJk5bi7$Ye66;RWJ>hYMQ*1ed6n9Fk#(z4rGB>*hmITMv~`FwIy0JJ^257`2BO5Qb-Gt=EyXo z|BJ$(I0^YBoPFm1J$T;*f!zVbsHXfipaUgfs&t&s7;wek-p!2R&u;*_dp#BV_vqu< zLX}a_%wKTV6@Wn37VRGGOgTeaZJ~%JJcgE=1|Hw6(X(1Q4=~^9_{yIa@szlpimaOX z1m+REN)MJB{>XxWG+X5T|AxlOfXx7kD-H~umb8g;zNhCO6dtBgMc1@r;vJ;-W>mn6 z98HG?*k>vohOWYVE_V|~8 zx)B{QWOC7&-W0z0Odx~&a#(V*m^mA|G);d5T0B08h1PQ{+Y=YpzW0+2Sl`Ha` z+%r$nE#zI{)Pp&Aj|7wcRRa9GUI1+ZBqbtdz~x3%cie;upoqYj8JfvGpht&A{JEz8 zCW)5H=B$V3qztiTeWw4R**^wEB~O6LwGcrC4Z~?{H^4!ND9%&M|7B>Jgbw8a0aR4j zISOkhtVSoU;|HUUAA^7#CRi6RSn5Wb_9Mn)gVKSDp)7W4b*Tqt|BVv}MCgNXUS_lb z+pkw(Xh)441epS3&G$|?-vgH(gcV1?kTAj%9ZK9kh|g2hJCK?FApmB?h_uM%(jJWH zvC)J)n0;rbUrV1e4g&$d5@hEt+j;QWmQV~Kz>5Sl`sWrU6C^D^6a*j^r0ou{yB((n zd*`>xTQos&v~UVk7cO!%&HMlYvfEMG{Jav8+CO;Yt4Vq~70qB4hMw#U@dVj1Hv;)f zMqE?DVFj4LSCZ&P>^3pyFRg5v7mXcdfQTa9IF2q#yF|Rq7fL3%H}3#(WUbfnr{zd?Vk`s54VNG6f2&ajb6v^DLEKFG z;Qp5BYNpNEf`;8HTm^zwpjYAF#htZD`8a=6XGV)3d*#P#_wxJ!SzQpseb8|W;yTz^ zbut^jipv>6${6^)fFoQmWOUUV#7JvNVgq|x)=(#k2ORAF6$TJmEx9dkd8qE~Xb7(_ z2$C})htMK?m~Y>J{{+k^ESi+Mj0NLc4)8l)SC+o{s(w>d1tlE}d##Rr#!)Vi0qAK9 zVue(Uxq3)vsBh-q$B`@>x$7+ZR07|L;29*<8wee6LePa7Hl_9yMk7G9U4 z%?JSR0}On|F=0NxIlx{&)+E0{AG@w1^<$8UfN5yUq7n)7P^rj9F!c(yAb>KHaMjnF zjkK|4#Dl8XaW_C9b&b8lK`_rABY6u9@Pc8ZHhJsrGi@L~K>0hg?L%=ZbI0I?wpvF* zQDs0^PWw2yqp?QAFwFv-&#&oxHS{&y-A_l%MzI zWd-pFT<_U^H`0ksK#k_ysV9Nt} zZ4hwb@8Q>hIV2vz&~lZX^-Xrn|4oyxg~RKCHp@moxoCn@l=tigfeianAoT!C7KFSL zRyHw2Pmqq|yTb4mq~?I`1D@{ePgDo#snk|={U!b4+wz9S$Cv!fEY!k)_M&;V5JZm3 z_o`t)xOnjH;?J|E9}Ar8S!mGHDhw)@EujEL1^$4BBd~HmPU`>uvI5LCrq|)<>^O5} zShyAUn&?dL12?qsS6`>{=o}4l0r73;2~d$!wWNSgf>GhbSZ~_kLr>d|&lXB=@e46_;yS;X z-OrC;as@crKsyB+r>JP|GR?K8G4GD0L+zN>H@8rV6{Ef?Gf0m~8Nh4`-tY_D(*=KZLIy~P=0I_%qkIOHjzMV+>YOA|Ee;>^XB$H3ahZT|#xR zSdMh)qoI|D59Ht6fp|HsfBWwLa=te_Tz`y+=bi!_qfEh z=akyWK1;7cFcQisN&H1V|_{UFUjoWk|^k99jIsKra zgOt>>ra}}=Ai1Il8$X+K0_8(l_7C=BIhQ>r4T1B@t>$3VWG7+~P<5geuciG;!rwTnw1umzy^g7k8jreXtjb_i5B048w% z**9W6U_$4B7@H(G{k4J@xGtRRffg=i0aTQt4>>`6IVDU*@_)5==HF2E@&6xflGGig zY-yuKqoNR^JC*FZv(6+$wz0*al4wzPNedZD(t_-geQYhaWZ${1b4!*nG1*1{nH^M1cx&)4JmeE*yxr0@NzaTiomq5a%wXPjHd(Y*Dn-6-rP zv8nIh*kt5>lYjM_r4dWcUadG1boZ24VNa$)wp2xQf}!o77NLF|*B-Bn<7S;@F(zCk zW3O%22cI<8RSN`LW?V1tkkffFG?7`JK4!V^bx5Ecv11S>^Bxym-=cY2njr zpP$v-5jO8^G{Zi~?!Ah{szXM;r%4L;Wv%#=D;=;@>@4A!?tR*!1WUpqopv(0T|wzk za>e2nulUUKoi3R4#LE_I>s==^57rUOWT1`p#iv1`=DR%0GmGi>*%9vzRI1Ge6*3pM zj2^v(GO)>f1uu$N|ANVRCOKXcu+H8?HFR~D0f8DrfNn5yr@+gGf)}nEv~cw2^t9OT z4WMai+KSJ}2OKi-`3pnM_Dd^+bZSMp&U)xf`6kZ9W7SsD3Vl$tlpHHV)SF-w zxk@dPDJls@HO*cBMHuUmtOR&!uMu$qyU$+gZpG*|X|dvNZcDej*_pqbdza2OOv+z!jVR%Y?@%SP6VD(b=MT{lh)n|juhR)+8;@Scu zAqWp#CXxA-L$dKFZAM%hnl27&LUe$4;v{SQ!J_T}EYu*0(KizowAdBPVbTK=g2u>v z-W;rbZM<(A8^$1km^cij53B#%pvc=Q|Z)<&c$MXh{-20jt+|>w8Z=3T$*$P>c zJ7p27T9;n2udAT82AIdyzd?z7W2nka=P>5oxcAX))Fxdr&M-Xmu z5=N{8bu>p|w;h7@lBtDht<;oI&dwUylj)%LrAvA&Q~e@7Ll`P98t;?n=2qKms3oFq zU<9TkT0)kp-sg4sTP#Vi;gl30;P#;gSwH)#AC4l!y07odP@7Pnb$ z)w4W67^+sqo4qzupitnw+0?Du@w9O_0p)86%oqFp;f2;slcPVFCiydPGNN%!Cb3B^ zRA~68V!mlxQM$af1cD#(o#qmr(Jsq%=N9bd?{r#BOKyJfcUXF2P7Xstjy)q#y5$o0 z(`yE2I&cd=>d$1hH?Q`T^Ng7y`0B*R({>HFC~tDhHKFMOay#L4EIP_zvuL*Jdm8XW zZ+_ZU`?L+W@{*pnWoF5`{xdNgY_MCBBldA9S!EaIUa&K&^$*GNBZ%rl^~a8H%~hFZ)Jt zTURESrQfj*%+%X~uSA zSLkMukVe&xxRD=U87GKIN$*uV2{Ox{^(;E7r*nm7N(=wclYvv134CxdS#@k@m0a5W zi+=HBww4_P*v!U3{&(U$d-*JVEQ~DB!JOX_YhDs(^CDzT-nwP07{dfB(KXpJh+ga4 zv(m6Wy}G<-G6g>(m2M_%EUun9V=<8*=wQa*#>}$Eii}(Ym4xDS!RHEc;_vpZ%nI(( zRa#crKS`jU*TtT$`~s%TYb(_v_KP=M2g4jv#5e8jCPy;uO9UJf0vEBd!f2^;VVS@< za<`r?&w~y4XuqJ89!|`sVV5xcEim+qk1WJToVNqqDShqK3eAtB%!2ZwtY`gK>kApo z=aLD2heNN5pe{YX$hj8nFCr|Ot42~JsBAA^qlXrWpty`eO&^Z4sE)CS?P#y{ga>ec z)Dp-Dx!t6Q$R{psi#9?Yac{qCp9Gv_?cE!@^%`4me+oVQ(WlvVOUU@p-gQ$cS=Xza z#|ycUqL7=Y0i=i+xJ-;6VN5CAx!D9+6-DeKTgts{qCtbc!VDL}C-J2(?*Ok4Z_j2} zLIAf804s`0JQ#<(551`$jl;JZRhpuW!t3!8M`{&g8?%$ z$05AFpxGqn0xY;QTzlS-GsY#H$z2uEFM#r#n_0h5ppyE(3SNlLQXX!OSUAQzSS zvQ)nOkgygt1$FC-$LELOlEUaEd)=q`RC7MMj8sNJOjxa|(38&ZD}Vrx`vXEx54afXqVBO` zpP~9J1x@R)J2B792s1JaN#S)`ddSFASF@suQ+sZ@p8h=MPfR8ST}>Z7Ohb9I&VDUY z&)lh0WjVbSSKV@w^;C<@3;)!L%ebPqpr+)>TK3L%QPeh_jDT>K82`BhbWQ^5QwKxM z`$)-~Nv;9b8;COfQ{Sfvht4tqFQH>SCkbAOFg|y;3B|Qj9a9cAc)kB?n##tgRQv6U ztekkYZtq#0$$`thf8e+Nch_2Vo#oKunVs&^JUQg`Z2xdoro z<4S%)w8hjFkT8SOSC)QYT1w@MTgpZI%7iw&{PfA*{Fcp>slk%(7WhOT5FdlyiUajR z`E;|x#q_c2k&S+BBNHC{fno1w?JR;(YQSCMGT=qH<{U|t`ejB;BqF44RhdrY6u^TM z*3Q<>wLoKu)gIb3!{6jF)tmNKZ!j)ev*YjW2l6}4jb6@~`;u{c!rDSujaGMoeyV2A zCCTt>t<_=&Wq7K3IxZ}|epD)(WTr{#h;iSaT%%Gw=sfjhWjE}X>*D%%ehileeu{P< zGBdIPCiGS(xWt?~_5QK(>}N&CPI=piRPS1q18=(bB5+@^AmwGBQevBmeTB z9FzU0ilH^C#0{?K(GOBFague7o0z&16|tCj=*WWijyI|{GU%NJa7VH4<{egYXgh*Z zrL%ENGCF#{KmfH)+p8Eu2(vcX&SIr|^2oMexn0I!0xg&uAig*8LAQcquB_&J(a$l#}^ z*=BnPkZ8*TSo>tISK4cM#&y#&I*m=3F4;Z&BUh{^ruPI}_!1^~rWGg>FGQO$Klv(- zpL_hhfD$1er8{D&wxAjKYO2djNhax;nTTTK3GcyXgLkbbl3tf)Wym&Q=7HHxgWRd! z)>yG!dyF4?`s-Kn3@b3M&E7j;wqv`z$o}Z6h|0GfwDfw4pyDvMH(g_LDQ1ir6 z7fq_d0VSr=t9SIsK;Jh~1J9=aI2gq+X);s3>Gh+pXB?4AGw~A@G0Ql!s%3#u-H%T; zxZoX!%WTw&|JY0B{X$pLRk!5$KU+Z#v#0DlYhADPmga0fU9Y!&ePp?fX65<>KK?+13?K`SPCkDj zVAN8hSC!ppp^#q2bec*65lp_X7`alPx*`Cxi%{9KPlpUrE9$k&o+B6#bq6c7)X%}& zC|`F`6Wsh+cj?;>ahjY>eo~UxDpVU7xc;P^(`VoNsY}1R$3%1Q7!<~dwi0!U=#lgB znJ3Xqsf=DAO>J59{22VLe2c9xSp~+yD9yxlYry@7TEmd+q{XRC;+dH>rQT7EwDqhL zgB8^f17EcD#I=_QXrL|okORLmRD;@&2TI8urTtqMo8`Tf_EQF;XqP>XEGIfw20cRefX+j;J*QWt4RQ+|>4YR(5AtN)L8LH*A zR8qFxenx5+IkouW9{pvxRP>num(UFpqCd>~1Qn^5sFP^_mNmL>eEUI_mh!59h&^a& zXxl^mU(NZG#;;4EuGoui)Y~wR`JXE@#*nD2WGJfO|9km110va@pqBNbOw`0=qt;Zc zxf2f~1~XmbZ?$13KvXwa1;x6^c$OpL^UBLmW6ej=&k#>0gVhZ)JBeMi#^{ayf!}$Z z7gI>&L2+)~k^N8IPZK`{b>-=&^X?OKUQ~B1v(Ul0kzFEUa^n~KTYDFZ<=i#kSc$6{ zL+~ybq=}R5>-oZ|9{C-N@O`1!?)9cReJ`Q^V~bW&*~kacdfWJt8g3e!(HXuwYprn~ zgKfp`5;*jlcAbn=(rwo3y@5#+o{_G?k=xh0|H*J8M1U(FZ4&pgnFY%K7O;Cn;Bt_w zPr#6vFK3LYN+<*bj?e@X%&<3pMKzj2fK zXe74}-#!#TH#z%bL8bK4IFvfQh2aamn+dV?T&@QE5KFiIS;AOkN=Ze6i&4bG(^_}4 z>>iyND2#(7+fctBvAoESbUk1%D=i6n(@(n}|>oBMuw6Vkx3Ry}7X+}r}f)`4z zvzaqG@ZyQhr2#d!5#mY5ZDcf;XAfSkStpUE`cL4}f442N5=797a_4*)K|N+4I=)G; zQ8LZ%OsHX=sYUzlu$lSB zCR|;9rAD;(W#pJ-vBh|`2$>22T1yUF@$co^riIqPD{o;2BgM7mwFLFTUSe?rwGumY zGA(<~>r-%Um&44agw{|q7jUNw-rZA4%+c_t;Pr22XB#(Zw?<4z+f|a6jNeM)np4); zy+Rv2;Wbr4X1V`7Ci3g^pJ;R02iTxHd?{vd_gZn&wR4%6fR2Sgc;o^!W53P{POfuo() zivkttuZ1oeeBcVkXL=RMx|2{C)_ZIkYgZL5N0N% zoCRz|>x6oVI?9A11I}{XYwFmsvnMwnB+@qU5@MZgj)!!$7EiwIoCaZmeDFeMt_m49 z$?T)c9nX7cy;PjOQLryF- zKA4|vZ5ekTx*cP(P9#dKr9X-l@B5NlG%pU1Ha$H}YyE5pS1bMPQOlQtW+dTXiG`Zf zAHvA)07q;LjaU2a9Spr6u!cfwhK%8aMl=|L+z^!~`gG&TQZt|Wq(c!!kCC$^$8U`0 z>;s}yV|zbyCoB3V%Q=&n@9$b`Zn#6Ve)?w&;Ro9<|FSOcc7AjHcSVDr9-XYYA$D=j z#KEtgzQ(ZFOn1fFRrHUPaYlED2k%%bfWecat+(!C`H$FJ3TWKNrM)H~a?0P{F-9B( zC=#T&5V!QpKJq^wkgW#eZUX8Rm{J{VUB9Wg6=E*Dt7+h(t#>LZ-V^Kbu;yQSm_Y})q;hc9GzAS?z*TPfYn7uzx@5e|lCUV7tBa(h!w zsP016gR_4e@Ex!C?JzpH%H zDpING)OxHm3O-9^7e8eanJ;p2n;uJ|ffassL0MQnm%6dM;HL zr52Xt6M8*ldxgyCx;#Eir|aOZYu?SPa1}>RY2$`P<_lZ-tAO@%>YEGf9fMIl(noG$;OMr)7spOGuY_?T&adJN%;-^IX=9Sh|up z#UhjRC3S`fqx_RZ`cLIJ|EB+K)aUon7{3n_`F)lOqHKR3CG-0vo!GvsG|0jot^)2vRe(wHG?N0nD>_CF_V`liLbzIrN!||Le-J0&`=1SUk!|WRu|4Y(3 Mrhhc`h}E_K0cCQtZ~y=R literal 0 HcmV?d00001 From bc036fc39d131abfd4e5f563b44c6a12ac754dda Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 29 Jul 2018 14:16:04 +0530 Subject: [PATCH 063/298] [BAEL-7608] - Reverted NettyContext to Embedded Tomcat example with Async = true --- .../functional/FunctionalWebApplication.java | 27 ++++++++++++++----- ...Spring5URLPatternUsingRouterFunctions.java | 27 +++++++++++++------ ...nctionalWebApplicationIntegrationTest.java | 12 +++------ ...rnUsingRouterFunctionsIntegrationTest.java | 8 +++--- 4 files changed, 47 insertions(+), 27 deletions(-) diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java index 4e914ab65e..1f40798ada 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalWebApplication.java @@ -12,9 +12,14 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import org.apache.catalina.Context; +import org.apache.catalina.Wrapper; +import org.apache.catalina.startup.Tomcat; +import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; +import org.springframework.boot.web.server.WebServer; import org.springframework.core.io.ClassPathResource; import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; +import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; @@ -22,8 +27,6 @@ import org.springframework.web.server.WebHandler; import org.springframework.web.server.adapter.WebHttpHandlerBuilder; import reactor.core.publisher.Flux; -import reactor.ipc.netty.NettyContext; -import reactor.ipc.netty.http.server.HttpServer; public class FunctionalWebApplication { @@ -48,15 +51,25 @@ public class FunctionalWebApplication { }); } - NettyContext start() throws Exception { + WebServer start() throws Exception { WebHandler webHandler = (WebHandler) toHttpHandler(routingFunction()); HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler(webHandler) .filter(new IndexRewriteFilter()) .build(); - ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); - HttpServer server = HttpServer.create("localhost", 9090); - return server.newHandler(adapter).block(); + Tomcat tomcat = new Tomcat(); + tomcat.setHostname("localhost"); + tomcat.setPort(9090); + Context rootContext = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); + Wrapper servletWrapper = Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet); + servletWrapper.setAsyncSupported(true); + rootContext.addServletMappingDecoded("/", "httpHandlerServlet"); + + TomcatWebServer server = new TomcatWebServer(tomcat); + server.start(); + return server; + } public static void main(String[] args) { diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctions.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctions.java index 0de1bcb539..115a057915 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctions.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctions.java @@ -6,18 +6,20 @@ import static org.springframework.web.reactive.function.server.RouterFunctions.r import static org.springframework.web.reactive.function.server.RouterFunctions.toHttpHandler; import static org.springframework.web.reactive.function.server.ServerResponse.ok; +import org.apache.catalina.Context; +import org.apache.catalina.Wrapper; +import org.apache.catalina.startup.Tomcat; +import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; +import org.springframework.boot.web.server.WebServer; import org.springframework.core.io.ClassPathResource; import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter; +import org.springframework.http.server.reactive.ServletHttpHandlerAdapter; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; import org.springframework.web.server.WebHandler; import org.springframework.web.server.adapter.WebHttpHandlerBuilder; -import reactor.ipc.netty.NettyContext; -import reactor.ipc.netty.http.server.HttpServer; - public class ExploreSpring5URLPatternUsingRouterFunctions { private RouterFunction routingFunction() { @@ -29,15 +31,24 @@ public class ExploreSpring5URLPatternUsingRouterFunctions { .and(RouterFunctions.resources("/files/{*filepaths}", new ClassPathResource("files/"))); } - NettyContext start() throws Exception { + WebServer start() throws Exception { WebHandler webHandler = (WebHandler) toHttpHandler(routingFunction()); HttpHandler httpHandler = WebHttpHandlerBuilder.webHandler(webHandler) .filter(new IndexRewriteFilter()) .build(); - ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); - HttpServer server = HttpServer.create("localhost", 9090); - return server.newHandler(adapter).block(); + Tomcat tomcat = new Tomcat(); + tomcat.setHostname("localhost"); + tomcat.setPort(9090); + Context rootContext = tomcat.addContext("", System.getProperty("java.io.tmpdir")); + ServletHttpHandlerAdapter servlet = new ServletHttpHandlerAdapter(httpHandler); + Wrapper servletWrapper = Tomcat.addServlet(rootContext, "httpHandlerServlet", servlet); + servletWrapper.setAsyncSupported(true); + rootContext.addServletMappingDecoded("/", "httpHandlerServlet"); + + TomcatWebServer server = new TomcatWebServer(tomcat); + server.start(); + return server; } diff --git a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java index e780589333..4dea2a05cf 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/functional/FunctionalWebApplicationIntegrationTest.java @@ -3,11 +3,10 @@ package com.baeldung.functional; import static org.springframework.web.reactive.function.BodyInserters.fromObject; import static org.springframework.web.reactive.function.BodyInserters.fromResource; -import java.net.InetSocketAddress; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.springframework.boot.web.server.WebServer; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.http.MediaType; @@ -16,25 +15,22 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.reactive.function.BodyInserters; -import reactor.ipc.netty.NettyContext; - public class FunctionalWebApplicationIntegrationTest { private static WebTestClient client; - private static NettyContext server; + private static WebServer server; @BeforeClass public static void setup() throws Exception { server = new FunctionalWebApplication().start(); - InetSocketAddress serverAddress = server.address(); client = WebTestClient.bindToServer() - .baseUrl("http://" + serverAddress.getHostName() + ":" + serverAddress.getPort()) + .baseUrl("http://localhost:" + server.getPort()) .build(); } @AfterClass public static void destroy() { - server.dispose(); + server.stop(); } @Test diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java index c9e1c59fdc..d735fd9f72 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java @@ -5,6 +5,7 @@ import java.net.InetSocketAddress; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.springframework.boot.web.server.WebServer; import org.springframework.test.web.reactive.server.WebTestClient; import reactor.ipc.netty.NettyContext; @@ -12,20 +13,19 @@ import reactor.ipc.netty.NettyContext; public class ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest { private static WebTestClient client; - private static NettyContext server; + private static WebServer server; @BeforeClass public static void setup() throws Exception { server = new ExploreSpring5URLPatternUsingRouterFunctions().start(); - InetSocketAddress serverAddress = server.address(); client = WebTestClient.bindToServer() - .baseUrl("http://" + serverAddress.getHostName() + ":" + serverAddress.getPort()) + .baseUrl("http://localhost:" + server.getPort()) .build(); } @AfterClass public static void destroy() { - server.dispose(); + server.stop(); } @Test From 38e7ec8065772db736169fbd8d3fe27dbadba406 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 29 Jul 2018 14:17:48 +0530 Subject: [PATCH 064/298] [BAEL-7608] - Removed unused imports --- ...eSpring5URLPatternUsingRouterFunctionsIntegrationTest.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java index d735fd9f72..91721d2cef 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/reactive/urlmatch/ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest.java @@ -1,15 +1,11 @@ package com.baeldung.reactive.urlmatch; -import java.net.InetSocketAddress; - import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.boot.web.server.WebServer; import org.springframework.test.web.reactive.server.WebTestClient; -import reactor.ipc.netty.NettyContext; - public class ExploreSpring5URLPatternUsingRouterFunctionsIntegrationTest { private static WebTestClient client; From 4981b1fd0e52510e07776263802c49005fac7d8e Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 29 Jul 2018 15:03:12 +0300 Subject: [PATCH 065/298] Update pom.xml --- libraries/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/pom.xml b/libraries/pom.xml index 909be87083..02ea1d4d51 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -771,7 +771,7 @@ ${hamcrest-all.version} test - + org.eclipse.paho org.eclipse.paho.client.mqttv3 1.2.0 @@ -1024,4 +1024,4 @@ 3.0.2 - \ No newline at end of file + From ec4a0a5b941bb2c4da4c37a4a017943759490df6 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 29 Jul 2018 18:32:39 +0530 Subject: [PATCH 066/298] [BAEL-7609] - Fixed spring-boot integration tests --- .../controller/FooController.java | 5 +++-- .../org/baeldung/boot/config/WebConfig.java | 15 +++++++++++++++ .../converter/StringToEmployeeConverter.java | 16 ++++++++++++++++ .../StringToEmployeeConverterController.java | 17 +++++++++++++++++ .../HibernateSessionIntegrationTest.java | 10 ++++------ .../NoHibernateSessionIntegrationTest.java | 2 ++ .../CustomConverterIntegrationTest.java | 2 +- .../EmployeeServiceImplIntegrationTest.java | 19 ++++++++----------- 8 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java create mode 100644 spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java create mode 100644 spring-boot/src/main/java/org/baeldung/boot/converter/controller/StringToEmployeeConverterController.java diff --git a/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java b/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java index c4a83cc2d9..630820ff9f 100644 --- a/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java +++ b/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java @@ -3,6 +3,7 @@ package com.baeldung.displayallbeans.controller; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @@ -14,9 +15,9 @@ public class FooController { private FooService fooService; @GetMapping(value = "/displayallbeans") - public String getHeaderAndBody(Map model) { + public ResponseEntity getHeaderAndBody(Map model) { model.put("header", fooService.getHeader()); model.put("message", fooService.getBody()); - return "displayallbeans"; + return ResponseEntity.ok("displayallbeans"); } } diff --git a/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java b/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java new file mode 100644 index 0000000000..69abeb0bdd --- /dev/null +++ b/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java @@ -0,0 +1,15 @@ +package org.baeldung.boot.config; + +import org.baeldung.boot.converter.StringToEmployeeConverter; +import org.springframework.context.annotation.Configuration; +import org.springframework.format.FormatterRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebConfig implements WebMvcConfigurer { + + @Override + public void addFormatters(FormatterRegistry registry) { + registry.addConverter(new StringToEmployeeConverter()); + } +} diff --git a/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java new file mode 100644 index 0000000000..6902cd84d1 --- /dev/null +++ b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java @@ -0,0 +1,16 @@ +package org.baeldung.boot.converter; + +import org.springframework.core.convert.converter.Converter; + +import com.baeldung.toggle.Employee; + +public class StringToEmployeeConverter implements Converter { + + @Override + public Employee convert(String from) { + String[] data = from.split(","); + return new Employee( + Long.parseLong(data[0]), + Double.parseDouble(data[1])); + } +} diff --git a/spring-boot/src/main/java/org/baeldung/boot/converter/controller/StringToEmployeeConverterController.java b/spring-boot/src/main/java/org/baeldung/boot/converter/controller/StringToEmployeeConverterController.java new file mode 100644 index 0000000000..27bad4c387 --- /dev/null +++ b/spring-boot/src/main/java/org/baeldung/boot/converter/controller/StringToEmployeeConverterController.java @@ -0,0 +1,17 @@ +package org.baeldung.boot.converter.controller; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.toggle.Employee; + +@RestController +public class StringToEmployeeConverterController { + + @GetMapping("/string-to-employee") + public ResponseEntity getStringToEmployee(@RequestParam("employee") Employee employee) { + return ResponseEntity.ok(employee); + } +} diff --git a/spring-boot/src/test/java/org/baeldung/boot/repository/HibernateSessionIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/repository/HibernateSessionIntegrationTest.java index 4658861162..baa4f70e83 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/repository/HibernateSessionIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/repository/HibernateSessionIntegrationTest.java @@ -4,17 +4,15 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertThat; -import org.baeldung.boot.ApplicationIntegrationTest; +import org.baeldung.boot.DemoApplicationIntegrationTest; import org.baeldung.demo.model.Foo; -import org.baeldung.session.exception.repository.FooRepository; +import org.baeldung.demo.repository.FooRepository; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.TestPropertySource; import org.springframework.transaction.annotation.Transactional; @Transactional -@TestPropertySource("classpath:exception-hibernate.properties") -public class HibernateSessionIntegrationTest extends ApplicationIntegrationTest { +public class HibernateSessionIntegrationTest extends DemoApplicationIntegrationTest { @Autowired private FooRepository fooRepository; @@ -23,7 +21,7 @@ public class HibernateSessionIntegrationTest extends ApplicationIntegrationTest Foo foo = new Foo("Exception Solved"); fooRepository.save(foo); foo = null; - foo = fooRepository.get(1); + foo = fooRepository.findByName("Exception Solved"); assertThat(foo, notNullValue()); assertThat(foo.getId(), is(1)); diff --git a/spring-boot/src/test/java/org/baeldung/boot/repository/NoHibernateSessionIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/repository/NoHibernateSessionIntegrationTest.java index 8de7068949..5c8d10223b 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/repository/NoHibernateSessionIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/repository/NoHibernateSessionIntegrationTest.java @@ -6,9 +6,11 @@ import org.baeldung.session.exception.repository.FooRepository; import org.hibernate.HibernateException; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.TestPropertySource; import org.springframework.transaction.annotation.Transactional; @Transactional +@TestPropertySource("classpath:exception-hibernate.properties") public class NoHibernateSessionIntegrationTest extends ApplicationIntegrationTest { @Autowired private FooRepository fooRepository; diff --git a/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java index bd1ae2c8fa..1356de6d0e 100644 --- a/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java @@ -43,7 +43,7 @@ public class CustomConverterIntegrationTest { @Test public void whenConvertingToBigDecimalUsingGenericConverter_thenSuccess() { - assertThat(conversionService.convert(Integer.valueOf(11), BigDecimal.class)).isEqualTo(BigDecimal.valueOf(11.00).setScale(2, BigDecimal.ROUND_HALF_EVEN)); + assertThat(conversionService.convert(Integer.valueOf(11), BigDecimal.class)).isEqualTo(BigDecimal.valueOf(11.00).setScale(0, BigDecimal.ROUND_HALF_EVEN)); assertThat(conversionService.convert(Double.valueOf(25.23), BigDecimal.class)).isEqualByComparingTo(BigDecimal.valueOf(Double.valueOf(25.23))); assertThat(conversionService.convert("2.32", BigDecimal.class)).isEqualTo(BigDecimal.valueOf(2.32)); } diff --git a/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeServiceImplIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeServiceImplIntegrationTest.java index 4eec62db13..df28111a57 100644 --- a/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeServiceImplIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/demo/boottest/EmployeeServiceImplIntegrationTest.java @@ -1,9 +1,11 @@ package org.baeldung.demo.boottest; -import org.baeldung.demo.boottest.Employee; -import org.baeldung.demo.boottest.EmployeeRepository; -import org.baeldung.demo.boottest.EmployeeService; -import org.baeldung.demo.boottest.EmployeeServiceImpl; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -15,11 +17,6 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; import org.springframework.test.context.junit4.SpringRunner; -import java.util.Arrays; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - @RunWith(SpringRunner.class) public class EmployeeServiceImplIntegrationTest { @@ -50,9 +47,9 @@ public class EmployeeServiceImplIntegrationTest { Mockito.when(employeeRepository.findByName(john.getName())).thenReturn(john); Mockito.when(employeeRepository.findByName(alex.getName())).thenReturn(alex); Mockito.when(employeeRepository.findByName("wrong_name")).thenReturn(null); - Mockito.when(employeeRepository.findById(john.getId()).orElse(null)).thenReturn(john); + Mockito.when(employeeRepository.findById(john.getId())).thenReturn(Optional.of(john)); Mockito.when(employeeRepository.findAll()).thenReturn(allEmployees); - Mockito.when(employeeRepository.findById(-99L).orElse(null)).thenReturn(null); + Mockito.when(employeeRepository.findById(-99L)).thenReturn(Optional.empty()); } @Test From deb27c1e3bbd7b2dc6416a70a0004a1f359a8f71 Mon Sep 17 00:00:00 2001 From: Tonnix Date: Sun, 29 Jul 2018 18:07:16 +0300 Subject: [PATCH 067/298] Added PR files for BAEL-2031 (#4844) * Added source files for BAEL-2031 * Added test files for BAEL-2031 --- ...lectionStreamsUsingCommonsEmptyIfNull.java | 19 +++++++ ...ionStreamsUsingJava8OptionalContainer.java | 21 ++++++++ ...ctionStreamsUsingNullDereferenceCheck.java | 20 +++++++ ...treamsUsingCommonsEmptyIfNullUnitTest.java | 41 ++++++++++++++ ...msUsingJava8OptionalContainerUnitTest.java | 53 +++++++++++++++++++ ...eamsUsingNullDereferenceCheckUnitTest.java | 45 ++++++++++++++++ 6 files changed, 199 insertions(+) create mode 100644 core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java create mode 100644 core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java create mode 100644 core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java create mode 100644 core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java create mode 100644 core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java create mode 100644 core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java diff --git a/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java b/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java new file mode 100644 index 0000000000..7587cc6834 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java @@ -0,0 +1,19 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Collection; +import java.util.stream.Stream; +import static org.apache.commons.collections4.CollectionUtils.emptyIfNull; + +public class NullSafeCollectionStreamsUsingCommonsEmptyIfNull { + + /** + * This method shows how to make a null safe stream from a collection through the use of + * emptyIfNull() method from Apache Commons CollectionUtils library + * + * @param collection The collection that is to be converted into a stream + * @return The stream that has been created from the collection or an empty stream if the collection is null + */ + public Stream collectionAsStream(Collection collection) { + return emptyIfNull(collection).stream(); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java b/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java new file mode 100644 index 0000000000..ae8e399d53 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java @@ -0,0 +1,21 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Collection; +import java.util.Optional; +import java.util.stream.Stream; + +public class NullSafeCollectionStreamsUsingJava8OptionalContainer { + + /** + * This method shows how to make a null safe stream from a collection through the use of + * Java SE 8’s Optional Container + * + * @param collection The collection that is to be converted into a stream + * @return The stream that has been created from the collection or an empty stream if the collection is null + */ + public Stream collectionAsStream(Collection collection) { + return Optional.ofNullable(collection) + .map(Collection::stream) + .orElseGet(Stream::empty); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java b/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java new file mode 100644 index 0000000000..63b6d34f11 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java @@ -0,0 +1,20 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Collection; +import java.util.stream.Stream; + +public class NullSafeCollectionStreamsUsingNullDereferenceCheck { + + /** + * This method shows how to make a null safe stream from a collection through the use of a check + * to prevent null dereferences + * + * @param collection The collection that is to be converted into a stream + * @return The stream that has been created from the collection or an empty stream if the collection is null + */ + public Stream collectionAsStream(Collection collection) { + return collection == null ? Stream.empty() : collection.stream(); + } + + +} diff --git a/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java b/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java new file mode 100644 index 0000000000..f68df2c821 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java @@ -0,0 +1,41 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.stream.Stream; +import org.junit.Test; +import static org.junit.Assert.*; + + +public class NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest { + + private final NullSafeCollectionStreamsUsingCommonsEmptyIfNull instance = + new NullSafeCollectionStreamsUsingCommonsEmptyIfNull(); + + @Test + public void whenCollectionIsNull_thenExpectAnEmptyStream() { + Collection collection = null; + Stream expResult = Stream.empty(); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + + } + + @Test + public void whenCollectionHasElements_thenExpectAStreamOfExactlyTheSameElements() { + + Collection collection = Arrays.asList("a", "b", "c"); + Stream expResult = Arrays.stream(new String[] { "a", "b", "c" }); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + } + + private static void assertStreamEquals(Stream s1, Stream s2) { + Iterator iter1 = s1.iterator(), iter2 = s2.iterator(); + while (iter1.hasNext() && iter2.hasNext()) + assertEquals(iter1.next(), iter2.next()); + assert !iter1.hasNext() && !iter2.hasNext(); + } + +} diff --git a/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java b/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java new file mode 100644 index 0000000000..4df3482633 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java @@ -0,0 +1,53 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.stream.Stream; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author Kwaje Anthony + */ +public class NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest { + + private final NullSafeCollectionStreamsUsingJava8OptionalContainer instance = + new NullSafeCollectionStreamsUsingJava8OptionalContainer(); + + @Test + public void whenCollectionIsNull_thenExpectAnEmptyStream() { + Collection collection = null; + Stream expResult = Stream.empty(); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + + } + + @Test + public void whenCollectionHasElements_thenExpectAStreamOfExactlyTheSameElements() { + + Collection collection = Arrays.asList("a", "b", "c"); + Stream expResult = Arrays.stream(new String[] { "a", "b", "c" }); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + } + + private static void assertStreamEquals(Stream s1, Stream s2) { + Iterator iter1 = s1.iterator(), iter2 = s2.iterator(); + while (iter1.hasNext() && iter2.hasNext()) + assertEquals(iter1.next(), iter2.next()); + assert !iter1.hasNext() && !iter2.hasNext(); + } + +} diff --git a/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java b/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java new file mode 100644 index 0000000000..ddb4dcdc12 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java @@ -0,0 +1,45 @@ + +package com.baeldung.nullsafecollectionstreams; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.stream.Stream; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author Kwaje Anthony + */ +public class NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest { + + private final NullSafeCollectionStreamsUsingNullDereferenceCheck instance = + new NullSafeCollectionStreamsUsingNullDereferenceCheck(); + + @Test + public void whenCollectionIsNull_thenExpectAnEmptyStream() { + Collection collection = null; + Stream expResult = Stream.empty(); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + + } + + @Test + public void whenCollectionHasElements_thenExpectAStreamOfExactlyTheSameElements() { + + Collection collection = Arrays.asList("a", "b", "c"); + Stream expResult = Arrays.stream(new String[] { "a", "b", "c" }); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + } + + private static void assertStreamEquals(Stream s1, Stream s2) { + Iterator iter1 = s1.iterator(), iter2 = s2.iterator(); + while (iter1.hasNext() && iter2.hasNext()) + assertEquals(iter1.next(), iter2.next()); + assert !iter1.hasNext() && !iter2.hasNext(); + } + +} From 14ad816b7db7cbb7bce56a04ce963b344379d5d4 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 29 Jul 2018 18:12:48 +0300 Subject: [PATCH 068/298] re-add code for type conversion article --- .../org/baeldung/boot/config/WebConfig.java | 4 +++ .../converter/GenericBigDecimalConverter.java | 31 +++++++++++++++++++ .../converter/StringToEmployeeConverter.java | 4 +-- .../StringToEnumConverterFactory.java | 30 ++++++++++++++++++ .../CustomConverterIntegrationTest.java | 2 +- 5 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 spring-boot/src/main/java/org/baeldung/boot/converter/GenericBigDecimalConverter.java create mode 100644 spring-boot/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java diff --git a/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java b/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java index 69abeb0bdd..825e38f622 100644 --- a/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java +++ b/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java @@ -1,6 +1,8 @@ package org.baeldung.boot.config; import org.baeldung.boot.converter.StringToEmployeeConverter; +import org.baeldung.boot.converter.StringToEnumConverterFactory; +import org.baeldung.boot.converter.GenericBigDecimalConverter; import org.springframework.context.annotation.Configuration; import org.springframework.format.FormatterRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -11,5 +13,7 @@ public class WebConfig implements WebMvcConfigurer { @Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new StringToEmployeeConverter()); + registry.addConverterFactory(new StringToEnumConverterFactory()); + registry.addConverter(new GenericBigDecimalConverter()); } } diff --git a/spring-boot/src/main/java/org/baeldung/boot/converter/GenericBigDecimalConverter.java b/spring-boot/src/main/java/org/baeldung/boot/converter/GenericBigDecimalConverter.java new file mode 100644 index 0000000000..8add28fc2d --- /dev/null +++ b/spring-boot/src/main/java/org/baeldung/boot/converter/GenericBigDecimalConverter.java @@ -0,0 +1,31 @@ +package org.baeldung.boot.converter; + +import com.google.common.collect.ImmutableSet; +import org.springframework.core.convert.TypeDescriptor; +import org.springframework.core.convert.converter.GenericConverter; +import java.math.BigDecimal; +import java.util.Set; +public class GenericBigDecimalConverter implements GenericConverter { + @Override + public Set getConvertibleTypes () { + ConvertiblePair[] pairs = new ConvertiblePair[] { + new ConvertiblePair(Number.class, BigDecimal.class), + new ConvertiblePair(String.class, BigDecimal.class)}; + return ImmutableSet.copyOf(pairs); + } + @Override + public Object convert (Object source, TypeDescriptor sourceType, + TypeDescriptor targetType) { + if (sourceType.getType() == BigDecimal.class) { + return source; + } + if(sourceType.getType() == String.class) { + String number = (String) source; + return new BigDecimal(number); + } else { + Number number = (Number) source; + BigDecimal converted = new BigDecimal(number.doubleValue()); + return converted.setScale(2, BigDecimal.ROUND_HALF_EVEN); + } + } +} \ No newline at end of file diff --git a/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java index 6902cd84d1..1bf75b38f0 100644 --- a/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java +++ b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEmployeeConverter.java @@ -9,8 +9,6 @@ public class StringToEmployeeConverter implements Converter { @Override public Employee convert(String from) { String[] data = from.split(","); - return new Employee( - Long.parseLong(data[0]), - Double.parseDouble(data[1])); + return new Employee(Long.parseLong(data[0]), Double.parseDouble(data[1])); } } diff --git a/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java new file mode 100644 index 0000000000..ddb2cd2b08 --- /dev/null +++ b/spring-boot/src/main/java/org/baeldung/boot/converter/StringToEnumConverterFactory.java @@ -0,0 +1,30 @@ +package org.baeldung.boot.converter; + +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.convert.converter.ConverterFactory; +import org.springframework.stereotype.Component; + +@Component +public class StringToEnumConverterFactory + implements ConverterFactory { + + private static class StringToEnumConverter + implements Converter { + + private Class enumType; + + public StringToEnumConverter(Class enumType) { + this.enumType = enumType; + } + + public T convert(String source) { + return (T) Enum.valueOf(this.enumType, source.trim()); + } + } + + @Override + public Converter getConverter( + Class targetType) { + return new StringToEnumConverter(targetType); + } +} \ No newline at end of file diff --git a/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java index 1356de6d0e..bd1ae2c8fa 100644 --- a/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/converter/CustomConverterIntegrationTest.java @@ -43,7 +43,7 @@ public class CustomConverterIntegrationTest { @Test public void whenConvertingToBigDecimalUsingGenericConverter_thenSuccess() { - assertThat(conversionService.convert(Integer.valueOf(11), BigDecimal.class)).isEqualTo(BigDecimal.valueOf(11.00).setScale(0, BigDecimal.ROUND_HALF_EVEN)); + assertThat(conversionService.convert(Integer.valueOf(11), BigDecimal.class)).isEqualTo(BigDecimal.valueOf(11.00).setScale(2, BigDecimal.ROUND_HALF_EVEN)); assertThat(conversionService.convert(Double.valueOf(25.23), BigDecimal.class)).isEqualByComparingTo(BigDecimal.valueOf(Double.valueOf(25.23))); assertThat(conversionService.convert("2.32", BigDecimal.class)).isEqualTo(BigDecimal.valueOf(2.32)); } From 0c28af774ad1675fe8db01b524cb790484511017 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 29 Jul 2018 21:55:28 +0300 Subject: [PATCH 069/298] upgrade sockets to spring5 --- parent-spring-5/pom.xml | 2 ++ spring-security-mvc-socket/pom.xml | 12 +++++------- .../springsecuredsockets/config/AppConfig.java | 6 +++--- .../config/SocketBrokerConfig.java | 4 ++-- .../config/WebAppInitializer.java | 1 - .../security/CustomDaoAuthenticationProvider.java | 1 - 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/parent-spring-5/pom.xml b/parent-spring-5/pom.xml index f02796cfcf..6a15f38884 100644 --- a/parent-spring-5/pom.xml +++ b/parent-spring-5/pom.xml @@ -32,6 +32,8 @@ 5.0.6.RELEASE 5.0.2 2.9.6 + 2.9.6 + 5.0.6.RELEASE \ No newline at end of file diff --git a/spring-security-mvc-socket/pom.xml b/spring-security-mvc-socket/pom.xml index b3155c3bf5..1f75becc98 100644 --- a/spring-security-mvc-socket/pom.xml +++ b/spring-security-mvc-socket/pom.xml @@ -11,9 +11,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-4 + ../parent-spring-5 @@ -56,12 +56,12 @@ org.springframework.security spring-security-web - ${springsecurity.version} + ${spring-security.version} org.springframework.security spring-security-config - ${springsecurity.version} + ${spring-security.version} @@ -95,7 +95,7 @@ org.springframework.security spring-security-messaging - ${springsecurity.version} + ${spring-security.version} @@ -176,8 +176,6 @@ - 4.2.6.RELEASE - 2.8.7 5.2.10.Final 1.11.3.RELEASE 1.4.196 diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java index da687a328a..49b7ab2ff8 100644 --- a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java +++ b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java @@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.resource.PathResourceResolver; import org.springframework.web.servlet.view.JstlView; import org.springframework.web.servlet.view.UrlBasedViewResolver; @@ -20,7 +20,7 @@ import java.sql.SQLException; @EnableJpaRepositories @ComponentScan("com.baeldung.springsecuredsockets") @Import({ SecurityConfig.class, DataStoreConfig.class, SocketBrokerConfig.class, SocketSecurityConfig.class }) -public class AppConfig extends WebMvcConfigurerAdapter { +public class AppConfig implements WebMvcConfigurer { public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("index"); @@ -51,6 +51,6 @@ public class AppConfig extends WebMvcConfigurerAdapter { // View H2 @Bean(initMethod="start", destroyMethod="stop") public Server h2Console () throws SQLException { - return Server.createWebServer("-web","-webAllowOthers","-webDaemon","-webPort", "8082"); + return Server.createWebServer("-web","-webAllowOthers","-webDaemon","-webPort", "8084"); } } \ No newline at end of file diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java index 5affbd4c0e..941cac8392 100644 --- a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java +++ b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java @@ -3,15 +3,15 @@ package com.baeldung.springsecuredsockets.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.messaging.simp.config.MessageBrokerRegistry; -import org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer; import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; import org.springframework.web.socket.config.annotation.StompEndpointRegistry; +import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; @Configuration @EnableWebSocketMessageBroker @ComponentScan("com.baeldung.springsecuredsockets.controllers") -public class SocketBrokerConfig extends AbstractWebSocketMessageBrokerConfigurer { +public class SocketBrokerConfig implements WebSocketMessageBrokerConfigurer { @Override public void configureMessageBroker(MessageBrokerRegistry config) { diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java index 20311426c7..84c045a75a 100644 --- a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java +++ b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java @@ -1,6 +1,5 @@ package com.baeldung.springsecuredsockets.config; -import org.hibernate.cfg.Configuration; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; diff --git a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java index 576495bedf..5b246ac380 100644 --- a/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java +++ b/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java @@ -8,7 +8,6 @@ import org.springframework.security.authentication.dao.DaoAuthenticationProvider import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; public class CustomDaoAuthenticationProvider extends DaoAuthenticationProvider { From 93bfc63f153d622c61cb186cd71fd07b896586ce Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Sun, 29 Jul 2018 22:56:16 -0400 Subject: [PATCH 070/298] Create readme.md --- jersey-client-rx/readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 jersey-client-rx/readme.md diff --git a/jersey-client-rx/readme.md b/jersey-client-rx/readme.md new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/jersey-client-rx/readme.md @@ -0,0 +1 @@ + From c195c5dc508d733f0c4e2a3921ad69d1e0d1eb06 Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Sun, 29 Jul 2018 22:56:58 -0400 Subject: [PATCH 071/298] Add files via upload --- jersey-client-rx/pom.xml | 30 +++ .../samples/jerseyrx/ClientOrchestration.java | 203 ++++++++++++++++++ 2 files changed, 233 insertions(+) create mode 100644 jersey-client-rx/pom.xml create mode 100644 jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java diff --git a/jersey-client-rx/pom.xml b/jersey-client-rx/pom.xml new file mode 100644 index 0000000000..3857c16730 --- /dev/null +++ b/jersey-client-rx/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + com.baeldung.samples + jersey-client-rx + 1.0 + jar + + + org.glassfish.jersey.core + jersey-client + 2.27 + + + org.glassfish.jersey.ext.rx + jersey-rx-client-rxjava + 2.27 + + + org.glassfish.jersey.ext.rx + jersey-rx-client-rxjava2 + 2.27 + + + + UTF-8 + 1.8 + 1.8 + + \ No newline at end of file diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java new file mode 100644 index 0000000000..4adf5e50b8 --- /dev/null +++ b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java @@ -0,0 +1,203 @@ +package com.baeldung.samples.jerseyrx; + +import io.reactivex.Flowable; +import io.reactivex.disposables.Disposable; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import org.glassfish.jersey.client.rx.rxjava.RxObservableInvokerProvider; +import org.glassfish.jersey.client.rx.rxjava.RxObservableInvoker; +import java.util.logging.Logger; +import java.util.stream.Collectors; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.InvocationCallback; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.GenericType; +import org.glassfish.jersey.client.rx.rxjava2.RxFlowableInvoker; +import org.glassfish.jersey.client.rx.rxjava2.RxFlowableInvokerProvider; +import rx.Observable; + +/** + * + * @author baeldung + */ +public class ClientOrchestration { + + Client client = ClientBuilder.newClient(); + WebTarget userIdService = client.target("http:localhost:8080/serviceA/id?limit=10"); + WebTarget nameService = client.target("http:localhost:8080/serviceA/{empId}/name"); + WebTarget hashService = client.target("http:localhost:8080/serviceA/{comboIDandName}/address"); + + Logger logger = Logger.getLogger("ClientOrchestrator"); + + public static void main(String[] args) { + ClientOrchestration orchestrator = new ClientOrchestration(); + + orchestrator.callBackOrchestrate(); + orchestrator.rxOrchestrate(); + orchestrator.observableJavaOrchestrate(); + orchestrator.flowableJavaOrchestrate(); + + } + + public void callBackOrchestrate() { + logger.info("Orchestrating with the pyramid of doom"); + userIdService.request() + .async() + .get(new InvocationCallback>() { + @Override + public void completed(List empIds) { + CountDownLatch completionTracker = new CountDownLatch(empIds.size()); //used to keep track of the progress of the subsequent calls + empIds.forEach((id) -> { + //for each employee ID, get the name + nameService.resolveTemplate("empId", id).request() + .async() + .get(new InvocationCallback() { + @Override + public void completed(String response) { + completionTracker.countDown(); + hashService.request().async().get(new InvocationCallback() { + @Override + public void completed(String response) { + logger.log(Level.INFO, "The hash output {0}", response); + } + + @Override + public void failed(Throwable throwable) { + completionTracker.countDown(); + logger.log(Level.WARNING, "An error has occurred in the hashing request step {0}", throwable.getMessage()); + } + }); + } + @Override + public void failed(Throwable throwable) { + completionTracker.countDown(); + logger.log(Level.WARNING, "An error has occurred in the username request step {0}", throwable.getMessage()); + } + }); + }); + + try { + if (!completionTracker.await(10, TimeUnit.SECONDS)) { //wait for inner requests to complete in 10 seconds + logger.warning("Some requests didn't complete within the timeout"); + } + } catch (InterruptedException ex) { + Logger.getLogger(ClientOrchestration.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + @Override + public void failed(Throwable throwable) { + //implement callback + } + }); + } + + public void rxOrchestrate() { + logger.info("Orchestrating with a CompletionStage"); + CompletionStage> userIdStage = userIdService.request() + .rx() + .get(new GenericType>() { + }) + .exceptionally((Throwable throwable) -> { + logger.warning("An error has occurred"); + return null; + }); + + CompletionStage>> completedNameStage = userIdStage.thenApplyAsync(list -> list.stream().map((Long id) -> { + CompletionStage nameStage = nameService.resolveTemplate("empId", id).request().rx().get(String.class); + }).collect(Collectors.toList())); + + userIdStage.thenAcceptAsync(listOfIds -> { + listOfIds.stream().map((Long id) -> { + CompletableFuture completable = nameService.resolveTemplate("empId", id) + .request() + .rx() + .get(String.class) + .toCompletableFuture(); + + completable.thenAccept((String userName) -> { + hashService.resolveTemplate("comboIDandName", userName + id) + .request() + .rx() + .get(String.class) + .toCompletableFuture() + .thenAcceptAsync(hashValue -> logger.log(Level.INFO, "The hash output {0}", hashValue)) + .exceptionally((Throwable throwable) -> { + logger.log(Level.WARNING, "Hash computation failed for {0}", id); + return null; + }); + + }); + + }); + }); + + } + + public void observableJavaOrchestrate() { + + logger.info("Orchestrating with Observables"); + + client.register(RxObservableInvokerProvider.class); + + Observable> userIdObservable = userIdService.request() + .rx(RxObservableInvoker.class) + .get(new GenericType>() { + }); + + userIdObservable.subscribe((List listOfIds) -> { + Observable.from(listOfIds).map(id + -> nameService.resolveTemplate("empId", id) + .request() + .rx(RxObservableInvoker.class) + .get(String.class) + .asObservable() //gotten the name for the given empId + .doOnError(throwable -> logger.log(Level.WARNING, "An error has occurred in the username request step {0}", throwable.getMessage())) + .subscribe(userName -> hashService.resolveTemplate("comboIDandName", userName + id) + .request() + .rx(RxObservableInvoker.class) + .get(String.class) + .asObservable() //gotten the hash value for empId+username + .doOnError(throwable -> logger.log(Level.WARNING, "An error has occurred in the hashing request step {0}", throwable.getMessage())) + .subscribe(hashValue -> logger.log(Level.INFO, "The hash output {0}", hashValue)))); + }); + + } + + public void flowableJavaOrchestrate() { + + logger.info("Orchestrating with Flowable"); + + client.register(RxFlowableInvokerProvider.class); + + Flowable> userIdObservable = userIdService.request() + .rx(RxFlowableInvoker.class) + .get(new GenericType>() { + }); + + Disposable subscribe = userIdObservable.subscribe((List listOfIds) -> { + Observable.from(listOfIds).map(id + -> nameService.resolveTemplate("empId", id) + .request() + .rx(RxObservableInvoker.class) + .get(String.class) + .asObservable() //gotten the name for the given empId + .doOnError(throwable -> logger.log(Level.WARNING, "An error has occurred in the username request step {0}", throwable.getMessage())) + .subscribe(userName -> hashService.resolveTemplate("comboIDandName", userName + id) + .request() + .rx(RxObservableInvoker.class) + .get(String.class) + .asObservable() //gotten the hash value for empId+username + .doOnError(throwable -> logger.warning("An error has occurred in the hashing request step " + throwable.getMessage())) + .subscribe(hashValue -> logger.log(Level.INFO, "The hash output {0}", hashValue)))); + }); + + } + +} From 075ba76de1d6688a1cf8374551ded910d1fba2c1 Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Sun, 29 Jul 2018 23:36:33 -0400 Subject: [PATCH 072/298] Add files via upload --- jersey-client-rx/pom.xml | 5 ++++ .../samples/jerseyrx/ClientOrchestration.java | 27 +++++++------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/jersey-client-rx/pom.xml b/jersey-client-rx/pom.xml index 3857c16730..cc5f28c938 100644 --- a/jersey-client-rx/pom.xml +++ b/jersey-client-rx/pom.xml @@ -6,6 +6,11 @@ 1.0 jar + + org.glassfish.jersey.inject + jersey-hk2 + 2.27 + org.glassfish.jersey.core jersey-client diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java index 4adf5e50b8..d3e6986b39 100644 --- a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java +++ b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java @@ -28,9 +28,9 @@ import rx.Observable; public class ClientOrchestration { Client client = ClientBuilder.newClient(); - WebTarget userIdService = client.target("http:localhost:8080/serviceA/id?limit=10"); - WebTarget nameService = client.target("http:localhost:8080/serviceA/{empId}/name"); - WebTarget hashService = client.target("http:localhost:8080/serviceA/{comboIDandName}/address"); + WebTarget userIdService = client.target("http://localhost:8080/serviceA/id?limit=10"); + WebTarget nameService = client.target("http://localhost:8080/serviceA/{empId}/name"); + WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/address"); Logger logger = Logger.getLogger("ClientOrchestrator"); @@ -73,6 +73,7 @@ public class ClientOrchestration { } }); } + @Override public void failed(Throwable throwable) { completionTracker.countDown(); @@ -80,7 +81,7 @@ public class ClientOrchestration { } }); }); - + try { if (!completionTracker.await(10, TimeUnit.SECONDS)) { //wait for inner requests to complete in 10 seconds logger.warning("Some requests didn't complete within the timeout"); @@ -88,7 +89,7 @@ public class ClientOrchestration { } catch (InterruptedException ex) { Logger.getLogger(ClientOrchestration.class.getName()).log(Level.SEVERE, null, ex); } - + } @Override @@ -109,12 +110,8 @@ public class ClientOrchestration { return null; }); - CompletionStage>> completedNameStage = userIdStage.thenApplyAsync(list -> list.stream().map((Long id) -> { - CompletionStage nameStage = nameService.resolveTemplate("empId", id).request().rx().get(String.class); - }).collect(Collectors.toList())); - userIdStage.thenAcceptAsync(listOfIds -> { - listOfIds.stream().map((Long id) -> { + listOfIds.stream().forEach((Long id) -> { CompletableFuture completable = nameService.resolveTemplate("empId", id) .request() .rx() @@ -143,10 +140,7 @@ public class ClientOrchestration { public void observableJavaOrchestrate() { logger.info("Orchestrating with Observables"); - - client.register(RxObservableInvokerProvider.class); - - Observable> userIdObservable = userIdService.request() + Observable> userIdObservable = userIdService.register(RxObservableInvokerProvider.class).request() .rx(RxObservableInvoker.class) .get(new GenericType>() { }); @@ -173,10 +167,7 @@ public class ClientOrchestration { public void flowableJavaOrchestrate() { logger.info("Orchestrating with Flowable"); - - client.register(RxFlowableInvokerProvider.class); - - Flowable> userIdObservable = userIdService.request() + Flowable> userIdObservable = userIdService.register(RxFlowableInvokerProvider.class).request() .rx(RxFlowableInvoker.class) .get(new GenericType>() { }); From 03b611d494ef912add25e68a59d8f4dfd2f26028 Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Sun, 29 Jul 2018 23:38:53 -0400 Subject: [PATCH 073/298] Add files via upload --- .../java/com/baeldung/samples/jerseyrx/ClientOrchestration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java index d3e6986b39..2b5c6bf965 100644 --- a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java +++ b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java @@ -30,7 +30,7 @@ public class ClientOrchestration { Client client = ClientBuilder.newClient(); WebTarget userIdService = client.target("http://localhost:8080/serviceA/id?limit=10"); WebTarget nameService = client.target("http://localhost:8080/serviceA/{empId}/name"); - WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/address"); + WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/hash"); Logger logger = Logger.getLogger("ClientOrchestrator"); From 11c97cff08c49c727654b285d3985a1b6c8f2c7c Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Sun, 29 Jul 2018 23:42:17 -0400 Subject: [PATCH 074/298] Update readme.md --- jersey-client-rx/readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jersey-client-rx/readme.md b/jersey-client-rx/readme.md index 8b13789179..d1bc4e950b 100644 --- a/jersey-client-rx/readme.md +++ b/jersey-client-rx/readme.md @@ -1 +1,3 @@ +# Fluent, Reactive Jersey Client Orchestration # +### Sample code demonstrating the options for asynchronous, reactive RESTful service consumption with JAX-RS ### From 1bae07cc5c49f7d2c4c641c3901be34677634b13 Mon Sep 17 00:00:00 2001 From: sandy03934 Date: Mon, 30 Jul 2018 19:00:43 +0530 Subject: [PATCH 075/298] BAEL-1979 Added examples for SnakeYAML Library (#4802) * BAEL-1979 Added examples for SnakeYAML Library * BAEL-1979 Moved the snakeyaml related code to libraries module * BAEL-1979 Removed the System.out.println() statements and converted the assertTrue to assertEquals wherever possible. * BAEL-1979 Removed println statements, small formatting fix in pom.xml --- libraries/.gitignore | 1 + libraries/pom.xml | 11 +- .../java/com/baeldung/snakeyaml/Address.java | 41 ++++++ .../java/com/baeldung/snakeyaml/Contact.java | 26 ++++ .../java/com/baeldung/snakeyaml/Customer.java | 53 +++++++ .../JavaToYAMLSerializationUnitTest.java | 54 ++++++++ .../YAMLToJavaDeserialisationUnitTest.java | 131 ++++++++++++++++++ .../src/test/resources/yaml/customer.yaml | 3 + .../yaml/customer_with_contact_details.yaml | 7 + ...omer_with_contact_details_and_address.yaml | 13 ++ ...ustomer_with_contact_details_and_tags.yaml | 6 + .../resources/yaml/customer_with_type.yaml | 4 + .../src/test/resources/yaml/customers.yaml | 8 ++ pom.xml | 6 +- 14 files changed, 360 insertions(+), 4 deletions(-) create mode 100644 libraries/src/main/java/com/baeldung/snakeyaml/Address.java create mode 100644 libraries/src/main/java/com/baeldung/snakeyaml/Contact.java create mode 100644 libraries/src/main/java/com/baeldung/snakeyaml/Customer.java create mode 100644 libraries/src/test/java/com/baeldung/snakeyaml/JavaToYAMLSerializationUnitTest.java create mode 100644 libraries/src/test/java/com/baeldung/snakeyaml/YAMLToJavaDeserialisationUnitTest.java create mode 100644 libraries/src/test/resources/yaml/customer.yaml create mode 100644 libraries/src/test/resources/yaml/customer_with_contact_details.yaml create mode 100644 libraries/src/test/resources/yaml/customer_with_contact_details_and_address.yaml create mode 100644 libraries/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml create mode 100644 libraries/src/test/resources/yaml/customer_with_type.yaml create mode 100644 libraries/src/test/resources/yaml/customers.yaml diff --git a/libraries/.gitignore b/libraries/.gitignore index ac45fafa62..e594daf27a 100644 --- a/libraries/.gitignore +++ b/libraries/.gitignore @@ -6,3 +6,4 @@ # Packaged files # *.jar +/bin/ diff --git a/libraries/pom.xml b/libraries/pom.xml index 02ea1d4d51..b19a005d94 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -771,12 +771,20 @@ ${hamcrest-all.version} test - + + + org.yaml + snakeyaml + ${snakeyaml.version} + + + org.eclipse.paho org.eclipse.paho.client.mqttv3 1.2.0 + @@ -914,6 +922,7 @@ + 1.21 1.23.0 0.1.0 0.7.0 diff --git a/libraries/src/main/java/com/baeldung/snakeyaml/Address.java b/libraries/src/main/java/com/baeldung/snakeyaml/Address.java new file mode 100644 index 0000000000..83c327a4ed --- /dev/null +++ b/libraries/src/main/java/com/baeldung/snakeyaml/Address.java @@ -0,0 +1,41 @@ +package com.baeldung.snakeyaml; + +public class Address { + private String line; + private String city; + private String state; + private Integer zip; + + public String getLine() { + return line; + } + + public void setLine(String line) { + this.line = line; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public Integer getZip() { + return zip; + } + + public void setZip(Integer zip) { + this.zip = zip; + } + +} diff --git a/libraries/src/main/java/com/baeldung/snakeyaml/Contact.java b/libraries/src/main/java/com/baeldung/snakeyaml/Contact.java new file mode 100644 index 0000000000..a808747786 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/snakeyaml/Contact.java @@ -0,0 +1,26 @@ +package com.baeldung.snakeyaml; + +public class Contact { + + private String type; + + private int number; + + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } + +} diff --git a/libraries/src/main/java/com/baeldung/snakeyaml/Customer.java b/libraries/src/main/java/com/baeldung/snakeyaml/Customer.java new file mode 100644 index 0000000000..c741f6dc85 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/snakeyaml/Customer.java @@ -0,0 +1,53 @@ +package com.baeldung.snakeyaml; + +import java.util.List; + +public class Customer { + + private String firstName; + private String lastName; + private int age; + private List contactDetails; + private Address homeAddress; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public List getContactDetails() { + return contactDetails; + } + + public void setContactDetails(List contactDetails) { + this.contactDetails = contactDetails; + } + + public Address getHomeAddress() { + return homeAddress; + } + + public void setHomeAddress(Address homeAddress) { + this.homeAddress = homeAddress; + } + +} diff --git a/libraries/src/test/java/com/baeldung/snakeyaml/JavaToYAMLSerializationUnitTest.java b/libraries/src/test/java/com/baeldung/snakeyaml/JavaToYAMLSerializationUnitTest.java new file mode 100644 index 0000000000..f6836f6d56 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/snakeyaml/JavaToYAMLSerializationUnitTest.java @@ -0,0 +1,54 @@ +package com.baeldung.snakeyaml; + +import static org.junit.Assert.assertEquals; + +import java.io.StringWriter; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.junit.Test; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.nodes.Tag; + +import com.baeldung.snakeyaml.Customer; + +public class JavaToYAMLSerializationUnitTest { + + @Test + public void whenDumpMap_thenGenerateCorrectYAML() { + Map data = new LinkedHashMap(); + data.put("name", "Silenthand Olleander"); + data.put("race", "Human"); + data.put("traits", new String[] { "ONE_HAND", "ONE_EYE" }); + Yaml yaml = new Yaml(); + StringWriter writer = new StringWriter(); + yaml.dump(data, writer); + String expectedYaml = "name: Silenthand Olleander\nrace: Human\ntraits: [ONE_HAND, ONE_EYE]\n"; + assertEquals(expectedYaml, writer.toString()); + } + + @Test + public void whenDumpACustomType_thenGenerateCorrectYAML() { + Customer customer = new Customer(); + customer.setAge(45); + customer.setFirstName("Greg"); + customer.setLastName("McDowell"); + Yaml yaml = new Yaml(); + StringWriter writer = new StringWriter(); + yaml.dump(customer, writer); + String expectedYaml = "!!com.baeldung.snakeyaml.Customer {age: 45, contactDetails: null, firstName: Greg,\n homeAddress: null, lastName: McDowell}\n"; + assertEquals(expectedYaml, writer.toString()); + } + + @Test + public void whenDumpAsCustomType_thenGenerateCorrectYAML() { + Customer customer = new Customer(); + customer.setAge(45); + customer.setFirstName("Greg"); + customer.setLastName("McDowell"); + Yaml yaml = new Yaml(); + String expectedYaml = "{age: 45, contactDetails: null, firstName: Greg, homeAddress: null, lastName: McDowell}\n"; + assertEquals(expectedYaml, yaml.dumpAs(customer, Tag.MAP, null)); + } + +} diff --git a/libraries/src/test/java/com/baeldung/snakeyaml/YAMLToJavaDeserialisationUnitTest.java b/libraries/src/test/java/com/baeldung/snakeyaml/YAMLToJavaDeserialisationUnitTest.java new file mode 100644 index 0000000000..56cd3c2b2e --- /dev/null +++ b/libraries/src/test/java/com/baeldung/snakeyaml/YAMLToJavaDeserialisationUnitTest.java @@ -0,0 +1,131 @@ +package com.baeldung.snakeyaml; + +import org.junit.Test; +import org.yaml.snakeyaml.TypeDescription; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.Constructor; + +import java.io.InputStream; +import java.util.Date; +import java.util.Map; + +import static org.junit.Assert.*; + +public class YAMLToJavaDeserialisationUnitTest { + + @Test + public void whenLoadYAMLDocument_thenLoadCorrectMap() { + Yaml yaml = new Yaml(); + InputStream inputStream = this.getClass() + .getClassLoader() + .getResourceAsStream("yaml/customer.yaml"); + Map obj = yaml.load(inputStream); + assertEquals("John", obj.get("firstName")); + assertEquals("Doe", obj.get("lastName")); + assertEquals(20, obj.get("age")); + } + + @Test + public void whenLoadYAMLDocumentWithTopLevelClass_thenLoadCorrectJavaObject() { + Yaml yaml = new Yaml(new Constructor(Customer.class)); + InputStream inputStream = this.getClass() + .getClassLoader() + .getResourceAsStream("yaml/customer.yaml"); + Customer customer = yaml.load(inputStream); + assertEquals("John", customer.getFirstName()); + assertEquals("Doe", customer.getLastName()); + assertEquals(20, customer.getAge()); + } + + @Test + public void whenLoadYAMLDocumentWithAssumedClass_thenLoadCorrectJavaObject() { + Yaml yaml = new Yaml(); + InputStream inputStream = this.getClass() + .getClassLoader() + .getResourceAsStream("yaml/customer_with_type.yaml"); + Customer customer = yaml.load(inputStream); + assertEquals("John", customer.getFirstName()); + assertEquals("Doe", customer.getLastName()); + assertEquals(20, customer.getAge()); + } + + @Test + public void whenLoadYAML_thenLoadCorrectImplicitTypes() { + Yaml yaml = new Yaml(); + Map document = yaml.load("3.0: 2018-07-22"); + assertNotNull(document); + assertEquals(1, document.size()); + assertTrue(document.containsKey(3.0d)); + assertTrue(document.get(3.0d) instanceof Date); + } + + @Test + public void whenLoadYAMLDocumentWithTopLevelClass_thenLoadCorrectJavaObjectWithNestedObjects() { + Yaml yaml = new Yaml(new Constructor(Customer.class)); + InputStream inputStream = this.getClass() + .getClassLoader() + .getResourceAsStream("yaml/customer_with_contact_details_and_address.yaml"); + Customer customer = yaml.load(inputStream); + assertNotNull(customer); + assertEquals("John", customer.getFirstName()); + assertEquals("Doe", customer.getLastName()); + assertEquals(31, customer.getAge()); + assertNotNull(customer.getContactDetails()); + assertEquals(2, customer.getContactDetails().size()); + assertEquals("mobile", customer.getContactDetails() + .get(0) + .getType()); + assertEquals(123456789,customer.getContactDetails() + .get(0) + .getNumber()); + assertEquals("landline", customer.getContactDetails() + .get(1) + .getType()); + assertEquals(456786868, customer.getContactDetails() + .get(1) + .getNumber()); + assertNotNull(customer.getHomeAddress()); + assertEquals("Xyz, DEF Street", customer.getHomeAddress() + .getLine()); + } + + @Test + public void whenLoadYAMLDocumentWithTypeDescription_thenLoadCorrectJavaObjectWithCorrectGenericType() { + Constructor constructor = new Constructor(Customer.class); + TypeDescription customTypeDescription = new TypeDescription(Customer.class); + customTypeDescription.addPropertyParameters("contactDetails", Contact.class); + constructor.addTypeDescription(customTypeDescription); + Yaml yaml = new Yaml(constructor); + InputStream inputStream = this.getClass() + .getClassLoader() + .getResourceAsStream("yaml/customer_with_contact_details.yaml"); + Customer customer = yaml.load(inputStream); + assertNotNull(customer); + assertEquals("John", customer.getFirstName()); + assertEquals("Doe", customer.getLastName()); + assertEquals(31, customer.getAge()); + assertNotNull(customer.getContactDetails()); + assertEquals(2, customer.getContactDetails().size()); + assertEquals("mobile", customer.getContactDetails() + .get(0) + .getType()); + assertEquals("landline", customer.getContactDetails() + .get(1) + .getType()); + } + + @Test + public void whenLoadMultipleYAMLDocuments_thenLoadCorrectJavaObjects() { + Yaml yaml = new Yaml(new Constructor(Customer.class)); + InputStream inputStream = this.getClass() + .getClassLoader() + .getResourceAsStream("yaml/customers.yaml"); + int count = 0; + for (Object object : yaml.loadAll(inputStream)) { + count++; + assertTrue(object instanceof Customer); + } + assertEquals(2, count); + } + +} diff --git a/libraries/src/test/resources/yaml/customer.yaml b/libraries/src/test/resources/yaml/customer.yaml new file mode 100644 index 0000000000..aa76141c7d --- /dev/null +++ b/libraries/src/test/resources/yaml/customer.yaml @@ -0,0 +1,3 @@ +firstName: "John" +lastName: "Doe" +age: 20 \ No newline at end of file diff --git a/libraries/src/test/resources/yaml/customer_with_contact_details.yaml b/libraries/src/test/resources/yaml/customer_with_contact_details.yaml new file mode 100644 index 0000000000..34563cbd21 --- /dev/null +++ b/libraries/src/test/resources/yaml/customer_with_contact_details.yaml @@ -0,0 +1,7 @@ +firstName: "John" +lastName: "Doe" +age: 31 +contactDetails: + - { type: "mobile", number: 123456789} + - { type: "landline", number: 456786868} + \ No newline at end of file diff --git a/libraries/src/test/resources/yaml/customer_with_contact_details_and_address.yaml b/libraries/src/test/resources/yaml/customer_with_contact_details_and_address.yaml new file mode 100644 index 0000000000..664afe8594 --- /dev/null +++ b/libraries/src/test/resources/yaml/customer_with_contact_details_and_address.yaml @@ -0,0 +1,13 @@ +firstName: "John" +lastName: "Doe" +age: 31 +contactDetails: + - type: "mobile" + number: 123456789 + - type: "landline" + number: 456786868 +homeAddress: + line: "Xyz, DEF Street" + city: "City Y" + state: "State Y" + zip: 345657 diff --git a/libraries/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml b/libraries/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml new file mode 100644 index 0000000000..145da256d9 --- /dev/null +++ b/libraries/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml @@ -0,0 +1,6 @@ +firstName: "John" +lastName: "Doe" +age: 31 +contactDetails: + - !contact { type: "mobile", number: 123456789} + - !contact { type: "landline", number: 456786868} diff --git a/libraries/src/test/resources/yaml/customer_with_type.yaml b/libraries/src/test/resources/yaml/customer_with_type.yaml new file mode 100644 index 0000000000..6e13c26cea --- /dev/null +++ b/libraries/src/test/resources/yaml/customer_with_type.yaml @@ -0,0 +1,4 @@ +!!com.baeldung.snakeyaml.Customer +firstName: "John" +lastName: "Doe" +age: 20 \ No newline at end of file diff --git a/libraries/src/test/resources/yaml/customers.yaml b/libraries/src/test/resources/yaml/customers.yaml new file mode 100644 index 0000000000..23b9039c2e --- /dev/null +++ b/libraries/src/test/resources/yaml/customers.yaml @@ -0,0 +1,8 @@ +--- +firstName: "John" +lastName: "Doe" +age: 20 +--- +firstName: "Jack" +lastName: "Jones" +age: 25 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6f2351b56f..20ad5160d9 100644 --- a/pom.xml +++ b/pom.xml @@ -550,7 +550,7 @@ apache-meecrowave spring-reactive-kotlin jnosql - testing-modules/junit-abstract + testing-modules/junit-abstract @@ -670,7 +670,7 @@ spring-amqp-simple spring-apache-camel spring-batch - testing-modules/junit-abstract + testing-modules/junit-abstract @@ -1076,7 +1076,7 @@ antlr maven-archetype apache-meecrowave - testing-modules/junit-abstract + testing-modules/junit-abstract spring-hibernate4 xml From 680e0c24a750f8e090daf356044c588344c876af Mon Sep 17 00:00:00 2001 From: amit2103 Date: Tue, 31 Jul 2018 00:41:20 +0530 Subject: [PATCH 076/298] [BAEL-7608] - Fixed SecurityIntegrationTest with redirecting to login --- .../java/com/baeldung/reactive/SpringSecurity5Application.java | 2 +- .../java/com/baeldung/reactive/security/SecurityConfig.java | 2 +- .../java/com/baeldung/security/SecurityIntegrationTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/SpringSecurity5Application.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/SpringSecurity5Application.java index 0e695ff596..ca49ec6826 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/SpringSecurity5Application.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/SpringSecurity5Application.java @@ -11,7 +11,7 @@ import org.springframework.web.server.adapter.WebHttpHandlerBuilder; import reactor.ipc.netty.NettyContext; import reactor.ipc.netty.http.server.HttpServer; -@ComponentScan(basePackages = {"com.baeldung.security"}) +@ComponentScan(basePackages = {"com.baeldung.reactive.security"}) @EnableWebFlux public class SpringSecurity5Application { diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java index d3468f0a0f..5ec3b6e241 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java @@ -19,7 +19,7 @@ public class SecurityConfig { @Bean public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) { return http.authorizeExchange() - .pathMatchers("/admin") + .pathMatchers("/", "/admin") .hasAuthority("ROLE_ADMIN") .matchers(EndpointRequest.to(FeaturesEndpoint.class)) .permitAll() diff --git a/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java b/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java index 341bd2a0c7..a59ef57db8 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java @@ -28,7 +28,7 @@ public class SecurityIntegrationTest { @Test public void whenNoCredentials_thenRedirectToLogin() { - this.rest.get().uri("/").exchange().expectStatus().is4xxClientError(); + this.rest.get().uri("/").exchange().expectStatus().is3xxRedirection(); } @Test From 8eb1b1bb9fd0dcba5e89de2a43e5f0e7504b04c0 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Mon, 30 Jul 2018 23:48:50 +0400 Subject: [PATCH 077/298] Examples for Reading a file into an arraylist. 1. Using FileReader 2. Using BufferedReader 3. Using Scanner(String and int) 4. Using Files.readAllLines --- .../fileparser/BufferedReaderExample.java | 34 +++++++++++++++++ .../fileparser/FileReaderExample.java | 37 +++++++++++++++++++ .../fileparser/FilesReadLineExample.java | 28 ++++++++++++++ .../fileparser/ScannerIntExample.java | 34 +++++++++++++++++ .../fileparser/ScannerStringExample.java | 34 +++++++++++++++++ file-parser/src/resources/num.txt | 2 + file-parser/src/resources/txt.txt | 2 + 7 files changed, 171 insertions(+) create mode 100644 file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java create mode 100644 file-parser/src/com/baeldung/fileparser/FileReaderExample.java create mode 100644 file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java create mode 100644 file-parser/src/com/baeldung/fileparser/ScannerIntExample.java create mode 100644 file-parser/src/com/baeldung/fileparser/ScannerStringExample.java create mode 100644 file-parser/src/resources/num.txt create mode 100644 file-parser/src/resources/txt.txt diff --git a/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java b/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java new file mode 100644 index 0000000000..a139ed80ab --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java @@ -0,0 +1,34 @@ +package com.baeldung.fileparser; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; + +public class BufferedReaderExample { + + private static final String FILENAME = "src/resources/txt.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (BufferedReader br = new BufferedReader(new FileReader(filename))) { + + while (br.ready()) { + result.add(br.readLine()); + } + return result; + } + + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/FileReaderExample.java b/file-parser/src/com/baeldung/fileparser/FileReaderExample.java new file mode 100644 index 0000000000..1ab98973c7 --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/FileReaderExample.java @@ -0,0 +1,37 @@ +package com.baeldung.fileparser; + +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; + +public class FileReaderExample { + + private static final String FILENAME = "src/resources/txt.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (FileReader f = new FileReader(filename)) { + + while (f.ready()) { + char c = (char) f.read(); + + if (c != ' ' && c != '\t' && c != '\n') { + result.add(c); + } + } + return result; + } + + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java b/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java new file mode 100644 index 0000000000..7f94525c22 --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java @@ -0,0 +1,28 @@ +package com.baeldung.fileparser; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +public class FilesReadLineExample { + + private static final String FILENAME = "src/resources/txt.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + List result = Files.readAllLines(Paths.get(filename)); + + return (ArrayList) result; + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java b/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java new file mode 100644 index 0000000000..aab7455c30 --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java @@ -0,0 +1,34 @@ +package com.baeldung.fileparser; + +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Scanner; + +public class ScannerIntExample { + + private static final String FILENAME = "src/resources/num.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (Scanner s = new Scanner(new FileReader(filename))) { + + while (s.hasNext()) { + result.add(s.nextInt()); + } + return result; + } + + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java b/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java new file mode 100644 index 0000000000..fc18b53609 --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java @@ -0,0 +1,34 @@ +package com.baeldung.fileparser; + +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Scanner; + +public class ScannerStringExample { + + private static final String FILENAME = "src/resources/txt.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (Scanner s = new Scanner(new FileReader(filename))) { + + while (s.hasNext()) { + result.add(s.nextLine()); + } + return result; + } + + } + +} diff --git a/file-parser/src/resources/num.txt b/file-parser/src/resources/num.txt new file mode 100644 index 0000000000..7787faa3c1 --- /dev/null +++ b/file-parser/src/resources/num.txt @@ -0,0 +1,2 @@ +111 +222 \ No newline at end of file diff --git a/file-parser/src/resources/txt.txt b/file-parser/src/resources/txt.txt new file mode 100644 index 0000000000..75cb50aafa --- /dev/null +++ b/file-parser/src/resources/txt.txt @@ -0,0 +1,2 @@ +Hello +World \ No newline at end of file From a1213549f3cc8a9692e5f8b67c1944c8478a2455 Mon Sep 17 00:00:00 2001 From: Adam InTae Gerard Date: Mon, 30 Jul 2018 22:41:59 -0700 Subject: [PATCH 078/298] Bael 1555 - Improve Example (#4852) * BAEL-1555 * Corrected indents and spacing * RequestMapping to GetMapping * Improved Performance For Concurrent Users --- .../java/com/baeldung/web/ResponseBodyEmitterController.java | 2 +- .../src/main/java/com/baeldung/web/SseEmitterController.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-5-mvc/src/main/java/com/baeldung/web/ResponseBodyEmitterController.java b/spring-5-mvc/src/main/java/com/baeldung/web/ResponseBodyEmitterController.java index 4af8eb9bd3..ff1fb87393 100644 --- a/spring-5-mvc/src/main/java/com/baeldung/web/ResponseBodyEmitterController.java +++ b/spring-5-mvc/src/main/java/com/baeldung/web/ResponseBodyEmitterController.java @@ -13,11 +13,11 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter @Controller public class ResponseBodyEmitterController { + private ExecutorService nonBlockingService = Executors.newSingleThreadExecutor(); @GetMapping(Constants.API_RBE) public ResponseEntity handleRbe() { ResponseBodyEmitter emitter = new ResponseBodyEmitter(); - ExecutorService nonBlockingService = Executors.newSingleThreadExecutor(); nonBlockingService.execute(() -> { try { diff --git a/spring-5-mvc/src/main/java/com/baeldung/web/SseEmitterController.java b/spring-5-mvc/src/main/java/com/baeldung/web/SseEmitterController.java index 390178aaef..944aec2559 100644 --- a/spring-5-mvc/src/main/java/com/baeldung/web/SseEmitterController.java +++ b/spring-5-mvc/src/main/java/com/baeldung/web/SseEmitterController.java @@ -10,12 +10,12 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; @Controller public class SseEmitterController { + private ExecutorService nonBlockingService = Executors.newSingleThreadExecutor(); @GetMapping(Constants.API_SSE) public SseEmitter handleSse() { SseEmitter emitter = new SseEmitter(); - ExecutorService nonBlockingService = Executors.newSingleThreadExecutor(); nonBlockingService.execute(() -> { try { emitter.send(Constants.API_SSE_MSG + " @ " + new Date()); From fb7b7c3ec56f90b964933fd397b01a753a8212d0 Mon Sep 17 00:00:00 2001 From: Saikat <11479802+psysane@users.noreply.github.com> Date: Tue, 31 Jul 2018 13:33:04 +0530 Subject: [PATCH 079/298] BAEL-1958 Log using SLF4J (#4790) * Log using SLF4J Jira Ticket: BAEL-1958 * Incorporate first review comments --- .../java/com/baeldung/logging/LogUsingSlf4J.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/logging/LogUsingSlf4J.java diff --git a/core-java/src/main/java/com/baeldung/logging/LogUsingSlf4J.java b/core-java/src/main/java/com/baeldung/logging/LogUsingSlf4J.java new file mode 100644 index 0000000000..bef4f06889 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/logging/LogUsingSlf4J.java @@ -0,0 +1,16 @@ +package com.baeldung.logging; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LogUsingSlf4J { + + public static void main(String[] args) { + Logger logger = LoggerFactory.getLogger(LogUsingSlf4J.class); + + logger.error("An exception occurred!"); + logger.error("An exception occurred!", new Exception("Custom exception")); + logger.error("{}, {}! An exception occurred!", "Hello", "World", new Exception("Custom exception")); + } + +} From 6e646bf0de509f89c4de59a0684c987e0682912b Mon Sep 17 00:00:00 2001 From: fanatixan Date: Tue, 31 Jul 2018 12:56:29 +0200 Subject: [PATCH 080/298] Bael 2023 (#4851) * bael-2023: removing all occurrences of a value from a list * adjusting examples to match the article --- .../java/com/baeldung/list/RemoveAll.java | 111 ++++++++++ .../com/baeldung/list/RemoveAllUnitTest.java | 208 ++++++++++++++++++ 2 files changed, 319 insertions(+) create mode 100644 core-java-8/src/main/java/com/baeldung/list/RemoveAll.java create mode 100644 core-java-8/src/test/java/com/baeldung/list/RemoveAllUnitTest.java diff --git a/core-java-8/src/main/java/com/baeldung/list/RemoveAll.java b/core-java-8/src/main/java/com/baeldung/list/RemoveAll.java new file mode 100644 index 0000000000..0dd97af6e8 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/list/RemoveAll.java @@ -0,0 +1,111 @@ +package com.baeldung.list; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +public class RemoveAll { + + static void removeWithWhileLoopPrimitiveElement(List list, int element) { + while (list.contains(element)) { + list.remove(element); + } + } + + static void removeWithWhileLoopNonPrimitiveElement(List list, Integer element) { + while (list.contains(element)) { + list.remove(element); + } + } + + static void removeWithWhileLoopStoringFirstOccurrenceIndex(List list, Integer element) { + int index; + while ((index = list.indexOf(element)) >= 0) { + list.remove(index); + } + } + + static void removeWithCallingRemoveUntilModifies(List list, Integer element) { + while (list.remove(element)) + ; + } + + static void removeWithStandardForLoopUsingIndex(List list, int element) { + for (int i = 0; i < list.size(); i++) { + if (Objects.equals(element, list.get(i))) { + list.remove(i); + } + } + } + + static void removeWithForLoopDecrementOnRemove(List list, int element) { + for (int i = 0; i < list.size(); i++) { + if (Objects.equals(element, list.get(i))) { + list.remove(i); + i--; + } + } + } + + static void removeWithForLoopIncrementIfRemains(List list, int element) { + for (int i = 0; i < list.size();) { + if (Objects.equals(element, list.get(i))) { + list.remove(i); + } else { + i++; + } + } + } + + static void removeWithForEachLoop(List list, int element) { + for (Integer number : list) { + if (Objects.equals(number, element)) { + list.remove(number); + } + } + } + + static void removeWithIterator(List list, int element) { + for (Iterator i = list.iterator(); i.hasNext();) { + Integer number = i.next(); + if (Objects.equals(number, element)) { + i.remove(); + } + } + } + + static List removeWithCollectingAndReturningRemainingElements(List list, int element) { + List remainingElements = new ArrayList<>(); + for (Integer number : list) { + if (!Objects.equals(number, element)) { + remainingElements.add(number); + } + } + return remainingElements; + } + + static void removeWithCollectingRemainingElementsAndAddingToOriginalList(List list, int element) { + List remainingElements = new ArrayList<>(); + for (Integer number : list) { + if (!Objects.equals(number, element)) { + remainingElements.add(number); + } + } + + list.clear(); + list.addAll(remainingElements); + } + + static List removeWithStreamFilter(List list, Integer element) { + return list.stream() + .filter(e -> !Objects.equals(e, element)) + .collect(Collectors.toList()); + } + + static void removeWithRemoveIf(List list, Integer element) { + list.removeIf(n -> Objects.equals(n, element)); + } + +} diff --git a/core-java-8/src/test/java/com/baeldung/list/RemoveAllUnitTest.java b/core-java-8/src/test/java/com/baeldung/list/RemoveAllUnitTest.java new file mode 100644 index 0000000000..7ada66a49e --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/list/RemoveAllUnitTest.java @@ -0,0 +1,208 @@ +package com.baeldung.list; + +import static com.baeldung.list.RemoveAll.removeWithCallingRemoveUntilModifies; +import static com.baeldung.list.RemoveAll.removeWithCollectingAndReturningRemainingElements; +import static com.baeldung.list.RemoveAll.removeWithCollectingRemainingElementsAndAddingToOriginalList; +import static com.baeldung.list.RemoveAll.removeWithForEachLoop; +import static com.baeldung.list.RemoveAll.removeWithForLoopDecrementOnRemove; +import static com.baeldung.list.RemoveAll.removeWithForLoopIncrementIfRemains; +import static com.baeldung.list.RemoveAll.removeWithIterator; +import static com.baeldung.list.RemoveAll.removeWithRemoveIf; +import static com.baeldung.list.RemoveAll.removeWithStandardForLoopUsingIndex; +import static com.baeldung.list.RemoveAll.removeWithStreamFilter; +import static com.baeldung.list.RemoveAll.*; + +import static org.assertj.core.api.Assertions.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.ConcurrentModificationException; +import java.util.List; + +import org.junit.Test; + +public class RemoveAllUnitTest { + + private List list(Integer... elements) { + return new ArrayList<>(Arrays.asList(elements)); + } + + @Test + public void givenAList_whenRemovingElementsWithWhileLoopUsingPrimitiveElement_thenTheResultCorrect() { + // given + List list = list(1, 2, 3); + int valueToRemove = 1; + + // when + assertThatThrownBy(() -> removeWithWhileLoopPrimitiveElement(list, valueToRemove)) + .isInstanceOf(IndexOutOfBoundsException.class); + } + + @Test + public void givenAList_whenRemovingElementsWithWhileLoopUsingNonPrimitiveElement_thenTheResultCorrect() { + // given + List list = list(1, 2, 3); + int valueToRemove = 1; + + // when + removeWithWhileLoopNonPrimitiveElement(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithWhileLoopStoringFirstOccurrenceIndex_thenTheResultCorrect() { + // given + List list = list(1, 2, 3); + int valueToRemove = 1; + + // when + removeWithWhileLoopStoringFirstOccurrenceIndex(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithCallingRemoveUntilModifies_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithCallingRemoveUntilModifies(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAListWithoutDuplication_whenRemovingElementsWithStandardForLoopUsingIndex_thenTheResultIsCorrect() { + // given + List list = list(1, 2, 3); + int valueToRemove = 1; + + // when + removeWithStandardForLoopUsingIndex(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAListWithAdjacentElements_whenRemovingElementsWithStandardForLoop_thenTheResultIsInCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithStandardForLoopUsingIndex(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(1, 2, 3)); + } + + @Test + public void givenAListWithAdjacentElements_whenRemovingElementsWithForLoopAndDecrementOnRemove_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithForLoopDecrementOnRemove(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAListWithAdjacentElements_whenRemovingElementsWithForLoopAndIncrementIfRemains_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithForLoopIncrementIfRemains(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithForEachLoop_thenExceptionIsThrown() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + assertThatThrownBy(() -> removeWithForEachLoop(list, valueToRemove)) + .isInstanceOf(ConcurrentModificationException.class); + } + + @Test + public void givenAList_whenRemovingElementsWithIterator_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithIterator(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithCollectingAndReturningRemainingElements_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + List result = removeWithCollectingAndReturningRemainingElements(list, valueToRemove); + + // then + assertThat(result).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithCollectingRemainingAndAddingToOriginalList_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithCollectingRemainingElementsAndAddingToOriginalList(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithStreamFilter_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + List result = removeWithStreamFilter(list, valueToRemove); + + // then + assertThat(result).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithCallingRemoveIf_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithRemoveIf(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + +} From e5ead99060dd423c61f644111a93f38124f1da5b Mon Sep 17 00:00:00 2001 From: amit2103 Date: Tue, 31 Jul 2018 23:07:28 +0530 Subject: [PATCH 081/298] [BAEL-7437] - Added spring tx dependency to fix spring-mvc-simple junit 5 TCs --- spring-mvc-simple/pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spring-mvc-simple/pom.xml b/spring-mvc-simple/pom.xml index b886750d37..bd63b5ed1c 100644 --- a/spring-mvc-simple/pom.xml +++ b/spring-mvc-simple/pom.xml @@ -59,6 +59,11 @@ spring-webmvc ${spring.version} + + org.springframework + spring-tx + ${spring.version} + From 4aa8633c43dcaab6eb919ef1298706bac8cd1893 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Tue, 31 Jul 2018 22:39:22 +0300 Subject: [PATCH 082/298] add libraries server project --- libraries-server/.gitignore | 9 ++++ libraries-server/pom.xml | 19 ++++++++ .../mqtt/EngineTemperatureSensor.java | 0 .../mqtt/EngineTemperatureSensorLiveTest.java | 0 libraries-server/src/test/resources/ABC.txt | 1 + .../resources/JunitParamsTestParameters.csv | 4 ++ libraries-server/src/test/resources/aaa.txt | 1 + .../src/test/resources/adder-beans.xml | 13 ++++++ libraries-server/src/test/resources/book.csv | 3 ++ .../src/test/resources/csv/fourColumn.csv | 5 +++ .../src/test/resources/csv/namedColumn.csv | 5 +++ .../src/test/resources/csv/twoColumn.csv | 5 +++ .../src/test/resources/csv/writtenAll.csv | 0 .../src/test/resources/csv/writtenBean.csv | 0 .../test/resources/csv/writtenOneByOne.csv | 0 .../src/test/resources/dockerapi/Dockerfile | 8 ++++ .../src/test/resources/employees.sql | 43 +++++++++++++++++++ .../src/test/resources/fileTest.txt | 1 + .../src/test/resources/ftp/baz.txt | 0 libraries-server/src/test/resources/input.txt | 1 + .../src/test/resources/output.txt | 1 + .../src/test/resources/sample.txt | 2 + .../github_user_profile_payload_test.story | 13 ++++++ .../resources/stories/spring/adder_test.story | 11 +++++ .../src/test/resources/yaml/customer.yaml | 3 ++ .../yaml/customer_with_contact_details.yaml | 7 +++ ...omer_with_contact_details_and_address.yaml | 13 ++++++ ...ustomer_with_contact_details_and_tags.yaml | 6 +++ .../resources/yaml/customer_with_type.yaml | 4 ++ .../src/test/resources/yaml/customers.yaml | 8 ++++ libraries/pom.xml | 7 --- 31 files changed, 186 insertions(+), 7 deletions(-) create mode 100644 libraries-server/.gitignore create mode 100644 libraries-server/pom.xml rename {libraries => libraries-server}/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java (100%) rename {libraries => libraries-server}/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java (100%) create mode 100644 libraries-server/src/test/resources/ABC.txt create mode 100644 libraries-server/src/test/resources/JunitParamsTestParameters.csv create mode 100644 libraries-server/src/test/resources/aaa.txt create mode 100644 libraries-server/src/test/resources/adder-beans.xml create mode 100644 libraries-server/src/test/resources/book.csv create mode 100644 libraries-server/src/test/resources/csv/fourColumn.csv create mode 100644 libraries-server/src/test/resources/csv/namedColumn.csv create mode 100644 libraries-server/src/test/resources/csv/twoColumn.csv create mode 100644 libraries-server/src/test/resources/csv/writtenAll.csv create mode 100644 libraries-server/src/test/resources/csv/writtenBean.csv create mode 100644 libraries-server/src/test/resources/csv/writtenOneByOne.csv create mode 100644 libraries-server/src/test/resources/dockerapi/Dockerfile create mode 100644 libraries-server/src/test/resources/employees.sql create mode 100644 libraries-server/src/test/resources/fileTest.txt create mode 100644 libraries-server/src/test/resources/ftp/baz.txt create mode 100644 libraries-server/src/test/resources/input.txt create mode 100644 libraries-server/src/test/resources/output.txt create mode 100644 libraries-server/src/test/resources/sample.txt create mode 100644 libraries-server/src/test/resources/stories/github_rest/user_profile/github_user_profile_payload_test.story create mode 100644 libraries-server/src/test/resources/stories/spring/adder_test.story create mode 100644 libraries-server/src/test/resources/yaml/customer.yaml create mode 100644 libraries-server/src/test/resources/yaml/customer_with_contact_details.yaml create mode 100644 libraries-server/src/test/resources/yaml/customer_with_contact_details_and_address.yaml create mode 100644 libraries-server/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml create mode 100644 libraries-server/src/test/resources/yaml/customer_with_type.yaml create mode 100644 libraries-server/src/test/resources/yaml/customers.yaml diff --git a/libraries-server/.gitignore b/libraries-server/.gitignore new file mode 100644 index 0000000000..e594daf27a --- /dev/null +++ b/libraries-server/.gitignore @@ -0,0 +1,9 @@ +*.class + +# Folders # +/gensrc +/target + +# Packaged files # +*.jar +/bin/ diff --git a/libraries-server/pom.xml b/libraries-server/pom.xml new file mode 100644 index 0000000000..517cf6a07c --- /dev/null +++ b/libraries-server/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + com.baeldung + libraries-server + 0.0.1-SNAPSHOT + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + 1.2.0 + + + \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java b/libraries-server/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java similarity index 100% rename from libraries/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java rename to libraries-server/src/main/java/com/baeldung/mqtt/EngineTemperatureSensor.java diff --git a/libraries/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java b/libraries-server/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java rename to libraries-server/src/test/java/com/baeldung/mqtt/EngineTemperatureSensorLiveTest.java diff --git a/libraries-server/src/test/resources/ABC.txt b/libraries-server/src/test/resources/ABC.txt new file mode 100644 index 0000000000..f78e42598c --- /dev/null +++ b/libraries-server/src/test/resources/ABC.txt @@ -0,0 +1 @@ +Hello World from ABC.txt!!! \ No newline at end of file diff --git a/libraries-server/src/test/resources/JunitParamsTestParameters.csv b/libraries-server/src/test/resources/JunitParamsTestParameters.csv new file mode 100644 index 0000000000..84eb5a0b23 --- /dev/null +++ b/libraries-server/src/test/resources/JunitParamsTestParameters.csv @@ -0,0 +1,4 @@ +1,2,3 +-10, 30, 20 +15, -5, 10 +-5, -10, -15 \ No newline at end of file diff --git a/libraries-server/src/test/resources/aaa.txt b/libraries-server/src/test/resources/aaa.txt new file mode 100644 index 0000000000..e5875f97d6 --- /dev/null +++ b/libraries-server/src/test/resources/aaa.txt @@ -0,0 +1 @@ +Hello World from aaa.txt!!! \ No newline at end of file diff --git a/libraries-server/src/test/resources/adder-beans.xml b/libraries-server/src/test/resources/adder-beans.xml new file mode 100644 index 0000000000..2fbdbd378f --- /dev/null +++ b/libraries-server/src/test/resources/adder-beans.xml @@ -0,0 +1,13 @@ + + + + + + 4 + + + + + diff --git a/libraries-server/src/test/resources/book.csv b/libraries-server/src/test/resources/book.csv new file mode 100644 index 0000000000..d709152a5e --- /dev/null +++ b/libraries-server/src/test/resources/book.csv @@ -0,0 +1,3 @@ +author,title +Dan Simmons,Hyperion +Douglas Adams,The Hitchhiker's Guide to the Galaxy diff --git a/libraries-server/src/test/resources/csv/fourColumn.csv b/libraries-server/src/test/resources/csv/fourColumn.csv new file mode 100644 index 0000000000..51a69fd1a0 --- /dev/null +++ b/libraries-server/src/test/resources/csv/fourColumn.csv @@ -0,0 +1,5 @@ +ColA,ColB,ColC,ColD +A,B,B,B +C,D,W,W +G,G,E,E +G,F,Q,Q diff --git a/libraries-server/src/test/resources/csv/namedColumn.csv b/libraries-server/src/test/resources/csv/namedColumn.csv new file mode 100644 index 0000000000..279b743600 --- /dev/null +++ b/libraries-server/src/test/resources/csv/namedColumn.csv @@ -0,0 +1,5 @@ +name,age +adam,1000 +martin,27 +gigi,41 +seraphine,30 \ No newline at end of file diff --git a/libraries-server/src/test/resources/csv/twoColumn.csv b/libraries-server/src/test/resources/csv/twoColumn.csv new file mode 100644 index 0000000000..3eab8e8a64 --- /dev/null +++ b/libraries-server/src/test/resources/csv/twoColumn.csv @@ -0,0 +1,5 @@ +ColA,ColB +A,B +C,D +G,G +G,F diff --git a/libraries-server/src/test/resources/csv/writtenAll.csv b/libraries-server/src/test/resources/csv/writtenAll.csv new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libraries-server/src/test/resources/csv/writtenBean.csv b/libraries-server/src/test/resources/csv/writtenBean.csv new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libraries-server/src/test/resources/csv/writtenOneByOne.csv b/libraries-server/src/test/resources/csv/writtenOneByOne.csv new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libraries-server/src/test/resources/dockerapi/Dockerfile b/libraries-server/src/test/resources/dockerapi/Dockerfile new file mode 100644 index 0000000000..f9ad47f032 --- /dev/null +++ b/libraries-server/src/test/resources/dockerapi/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:3.6 + +RUN apk --update add git openssh && \ + rm -rf /var/lib/apt/lists/* && \ + rm /var/cache/apk/* + +ENTRYPOINT ["git"] +CMD ["--help"] \ No newline at end of file diff --git a/libraries-server/src/test/resources/employees.sql b/libraries-server/src/test/resources/employees.sql new file mode 100644 index 0000000000..c6109724cf --- /dev/null +++ b/libraries-server/src/test/resources/employees.sql @@ -0,0 +1,43 @@ +CREATE TABLE employee( + id int NOT NULL PRIMARY KEY auto_increment, + firstname varchar(255), + lastname varchar(255), + salary double, + hireddate date +); + +CREATE TABLE email( + id int NOT NULL PRIMARY KEY auto_increment, + employeeid int, + address varchar(255) +); + +CREATE TABLE employee_legacy( + id int NOT NULL PRIMARY KEY auto_increment, + first_name varchar(255), + last_name varchar(255), + salary double, + hired_date date +); + + +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('John', 'Doe', 10000.10, to_date('01-01-2001','dd-mm-yyyy')); +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Kevin', 'Smith', 20000.20, to_date('02-02-2002','dd-mm-yyyy')); +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Kim', 'Smith', 30000.30, to_date('03-03-2003','dd-mm-yyyy')); +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Stephen', 'Torvalds', 40000.40, to_date('04-04-2004','dd-mm-yyyy')); +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Christian', 'Reynolds', 50000.50, to_date('05-05-2005','dd-mm-yyyy')); + +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('John', 'Doe', 10000.10, to_date('01-01-2001','dd-mm-yyyy')); +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Kevin', 'Smith', 20000.20, to_date('02-02-2002','dd-mm-yyyy')); +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Kim', 'Smith', 30000.30, to_date('03-03-2003','dd-mm-yyyy')); +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Stephen', 'Torvalds', 40000.40, to_date('04-04-2004','dd-mm-yyyy')); +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Christian', 'Reynolds', 50000.50, to_date('05-05-2005','dd-mm-yyyy')); + +INSERT INTO email (employeeid,address) VALUES (1, 'john@baeldung.com'); +INSERT INTO email (employeeid,address) VALUES (1, 'john@gmail.com'); +INSERT INTO email (employeeid,address) VALUES (2, 'kevin@baeldung.com'); +INSERT INTO email (employeeid,address) VALUES (3, 'kim@baeldung.com'); +INSERT INTO email (employeeid,address) VALUES (3, 'kim@gmail.com'); +INSERT INTO email (employeeid,address) VALUES (3, 'kim@outlook.com'); +INSERT INTO email (employeeid,address) VALUES (4, 'stephen@baeldung.com'); +INSERT INTO email (employeeid,address) VALUES (5, 'christian@gmail.com'); diff --git a/libraries-server/src/test/resources/fileTest.txt b/libraries-server/src/test/resources/fileTest.txt new file mode 100644 index 0000000000..ce4bea208b --- /dev/null +++ b/libraries-server/src/test/resources/fileTest.txt @@ -0,0 +1 @@ +Hello World from fileTest.txt!!! \ No newline at end of file diff --git a/libraries-server/src/test/resources/ftp/baz.txt b/libraries-server/src/test/resources/ftp/baz.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libraries-server/src/test/resources/input.txt b/libraries-server/src/test/resources/input.txt new file mode 100644 index 0000000000..811232fa1f --- /dev/null +++ b/libraries-server/src/test/resources/input.txt @@ -0,0 +1 @@ +This file is merely for testing. \ No newline at end of file diff --git a/libraries-server/src/test/resources/output.txt b/libraries-server/src/test/resources/output.txt new file mode 100644 index 0000000000..34e1e27d5a --- /dev/null +++ b/libraries-server/src/test/resources/output.txt @@ -0,0 +1 @@ +Should be copied to OutputStream. \ No newline at end of file diff --git a/libraries-server/src/test/resources/sample.txt b/libraries-server/src/test/resources/sample.txt new file mode 100644 index 0000000000..20f137b416 --- /dev/null +++ b/libraries-server/src/test/resources/sample.txt @@ -0,0 +1,2 @@ +line 1 +a second line \ No newline at end of file diff --git a/libraries-server/src/test/resources/stories/github_rest/user_profile/github_user_profile_payload_test.story b/libraries-server/src/test/resources/stories/github_rest/user_profile/github_user_profile_payload_test.story new file mode 100644 index 0000000000..841bf901b5 --- /dev/null +++ b/libraries-server/src/test/resources/stories/github_rest/user_profile/github_user_profile_payload_test.story @@ -0,0 +1,13 @@ + +Meta: + +Narrative: +As a user +I want to look up a valid user's profile on github +So that I can know the login payload should be the same as username + +Scenario: Github user's profile should have a login payload same as username + +Given github user profile api +When looking for eugenp via the api +Then github's response contains a 'login' payload same as eugenp diff --git a/libraries-server/src/test/resources/stories/spring/adder_test.story b/libraries-server/src/test/resources/stories/spring/adder_test.story new file mode 100644 index 0000000000..e8de2cf076 --- /dev/null +++ b/libraries-server/src/test/resources/stories/spring/adder_test.story @@ -0,0 +1,11 @@ +Meta: + +Narrative: +As user +I want to add a number +So that I can have the sum + +Scenario: A user can submit a number to adder and get current sum +Given a number +When I submit another number 5 to adder +Then I get a sum of the numbers \ No newline at end of file diff --git a/libraries-server/src/test/resources/yaml/customer.yaml b/libraries-server/src/test/resources/yaml/customer.yaml new file mode 100644 index 0000000000..aa76141c7d --- /dev/null +++ b/libraries-server/src/test/resources/yaml/customer.yaml @@ -0,0 +1,3 @@ +firstName: "John" +lastName: "Doe" +age: 20 \ No newline at end of file diff --git a/libraries-server/src/test/resources/yaml/customer_with_contact_details.yaml b/libraries-server/src/test/resources/yaml/customer_with_contact_details.yaml new file mode 100644 index 0000000000..34563cbd21 --- /dev/null +++ b/libraries-server/src/test/resources/yaml/customer_with_contact_details.yaml @@ -0,0 +1,7 @@ +firstName: "John" +lastName: "Doe" +age: 31 +contactDetails: + - { type: "mobile", number: 123456789} + - { type: "landline", number: 456786868} + \ No newline at end of file diff --git a/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_address.yaml b/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_address.yaml new file mode 100644 index 0000000000..664afe8594 --- /dev/null +++ b/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_address.yaml @@ -0,0 +1,13 @@ +firstName: "John" +lastName: "Doe" +age: 31 +contactDetails: + - type: "mobile" + number: 123456789 + - type: "landline" + number: 456786868 +homeAddress: + line: "Xyz, DEF Street" + city: "City Y" + state: "State Y" + zip: 345657 diff --git a/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml b/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml new file mode 100644 index 0000000000..145da256d9 --- /dev/null +++ b/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml @@ -0,0 +1,6 @@ +firstName: "John" +lastName: "Doe" +age: 31 +contactDetails: + - !contact { type: "mobile", number: 123456789} + - !contact { type: "landline", number: 456786868} diff --git a/libraries-server/src/test/resources/yaml/customer_with_type.yaml b/libraries-server/src/test/resources/yaml/customer_with_type.yaml new file mode 100644 index 0000000000..6e13c26cea --- /dev/null +++ b/libraries-server/src/test/resources/yaml/customer_with_type.yaml @@ -0,0 +1,4 @@ +!!com.baeldung.snakeyaml.Customer +firstName: "John" +lastName: "Doe" +age: 20 \ No newline at end of file diff --git a/libraries-server/src/test/resources/yaml/customers.yaml b/libraries-server/src/test/resources/yaml/customers.yaml new file mode 100644 index 0000000000..23b9039c2e --- /dev/null +++ b/libraries-server/src/test/resources/yaml/customers.yaml @@ -0,0 +1,8 @@ +--- +firstName: "John" +lastName: "Doe" +age: 20 +--- +firstName: "Jack" +lastName: "Jones" +age: 25 \ No newline at end of file diff --git a/libraries/pom.xml b/libraries/pom.xml index b19a005d94..7402d88ef3 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -778,13 +778,6 @@ ${snakeyaml.version} - - org.eclipse.paho - org.eclipse.paho.client.mqttv3 - 1.2.0 - - - From 2299a6647254380b8957f192ffba7a1f4d983d3c Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Tue, 31 Jul 2018 22:39:56 +0300 Subject: [PATCH 083/298] remove extra files --- libraries-server/src/test/resources/ABC.txt | 1 - .../resources/JunitParamsTestParameters.csv | 4 -- libraries-server/src/test/resources/aaa.txt | 1 - .../src/test/resources/adder-beans.xml | 13 ------ libraries-server/src/test/resources/book.csv | 3 -- .../src/test/resources/csv/fourColumn.csv | 5 --- .../src/test/resources/csv/namedColumn.csv | 5 --- .../src/test/resources/csv/twoColumn.csv | 5 --- .../src/test/resources/csv/writtenAll.csv | 0 .../src/test/resources/csv/writtenBean.csv | 0 .../test/resources/csv/writtenOneByOne.csv | 0 .../src/test/resources/dockerapi/Dockerfile | 8 ---- .../src/test/resources/employees.sql | 43 ------------------- .../src/test/resources/fileTest.txt | 1 - .../src/test/resources/ftp/baz.txt | 0 libraries-server/src/test/resources/input.txt | 1 - .../src/test/resources/output.txt | 1 - .../src/test/resources/sample.txt | 2 - .../github_user_profile_payload_test.story | 13 ------ .../resources/stories/spring/adder_test.story | 11 ----- .../src/test/resources/yaml/customer.yaml | 3 -- .../yaml/customer_with_contact_details.yaml | 7 --- ...omer_with_contact_details_and_address.yaml | 13 ------ ...ustomer_with_contact_details_and_tags.yaml | 6 --- .../resources/yaml/customer_with_type.yaml | 4 -- .../src/test/resources/yaml/customers.yaml | 8 ---- 26 files changed, 158 deletions(-) delete mode 100644 libraries-server/src/test/resources/ABC.txt delete mode 100644 libraries-server/src/test/resources/JunitParamsTestParameters.csv delete mode 100644 libraries-server/src/test/resources/aaa.txt delete mode 100644 libraries-server/src/test/resources/adder-beans.xml delete mode 100644 libraries-server/src/test/resources/book.csv delete mode 100644 libraries-server/src/test/resources/csv/fourColumn.csv delete mode 100644 libraries-server/src/test/resources/csv/namedColumn.csv delete mode 100644 libraries-server/src/test/resources/csv/twoColumn.csv delete mode 100644 libraries-server/src/test/resources/csv/writtenAll.csv delete mode 100644 libraries-server/src/test/resources/csv/writtenBean.csv delete mode 100644 libraries-server/src/test/resources/csv/writtenOneByOne.csv delete mode 100644 libraries-server/src/test/resources/dockerapi/Dockerfile delete mode 100644 libraries-server/src/test/resources/employees.sql delete mode 100644 libraries-server/src/test/resources/fileTest.txt delete mode 100644 libraries-server/src/test/resources/ftp/baz.txt delete mode 100644 libraries-server/src/test/resources/input.txt delete mode 100644 libraries-server/src/test/resources/output.txt delete mode 100644 libraries-server/src/test/resources/sample.txt delete mode 100644 libraries-server/src/test/resources/stories/github_rest/user_profile/github_user_profile_payload_test.story delete mode 100644 libraries-server/src/test/resources/stories/spring/adder_test.story delete mode 100644 libraries-server/src/test/resources/yaml/customer.yaml delete mode 100644 libraries-server/src/test/resources/yaml/customer_with_contact_details.yaml delete mode 100644 libraries-server/src/test/resources/yaml/customer_with_contact_details_and_address.yaml delete mode 100644 libraries-server/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml delete mode 100644 libraries-server/src/test/resources/yaml/customer_with_type.yaml delete mode 100644 libraries-server/src/test/resources/yaml/customers.yaml diff --git a/libraries-server/src/test/resources/ABC.txt b/libraries-server/src/test/resources/ABC.txt deleted file mode 100644 index f78e42598c..0000000000 --- a/libraries-server/src/test/resources/ABC.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World from ABC.txt!!! \ No newline at end of file diff --git a/libraries-server/src/test/resources/JunitParamsTestParameters.csv b/libraries-server/src/test/resources/JunitParamsTestParameters.csv deleted file mode 100644 index 84eb5a0b23..0000000000 --- a/libraries-server/src/test/resources/JunitParamsTestParameters.csv +++ /dev/null @@ -1,4 +0,0 @@ -1,2,3 --10, 30, 20 -15, -5, 10 --5, -10, -15 \ No newline at end of file diff --git a/libraries-server/src/test/resources/aaa.txt b/libraries-server/src/test/resources/aaa.txt deleted file mode 100644 index e5875f97d6..0000000000 --- a/libraries-server/src/test/resources/aaa.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World from aaa.txt!!! \ No newline at end of file diff --git a/libraries-server/src/test/resources/adder-beans.xml b/libraries-server/src/test/resources/adder-beans.xml deleted file mode 100644 index 2fbdbd378f..0000000000 --- a/libraries-server/src/test/resources/adder-beans.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - 4 - - - - - diff --git a/libraries-server/src/test/resources/book.csv b/libraries-server/src/test/resources/book.csv deleted file mode 100644 index d709152a5e..0000000000 --- a/libraries-server/src/test/resources/book.csv +++ /dev/null @@ -1,3 +0,0 @@ -author,title -Dan Simmons,Hyperion -Douglas Adams,The Hitchhiker's Guide to the Galaxy diff --git a/libraries-server/src/test/resources/csv/fourColumn.csv b/libraries-server/src/test/resources/csv/fourColumn.csv deleted file mode 100644 index 51a69fd1a0..0000000000 --- a/libraries-server/src/test/resources/csv/fourColumn.csv +++ /dev/null @@ -1,5 +0,0 @@ -ColA,ColB,ColC,ColD -A,B,B,B -C,D,W,W -G,G,E,E -G,F,Q,Q diff --git a/libraries-server/src/test/resources/csv/namedColumn.csv b/libraries-server/src/test/resources/csv/namedColumn.csv deleted file mode 100644 index 279b743600..0000000000 --- a/libraries-server/src/test/resources/csv/namedColumn.csv +++ /dev/null @@ -1,5 +0,0 @@ -name,age -adam,1000 -martin,27 -gigi,41 -seraphine,30 \ No newline at end of file diff --git a/libraries-server/src/test/resources/csv/twoColumn.csv b/libraries-server/src/test/resources/csv/twoColumn.csv deleted file mode 100644 index 3eab8e8a64..0000000000 --- a/libraries-server/src/test/resources/csv/twoColumn.csv +++ /dev/null @@ -1,5 +0,0 @@ -ColA,ColB -A,B -C,D -G,G -G,F diff --git a/libraries-server/src/test/resources/csv/writtenAll.csv b/libraries-server/src/test/resources/csv/writtenAll.csv deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libraries-server/src/test/resources/csv/writtenBean.csv b/libraries-server/src/test/resources/csv/writtenBean.csv deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libraries-server/src/test/resources/csv/writtenOneByOne.csv b/libraries-server/src/test/resources/csv/writtenOneByOne.csv deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libraries-server/src/test/resources/dockerapi/Dockerfile b/libraries-server/src/test/resources/dockerapi/Dockerfile deleted file mode 100644 index f9ad47f032..0000000000 --- a/libraries-server/src/test/resources/dockerapi/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM alpine:3.6 - -RUN apk --update add git openssh && \ - rm -rf /var/lib/apt/lists/* && \ - rm /var/cache/apk/* - -ENTRYPOINT ["git"] -CMD ["--help"] \ No newline at end of file diff --git a/libraries-server/src/test/resources/employees.sql b/libraries-server/src/test/resources/employees.sql deleted file mode 100644 index c6109724cf..0000000000 --- a/libraries-server/src/test/resources/employees.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE employee( - id int NOT NULL PRIMARY KEY auto_increment, - firstname varchar(255), - lastname varchar(255), - salary double, - hireddate date -); - -CREATE TABLE email( - id int NOT NULL PRIMARY KEY auto_increment, - employeeid int, - address varchar(255) -); - -CREATE TABLE employee_legacy( - id int NOT NULL PRIMARY KEY auto_increment, - first_name varchar(255), - last_name varchar(255), - salary double, - hired_date date -); - - -INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('John', 'Doe', 10000.10, to_date('01-01-2001','dd-mm-yyyy')); -INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Kevin', 'Smith', 20000.20, to_date('02-02-2002','dd-mm-yyyy')); -INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Kim', 'Smith', 30000.30, to_date('03-03-2003','dd-mm-yyyy')); -INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Stephen', 'Torvalds', 40000.40, to_date('04-04-2004','dd-mm-yyyy')); -INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Christian', 'Reynolds', 50000.50, to_date('05-05-2005','dd-mm-yyyy')); - -INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('John', 'Doe', 10000.10, to_date('01-01-2001','dd-mm-yyyy')); -INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Kevin', 'Smith', 20000.20, to_date('02-02-2002','dd-mm-yyyy')); -INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Kim', 'Smith', 30000.30, to_date('03-03-2003','dd-mm-yyyy')); -INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Stephen', 'Torvalds', 40000.40, to_date('04-04-2004','dd-mm-yyyy')); -INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Christian', 'Reynolds', 50000.50, to_date('05-05-2005','dd-mm-yyyy')); - -INSERT INTO email (employeeid,address) VALUES (1, 'john@baeldung.com'); -INSERT INTO email (employeeid,address) VALUES (1, 'john@gmail.com'); -INSERT INTO email (employeeid,address) VALUES (2, 'kevin@baeldung.com'); -INSERT INTO email (employeeid,address) VALUES (3, 'kim@baeldung.com'); -INSERT INTO email (employeeid,address) VALUES (3, 'kim@gmail.com'); -INSERT INTO email (employeeid,address) VALUES (3, 'kim@outlook.com'); -INSERT INTO email (employeeid,address) VALUES (4, 'stephen@baeldung.com'); -INSERT INTO email (employeeid,address) VALUES (5, 'christian@gmail.com'); diff --git a/libraries-server/src/test/resources/fileTest.txt b/libraries-server/src/test/resources/fileTest.txt deleted file mode 100644 index ce4bea208b..0000000000 --- a/libraries-server/src/test/resources/fileTest.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World from fileTest.txt!!! \ No newline at end of file diff --git a/libraries-server/src/test/resources/ftp/baz.txt b/libraries-server/src/test/resources/ftp/baz.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libraries-server/src/test/resources/input.txt b/libraries-server/src/test/resources/input.txt deleted file mode 100644 index 811232fa1f..0000000000 --- a/libraries-server/src/test/resources/input.txt +++ /dev/null @@ -1 +0,0 @@ -This file is merely for testing. \ No newline at end of file diff --git a/libraries-server/src/test/resources/output.txt b/libraries-server/src/test/resources/output.txt deleted file mode 100644 index 34e1e27d5a..0000000000 --- a/libraries-server/src/test/resources/output.txt +++ /dev/null @@ -1 +0,0 @@ -Should be copied to OutputStream. \ No newline at end of file diff --git a/libraries-server/src/test/resources/sample.txt b/libraries-server/src/test/resources/sample.txt deleted file mode 100644 index 20f137b416..0000000000 --- a/libraries-server/src/test/resources/sample.txt +++ /dev/null @@ -1,2 +0,0 @@ -line 1 -a second line \ No newline at end of file diff --git a/libraries-server/src/test/resources/stories/github_rest/user_profile/github_user_profile_payload_test.story b/libraries-server/src/test/resources/stories/github_rest/user_profile/github_user_profile_payload_test.story deleted file mode 100644 index 841bf901b5..0000000000 --- a/libraries-server/src/test/resources/stories/github_rest/user_profile/github_user_profile_payload_test.story +++ /dev/null @@ -1,13 +0,0 @@ - -Meta: - -Narrative: -As a user -I want to look up a valid user's profile on github -So that I can know the login payload should be the same as username - -Scenario: Github user's profile should have a login payload same as username - -Given github user profile api -When looking for eugenp via the api -Then github's response contains a 'login' payload same as eugenp diff --git a/libraries-server/src/test/resources/stories/spring/adder_test.story b/libraries-server/src/test/resources/stories/spring/adder_test.story deleted file mode 100644 index e8de2cf076..0000000000 --- a/libraries-server/src/test/resources/stories/spring/adder_test.story +++ /dev/null @@ -1,11 +0,0 @@ -Meta: - -Narrative: -As user -I want to add a number -So that I can have the sum - -Scenario: A user can submit a number to adder and get current sum -Given a number -When I submit another number 5 to adder -Then I get a sum of the numbers \ No newline at end of file diff --git a/libraries-server/src/test/resources/yaml/customer.yaml b/libraries-server/src/test/resources/yaml/customer.yaml deleted file mode 100644 index aa76141c7d..0000000000 --- a/libraries-server/src/test/resources/yaml/customer.yaml +++ /dev/null @@ -1,3 +0,0 @@ -firstName: "John" -lastName: "Doe" -age: 20 \ No newline at end of file diff --git a/libraries-server/src/test/resources/yaml/customer_with_contact_details.yaml b/libraries-server/src/test/resources/yaml/customer_with_contact_details.yaml deleted file mode 100644 index 34563cbd21..0000000000 --- a/libraries-server/src/test/resources/yaml/customer_with_contact_details.yaml +++ /dev/null @@ -1,7 +0,0 @@ -firstName: "John" -lastName: "Doe" -age: 31 -contactDetails: - - { type: "mobile", number: 123456789} - - { type: "landline", number: 456786868} - \ No newline at end of file diff --git a/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_address.yaml b/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_address.yaml deleted file mode 100644 index 664afe8594..0000000000 --- a/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_address.yaml +++ /dev/null @@ -1,13 +0,0 @@ -firstName: "John" -lastName: "Doe" -age: 31 -contactDetails: - - type: "mobile" - number: 123456789 - - type: "landline" - number: 456786868 -homeAddress: - line: "Xyz, DEF Street" - city: "City Y" - state: "State Y" - zip: 345657 diff --git a/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml b/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml deleted file mode 100644 index 145da256d9..0000000000 --- a/libraries-server/src/test/resources/yaml/customer_with_contact_details_and_tags.yaml +++ /dev/null @@ -1,6 +0,0 @@ -firstName: "John" -lastName: "Doe" -age: 31 -contactDetails: - - !contact { type: "mobile", number: 123456789} - - !contact { type: "landline", number: 456786868} diff --git a/libraries-server/src/test/resources/yaml/customer_with_type.yaml b/libraries-server/src/test/resources/yaml/customer_with_type.yaml deleted file mode 100644 index 6e13c26cea..0000000000 --- a/libraries-server/src/test/resources/yaml/customer_with_type.yaml +++ /dev/null @@ -1,4 +0,0 @@ -!!com.baeldung.snakeyaml.Customer -firstName: "John" -lastName: "Doe" -age: 20 \ No newline at end of file diff --git a/libraries-server/src/test/resources/yaml/customers.yaml b/libraries-server/src/test/resources/yaml/customers.yaml deleted file mode 100644 index 23b9039c2e..0000000000 --- a/libraries-server/src/test/resources/yaml/customers.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -firstName: "John" -lastName: "Doe" -age: 20 ---- -firstName: "Jack" -lastName: "Jones" -age: 25 \ No newline at end of file From 62c6f3434c379ef33431d2847aaffbe5572798c7 Mon Sep 17 00:00:00 2001 From: cdjole Date: Tue, 31 Jul 2018 22:00:44 +0200 Subject: [PATCH 084/298] BAEL-1865 - Java Objects Sizes (#4584) * BAEL-1865 - Java Objects Sizes * BAEL-1865 - PR fix --- .../objectsize/InstrumentationAgent.java | 18 ++++++ .../objectsize/InstrumentationExample.java | 59 +++++++++++++++++++ .../java/com/baeldung/objectsize/MANIFEST.MF | 1 + 3 files changed, 78 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/objectsize/InstrumentationAgent.java create mode 100644 core-java/src/main/java/com/baeldung/objectsize/InstrumentationExample.java create mode 100644 core-java/src/main/java/com/baeldung/objectsize/MANIFEST.MF diff --git a/core-java/src/main/java/com/baeldung/objectsize/InstrumentationAgent.java b/core-java/src/main/java/com/baeldung/objectsize/InstrumentationAgent.java new file mode 100644 index 0000000000..66e9a44af8 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/objectsize/InstrumentationAgent.java @@ -0,0 +1,18 @@ +package com.baeldung.objectsize; + +import java.lang.instrument.Instrumentation; + +public class InstrumentationAgent { + private static volatile Instrumentation globalInstrumentation; + + public static void premain(final String agentArgs, final Instrumentation inst) { + globalInstrumentation = inst; + } + + public static long getObjectSize(final Object object) { + if (globalInstrumentation == null) { + throw new IllegalStateException("Agent not initialized."); + } + return globalInstrumentation.getObjectSize(object); + } +} diff --git a/core-java/src/main/java/com/baeldung/objectsize/InstrumentationExample.java b/core-java/src/main/java/com/baeldung/objectsize/InstrumentationExample.java new file mode 100644 index 0000000000..f751d954c8 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/objectsize/InstrumentationExample.java @@ -0,0 +1,59 @@ +package com.baeldung.objectsize; + +import java.util.ArrayList; +import java.util.List; + +public class InstrumentationExample { + + public static void printObjectSize(Object object) { + System.out.println("Object type: " + object.getClass() + ", size: " + InstrumentationAgent.getObjectSize(object) + " bytes"); + } + + public static void main(String[] arguments) { + String emptyString = ""; + String string = "Estimating Object Size Using Instrumentation"; + String[] stringArray = { emptyString, string, "com.baeldung" }; + String[] anotherStringArray = new String[100]; + List stringList = new ArrayList<>(); + StringBuilder stringBuilder = new StringBuilder(100); + int maxIntPrimitive = Integer.MAX_VALUE; + int minIntPrimitive = Integer.MIN_VALUE; + Integer maxInteger = Integer.MAX_VALUE; + Integer minInteger = Integer.MIN_VALUE; + long zeroLong = 0L; + double zeroDouble = 0.0; + boolean falseBoolean = false; + Object object = new Object(); + + class EmptyClass { + } + EmptyClass emptyClass = new EmptyClass(); + + class StringClass { + public String s; + } + StringClass stringClass = new StringClass(); + + printObjectSize(emptyString); + printObjectSize(string); + printObjectSize(stringArray); + printObjectSize(anotherStringArray); + printObjectSize(stringList); + printObjectSize(stringBuilder); + printObjectSize(maxIntPrimitive); + printObjectSize(minIntPrimitive); + printObjectSize(maxInteger); + printObjectSize(minInteger); + printObjectSize(zeroLong); + printObjectSize(zeroDouble); + printObjectSize(falseBoolean); + printObjectSize(Day.TUESDAY); + printObjectSize(object); + printObjectSize(emptyClass); + printObjectSize(stringClass); + } + + public enum Day { + MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY + } +} diff --git a/core-java/src/main/java/com/baeldung/objectsize/MANIFEST.MF b/core-java/src/main/java/com/baeldung/objectsize/MANIFEST.MF new file mode 100644 index 0000000000..b814f624d0 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/objectsize/MANIFEST.MF @@ -0,0 +1 @@ +Premain-class: com.baeldung.objectsize.InstrumentationAgent From d05f4572f8a7e9eefe9e97ff6b952b96ff04988d Mon Sep 17 00:00:00 2001 From: db Date: Tue, 31 Jul 2018 22:42:52 +0100 Subject: [PATCH 085/298] OAuth2 Principal and Authorities example - refactor and added example using custom authorization server --- .../ExtractorsApplication.java | 9 ++++++ .../configuration/SecurityConfig.java | 31 ++++++++++++++----- .../custom/BaeldungAuthoritiesExtractor.java | 29 +++++++++++++++++ .../custom/BaeldungPrincipalExtractor.java | 13 ++++++++ .../GithubAuthoritiesExtractor.java} | 4 +-- .../GithubPrincipalExtractor.java} | 4 +-- ...tion-oauth2-extractors-baeldung.properties | 6 ++++ ...ation-oauth2-extractors-github.properties} | 1 + .../oauth2extractors/ExtractorsUnitTest.java | 2 ++ .../org/baeldung/config/AuthServerConfig.java | 2 +- 10 files changed, 88 insertions(+), 13 deletions(-) create mode 100644 spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java create mode 100644 spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java rename spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/{CustomAuthoritiesExtractor.java => github/GithubAuthoritiesExtractor.java} (89%) rename spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/{CustomPrincipalExtractor.java => github/GithubPrincipalExtractor.java} (66%) create mode 100644 spring-5-security/src/main/resources/application-oauth2-extractors-baeldung.properties rename spring-5-security/src/main/resources/{application-oauth2-extractors.properties => application-oauth2-extractors-github.properties} (96%) diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java index c9a18d1599..6ab4d525bf 100644 --- a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/ExtractorsApplication.java @@ -1,7 +1,9 @@ package com.baeldung.oauth2extractors; +import org.apache.logging.log4j.util.Strings; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.core.env.AbstractEnvironment; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -9,6 +11,13 @@ import org.springframework.web.bind.annotation.RequestMapping; @Controller public class ExtractorsApplication { public static void main(String[] args) { + if (Strings.isEmpty(System.getProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME))) { + /*System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, + "oauth2-extractors-baeldung");*/ + System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, + "oauth2-extractors-github"); + } + SpringApplication.run(ExtractorsApplication.class, args); } diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java index cc1258d14b..b2ea19c008 100644 --- a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/configuration/SecurityConfig.java @@ -1,18 +1,19 @@ package com.baeldung.oauth2extractors.configuration; -import com.baeldung.oauth2extractors.extractor.CustomAuthoritiesExtractor; -import com.baeldung.oauth2extractors.extractor.CustomPrincipalExtractor; +import com.baeldung.oauth2extractors.extractor.custom.BaeldungAuthoritiesExtractor; +import com.baeldung.oauth2extractors.extractor.custom.BaeldungPrincipalExtractor; +import com.baeldung.oauth2extractors.extractor.github.GithubAuthoritiesExtractor; +import com.baeldung.oauth2extractors.extractor.github.GithubPrincipalExtractor; import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor; import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.Profile; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration -@PropertySource("application-oauth2-extractors.properties") @EnableOAuth2Sso public class SecurityConfig extends WebSecurityConfigurerAdapter { @@ -29,12 +30,26 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { } @Bean - public PrincipalExtractor principalExtractor() { - return new CustomPrincipalExtractor(); + @Profile("oauth2-extractors-baeldung") + public PrincipalExtractor baeldungPrincipalExtractor() { + return new BaeldungPrincipalExtractor(); } @Bean - public AuthoritiesExtractor authoritiesExtractor() { - return new CustomAuthoritiesExtractor(); + @Profile("oauth2-extractors-baeldung") + public AuthoritiesExtractor baeldungAuthoritiesExtractor() { + return new BaeldungAuthoritiesExtractor(); + } + + @Bean + @Profile("oauth2-extractors-github") + public PrincipalExtractor githubPrincipalExtractor() { + return new GithubPrincipalExtractor(); + } + + @Bean + @Profile("oauth2-extractors-github") + public AuthoritiesExtractor githubAuthoritiesExtractor() { + return new GithubAuthoritiesExtractor(); } } \ No newline at end of file diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java new file mode 100644 index 0000000000..275bcd0d31 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungAuthoritiesExtractor.java @@ -0,0 +1,29 @@ +package com.baeldung.oauth2extractors.extractor.custom; + +import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.AuthorityUtils; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class BaeldungAuthoritiesExtractor implements AuthoritiesExtractor { + + @Override + public List extractAuthorities(Map map) { + return AuthorityUtils + .commaSeparatedStringToAuthorityList(asAuthorities(map)); + } + + private String asAuthorities(Map map) { + List authorities = new ArrayList<>(); + authorities.add("BAELDUNG_USER"); + List> authz = (List>) map.get("authorities"); + for (LinkedHashMap entry : authz) { + authorities.add(entry.get("authority")); + } + return String.join(",", authorities); + } +} diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java new file mode 100644 index 0000000000..6f1b20df10 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/custom/BaeldungPrincipalExtractor.java @@ -0,0 +1,13 @@ +package com.baeldung.oauth2extractors.extractor.custom; + +import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor; + +import java.util.Map; + +public class BaeldungPrincipalExtractor implements PrincipalExtractor { + + @Override + public Object extractPrincipal(Map map) { + return map.get("name"); + } +} diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomAuthoritiesExtractor.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java similarity index 89% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomAuthoritiesExtractor.java rename to spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java index ad23f6c32f..5d90164f06 100644 --- a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomAuthoritiesExtractor.java +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubAuthoritiesExtractor.java @@ -1,4 +1,4 @@ -package com.baeldung.oauth2extractors.extractor; +package com.baeldung.oauth2extractors.extractor.github; import org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor; import org.springframework.security.core.GrantedAuthority; @@ -9,7 +9,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; -public class CustomAuthoritiesExtractor implements AuthoritiesExtractor { +public class GithubAuthoritiesExtractor implements AuthoritiesExtractor { private List GITHUB_FREE_AUTHORITIES = AuthorityUtils .commaSeparatedStringToAuthorityList("GITHUB_USER,GITHUB_USER_FREE"); private List GITHUB_SUBSCRIBED_AUTHORITIES = AuthorityUtils diff --git a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomPrincipalExtractor.java b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java similarity index 66% rename from spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomPrincipalExtractor.java rename to spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java index c35522f0f3..fdc5c0c9f3 100644 --- a/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/CustomPrincipalExtractor.java +++ b/spring-5-security/src/main/java/com/baeldung/oauth2extractors/extractor/github/GithubPrincipalExtractor.java @@ -1,10 +1,10 @@ -package com.baeldung.oauth2extractors.extractor; +package com.baeldung.oauth2extractors.extractor.github; import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor; import java.util.Map; -public class CustomPrincipalExtractor implements PrincipalExtractor { +public class GithubPrincipalExtractor implements PrincipalExtractor { @Override public Object extractPrincipal(Map map) { diff --git a/spring-5-security/src/main/resources/application-oauth2-extractors-baeldung.properties b/spring-5-security/src/main/resources/application-oauth2-extractors-baeldung.properties new file mode 100644 index 0000000000..6ef0f5000b --- /dev/null +++ b/spring-5-security/src/main/resources/application-oauth2-extractors-baeldung.properties @@ -0,0 +1,6 @@ +server.port=8082 +security.oauth2.client.client-id=SampleClientId +security.oauth2.client.client-secret=secret +security.oauth2.client.access-token-uri=http://localhost:8081/auth/oauth/token +security.oauth2.client.user-authorization-uri=http://localhost:8081/auth/oauth/authorize +security.oauth2.resource.user-info-uri=http://localhost:8081/auth/user/me \ No newline at end of file diff --git a/spring-5-security/src/main/resources/application-oauth2-extractors.properties b/spring-5-security/src/main/resources/application-oauth2-extractors-github.properties similarity index 96% rename from spring-5-security/src/main/resources/application-oauth2-extractors.properties rename to spring-5-security/src/main/resources/application-oauth2-extractors-github.properties index 51d6ee7d6e..8a151dcb98 100644 --- a/spring-5-security/src/main/resources/application-oauth2-extractors.properties +++ b/spring-5-security/src/main/resources/application-oauth2-extractors-github.properties @@ -1,3 +1,4 @@ +server.port=8082 security.oauth2.client.client-id=89a7c4facbb3434d599d security.oauth2.client.client-secret=9b3b08e4a340bd20e866787e4645b54f73d74b6a security.oauth2.client.access-token-uri=https://github.com/login/oauth/access_token diff --git a/spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java b/spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java index 164bc4933f..491d618291 100644 --- a/spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java +++ b/spring-5-security/src/test/java/com/baeldung/oauth2extractors/ExtractorsUnitTest.java @@ -6,6 +6,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; @@ -21,6 +22,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @SpringBootTest(classes = ExtractorsApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ContextConfiguration(classes = {SecurityConfig.class}) +@ActiveProfiles("oauth2-extractors-github") public class ExtractorsUnitTest { @Autowired diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java b/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java index 56229d4d38..07057c3875 100644 --- a/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java +++ b/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java @@ -30,7 +30,7 @@ public class AuthServerConfig extends AuthorizationServerConfigurerAdapter { .authorizedGrantTypes("authorization_code") .scopes("user_info") .autoApprove(true) - .redirectUris("http://localhost:8082/ui/login","http://localhost:8083/ui2/login") + .redirectUris("http://localhost:8082/ui/login","http://localhost:8083/ui2/login","http://localhost:8082/login") // .accessTokenValiditySeconds(3600) ; // 1 hour } From 505a9f37eb272aee057603252c37c002056ddf2b Mon Sep 17 00:00:00 2001 From: eelhazati Date: Tue, 31 Jul 2018 20:34:50 +0100 Subject: [PATCH 086/298] Server-Sent Evensts --- pom.xml | 3 +- sse-jaxrs/pom.xml | 22 ++++ sse-jaxrs/sse-jaxrs-client/pom.xml | 62 +++++++++ .../sse/jaxrs/client/SseClientApp.java | 48 +++++++ .../jaxrs/client/SseClientBroadcastApp.java | 52 ++++++++ sse-jaxrs/sse-jaxrs-server/pom.xml | 85 +++++++++++++ .../com/baeldung/sse/jaxrs/AppConfig.java | 8 ++ .../com/baeldung/sse/jaxrs/SseResource.java | 119 ++++++++++++++++++ .../java/com/baeldung/sse/jaxrs/Stock.java | 50 ++++++++ .../com/baeldung/sse/jaxrs/StockService.java | 78 ++++++++++++ .../src/main/liberty/config/server.xml | 7 ++ .../src/main/resources/META-INF/beans.xml | 6 + .../src/main/webapp/WEB-INF/web.xml | 11 ++ .../src/main/webapp/index.html | 1 + .../src/main/webapp/sse-broadcast.html | 38 ++++++ .../sse-jaxrs-server/src/main/webapp/sse.html | 38 ++++++ 16 files changed, 627 insertions(+), 1 deletion(-) create mode 100644 sse-jaxrs/pom.xml create mode 100644 sse-jaxrs/sse-jaxrs-client/pom.xml create mode 100644 sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java create mode 100644 sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java create mode 100644 sse-jaxrs/sse-jaxrs-server/pom.xml create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html diff --git a/pom.xml b/pom.xml index 20ad5160d9..dae7e4b9c7 100644 --- a/pom.xml +++ b/pom.xml @@ -550,7 +550,8 @@ apache-meecrowave spring-reactive-kotlin jnosql - testing-modules/junit-abstract + testing-modules/junit-abstract + sse-jaxrs diff --git a/sse-jaxrs/pom.xml b/sse-jaxrs/pom.xml new file mode 100644 index 0000000000..ac9bff937f --- /dev/null +++ b/sse-jaxrs/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + com.baeldung.sse + sse-jaxrs + 1.0-SNAPSHOT + pom + + + 1.8 + 1.8 + + + + sse-jaxrs-server + sse-jaxrs-client + + + diff --git a/sse-jaxrs/sse-jaxrs-client/pom.xml b/sse-jaxrs/sse-jaxrs-client/pom.xml new file mode 100644 index 0000000000..a9068e133f --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-client/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + + com.baeldung.sse + sse-jaxrs + 1.0-SNAPSHOT + + + sse-jaxrs-client + + + 3.2.0 + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + singleEvent + + java + + + com.baeldung.sse.jaxrs.client.SseClientApp + + + + broadcast + + java + + + com.baeldung.sse.jaxrs.client.SseClientBroadcastApp + + + + + + + + + + org.apache.cxf + cxf-rt-rs-client + ${cxf-version} + + + org.apache.cxf + cxf-rt-rs-sse + ${cxf-version} + + + + diff --git a/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java b/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java new file mode 100644 index 0000000000..5d42b3a243 --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java @@ -0,0 +1,48 @@ +package com.baeldung.sse.jaxrs.client; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.sse.InboundSseEvent; +import javax.ws.rs.sse.SseEventSource; +import java.util.function.Consumer; + +public class SseClientApp { + + private static final String url = "http://127.0.0.1:9080/sse-jaxrs-server/sse/stock/prices"; + + public static void main(String... args) throws Exception { + + Client client = ClientBuilder.newClient(); + WebTarget target = client.target(url); + try (SseEventSource eventSource = SseEventSource.target(target).build()) { + + eventSource.register(onEvent, onError, onComplete); + eventSource.open(); + + //Consuming events for one hour + Thread.sleep(60 * 60 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + client.close(); + System.out.println("End"); + } + + // A new event is received + private static Consumer onEvent = (inboundSseEvent) -> { + String data = inboundSseEvent.readData(); + System.out.println(data); + }; + + //Error + private static Consumer onError = (throwable) -> { + throwable.printStackTrace(); + }; + + //Connection close and there is nothing to receive + private static Runnable onComplete = () -> { + System.out.println("Done!"); + }; + +} diff --git a/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java b/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java new file mode 100644 index 0000000000..9afc187a6d --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java @@ -0,0 +1,52 @@ +package com.baeldung.sse.jaxrs.client; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.sse.InboundSseEvent; +import javax.ws.rs.sse.SseEventSource; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; + +public class SseClientBroadcastApp { + + private static final String subscribeUrl = "http://localhost:9080/sse-jaxrs-server/sse/stock/subscribe"; + + + public static void main(String... args) throws Exception { + + Client client = ClientBuilder.newClient(); + WebTarget target = client.target(subscribeUrl); + try (final SseEventSource eventSource = SseEventSource.target(target) + .reconnectingEvery(5, TimeUnit.SECONDS) + .build()) { + eventSource.register(onEvent, onError, onComplete); + eventSource.open(); + System.out.println("Wainting for incoming event ..."); + + //Consuming events for one hour + Thread.sleep(60 * 60 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + client.close(); + System.out.println("End"); + } + + // A new event is received + private static Consumer onEvent = (inboundSseEvent) -> { + String data = inboundSseEvent.readData(); + System.out.println(data); + }; + + //Error + private static Consumer onError = (throwable) -> { + throwable.printStackTrace(); + }; + + //Connection close and there is nothing to receive + private static Runnable onComplete = () -> { + System.out.println("Done!"); + }; + +} diff --git a/sse-jaxrs/sse-jaxrs-server/pom.xml b/sse-jaxrs/sse-jaxrs-server/pom.xml new file mode 100644 index 0000000000..1e89c70e13 --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + + com.baeldung.sse + sse-jaxrs + 1.0-SNAPSHOT + + + sse-jaxrs-server + war + + + 2.4.2 + false + 18.0.0.2 + + + + ${artifactId} + + + net.wasdev.wlp.maven.plugins + liberty-maven-plugin + ${liberty-maven-plugin.version} + + + io.openliberty + openliberty-webProfile8 + ${openliberty-version} + zip + + project + true + src/main/liberty/config/server.xml + + + + install-server + prepare-package + + install-server + create-server + install-feature + + + + install-apps + package + + install-apps + + + + + + + + + + + javax.ws.rs + javax.ws.rs-api + 2.1 + provided + + + javax.enterprise + cdi-api + 2.0 + provided + + + javax.json.bind + javax.json.bind-api + 1.0 + provided + + + + + diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java new file mode 100644 index 0000000000..058d19f045 --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java @@ -0,0 +1,8 @@ +package com.baeldung.sse.jaxrs; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("sse") +public class AppConfig extends Application { +} diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java new file mode 100644 index 0000000000..1f60168a1b --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java @@ -0,0 +1,119 @@ +package com.baeldung.sse.jaxrs; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.sse.OutboundSseEvent; +import javax.ws.rs.sse.Sse; +import javax.ws.rs.sse.SseBroadcaster; +import javax.ws.rs.sse.SseEventSink; + +@ApplicationScoped +@Path("stock") +public class SseResource { + + @Inject + private StockService stockService; + + private Sse sse; + private SseBroadcaster sseBroadcaster; + private OutboundSseEvent.Builder eventBuilder; + + @Context + public void setSse(Sse sse) { + this.sse = sse; + this.eventBuilder = sse.newEventBuilder(); + this.sseBroadcaster = sse.newBroadcaster(); + } + + @GET + @Path("prices") + @Produces("text/event-stream") + public void getStockPrices(@Context SseEventSink sseEventSink, + @HeaderParam(HttpHeaders.LAST_EVENT_ID_HEADER) @DefaultValue("-1") int lastReceivedId) { + + int lastEventId = 1; + if (lastReceivedId != -1) { + lastEventId = ++lastReceivedId; + } + boolean running = true; + while (running) { + Stock stock = stockService.getNextTransaction(lastEventId); + if (stock != null) { + OutboundSseEvent sseEvent = this.eventBuilder + .name("stock") + .id(String.valueOf(lastEventId)) + .mediaType(MediaType.APPLICATION_JSON_TYPE) + .data(Stock.class, stock) + .reconnectDelay(3000) + .comment("price change") + .build(); + sseEventSink.send(sseEvent); + lastEventId++; + } + //Simulate connection close + if (lastEventId % 5 == 0) { + sseEventSink.close(); + break; + } + + try { + //Wait 5 seconds + Thread.sleep(5 * 1000); + } catch (InterruptedException ex) { + // ... + } + //Simulatae a while boucle break + running = lastEventId <= 2000; + } + sseEventSink.close(); + } + + @GET + @Path("subscribe") + @Produces(MediaType.SERVER_SENT_EVENTS) + public void listen(@Context SseEventSink sseEventSink) { + sseEventSink.send(sse.newEvent("Welcome !")); + this.sseBroadcaster.register(sseEventSink); + sseEventSink.send(sse.newEvent("You are registred !")); + } + + @GET + @Path("publish") + public void broadcast() { + Runnable r = new Runnable() { + @Override + public void run() { + int lastEventId = 0; + boolean running = true; + while (running) { + lastEventId++; + Stock stock = stockService.getNextTransaction(lastEventId); + if (stock != null) { + OutboundSseEvent sseEvent = eventBuilder + .name("stock") + .id(String.valueOf(lastEventId)) + .mediaType(MediaType.APPLICATION_JSON_TYPE) + .data(Stock.class, stock) + .reconnectDelay(3000) + .comment("price change") + .build(); + sseBroadcaster.broadcast(sseEvent); + } + try { + //Wait 5 seconds + Thread.currentThread().sleep(5 * 1000); + } catch (InterruptedException ex) { + // ... + } + //Simulatae a while boucle break + running = lastEventId <= 2000; + } + } + }; + new Thread(r).start(); + } +} diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java new file mode 100644 index 0000000000..a186b32771 --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java @@ -0,0 +1,50 @@ +package com.baeldung.sse.jaxrs; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +public class Stock { + private Integer id; + private String name; + private BigDecimal price; + LocalDateTime dateTime; + + public Stock(Integer id, String name, BigDecimal price, LocalDateTime dateTime) { + this.id = id; + this.name = name; + this.price = price; + this.dateTime = dateTime; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public LocalDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(LocalDateTime dateTime) { + this.dateTime = dateTime; + } +} diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java new file mode 100644 index 0000000000..15818ead5d --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java @@ -0,0 +1,78 @@ +package com.baeldung.sse.jaxrs; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.context.Initialized; +import javax.enterprise.event.Event; +import javax.enterprise.event.Observes; +import javax.inject.Inject; +import javax.inject.Named; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicInteger; + +@ApplicationScoped +@Named +public class StockService { + + private static final BigDecimal UP = BigDecimal.valueOf(1.05f); + private static final BigDecimal DOWN = BigDecimal.valueOf(0.95f); + + List stockNames = Arrays.asList("GOOG", "IBM", "MS", "GOOG", "YAHO"); + List stocksDB = new ArrayList<>(); + private AtomicInteger counter = new AtomicInteger(0); + + public void init(@Observes @Initialized(ApplicationScoped.class) Object init) { + //Open price + System.out.println("@Start Init ..."); + stockNames.forEach(stockName -> { + stocksDB.add(new Stock(counter.incrementAndGet(), stockName, generateOpenPrice(), LocalDateTime.now())); + }); + + Runnable runnable = new Runnable() { + @Override + public void run() { + //Simulate Change price and put every x seconds + while (true) { + int indx = new Random().nextInt(stockNames.size()); + String stockName = stockNames.get(indx); + BigDecimal price = getLastPrice(stockName); + BigDecimal newprice = changePrice(price); + Stock stock = new Stock(counter.incrementAndGet(), stockName, newprice, LocalDateTime.now()); + stocksDB.add(stock); + + int r = new Random().nextInt(30); + try { + Thread.currentThread().sleep(r*1000); + } catch (InterruptedException ex) { + // ... + } + } + } + }; + new Thread(runnable).start(); + System.out.println("@End Init ..."); + } + + public Stock getNextTransaction(Integer lastEventId) { + return stocksDB.stream().filter(s -> s.getId().equals(lastEventId)).findFirst().orElse(null); + } + + BigDecimal generateOpenPrice() { + float min = 70; + float max = 120; + return BigDecimal.valueOf(min + new Random().nextFloat() * (max - min)).setScale(4,RoundingMode.CEILING); + } + + BigDecimal changePrice(BigDecimal price) { + return Math.random() >= 0.5 ? price.multiply(UP).setScale(4,RoundingMode.CEILING) : price.multiply(DOWN).setScale(4,RoundingMode.CEILING); + } + + private BigDecimal getLastPrice(String stockName) { + return stocksDB.stream().filter(stock -> stock.getName().equals(stockName)).findFirst().get().getPrice(); + } +} diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml b/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml new file mode 100644 index 0000000000..9bf66d7795 --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml @@ -0,0 +1,7 @@ + + + jaxrs-2.1 + cdi-2.0 + + + diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml b/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000..4f0b3cdeeb --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..b4b8121fdd --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,11 @@ + + + Hello Servlet + + + index.html + + + diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html new file mode 100644 index 0000000000..9015a7a32c --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html @@ -0,0 +1 @@ +index diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html new file mode 100644 index 0000000000..5a46e2a5d3 --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html @@ -0,0 +1,38 @@ + + + + Server-Sent Event Broadcasting + + +

Stock prices :

+
+
    +
+
+ + + \ No newline at end of file diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html new file mode 100644 index 0000000000..8fddae4717 --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html @@ -0,0 +1,38 @@ + + + + Server-Sent Event + + +

Stock prices :

+
+
    +
+
+ + + \ No newline at end of file From 0f1e1a49d922b9a3927e70cfe7ca8023d810e7ec Mon Sep 17 00:00:00 2001 From: Neeraj Yadav Date: Wed, 1 Aug 2018 03:28:48 +0530 Subject: [PATCH 087/298] BAEL-1936 Use of FilenameFilter (#4520) * Added tests for FilenameFilter demo -added a test to show FilenameFilter implementation -added another test to show similar functionality using Predicate * refactored code to get directory at a single location * fixing formatting * changed test class name to conform to custom rule UnitTestNamingConventionRule lists the allowed test class names. Added ManualTest at the end to conform to the rule. --- .../file/FilenameFilterManualTest.java | 48 +++++++++++++++++++ .../src/test/resources/testFolder/people.json | 1 + .../test/resources/testFolder/students.json | 1 + .../test/resources/testFolder/teachers.xml | 1 + .../src/test/resources/testFolder/workers.xml | 1 + 5 files changed, 52 insertions(+) create mode 100644 core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java create mode 100644 core-java-io/src/test/resources/testFolder/people.json create mode 100644 core-java-io/src/test/resources/testFolder/students.json create mode 100644 core-java-io/src/test/resources/testFolder/teachers.xml create mode 100644 core-java-io/src/test/resources/testFolder/workers.xml diff --git a/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java new file mode 100644 index 0000000000..47a7973b34 --- /dev/null +++ b/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java @@ -0,0 +1,48 @@ +package com.baeldung.file; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class FilenameFilterManualTest { + + private static File directory; + + @BeforeClass + public static void setupClass() { + directory = new File(FilenameFilterManualTest.class.getClassLoader() + .getResource("testFolder") + .getFile()); + } + + @Test + public void whenFilteringFilesEndingWithJson_thenEqualExpectedFiles() { + FilenameFilter filter = (dir, name) -> name.endsWith(".json"); + + String[] expectedFiles = { "people.json", "students.json" }; + String[] actualFiles = directory.list(filter); + + Assert.assertArrayEquals(expectedFiles, actualFiles); + } + + @Test + public void whenFilteringFilesEndingWithXml_thenEqualExpectedFiles() { + Predicate predicate = (name) -> name.endsWith(".xml"); + + String[] expectedFiles = { "teachers.xml", "workers.xml" }; + List files = Arrays.stream(directory.list()) + .filter(predicate) + .collect(Collectors.toList()); + String[] actualFiles = files.toArray(new String[files.size()]); + + Assert.assertArrayEquals(expectedFiles, actualFiles); + } + +} diff --git a/core-java-io/src/test/resources/testFolder/people.json b/core-java-io/src/test/resources/testFolder/people.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/core-java-io/src/test/resources/testFolder/people.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/core-java-io/src/test/resources/testFolder/students.json b/core-java-io/src/test/resources/testFolder/students.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/core-java-io/src/test/resources/testFolder/students.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/core-java-io/src/test/resources/testFolder/teachers.xml b/core-java-io/src/test/resources/testFolder/teachers.xml new file mode 100644 index 0000000000..19b16cc72c --- /dev/null +++ b/core-java-io/src/test/resources/testFolder/teachers.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/core-java-io/src/test/resources/testFolder/workers.xml b/core-java-io/src/test/resources/testFolder/workers.xml new file mode 100644 index 0000000000..19b16cc72c --- /dev/null +++ b/core-java-io/src/test/resources/testFolder/workers.xml @@ -0,0 +1 @@ + \ No newline at end of file From e53159452383b4d2538ecb5be80f17b40a25f32b Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 1 Aug 2018 07:29:19 +0300 Subject: [PATCH 088/298] add new module --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 20ad5160d9..ee7a5a43d2 100644 --- a/pom.xml +++ b/pom.xml @@ -368,6 +368,7 @@ jws libraries libraries-data + libraries-server linkrest logging-modules/log-mdc logging-modules/log4j From cdf7aef433fd0232d1ef9a8536bebe6e6c23f6bd Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 1 Aug 2018 07:31:11 +0300 Subject: [PATCH 089/298] add new module --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 20ad5160d9..ee7a5a43d2 100644 --- a/pom.xml +++ b/pom.xml @@ -368,6 +368,7 @@ jws libraries libraries-data + libraries-server linkrest logging-modules/log-mdc logging-modules/log4j From a8288f98a7bcf14313e9ffe4110b687ebf23b144 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Wed, 1 Aug 2018 07:27:32 +0200 Subject: [PATCH 090/298] Update pom.xml (#4843) --- core-java-collections/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core-java-collections/pom.xml b/core-java-collections/pom.xml index ff06714bfe..1290419a6a 100644 --- a/core-java-collections/pom.xml +++ b/core-java-collections/pom.xml @@ -36,11 +36,6 @@ commons-lang3 ${commons-lang3.version} - - org.eclipse.collections - eclipse-collections-api - ${eclipse.collections.version} - org.eclipse.collections eclipse-collections From 72d592c8d174cf14df49c1115d554a0d3263cdbf Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Wed, 1 Aug 2018 10:12:20 +0400 Subject: [PATCH 091/298] Revert "A simple Real Time streaming example with Spring Webflux." This reverts commit b7d4a00dacdcddc877e1726832c4aeec378b6ed8. --- .../pom.xml | 70 ----------------- .../java/com/springwebflux/sample/Client.java | 29 ------- .../src/main/resources/application.properties | 1 - springflux-5-reactive-ranjeetkaur/pom.xml | 76 ------------------- .../springwebflux/controller/Controller.java | 28 ------- .../com/springwebflux/sample/Application.java | 17 ----- .../src/main/resources/application.properties | 1 - .../sample/ApplicationTests.java | 36 --------- 8 files changed, 258 deletions(-) delete mode 100644 springflux-5-reactive-client-ranjeetkaur/pom.xml delete mode 100644 springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java delete mode 100644 springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties delete mode 100644 springflux-5-reactive-ranjeetkaur/pom.xml delete mode 100644 springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java delete mode 100644 springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java delete mode 100644 springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties delete mode 100644 springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java diff --git a/springflux-5-reactive-client-ranjeetkaur/pom.xml b/springflux-5-reactive-client-ranjeetkaur/pom.xml deleted file mode 100644 index bb832ae055..0000000000 --- a/springflux-5-reactive-client-ranjeetkaur/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - 4.0.0 - - com.springboot - sample - 0.0.1-SNAPSHOT - jar - - client - SpringFlux Sample Client - - - org.springframework.boot - spring-boot-starter-parent - 2.0.3.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-webflux - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - --spring.profiles.active=dev - - - - - - - - - spring-releases - https://repo.spring.io/libs-release - - - - - spring-releases - https://repo.spring.io/libs-release - - - - diff --git a/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java b/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java deleted file mode 100644 index 5846969803..0000000000 --- a/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.springwebflux.sample; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.web.reactive.function.client.WebClient; - -/** - * @author ranjeetkaur - * - */ -@SpringBootApplication(scanBasePackages = "com.springwebflux.*") -@EnableAsync -public class Client { - - public static void main(String[] args) throws InterruptedException { - - WebClient webClient = WebClient.builder() - .baseUrl("http://localhost:8090") - .build(); - - webClient.get() - .uri("/v1/dice") - .retrieve() - .bodyToFlux(Integer.class) - .log(); - - Thread.sleep(10000); - } -} \ No newline at end of file diff --git a/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties b/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties deleted file mode 100644 index f667a68bc2..0000000000 --- a/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -server.port =8091 \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/pom.xml b/springflux-5-reactive-ranjeetkaur/pom.xml deleted file mode 100644 index 3fe4156360..0000000000 --- a/springflux-5-reactive-ranjeetkaur/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - 4.0.0 - - com.springboot - sample - 0.0.1-SNAPSHOT - jar - - webflux-server - SpringFlux Sample Server - - - org.springframework.boot - spring-boot-starter-parent - 2.0.3.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-webflux - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - --spring.profiles.active=dev - - - - - - - - - spring-releases - https://repo.spring.io/libs-release - - - - - spring-releases - https://repo.spring.io/libs-release - - - - diff --git a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java deleted file mode 100644 index fa3070640e..0000000000 --- a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.springwebflux.controller; - -import java.time.Duration; -import java.util.Random; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import reactor.core.publisher.Flux; - -/** - * @author ranjeetkaur - * - */ -@RestController -@RequestMapping(value = "/v1") -public class Controller { - - private static Random random = new Random(); - - @GetMapping("/dice") - public Flux rollDice() { - return Flux.interval(Duration.ofSeconds(1)) - .map(pulse -> random.nextInt(5) + 1); - } - -} diff --git a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java deleted file mode 100644 index 1641885f41..0000000000 --- a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.springwebflux.sample; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * @author ranjeetkaur - * - */ -@SpringBootApplication(scanBasePackages = "com.springwebflux.*") -public class Application { - - public static void main(String[] args) { - - SpringApplication.run(Application.class, args); - } -} \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties b/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties deleted file mode 100644 index 91f7491179..0000000000 --- a/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -server.port = 8090 \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java b/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java deleted file mode 100644 index ce09d9ae37..0000000000 --- a/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.springwebflux.sample; - -import java.time.Duration; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.reactive.server.WebTestClient; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class ApplicationTests { - - @Autowired - private WebTestClient webTestClient; - - @Before - private void setUp() { - webTestClient = webTestClient.mutate() - .responseTimeout(Duration.ofMillis(10000)) - .build(); - } - - @Test - public void rollDice() throws InterruptedException { - webTestClient.get() - .uri("/v1/dice") - .exchange() - .expectStatus() - .isOk() - .expectBodyList(Integer.class); - } -} \ No newline at end of file From c765acd1da77ed6c2460de47910e2c948af11dc8 Mon Sep 17 00:00:00 2001 From: Pello Altadill Date: Wed, 1 Aug 2018 11:58:35 +0200 Subject: [PATCH 092/298] BAEL-1861 - Running JUnit tests from a Java application (#4526) * BAEL-1562 - Thymeleaf sample working * BAEL-1562 Code added for Fragments sample * BAEL-1562 - Last correction for the test * BAEL-1562 - Thymeleaf sample working * BAEL-1562 Code added for Fragments sample * BAEL-1562 - Last correction for the test * Updates Thymeleaf version to 3.0.9.RELEASE * Added msf4j projects * updated msf4j project folder * fixed issue with spring-thymeleaf/pom.xml * Removed depedency-reduced-pom.xml * Whitespacing fix * Strange git issue with README.MD, wouldn't revert the file * Added jupiter api * Corrected junit test * Added test engine to plugin * Removed extra tag * Little fixes to junit4 and junit4 run from java * Removed scope from pom.xml * Removed bin file from testing * Slight changes for PMD * Slight changes for PMD * ok, moved code to another folder * Renamed and fixed runjunitfromjava * moved test classes to test folder * moved main to src/java * BAEL-1861 Moved test running classes to src/test/java * Added changes to runjunitfromjava * Added changes to runjunitfromjava * BAEL-1861 Changed test execution code examples * BAEL-1861 Changed test execution code examples; formatting --- testing-modules/runjunitfromjava/pom.xml | 54 +++++++++++ .../junit/runfromjava/listnode/ListNode.java | 41 ++++++++ .../runfromjava/listnode/MergeLists.java | 22 +++++ .../listnode/RemovedNthElement.java | 26 ++++++ .../runfromjava/listnode/RotateList.java | 30 ++++++ .../junit/runfromjava/listnode/SwapNodes.java | 33 +++++++ .../junit4/runfromjava/ListNodeUnitTest.java | 32 +++++++ .../runfromjava/MergeListsUnitTest.java | 36 +++++++ .../junit4/runfromjava/MyTestSuite.java | 10 ++ .../RemovedNthElementUnitTest.java | 33 +++++++ .../runfromjava/RotateListUnitTest.java | 32 +++++++ .../junit4/runfromjava/RunJUnit4Tests.java | 93 +++++++++++++++++++ .../junit4/runfromjava/SwapNodesUnitTest.java | 27 ++++++ .../junit5/runfromjava/ListNodeUnitTest.java | 30 ++++++ .../runfromjava/MergeListsUnitTest.java | 38 ++++++++ .../RemovedNthElementUnitTest.java | 33 +++++++ .../runfromjava/RotateListUnitTest.java | 32 +++++++ .../junit5/runfromjava/RunJUnit5Tests.java | 59 ++++++++++++ .../junit5/runfromjava/SwapNodesUnitTest.java | 27 ++++++ 19 files changed, 688 insertions(+) create mode 100644 testing-modules/runjunitfromjava/pom.xml create mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/ListNode.java create mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/MergeLists.java create mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RemovedNthElement.java create mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RotateList.java create mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/SwapNodes.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/ListNodeUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MergeListsUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RemovedNthElementUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RotateListUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SwapNodesUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/ListNodeUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/MergeListsUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RemovedNthElementUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RotateListUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SwapNodesUnitTest.java diff --git a/testing-modules/runjunitfromjava/pom.xml b/testing-modules/runjunitfromjava/pom.xml new file mode 100644 index 0000000000..8ad3e7ed00 --- /dev/null +++ b/testing-modules/runjunitfromjava/pom.xml @@ -0,0 +1,54 @@ + + 4.0.0 + + com.baeldung.junit + applicationtesting + 0.0.1-SNAPSHOT + jar + + applicationtesting + http://maven.apache.org + + + UTF-8 + 1.8 + 5.2.0 + 1.2.0 + 4.12 + 3.7.0 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + + + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-jupiter.version} + + + org.junit.platform + junit-platform-launcher + ${junit-launcher.version} + + + junit + junit + ${junit4.version} + + + + diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/ListNode.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/ListNode.java new file mode 100644 index 0000000000..31cbda15d3 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/ListNode.java @@ -0,0 +1,41 @@ +package com.baeldung.junit.runfromjava.listnode; + +public class ListNode { + private int value; + private ListNode next; + + public ListNode(int v) { + value = v; + } + + public ListNode(int v, ListNode next) { + value = v; + this.next = next; + } + + public int getValue() { + return value; + } + + public ListNode getNext() { + return next; + } + + public void setNext(ListNode next) { + this.next = next; + } + + public String toString() { + String result = ""; + ListNode tmp = this; + + while (tmp.next != null) { + result += tmp.value + "->"; + tmp = tmp.next; + } + + result += tmp.value; + + return result.toString(); + } +} diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/MergeLists.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/MergeLists.java new file mode 100644 index 0000000000..f2a24487c8 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/MergeLists.java @@ -0,0 +1,22 @@ +package com.baeldung.junit.runfromjava.listnode; + +public class MergeLists { + + public ListNode merge(ListNode list1, ListNode list2) { + + if (list1 == null) { + return list2; + } + if (list2 == null) { + return list1; + } + + if (list1.getValue() <= list2.getValue()) { + list1.setNext(merge(list1.getNext(), list2)); + return list1; + } else { + list2.setNext(merge(list2.getNext(), list1)); + return list2; + } + } +} \ No newline at end of file diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RemovedNthElement.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RemovedNthElement.java new file mode 100644 index 0000000000..22357aaeee --- /dev/null +++ b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RemovedNthElement.java @@ -0,0 +1,26 @@ +package com.baeldung.junit.runfromjava.listnode; + +public class RemovedNthElement { + public ListNode removeNthFromEnd(ListNode head, int n) { + + ListNode start = new ListNode(0); + start.setNext(head); + + ListNode fast = start; + ListNode slow = start; + + for (int i = 0; i < n + 1 && fast != null; i++) { + fast = fast.getNext(); + } + + while (fast != null) { + fast = fast.getNext(); + slow = slow.getNext(); + } + + slow.setNext(slow.getNext() + .getNext()); + + return start.getNext(); + } +} diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RotateList.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RotateList.java new file mode 100644 index 0000000000..52167cbacc --- /dev/null +++ b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RotateList.java @@ -0,0 +1,30 @@ +package com.baeldung.junit.runfromjava.listnode; + +public class RotateList { + public ListNode rotateRight(ListNode list, int n) { + + if (list == null || list.getNext() == null) { + return list; + } + + ListNode tmpList = new ListNode(0); + tmpList.setNext(list); + ListNode fast = tmpList; + ListNode slow = tmpList; + + int listLength; + for (listLength = 0; fast.getNext() != null; listLength++) { + fast = fast.getNext(); + } + + for (int j = listLength - n % listLength; j > 0; j--) { + slow = slow.getNext(); + } + + fast.setNext(tmpList.getNext()); + tmpList.setNext(slow.getNext()); + slow.setNext(null); + + return tmpList.getNext(); + } +} diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/SwapNodes.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/SwapNodes.java new file mode 100644 index 0000000000..076fed0d5e --- /dev/null +++ b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/SwapNodes.java @@ -0,0 +1,33 @@ +package com.baeldung.junit.runfromjava.listnode; + +public class SwapNodes { + public ListNode swapPairs(ListNode listHead) { + + ListNode result = new ListNode(0); + result.setNext(listHead); + + ListNode current = result; + + while (current.getNext() != null && current + .getNext() + .getNext() != null) { + + ListNode first = current.getNext(); + ListNode second = current + .getNext() + .getNext(); + + first.setNext(second.getNext()); + current.setNext(second); + current + .getNext() + .setNext(first); + + current = current + .getNext() + .getNext(); + } + + return result.getNext(); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/ListNodeUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/ListNodeUnitTest.java new file mode 100644 index 0000000000..f7571b6c8d --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/ListNodeUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.junit4.runfromjava; + +import org.junit.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; + +import static org.junit.Assert.*; + + +public class ListNodeUnitTest { + + @Test + public void whenListHasOneElement_thenGetExpectedValue() { + ListNode listNode = new ListNode(42); + assertEquals(listNode.getValue(), 42); + } + + @Test + public void whenInitSimpleList_thenGettersGiveExpectedValues() { + ListNode listNode = new ListNode(42, new ListNode(666, null)); + assertEquals(listNode.getValue(), 42); + assertEquals(listNode.getNext() + .getValue(), 666); + } + + @Test + public void whenConvertingListToString_thenGetExpectedValue() { + ListNode listNode = new ListNode(42, new ListNode(666, new ListNode(15, null))); + assertEquals(listNode.toString(), "42->666->15"); + } + +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MergeListsUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MergeListsUnitTest.java new file mode 100644 index 0000000000..3b9b5abd0c --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MergeListsUnitTest.java @@ -0,0 +1,36 @@ +package com.baeldung.junit4.runfromjava; + +import org.junit.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; +import com.baeldung.junit.runfromjava.listnode.MergeLists; + +import static org.junit.Assert.*; +import org.junit.Before; + +public class MergeListsUnitTest { + + private ListNode listNode1; + private ListNode listNode2; + private MergeLists mergeLists; + + @Before + public void setUp() throws Exception { + mergeLists = new MergeLists(); + listNode1 = new ListNode(2, new ListNode(4, new ListNode(6, new ListNode(8, null)))); + listNode2 = new ListNode(1, new ListNode(3, new ListNode(5, new ListNode(7, null)))); + } + + @Test + public void whenMergingNormalLists_thenGetExpectedString() { + assertEquals(mergeLists.merge(listNode1, listNode2) + .toString(), "1->2->3->4->5->6->7->8"); + } + + @Test + public void whenMergingNullLists_thenGetNull() { + listNode1 = null; + listNode2 = null; + assertNull(mergeLists.merge(listNode1, listNode2)); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java new file mode 100644 index 0000000000..c743491a48 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java @@ -0,0 +1,10 @@ +package com.baeldung.junit4.runfromjava; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ ListNodeUnitTest.class, MergeListsUnitTest.class }) +public class MyTestSuite { + +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RemovedNthElementUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RemovedNthElementUnitTest.java new file mode 100644 index 0000000000..e237dc7b90 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RemovedNthElementUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.junit4.runfromjava; + +import org.junit.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; +import com.baeldung.junit.runfromjava.listnode.RemovedNthElement; + +import static org.junit.Assert.*; +import org.junit.Before; + +public class RemovedNthElementUnitTest { + + private ListNode listNode; + private RemovedNthElement removedNthElement; + + @Before + public void setUp() throws Exception { + removedNthElement = new RemovedNthElement(); + listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); + } + + @Test + public void whenRemovingSecondElement_thenReturnExpectedList() { + assertEquals(removedNthElement.removeNthFromEnd(listNode, 2) + .toString(), "42->666->3"); + } + + @Test + public void whenRemovingThirdElement_thenReturnExpectedList() { + assertEquals(removedNthElement.removeNthFromEnd(listNode, 3) + .toString(), "42->15->3"); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RotateListUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RotateListUnitTest.java new file mode 100644 index 0000000000..bbe7f09cbe --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RotateListUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.junit4.runfromjava; + +import org.junit.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; +import com.baeldung.junit.runfromjava.listnode.RotateList; + +import static org.junit.Assert.*; +import org.junit.Before; + +public class RotateListUnitTest { + private RotateList rotateList; + private ListNode listNode; + + @Before + public void setUp() throws Exception { + rotateList = new RotateList(); + listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); + } + + @Test + public void whenRotatingListTwice_thenReturnExpectedList() { + assertEquals(rotateList.rotateRight(listNode, 2) + .toString(), "15->3->42->666"); + } + + @Test + public void whenRotatingListThreeTimes_thenReturnExpectedList() { + assertEquals(rotateList.rotateRight(listNode, 3) + .toString(), "666->15->3->42"); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java new file mode 100644 index 0000000000..cc865a056e --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java @@ -0,0 +1,93 @@ +package com.baeldung.junit4.runfromjava; + +import junit.extensions.ActiveTestSuite; +import junit.extensions.RepeatedTest; +import junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.junit.internal.TextListener; +import org.junit.runner.JUnitCore; +import org.junit.runner.Result; +import org.junit.runner.notification.Failure; + +public class RunJUnit4Tests { + + public static void runOne() { + JUnitCore junit = new JUnitCore(); + junit.addListener(new TextListener(System.out)); + junit.run(MergeListsUnitTest.class); + } + + public static void runAllClasses() { + JUnitCore junit = new JUnitCore(); + junit.addListener(new TextListener(System.out)); + + Result result = junit.run(ListNodeUnitTest.class, MergeListsUnitTest.class, RemovedNthElementUnitTest.class, RotateListUnitTest.class, SwapNodesUnitTest.class); + + for (Failure failure : result.getFailures()) { + System.out.println(failure.toString()); + } + + resultReport(result); + } + + public static void runSuiteOfClasses() { + JUnitCore junit = new JUnitCore(); + junit.addListener(new TextListener(System.out)); + Result result = junit.run(MyTestSuite.class); + + for (Failure failure : result.getFailures()) { + System.out.println(failure.toString()); + } + + resultReport(result); + } + + public static void runRepeated() { + Test test = new JUnit4TestAdapter(MergeListsUnitTest.class); + RepeatedTest repeatedTest = new RepeatedTest(test, 5); + + JUnitCore junit = new JUnitCore(); + junit.addListener(new TextListener(System.out)); + + junit.run(repeatedTest); + } + + public static void runRepeatedSuite() { + TestSuite mySuite = new ActiveTestSuite(); + + JUnitCore junit = new JUnitCore(); + junit.addListener(new TextListener(System.out)); + + mySuite.addTest(new RepeatedTest(new JUnit4TestAdapter(MergeListsUnitTest.class), 5)); + mySuite.addTest(new RepeatedTest(new JUnit4TestAdapter(RemovedNthElementUnitTest.class), 3)); + + junit.run(mySuite); + } + + public static void resultReport(Result result) { + System.out.println("Finished. Result: Failures: " + + result.getFailureCount() + ". Ignored: " + + result.getIgnoreCount() + ". Tests run: " + + result.getRunCount() + ". Time: " + + result.getRunTime() + "ms."); + } + + public static void main(String[] args) { + System.out.println("\nRunning one test class:"); + runOne(); + + System.out.println("\nRunning all test classes:"); + runAllClasses(); + + System.out.println("\nRunning a suite of test classes:"); + runSuiteOfClasses(); + + System.out.println("\nRunning repeated tests:"); + runRepeated(); + + System.out.println("\nRunning repeated suite tests:"); + runRepeatedSuite(); + } + +} \ No newline at end of file diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SwapNodesUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SwapNodesUnitTest.java new file mode 100644 index 0000000000..129f397485 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SwapNodesUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.junit4.runfromjava; + +import org.junit.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; +import com.baeldung.junit.runfromjava.listnode.SwapNodes; + +import static org.junit.Assert.*; +import org.junit.Before; + +public class SwapNodesUnitTest { + private SwapNodes swapNodes; + private ListNode listNode; + + @Before + public void setUp() throws Exception { + swapNodes = new SwapNodes(); + listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); + } + + @Test + public void whenSwappingPairs_thenReturnExpectedList() { + assertEquals(swapNodes.swapPairs(listNode) + .toString(), "666->42->3->15"); + } + +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/ListNodeUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/ListNodeUnitTest.java new file mode 100644 index 0000000000..7b76b114c3 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/ListNodeUnitTest.java @@ -0,0 +1,30 @@ +package com.baeldung.junit5.runfromjava; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; + +class ListNodeUnitTest { + + @Test + void whenListHasOneElement_thenGetExpectedValue() { + ListNode listNode = new ListNode(42); + assertEquals(listNode.getValue(), 42); + } + + @Test + void whenInitSimpleList_thenGettersGiveExpectedValues() { + ListNode listNode = new ListNode(42, new ListNode(666, null)); + assertEquals(listNode.getValue(), 42); + assertEquals(listNode.getNext() + .getValue(), 666); + } + + @Test + void whenConvertingListToString_thenGetExpectedValue() { + ListNode listNode = new ListNode(42, new ListNode(666, new ListNode(15, null))); + assertEquals(listNode.toString(), "42->666->15"); + } + +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/MergeListsUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/MergeListsUnitTest.java new file mode 100644 index 0000000000..89224f840b --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/MergeListsUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.junit5.runfromjava; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.RepeatedTest; +import org.junit.jupiter.api.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; +import com.baeldung.junit.runfromjava.listnode.MergeLists; + +class MergeListsUnitTest { + + private ListNode listNode1; + private ListNode listNode2; + private MergeLists mergeLists; + + @BeforeEach + void setUp() throws Exception { + mergeLists = new MergeLists(); + listNode1 = new ListNode(2, new ListNode(4, new ListNode(6, new ListNode(8, null)))); + listNode2 = new ListNode(1, new ListNode(3, new ListNode(5, new ListNode(7, null)))); + } + + @RepeatedTest(10) + void whenMergingNormalLists_thenGetExpectedString() { + assertEquals(mergeLists + .merge(listNode1, listNode2) + .toString(), "1->2->3->4->5->6->7->8"); + } + + @RepeatedTest(5) + void whenMergingNullLists_thenGetNull() { + listNode1 = null; + listNode2 = null; + assertNull(mergeLists.merge(listNode1, listNode2)); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RemovedNthElementUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RemovedNthElementUnitTest.java new file mode 100644 index 0000000000..d226df1423 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RemovedNthElementUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.junit5.runfromjava; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; +import com.baeldung.junit.runfromjava.listnode.RemovedNthElement; + +class RemovedNthElementUnitTest { + + private ListNode listNode; + private RemovedNthElement removedNthElement; + + @BeforeEach + void setUp() throws Exception { + removedNthElement = new RemovedNthElement(); + listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); + } + + @Test + void whenRemovingSecondElement_thenReturnExpectedList() { + assertEquals(removedNthElement.removeNthFromEnd(listNode, 2) + .toString(), "42->666->3"); + } + + @Test + void whenRemovingThirdElement_thenReturnExpectedList() { + assertEquals(removedNthElement.removeNthFromEnd(listNode, 3) + .toString(), "42->15->3"); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RotateListUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RotateListUnitTest.java new file mode 100644 index 0000000000..687786fcb5 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RotateListUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.junit5.runfromjava; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; +import com.baeldung.junit.runfromjava.listnode.RotateList; + +class RotateListUnitTest { + private RotateList rotateList; + private ListNode listNode; + + @BeforeEach + void setUp() throws Exception { + rotateList = new RotateList(); + listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); + } + + @Test + void whenRotatingListTwice_thenReturnExpectedList() { + assertEquals(rotateList.rotateRight(listNode, 2) + .toString(), "15->3->42->666"); + } + + @Test + void whenRotatingListThreeTimes_thenReturnExpectedList() { + assertEquals(rotateList.rotateRight(listNode, 3) + .toString(), "666->15->3->42"); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java new file mode 100644 index 0000000000..58e7c9ad79 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java @@ -0,0 +1,59 @@ +package com.baeldung.junit5.runfromjava; + +import static org.junit.platform.engine.discovery.ClassNameFilter.includeClassNamePatterns; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage; + +import java.io.PrintWriter; + +import org.junit.platform.launcher.Launcher; +import org.junit.platform.launcher.LauncherDiscoveryRequest; +import org.junit.platform.launcher.TestPlan; +import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; +import org.junit.platform.launcher.core.LauncherFactory; +import org.junit.platform.launcher.listeners.SummaryGeneratingListener; +import org.junit.platform.launcher.listeners.TestExecutionSummary; + +public class RunJUnit5Tests { + SummaryGeneratingListener listener = new SummaryGeneratingListener(); + + public void runOne() { + LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder + .request() + .selectors(selectClass(RotateListUnitTest.class)) + .build(); + Launcher launcher = LauncherFactory.create(); + TestPlan testPlan = launcher.discover(request); + + launcher.registerTestExecutionListeners(listener); + launcher.execute(request); + } + + public void runAll() { + LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder + .request() + .selectors(selectPackage("com.baeldung.junit5.runfromjava")) + .filters(includeClassNamePatterns(".*Test")) + .build(); + Launcher launcher = LauncherFactory.create(); + + TestPlan testPlan = launcher.discover(request); + + launcher.registerTestExecutionListeners(listener); + + launcher.execute(request); + } + + public static void main(String[] args) { + RunJUnit5Tests runner = new RunJUnit5Tests(); + runner.runAll(); + + TestExecutionSummary summary = runner.listener.getSummary(); + summary.printTo(new PrintWriter(System.out)); + + runner.runOne(); + + summary = runner.listener.getSummary(); + summary.printTo(new PrintWriter(System.out)); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SwapNodesUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SwapNodesUnitTest.java new file mode 100644 index 0000000000..73e3ff07fa --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SwapNodesUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.junit5.runfromjava; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.baeldung.junit.runfromjava.listnode.ListNode; +import com.baeldung.junit.runfromjava.listnode.SwapNodes; + +class SwapNodesUnitTest { + private SwapNodes swapNodes; + private ListNode listNode; + + @BeforeEach + void setUp() throws Exception { + swapNodes = new SwapNodes(); + listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); + } + + @Test + void whenSwappingPairs_thenReturnExpectedList() { + assertEquals(swapNodes.swapPairs(listNode) + .toString(), "666->42->3->15"); + } + +} From d1caea7afbe604537c96f958d2ec252f133d5835 Mon Sep 17 00:00:00 2001 From: Kartik Singla Date: Wed, 1 Aug 2018 15:40:43 +0530 Subject: [PATCH 093/298] Bael 1852 - Test case code is aligned to support Junit5 (#4847) * add prototype bean ex with function * remove extra classes * remove extra import * separate configs * separate configs * Update AppConfig.java * Code update to support Junit5 * BAEL-1979 Added examples for SnakeYAML Library (#4802) * BAEL-1979 Added examples for SnakeYAML Library * BAEL-1979 Moved the snakeyaml related code to libraries module * BAEL-1979 Removed the System.out.println() statements and converted the assertTrue to assertEquals wherever possible. * BAEL-1979 Removed println statements, small formatting fix in pom.xml * BAEL-1852 Renamed one test method, fixed formatting --- testing-modules/junit-abstract/pom.xml | 107 +++++++++--------- .../AbstractMethodCallingUnitTest.java | 40 ++++--- .../AbstractIndependentUnitTest.java | 19 ++-- .../AbstractInstanceFieldsUnitTest.java | 26 +++-- .../AbstractPrivateMethodsUnitTest.java | 27 ++--- 5 files changed, 115 insertions(+), 104 deletions(-) diff --git a/testing-modules/junit-abstract/pom.xml b/testing-modules/junit-abstract/pom.xml index c4957fbda4..106ed8e3a4 100644 --- a/testing-modules/junit-abstract/pom.xml +++ b/testing-modules/junit-abstract/pom.xml @@ -1,59 +1,62 @@ - - 4.0.0 + + 4.0.0 - junit-abstract - 1.0-SNAPSHOT - jar + junit-abstract + 1.0-SNAPSHOT + jar - abstractclasses - http://maven.apache.org - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../../ - + abstractclasses + http://maven.apache.org + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + - - UTF-8 - 1.7.0 - 4.12 - 1.10.19 - 1.8 - + + UTF-8 + 1.7.4 + 1.8 + 5.1.0 + 1.1.0 + 5.2.0 + - - - org.mockito - mockito-all - ${mockito.all.version} - test - - - org.powermock - powermock-module-junit4 - ${powermock.version} - test - - - junit - junit - - - + + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + junit + junit + + + + + org.powermock + powermock-api-mockito2 + ${powermock.version} + test + + - - org.powermock - powermock-api-mockito - ${powermock.version} - test - - - - - - junit-abstract - + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.0 + + + junit-abstract + + + diff --git a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java b/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java index 64094710b9..e02915db51 100644 --- a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java +++ b/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java @@ -1,32 +1,38 @@ package org.baeldung.testing.abstractclass.abstractmethod; -import static org.junit.Assert.assertEquals; - -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; public class AbstractMethodCallingUnitTest { + private AbstractMethodCalling cls; + + @BeforeEach + public void setup() { + cls = Mockito.mock(AbstractMethodCalling.class); + } + @Test public void givenDefaultImpl_whenMockAbstractFunc_thenExpectedBehaviour() { - - // mock classes and call real methods available - AbstractMethodCalling cls = Mockito.mock(AbstractMethodCalling.class); - Mockito.doReturn("Abstract") - .when(cls) - .abstractFunc(); - Mockito.doCallRealMethod() - .when(cls) - .defaultImpl(); + Mockito + .when(cls.abstractFunc()) + .thenReturn("Abstract"); + Mockito + .doCallRealMethod() + .when(cls) + .defaultImpl(); // validate result by mock abstractFunc's behaviour - assertEquals("Abstract Default", cls.defaultImpl()); + Assertions.assertEquals("Abstract Default", cls.defaultImpl()); // check the value with null response from abstract method - Mockito.doReturn(null) - .when(cls) - .abstractFunc(); - assertEquals("Default", cls.defaultImpl()); + Mockito + .doReturn(null) + .when(cls) + .abstractFunc(); + Assertions.assertEquals("Default", cls.defaultImpl()); } } diff --git a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java b/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java index ffad6327bd..80e42af756 100644 --- a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java +++ b/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java @@ -3,24 +3,23 @@ */ package org.baeldung.testing.abstractclass.indepedentmethod; -import static org.junit.Assert.assertEquals; - -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; public class AbstractIndependentUnitTest { -@Test -public void givenNonAbstractMethod_whenConcreteImpl_testCorrectBehaviour() { - ConcreteImpl conClass = new ConcreteImpl(); - String actual = conClass.defaultImpl(); + @Test + public void givenNonAbstractMethod_whenConcreteImpl_testCorrectBehaviour() { + ConcreteImpl conClass = new ConcreteImpl(); + String actual = conClass.defaultImpl(); - assertEquals("DEFAULT-1", actual); -} + Assertions.assertEquals("DEFAULT-1", actual); + } @Test public void givenNonAbstractMethod_whenMockitoMock_testCorrectBehaviour() { AbstractIndependent absCls = Mockito.mock(AbstractIndependent.class, Mockito.CALLS_REAL_METHODS); - assertEquals("DEFAULT-1", absCls.defaultImpl()); + Assertions.assertEquals("DEFAULT-1", absCls.defaultImpl()); } } diff --git a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java b/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java index ddaca8a245..ce2577521b 100644 --- a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java +++ b/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java @@ -1,8 +1,7 @@ package org.baeldung.testing.abstractclass.instancefields; -import static org.junit.Assert.assertEquals; - -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.reflect.Whitebox; @@ -10,31 +9,34 @@ import org.powermock.reflect.Whitebox; public class AbstractInstanceFieldsUnitTest { @Test - public void protectedInstanceField_MockClassCountGt5_testNonAbstractMethod() { + public void givenProtectedInstanceField_whenMockClassCountGt5_thenTestNonAbstractMethod() { // mock AbstractInstanceFields instClass = Mockito.mock(AbstractInstanceFields.class); - Mockito.doCallRealMethod() - .when(instClass) - .testFunc(); + Mockito + .doCallRealMethod() + .when(instClass) + .testFunc(); // set counter greater than 5 instClass.count = 7; // compare the result - assertEquals("Overflow", instClass.testFunc()); + Assertions.assertEquals("Overflow", instClass.testFunc()); } @Test public void givenNonAbstractMethodAndPrivateField_whenPowerMockitoAndActiveFieldTrue_thenCorrectBehaviour() { + AbstractInstanceFields instClass = PowerMockito.mock(AbstractInstanceFields.class); - PowerMockito.doCallRealMethod() - .when(instClass) - .testFunc(); + PowerMockito + .doCallRealMethod() + .when(instClass) + .testFunc(); Whitebox.setInternalState(instClass, "active", true); // compare the expected result with actual - assertEquals("Added", instClass.testFunc()); + Assertions.assertEquals("Added", instClass.testFunc()); } } diff --git a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java b/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java index 64f01a3c84..7220d9cc47 100644 --- a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java +++ b/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java @@ -1,13 +1,12 @@ /** - * + * */ package org.baeldung.testing.abstractclass.privatemethod; -import static org.junit.Assert.assertEquals; - import java.time.LocalDateTime; import org.junit.Test; +import org.junit.jupiter.api.Assertions; import org.junit.runner.RunWith; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -15,7 +14,7 @@ import org.powermock.modules.junit4.PowerMockRunner; /** * Providing custom values for private methods using powermock - * + * */ @RunWith(PowerMockRunner.class) @PrepareForTest(AbstractPrivateMethods.class) @@ -24,17 +23,19 @@ public class AbstractPrivateMethodsUnitTest { @Test public void givenNonAbstractMethodAndCallPrivateMethod_whenMockPrivateMethod_thenVerifyBehaviour() throws Exception { AbstractPrivateMethods mockClass = PowerMockito.mock(AbstractPrivateMethods.class); - PowerMockito.doCallRealMethod() - .when(mockClass) - .defaultImpl(); - - String dateTime = LocalDateTime.now() - .toString(); - PowerMockito.doReturn(dateTime) - .when(mockClass, "getCurrentDateTime"); + String dateTime = LocalDateTime + .now() + .toString(); + PowerMockito + .doCallRealMethod() + .when(mockClass) + .defaultImpl(); + PowerMockito + .doReturn(dateTime) + .when(mockClass, "getCurrentDateTime");// .thenReturn(dateTime); String actual = mockClass.defaultImpl(); - assertEquals(dateTime + "DEFAULT-1", actual); + Assertions.assertEquals(dateTime + "DEFAULT-1", actual); } } From 815f655f366054e5837a965c34ebe587282070b6 Mon Sep 17 00:00:00 2001 From: Donato Rimenti Date: Wed, 1 Aug 2018 19:58:08 +0200 Subject: [PATCH 094/298] Bael 1273 Spring RSS Feed View (#4707) * Added example for BAEL-1273 - rss feed with Spring. * Fixed javadoc * Removed useless SpringBootServletInitializer in RSS app's launcher * Explicitely added Spring Boot starting class in pom.xml to prevent errors in package phase. --- spring-mvc-java/pom.xml | 13 +++ .../com/baeldung/rss/RssFeedApplication.java | 23 +++++ .../com/baeldung/rss/RssFeedController.java | 32 ++++++ .../java/com/baeldung/rss/RssFeedView.java | 98 +++++++++++++++++++ .../com/baeldung/rss/RssFeedUnitTest.java | 62 ++++++++++++ 5 files changed, 228 insertions(+) create mode 100644 spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedApplication.java create mode 100644 spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedController.java create mode 100644 spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedView.java create mode 100644 spring-mvc-java/src/test/java/com/baeldung/rss/RssFeedUnitTest.java diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 9c6f9b57a8..068824eba0 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -141,6 +141,13 @@ com.google.code.gson gson + + + + com.rometools + rome + ${rome.version} + @@ -283,7 +290,13 @@ 3.16-beta1 + + 1.10.0 + 2.2.4 + + + com.baeldung.app.Application diff --git a/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedApplication.java b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedApplication.java new file mode 100644 index 0000000000..0f9de840d5 --- /dev/null +++ b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedApplication.java @@ -0,0 +1,23 @@ +package com.baeldung.rss; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * Spring Boot launcher for an application which exposes an RSS Feed. + * + * @author Donato Rimenti + * + */ +@SpringBootApplication +public class RssFeedApplication { + + /** + * Launches a Spring Boot application which exposes an RSS Feed. + * + * @param args null + */ + public static void main(final String[] args) { + SpringApplication.run(RssFeedApplication.class, args); + } +} \ No newline at end of file diff --git a/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedController.java b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedController.java new file mode 100644 index 0000000000..9d4e36dd5f --- /dev/null +++ b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedController.java @@ -0,0 +1,32 @@ +package com.baeldung.rss; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.View; + +/** + * REST Controller which returns an RSS Feed created by {@link RssFeedView}. + * + * @author Donato Rimenti + * + */ +@RestController +public class RssFeedController { + + /** + * View used by this controller. + */ + @Autowired + private RssFeedView view; + + /** + * Returns an RSS Feed created by {@link #view}. + * + * @return an RSS Feed + */ + @GetMapping("/rss") + public View getFeed() { + return view; + } +} diff --git a/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedView.java b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedView.java new file mode 100644 index 0000000000..c9b9c51bec --- /dev/null +++ b/spring-mvc-java/src/main/java/com/baeldung/rss/RssFeedView.java @@ -0,0 +1,98 @@ +package com.baeldung.rss; + +import java.sql.Date; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.view.feed.AbstractRssFeedView; + +import com.rometools.rome.feed.rss.Channel; +import com.rometools.rome.feed.rss.Item; + +/** + * View for a RSS feed. + * + * @author Donato Rimenti + */ +@Component +public class RssFeedView extends AbstractRssFeedView { + + /* + * (non-Javadoc) + * + * @see org.springframework.web.servlet.view.feed.AbstractFeedView# + * buildFeedMetadata(java.util.Map, com.rometools.rome.feed.WireFeed, + * javax.servlet.http.HttpServletRequest) + */ + @Override + protected void buildFeedMetadata(Map model, Channel feed, HttpServletRequest request) { + feed.setTitle("Baeldung RSS Feed"); + feed.setDescription("Learn how to program in Java"); + feed.setLink("http://www.baeldung.com"); + } + + /* + * (non-Javadoc) + * + * @see org.springframework.web.servlet.view.feed.AbstractRssFeedView# + * buildFeedItems(java.util.Map, javax.servlet.http.HttpServletRequest, + * javax.servlet.http.HttpServletResponse) + */ + @Override + protected List buildFeedItems(Map model, HttpServletRequest request, + HttpServletResponse response) { + + // Builds the single entries. + Item entryOne = new Item(); + entryOne.setTitle("JUnit 5 @Test Annotation"); + entryOne.setAuthor("donatohan.rimenti@gmail.com"); + entryOne.setLink("http://www.baeldung.com/junit-5-test-annotation"); + entryOne.setPubDate(Date.from(Instant.parse("2017-12-19T00:00:00Z"))); + + Item entryTwo = new Item(); + entryTwo.setTitle("Creating and Configuring Jetty 9 Server in Java"); + entryTwo.setAuthor("donatohan.rimenti@gmail.com"); + entryTwo.setLink("http://www.baeldung.com/jetty-java-programmatic"); + entryTwo.setPubDate(Date.from(Instant.parse("2018-01-23T00:00:00Z"))); + + Item entryThree = new Item(); + entryThree.setTitle("Flyweight Pattern in Java"); + entryThree.setAuthor("donatohan.rimenti@gmail.com"); + entryThree.setLink("http://www.baeldung.com/java-flyweight"); + entryThree.setPubDate(Date.from(Instant.parse("2018-02-01T00:00:00Z"))); + + Item entryFour = new Item(); + entryFour.setTitle("Multi-Swarm Optimization Algorithm in Java"); + entryFour.setAuthor("donatohan.rimenti@gmail.com"); + entryFour.setLink("http://www.baeldung.com/java-multi-swarm-algorithm"); + entryFour.setPubDate(Date.from(Instant.parse("2018-03-09T00:00:00Z"))); + + Item entryFive = new Item(); + entryFive.setTitle("A Simple Tagging Implementation with MongoDB"); + entryFive.setAuthor("donatohan.rimenti@gmail.com"); + entryFive.setLink("http://www.baeldung.com/mongodb-tagging"); + entryFive.setPubDate(Date.from(Instant.parse("2018-03-27T00:00:00Z"))); + + Item entrySix = new Item(); + entrySix.setTitle("Double-Checked Locking with Singleton"); + entrySix.setAuthor("donatohan.rimenti@gmail.com"); + entrySix.setLink("http://www.baeldung.com/java-singleton-double-checked-locking"); + entrySix.setPubDate(Date.from(Instant.parse("2018-04-23T00:00:00Z"))); + + Item entrySeven = new Item(); + entrySeven.setTitle("Introduction to Dagger 2"); + entrySeven.setAuthor("donatohan.rimenti@gmail.com"); + entrySeven.setLink("http://www.baeldung.com/dagger-2"); + entrySeven.setPubDate(Date.from(Instant.parse("2018-06-30T00:00:00Z"))); + + // Creates the feed. + return Arrays.asList(entryOne, entryTwo, entryThree, entryFour, entryFive, entrySix, entrySeven); + } + +} \ No newline at end of file diff --git a/spring-mvc-java/src/test/java/com/baeldung/rss/RssFeedUnitTest.java b/spring-mvc-java/src/test/java/com/baeldung/rss/RssFeedUnitTest.java new file mode 100644 index 0000000000..f5524c36fe --- /dev/null +++ b/spring-mvc-java/src/test/java/com/baeldung/rss/RssFeedUnitTest.java @@ -0,0 +1,62 @@ +package com.baeldung.rss; + +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +/** + * Test for {@link RssFeedApplication}. + * + * @author Donato Rimenti + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = RssFeedApplication.class) +public class RssFeedUnitTest { + + /** + * Application context. + */ + @Autowired + private WebApplicationContext context; + + /** + * Mock to perform tests on Spring Web Controller. + */ + private MockMvc mvc; + + /** + * Sets the test up. + */ + @Before + public void setup() { + mvc = MockMvcBuilders.webAppContextSetup(context).build(); + } + + /** + * Calls the RSS feed endpoint and checks that the result matches an + * expected one. + * + * @throws Exception + */ + @Test + public void givenRssFeed_whenComparedWithExisting_thenEquals() throws Exception { + // The expected response. + String expectedResult = " Baeldung RSS Feed http://www.baeldung.com Learn how to program in Java JUnit 5 @Test Annotation http://www.baeldung.com/junit-5-test-annotation Tue, 19 Dec 2017 00:00:00 GMT donatohan.rimenti@gmail.com Creating and Configuring Jetty 9 Server in Java http://www.baeldung.com/jetty-java-programmatic Tue, 23 Jan 2018 00:00:00 GMT donatohan.rimenti@gmail.com Flyweight Pattern in Java http://www.baeldung.com/java-flyweight Thu, 01 Feb 2018 00:00:00 GMT donatohan.rimenti@gmail.com Multi-Swarm Optimization Algorithm in Java http://www.baeldung.com/java-multi-swarm-algorithm Fri, 09 Mar 2018 00:00:00 GMT donatohan.rimenti@gmail.com A Simple Tagging Implementation with MongoDB http://www.baeldung.com/mongodb-tagging Tue, 27 Mar 2018 00:00:00 GMT donatohan.rimenti@gmail.com Double-Checked Locking with Singleton http://www.baeldung.com/java-singleton-double-checked-locking Mon, 23 Apr 2018 00:00:00 GMT donatohan.rimenti@gmail.com Introduction to Dagger 2 http://www.baeldung.com/dagger-2 Sat, 30 Jun 2018 00:00:00 GMT donatohan.rimenti@gmail.com "; + + // Performs a post against the RSS feed endpoint and checks that the + // result is equals to the expected one. + mvc.perform(MockMvcRequestBuilders.get("/rss")).andExpect(status().isOk()) + .andExpect(content().xml(expectedResult)); + } + +} From 0b642f91e0d00077f77dfcbe02b62e36c0d16d4b Mon Sep 17 00:00:00 2001 From: DavidLandup Date: Wed, 1 Aug 2018 19:59:16 +0200 Subject: [PATCH 095/298] Adding files for Exception Handling article (#4507) * Adding files for Exception Handling article * Updating files * Test folder * testing renaming * Formatting and Naming Conventions This commit reworks the code for the Intro to Exception Handling article, ensuring that packages and classes are formatted and named according to site standards. --- .../exceptionhandling/Exceptions.java | 212 ++++++++++++++++++ .../exceptionhandling/MyException.java | 5 + .../baeldung/exceptionhandling/Player.java | 12 + .../PlayerLoadException.java | 11 + .../PlayerScoreException.java | 8 + .../exceptionhandling/TimeoutException.java | 8 + .../exceptionhandling/ExceptionsUnitTest.java | 86 +++++++ 7 files changed, 342 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java create mode 100644 core-java/src/main/java/com/baeldung/exceptionhandling/MyException.java create mode 100644 core-java/src/main/java/com/baeldung/exceptionhandling/Player.java create mode 100644 core-java/src/main/java/com/baeldung/exceptionhandling/PlayerLoadException.java create mode 100644 core-java/src/main/java/com/baeldung/exceptionhandling/PlayerScoreException.java create mode 100644 core-java/src/main/java/com/baeldung/exceptionhandling/TimeoutException.java create mode 100644 core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java b/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java new file mode 100644 index 0000000000..eb8b733f82 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java @@ -0,0 +1,212 @@ +package com.baeldung.exceptionhandling; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.Scanner; +import java.util.logging.Logger; +import java.util.stream.Collectors; + +public class Exceptions { + + private final static Logger logger = Logger.getLogger("ExceptionLogging"); + + public static List getPlayers() throws IOException { + Path path = Paths.get("players.dat"); + List players = Files.readAllLines(path); + + return players.stream() + .map(Player::new) + .collect(Collectors.toList()); + } + + public List loadAllPlayers(String playersFile) throws IOException{ + try { + throw new IOException(); + } catch(IOException ex) { + throw new IllegalStateException(); + } + } + + public int getPlayerScoreThrows(String playerFile) throws FileNotFoundException { + Scanner contents = new Scanner(new File(playerFile)); + return Integer.parseInt(contents.nextLine()); + } + + public int getPlayerScoreTryCatch(String playerFile) { + try { + Scanner contents = new Scanner(new File(playerFile)); + return Integer.parseInt(contents.nextLine()); + } catch (FileNotFoundException noFile) { + throw new IllegalArgumentException("File not found"); + } + } + + public int getPlayerScoreTryCatchRecovery(String playerFile) { + try { + Scanner contents = new Scanner(new File(playerFile)); + return Integer.parseInt(contents.nextLine()); + } catch ( FileNotFoundException noFile ) { + logger.warning("File not found, resetting score."); + return 0; + } + } + + public int getPlayerScoreFinally(String playerFile) throws FileNotFoundException { + Scanner contents = null; + try { + contents = new Scanner(new File(playerFile)); + return Integer.parseInt(contents.nextLine()); + } finally { + if (contents != null) { + contents.close(); + } + } + } + + public int getPlayerScoreTryWithResources(String playerFile) { + try (Scanner contents = new Scanner(new File(playerFile))) { + return Integer.parseInt(contents.nextLine()); + } catch (FileNotFoundException e ) { + logger.warning("File not found, resetting score."); + return 0; + } + } + + public int getPlayerScoreMultipleCatchBlocks(String playerFile) { + try (Scanner contents = new Scanner(new File(playerFile))) { + return Integer.parseInt(contents.nextLine()); + } catch (IOException e) { + logger.warning("Player file wouldn't load!"); + return 0; + } catch (NumberFormatException e) { + logger.warning("Player file was corrupted!"); + return 0; + } + } + + public int getPlayerScoreMultipleCatchBlocksAlternative(String playerFile) { + try (Scanner contents = new Scanner(new File(playerFile)) ) { + return Integer.parseInt(contents.nextLine()); + } catch (FileNotFoundException e) { + logger.warning("Player file not found!"); + return 0; + } catch (IOException e) { + logger.warning("Player file wouldn't load!"); + return 0; + } catch (NumberFormatException e) { + logger.warning("Player file was corrupted!"); + return 0; + } + } + + public int getPlayerScoreUnionCatchBlocks(String playerFile) { + try (Scanner contents = new Scanner(new File(playerFile))) { + return Integer.parseInt(contents.nextLine()); + } catch (IOException | NumberFormatException e) { + logger.warning("Failed to load score!"); + return 0; + } + } + + public List loadAllPlayersThrowingChecked(String playersFile) throws TimeoutException { + boolean tooLong = true; + + while (!tooLong) { + // ... potentially long operation + } + throw new TimeoutException("This operation took too long"); + } + + public List loadAllPlayersThrowingUnchecked(String playersFile) throws TimeoutException { + if(!isFilenameValid(playersFile)) { + throw new IllegalArgumentException("Filename isn't valid!"); + } + return null; + + // ... + } + + public List loadAllPlayersWrapping(String playersFile) throws IOException { + try { + throw new IOException(); + } catch (IOException io) { + throw io; + } + } + + public List loadAllPlayersRethrowing(String playersFile) throws PlayerLoadException { + try { + throw new IOException(); + } catch (IOException io) { + throw new PlayerLoadException(io); + } + } + + public List loadAllPlayersThrowable(String playersFile) { + try { + throw new NullPointerException(); + } catch ( Throwable t ) { + throw t; + } + } + + class FewerExceptions extends Exceptions { + @Override + public List loadAllPlayers(String playersFile) { //can't add "throws MyCheckedException + return null; + // overridden + } + } + + public void throwAsGotoAntiPattern() { + try { + // bunch of code + throw new MyException(); + // second bunch of code + } catch ( MyException e ) { + // third bunch of code + } + } + + public int getPlayerScoreSwallowingExceptionAntiPattern(String playerFile) { + try { + // ... + } catch (Exception e) {} // <== catch and swallow + return 0; + } + + public int getPlayerScoreSwallowingExceptionAntiPatternAlternative(String playerFile) { + try { + // ... + } catch (Exception e) { + e.printStackTrace(); + } + return 0; + } + + public int getPlayerScoreSwallowingExceptionAntiPatternAlternative2(String playerFile) throws PlayerScoreException { + try { + throw new IOException(); + } catch (IOException e) { + throw new PlayerScoreException(e); + } + } + + public int getPlayerScoreReturnInFinallyAntiPattern(String playerFile) { + int score = 0; + try { + throw new IOException(); + } finally { + return score; // <== the IOException is dropped + } + } + + private boolean isFilenameValid(String name) { + return false; + } +} diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/MyException.java b/core-java/src/main/java/com/baeldung/exceptionhandling/MyException.java new file mode 100644 index 0000000000..5a50acc4de --- /dev/null +++ b/core-java/src/main/java/com/baeldung/exceptionhandling/MyException.java @@ -0,0 +1,5 @@ +package com.baeldung.exceptionhandling; + +public class MyException extends Throwable { + +} diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/Player.java b/core-java/src/main/java/com/baeldung/exceptionhandling/Player.java new file mode 100644 index 0000000000..4efd37134f --- /dev/null +++ b/core-java/src/main/java/com/baeldung/exceptionhandling/Player.java @@ -0,0 +1,12 @@ +package com.baeldung.exceptionhandling; + +public class Player { + + public int id; + public String name; + + public Player(String name) { + this.name = name; + } + +} diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/PlayerLoadException.java b/core-java/src/main/java/com/baeldung/exceptionhandling/PlayerLoadException.java new file mode 100644 index 0000000000..5302fd8e7d --- /dev/null +++ b/core-java/src/main/java/com/baeldung/exceptionhandling/PlayerLoadException.java @@ -0,0 +1,11 @@ +package com.baeldung.exceptionhandling; + +import java.io.IOException; + +public class PlayerLoadException extends Exception { + + public PlayerLoadException(IOException io) { + super(io); + } + +} diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/PlayerScoreException.java b/core-java/src/main/java/com/baeldung/exceptionhandling/PlayerScoreException.java new file mode 100644 index 0000000000..d11159217e --- /dev/null +++ b/core-java/src/main/java/com/baeldung/exceptionhandling/PlayerScoreException.java @@ -0,0 +1,8 @@ +package com.baeldung.exceptionhandling; + +public class PlayerScoreException extends Exception { + + public PlayerScoreException(Exception e) { + super(e); + } +} diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/TimeoutException.java b/core-java/src/main/java/com/baeldung/exceptionhandling/TimeoutException.java new file mode 100644 index 0000000000..294ad542d3 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/exceptionhandling/TimeoutException.java @@ -0,0 +1,8 @@ +package com.baeldung.exceptionhandling; + +public class TimeoutException extends Exception { + + public TimeoutException(String message) { + super(message); + } +} diff --git a/core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java b/core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java new file mode 100644 index 0000000000..1e86132116 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java @@ -0,0 +1,86 @@ +package com.baeldung.exceptionhandling; + +import org.junit.Test; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.NoSuchFileException; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +public class ExceptionsUnitTest { + + Exceptions exceptions = new Exceptions(); + + @Test + public void getPlayers() { + assertThatThrownBy(() -> exceptions.getPlayers()) + .isInstanceOf(NoSuchFileException.class); + } + + @Test + public void loadAllPlayers() { + assertThatThrownBy(() -> exceptions.loadAllPlayers("")) + .isInstanceOf(IOException.class); + } + + @Test + public void getPlayerScoreThrows() { + assertThatThrownBy(() -> exceptions.getPlayerScoreThrows("")) + .isInstanceOf(FileNotFoundException.class); + } + + @Test + public void getPlayerScoreTryCatch() { + assertThatThrownBy(() -> exceptions.getPlayerScoreTryCatch("")) + .isInstanceOf(IllegalArgumentException.class); + } + + @Test + public void getPlayerScoreFinally() { + assertThatThrownBy(() -> exceptions.getPlayerScoreFinally("")) + .isInstanceOf(FileNotFoundException.class); + } + + @Test + public void loadAllPlayersThrowingChecked() { + assertThatThrownBy(() -> exceptions.loadAllPlayersThrowingChecked("")) + .isInstanceOf(TimeoutException.class); + } + + @Test + public void loadAllPlayersThrowingUnchecked() { + assertThatThrownBy(() -> exceptions.loadAllPlayersThrowingUnchecked("")) + .isInstanceOf(IllegalArgumentException.class); + } + + @Test + public void loadAllPlayersWrapping() { + assertThatThrownBy(() -> exceptions.loadAllPlayersWrapping("")) + .isInstanceOf(IOException.class); + } + + @Test + public void loadAllPlayersRethrowing() { + assertThatThrownBy(() -> exceptions.loadAllPlayersRethrowing("")) + .isInstanceOf(PlayerLoadException.class); + } + + @Test + public void loadAllPlayersThrowable() { + assertThatThrownBy(() -> exceptions.loadAllPlayersThrowable("")) + .isInstanceOf(NullPointerException.class); + } + + @Test + public void throwAsGotoAntiPattern() { + assertThatThrownBy(() -> exceptions.throwAsGotoAntiPattern()) + .isInstanceOf(MyException.class); + } + + @Test + public void getPlayerScoreSwallowingExceptionAntiPatternAlternative2() { + assertThatThrownBy(() -> exceptions.getPlayerScoreSwallowingExceptionAntiPatternAlternative2("")) + .isInstanceOf(PlayerScoreException.class); + } +} From f69c26518512b7b0ee13136eed1a55f56f645199 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Wed, 1 Aug 2018 22:10:58 +0200 Subject: [PATCH 096/298] Update SseEmitterController.java (#4864) --- .../src/main/java/com/baeldung/web/SseEmitterController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-5-mvc/src/main/java/com/baeldung/web/SseEmitterController.java b/spring-5-mvc/src/main/java/com/baeldung/web/SseEmitterController.java index 944aec2559..b11c93fb08 100644 --- a/spring-5-mvc/src/main/java/com/baeldung/web/SseEmitterController.java +++ b/spring-5-mvc/src/main/java/com/baeldung/web/SseEmitterController.java @@ -10,7 +10,7 @@ import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; @Controller public class SseEmitterController { - private ExecutorService nonBlockingService = Executors.newSingleThreadExecutor(); + private ExecutorService nonBlockingService = Executors.newCachedThreadPool(); @GetMapping(Constants.API_SSE) public SseEmitter handleSse() { @@ -29,4 +29,4 @@ public class SseEmitterController { return emitter; } -} \ No newline at end of file +} From 6a53e33a0c19750113d46714aefea8ae9ffba8c1 Mon Sep 17 00:00:00 2001 From: fanatixan Date: Thu, 2 Aug 2018 07:23:14 +0200 Subject: [PATCH 097/298] fixing package hierarchy (*.list.list.listoflist -> *.list.listoflist) (#4879) --- .../main/java/com/baeldung/list/{list => }/listoflist/Pen.java | 0 .../main/java/com/baeldung/list/{list => }/listoflist/Pencil.java | 0 .../main/java/com/baeldung/list/{list => }/listoflist/Rubber.java | 0 .../java/com/baeldung/list/{list => }/listoflist/Stationery.java | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename core-java-collections/src/main/java/com/baeldung/list/{list => }/listoflist/Pen.java (100%) rename core-java-collections/src/main/java/com/baeldung/list/{list => }/listoflist/Pencil.java (100%) rename core-java-collections/src/main/java/com/baeldung/list/{list => }/listoflist/Rubber.java (100%) rename core-java-collections/src/main/java/com/baeldung/list/{list => }/listoflist/Stationery.java (100%) diff --git a/core-java-collections/src/main/java/com/baeldung/list/list/listoflist/Pen.java b/core-java-collections/src/main/java/com/baeldung/list/listoflist/Pen.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/list/listoflist/Pen.java rename to core-java-collections/src/main/java/com/baeldung/list/listoflist/Pen.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/list/listoflist/Pencil.java b/core-java-collections/src/main/java/com/baeldung/list/listoflist/Pencil.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/list/listoflist/Pencil.java rename to core-java-collections/src/main/java/com/baeldung/list/listoflist/Pencil.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/list/listoflist/Rubber.java b/core-java-collections/src/main/java/com/baeldung/list/listoflist/Rubber.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/list/listoflist/Rubber.java rename to core-java-collections/src/main/java/com/baeldung/list/listoflist/Rubber.java diff --git a/core-java-collections/src/main/java/com/baeldung/list/list/listoflist/Stationery.java b/core-java-collections/src/main/java/com/baeldung/list/listoflist/Stationery.java similarity index 100% rename from core-java-collections/src/main/java/com/baeldung/list/list/listoflist/Stationery.java rename to core-java-collections/src/main/java/com/baeldung/list/listoflist/Stationery.java From cc4ab484ccd0514aa3426ac3566f27fde945fbe5 Mon Sep 17 00:00:00 2001 From: fanatixan Date: Thu, 2 Aug 2018 08:59:55 +0200 Subject: [PATCH 098/298] moved examples for 'removing all occurrences of an element from a list' to core-java-collections (#4878) --- .../com/baeldung/list/RemoveAllUnitTest.java | 208 ----------------- .../baeldung/list/removeall}/RemoveAll.java | 2 +- .../list/removeall/RemoveAllUnitTest.java | 210 ++++++++++++++++++ 3 files changed, 211 insertions(+), 209 deletions(-) delete mode 100644 core-java-8/src/test/java/com/baeldung/list/RemoveAllUnitTest.java rename {core-java-8/src/main/java/com/baeldung/list => core-java-collections/src/main/java/com/baeldung/list/removeall}/RemoveAll.java (98%) create mode 100644 core-java-collections/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/list/RemoveAllUnitTest.java b/core-java-8/src/test/java/com/baeldung/list/RemoveAllUnitTest.java deleted file mode 100644 index 7ada66a49e..0000000000 --- a/core-java-8/src/test/java/com/baeldung/list/RemoveAllUnitTest.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.baeldung.list; - -import static com.baeldung.list.RemoveAll.removeWithCallingRemoveUntilModifies; -import static com.baeldung.list.RemoveAll.removeWithCollectingAndReturningRemainingElements; -import static com.baeldung.list.RemoveAll.removeWithCollectingRemainingElementsAndAddingToOriginalList; -import static com.baeldung.list.RemoveAll.removeWithForEachLoop; -import static com.baeldung.list.RemoveAll.removeWithForLoopDecrementOnRemove; -import static com.baeldung.list.RemoveAll.removeWithForLoopIncrementIfRemains; -import static com.baeldung.list.RemoveAll.removeWithIterator; -import static com.baeldung.list.RemoveAll.removeWithRemoveIf; -import static com.baeldung.list.RemoveAll.removeWithStandardForLoopUsingIndex; -import static com.baeldung.list.RemoveAll.removeWithStreamFilter; -import static com.baeldung.list.RemoveAll.*; - -import static org.assertj.core.api.Assertions.*; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.ConcurrentModificationException; -import java.util.List; - -import org.junit.Test; - -public class RemoveAllUnitTest { - - private List list(Integer... elements) { - return new ArrayList<>(Arrays.asList(elements)); - } - - @Test - public void givenAList_whenRemovingElementsWithWhileLoopUsingPrimitiveElement_thenTheResultCorrect() { - // given - List list = list(1, 2, 3); - int valueToRemove = 1; - - // when - assertThatThrownBy(() -> removeWithWhileLoopPrimitiveElement(list, valueToRemove)) - .isInstanceOf(IndexOutOfBoundsException.class); - } - - @Test - public void givenAList_whenRemovingElementsWithWhileLoopUsingNonPrimitiveElement_thenTheResultCorrect() { - // given - List list = list(1, 2, 3); - int valueToRemove = 1; - - // when - removeWithWhileLoopNonPrimitiveElement(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(2, 3)); - } - - @Test - public void givenAList_whenRemovingElementsWithWhileLoopStoringFirstOccurrenceIndex_thenTheResultCorrect() { - // given - List list = list(1, 2, 3); - int valueToRemove = 1; - - // when - removeWithWhileLoopStoringFirstOccurrenceIndex(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(2, 3)); - } - - @Test - public void givenAList_whenRemovingElementsWithCallingRemoveUntilModifies_thenTheResultIsCorrect() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - removeWithCallingRemoveUntilModifies(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(2, 3)); - } - - @Test - public void givenAListWithoutDuplication_whenRemovingElementsWithStandardForLoopUsingIndex_thenTheResultIsCorrect() { - // given - List list = list(1, 2, 3); - int valueToRemove = 1; - - // when - removeWithStandardForLoopUsingIndex(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(2, 3)); - } - - @Test - public void givenAListWithAdjacentElements_whenRemovingElementsWithStandardForLoop_thenTheResultIsInCorrect() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - removeWithStandardForLoopUsingIndex(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(1, 2, 3)); - } - - @Test - public void givenAListWithAdjacentElements_whenRemovingElementsWithForLoopAndDecrementOnRemove_thenTheResultIsCorrect() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - removeWithForLoopDecrementOnRemove(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(2, 3)); - } - - @Test - public void givenAListWithAdjacentElements_whenRemovingElementsWithForLoopAndIncrementIfRemains_thenTheResultIsCorrect() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - removeWithForLoopIncrementIfRemains(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(2, 3)); - } - - @Test - public void givenAList_whenRemovingElementsWithForEachLoop_thenExceptionIsThrown() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - assertThatThrownBy(() -> removeWithForEachLoop(list, valueToRemove)) - .isInstanceOf(ConcurrentModificationException.class); - } - - @Test - public void givenAList_whenRemovingElementsWithIterator_thenTheResultIsCorrect() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - removeWithIterator(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(2, 3)); - } - - @Test - public void givenAList_whenRemovingElementsWithCollectingAndReturningRemainingElements_thenTheResultIsCorrect() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - List result = removeWithCollectingAndReturningRemainingElements(list, valueToRemove); - - // then - assertThat(result).isEqualTo(list(2, 3)); - } - - @Test - public void givenAList_whenRemovingElementsWithCollectingRemainingAndAddingToOriginalList_thenTheResultIsCorrect() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - removeWithCollectingRemainingElementsAndAddingToOriginalList(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(2, 3)); - } - - @Test - public void givenAList_whenRemovingElementsWithStreamFilter_thenTheResultIsCorrect() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - List result = removeWithStreamFilter(list, valueToRemove); - - // then - assertThat(result).isEqualTo(list(2, 3)); - } - - @Test - public void givenAList_whenRemovingElementsWithCallingRemoveIf_thenTheResultIsCorrect() { - // given - List list = list(1, 1, 2, 3); - int valueToRemove = 1; - - // when - removeWithRemoveIf(list, valueToRemove); - - // then - assertThat(list).isEqualTo(list(2, 3)); - } - -} diff --git a/core-java-8/src/main/java/com/baeldung/list/RemoveAll.java b/core-java-collections/src/main/java/com/baeldung/list/removeall/RemoveAll.java similarity index 98% rename from core-java-8/src/main/java/com/baeldung/list/RemoveAll.java rename to core-java-collections/src/main/java/com/baeldung/list/removeall/RemoveAll.java index 0dd97af6e8..d5f9cf4b4e 100644 --- a/core-java-8/src/main/java/com/baeldung/list/RemoveAll.java +++ b/core-java-collections/src/main/java/com/baeldung/list/removeall/RemoveAll.java @@ -1,4 +1,4 @@ -package com.baeldung.list; +package com.baeldung.list.removeall; import java.util.ArrayList; import java.util.Iterator; diff --git a/core-java-collections/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java b/core-java-collections/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java new file mode 100644 index 0000000000..c23121053b --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/list/removeall/RemoveAllUnitTest.java @@ -0,0 +1,210 @@ +package com.baeldung.list.removeall; + +import static com.baeldung.list.removeall.RemoveAll.removeWithCallingRemoveUntilModifies; +import static com.baeldung.list.removeall.RemoveAll.removeWithCollectingAndReturningRemainingElements; +import static com.baeldung.list.removeall.RemoveAll.removeWithCollectingRemainingElementsAndAddingToOriginalList; +import static com.baeldung.list.removeall.RemoveAll.removeWithForEachLoop; +import static com.baeldung.list.removeall.RemoveAll.removeWithForLoopDecrementOnRemove; +import static com.baeldung.list.removeall.RemoveAll.removeWithForLoopIncrementIfRemains; +import static com.baeldung.list.removeall.RemoveAll.removeWithIterator; +import static com.baeldung.list.removeall.RemoveAll.removeWithRemoveIf; +import static com.baeldung.list.removeall.RemoveAll.removeWithStandardForLoopUsingIndex; +import static com.baeldung.list.removeall.RemoveAll.removeWithStreamFilter; +import static com.baeldung.list.removeall.RemoveAll.removeWithWhileLoopNonPrimitiveElement; +import static com.baeldung.list.removeall.RemoveAll.removeWithWhileLoopPrimitiveElement; +import static com.baeldung.list.removeall.RemoveAll.removeWithWhileLoopStoringFirstOccurrenceIndex; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.ConcurrentModificationException; +import java.util.List; + +import org.junit.Test; + +public class RemoveAllUnitTest { + + private List list(Integer... elements) { + return new ArrayList<>(Arrays.asList(elements)); + } + + @Test + public void givenAList_whenRemovingElementsWithWhileLoopUsingPrimitiveElement_thenTheResultCorrect() { + // given + List list = list(1, 2, 3); + int valueToRemove = 1; + + // when + assertThatThrownBy(() -> removeWithWhileLoopPrimitiveElement(list, valueToRemove)) + .isInstanceOf(IndexOutOfBoundsException.class); + } + + @Test + public void givenAList_whenRemovingElementsWithWhileLoopUsingNonPrimitiveElement_thenTheResultCorrect() { + // given + List list = list(1, 2, 3); + int valueToRemove = 1; + + // when + removeWithWhileLoopNonPrimitiveElement(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithWhileLoopStoringFirstOccurrenceIndex_thenTheResultCorrect() { + // given + List list = list(1, 2, 3); + int valueToRemove = 1; + + // when + removeWithWhileLoopStoringFirstOccurrenceIndex(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithCallingRemoveUntilModifies_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithCallingRemoveUntilModifies(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAListWithoutDuplication_whenRemovingElementsWithStandardForLoopUsingIndex_thenTheResultIsCorrect() { + // given + List list = list(1, 2, 3); + int valueToRemove = 1; + + // when + removeWithStandardForLoopUsingIndex(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAListWithAdjacentElements_whenRemovingElementsWithStandardForLoop_thenTheResultIsInCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithStandardForLoopUsingIndex(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(1, 2, 3)); + } + + @Test + public void givenAListWithAdjacentElements_whenRemovingElementsWithForLoopAndDecrementOnRemove_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithForLoopDecrementOnRemove(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAListWithAdjacentElements_whenRemovingElementsWithForLoopAndIncrementIfRemains_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithForLoopIncrementIfRemains(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithForEachLoop_thenExceptionIsThrown() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + assertThatThrownBy(() -> removeWithForEachLoop(list, valueToRemove)) + .isInstanceOf(ConcurrentModificationException.class); + } + + @Test + public void givenAList_whenRemovingElementsWithIterator_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithIterator(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithCollectingAndReturningRemainingElements_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + List result = removeWithCollectingAndReturningRemainingElements(list, valueToRemove); + + // then + assertThat(result).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithCollectingRemainingAndAddingToOriginalList_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithCollectingRemainingElementsAndAddingToOriginalList(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithStreamFilter_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + List result = removeWithStreamFilter(list, valueToRemove); + + // then + assertThat(result).isEqualTo(list(2, 3)); + } + + @Test + public void givenAList_whenRemovingElementsWithCallingRemoveIf_thenTheResultIsCorrect() { + // given + List list = list(1, 1, 2, 3); + int valueToRemove = 1; + + // when + removeWithRemoveIf(list, valueToRemove); + + // then + assertThat(list).isEqualTo(list(2, 3)); + } + +} From 46cf3c3997ee194d99130755a14d028df2ac9ec0 Mon Sep 17 00:00:00 2001 From: Predrag Maric Date: Thu, 2 Aug 2018 11:34:53 +0200 Subject: [PATCH 099/298] BAEL-1958 Moved the example to logging-modules (#4886) --- .../java/com/baeldung/logging/LogUsingSlf4J.java | 16 ---------------- .../com/baeldung/slf4j/SLF4JLogExceptions.java | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) delete mode 100644 core-java/src/main/java/com/baeldung/logging/LogUsingSlf4J.java create mode 100644 logging-modules/log4j/src/main/java/com/baeldung/slf4j/SLF4JLogExceptions.java diff --git a/core-java/src/main/java/com/baeldung/logging/LogUsingSlf4J.java b/core-java/src/main/java/com/baeldung/logging/LogUsingSlf4J.java deleted file mode 100644 index bef4f06889..0000000000 --- a/core-java/src/main/java/com/baeldung/logging/LogUsingSlf4J.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.logging; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LogUsingSlf4J { - - public static void main(String[] args) { - Logger logger = LoggerFactory.getLogger(LogUsingSlf4J.class); - - logger.error("An exception occurred!"); - logger.error("An exception occurred!", new Exception("Custom exception")); - logger.error("{}, {}! An exception occurred!", "Hello", "World", new Exception("Custom exception")); - } - -} diff --git a/logging-modules/log4j/src/main/java/com/baeldung/slf4j/SLF4JLogExceptions.java b/logging-modules/log4j/src/main/java/com/baeldung/slf4j/SLF4JLogExceptions.java new file mode 100644 index 0000000000..bd572770ab --- /dev/null +++ b/logging-modules/log4j/src/main/java/com/baeldung/slf4j/SLF4JLogExceptions.java @@ -0,0 +1,16 @@ +package com.baeldung.slf4j; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SLF4JLogExceptions { + + public static void main(String[] args) { + Logger logger = LoggerFactory.getLogger(SLF4JLogExceptions.class); + + logger.error("An exception occurred!"); + logger.error("An exception occurred!", new Exception("Custom exception")); + logger.error("{}, {}! An exception occurred!", "Hello", "World", new Exception("Custom exception")); + } + +} From 0cafd3004d33d027427723f2e522ea71cfd09792 Mon Sep 17 00:00:00 2001 From: Kevin Wittek Date: Thu, 2 Aug 2018 14:48:42 +0200 Subject: [PATCH 100/298] Example for removing first element of array (BAEL-2029) (#4836) * Example for removing first element of array (BAEL-2029) * Use AssertJ assertions --- .../array/RemoveFirstElementUnitTest.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 core-java/src/test/java/com/baeldung/array/RemoveFirstElementUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/array/RemoveFirstElementUnitTest.java b/core-java/src/test/java/com/baeldung/array/RemoveFirstElementUnitTest.java new file mode 100644 index 0000000000..7d11016d7f --- /dev/null +++ b/core-java/src/test/java/com/baeldung/array/RemoveFirstElementUnitTest.java @@ -0,0 +1,42 @@ +package com.baeldung.array; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +public class RemoveFirstElementUnitTest { + + @Test + public void givenStringArray_whenRemovingFirstElement_thenArrayIsSmallerAndElementRemoved() { + String[] stringArray = {"foo", "bar", "baz"}; + + String[] modifiedArray = Arrays.copyOfRange(stringArray, 1, stringArray.length); + + assertThat(modifiedArray.length).isEqualTo(2); + assertThat(modifiedArray[0]).isEqualTo("bar"); + } + + @Test + public void givenArrayList_whenRemovingFirstElement_thenListSmallerAndElementRemoved() { + List stringList = new ArrayList<>(Arrays.asList("foo", "bar", "baz")); + stringList.remove(0); + + assertThat(stringList.size()).isEqualTo(2); + assertThat(stringList.get(0)).isEqualTo("bar"); + } + + @Test + public void givenLinkedList_whenRemovingFirstElement_thenListSmallerAndElementRemoved() { + List stringList = new LinkedList<>(Arrays.asList("foo", "bar", "baz")); + stringList.remove(0); + + assertThat(stringList.size()).isEqualTo(2); + assertThat(stringList.get(0)).isEqualTo("bar"); + } + +} From 7dbca34ba44e7dbae636367ac914b69d124c10fd Mon Sep 17 00:00:00 2001 From: Vizsoro Date: Thu, 2 Aug 2018 21:48:38 +0200 Subject: [PATCH 101/298] BAEL-1986 List initialization in one line (#4696) * list initializations in one line * Enhance after review * formatting and naming * Formatting and renaming 2 --- .../ListInitializationUnitTest.java | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java b/core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java new file mode 100644 index 0000000000..bc012dae6b --- /dev/null +++ b/core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java @@ -0,0 +1,73 @@ +package com.baeldung.java.listInitialization; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import lombok.extern.java.Log; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +@Log +public class ListInitializationUnitTest { + + @Rule + public ExpectedException exception = ExpectedException.none(); + + @Test + public void givenAnonymousInnerClass_thenInitialiseList() { + List cities = new ArrayList() { + // Inside declaration of the subclass + + // You can have multiple initializer block + { + log.info("Inside the first initializer block."); + } + + { + log.info("Inside the second initializer block."); + add("New York"); + add("Rio"); + add("Tokyo"); + } + }; + + Assert.assertTrue(cities.contains("New York")); + } + + @Test + public void givenArraysAsList_thenInitialiseList() { + List list = Arrays.asList("foo", "bar"); + + Assert.assertTrue(list.contains("foo")); + } + + @Test + public void givenArraysAsList_whenAdd_thenUnsupportedException() { + List list = Arrays.asList("foo", "bar"); + + exception.expect(UnsupportedOperationException.class); + list.add("baz"); + } + + @Test + public void givenArrayAsList_whenCreated_thenShareReference() { + String[] array = { "foo", "bar" }; + List list = Arrays.asList(array); + array[0] = "baz"; + Assert.assertEquals("baz", list.get(0)); + } + + @Test + public void givenStream_thenInitializeList() { + List list = Stream.of("foo", "bar") + .collect(Collectors.toList()); + + Assert.assertTrue(list.contains("foo")); + } +} From 9bc5b950f686d9e3becd79d9ca5a925fac8e12f3 Mon Sep 17 00:00:00 2001 From: Karthikeyan Subbaraj Date: Mon, 30 Jul 2018 10:42:04 +0530 Subject: [PATCH 102/298] Unit tests and DequeBasedSynchronizedStack added up --- .../DequeBasedSynchronizedStack.java | 36 +++++++ .../MultithreadingCorrectnessStackTests.java | 101 ++++++++++++++++++ .../com/baeldung/stack_tests/StackTests.java | 63 +++++++++++ 3 files changed, 200 insertions(+) create mode 100644 core-java-collections/src/main/java/com/baeldung/thread_safe_lifo/DequeBasedSynchronizedStack.java create mode 100644 core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackTests.java create mode 100644 core-java-collections/src/test/java/com/baeldung/stack_tests/StackTests.java diff --git a/core-java-collections/src/main/java/com/baeldung/thread_safe_lifo/DequeBasedSynchronizedStack.java b/core-java-collections/src/main/java/com/baeldung/thread_safe_lifo/DequeBasedSynchronizedStack.java new file mode 100644 index 0000000000..ea1618b0f2 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/thread_safe_lifo/DequeBasedSynchronizedStack.java @@ -0,0 +1,36 @@ +package com.baeldung.thread_safe_lifo; + +import java.util.ArrayDeque; + +/** + * Deque Based Stack implementation. + */ +public class DequeBasedSynchronizedStack { + + // Internal Deque which gets decorated for synchronization. + private ArrayDeque dequeStore = new ArrayDeque<>(); + + public DequeBasedSynchronizedStack(int initialCapacity) { + this.dequeStore = new ArrayDeque<>(initialCapacity); + } + + public DequeBasedSynchronizedStack() { + + } + + public synchronized T pop() { + return this.dequeStore.pop(); + } + + public synchronized void push(T element) { + this.dequeStore.push(element); + } + + public synchronized T peek() { + return this.dequeStore.peek(); + } + + public synchronized int size() { + return this.dequeStore.size(); + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackTests.java b/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackTests.java new file mode 100644 index 0000000000..63f2d28902 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackTests.java @@ -0,0 +1,101 @@ +package com.baeldung.stack_tests; + +import com.baeldung.thread_safe_lifo.DequeBasedSynchronizedStack; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayDeque; +import java.util.concurrent.ConcurrentLinkedDeque; + +import static java.util.stream.IntStream.range; + +/** + * Correctness tests for Stack in multi threaded environment. + */ +public class MultithreadingCorrectnessStackTests { + + @Test + public void test_multithreading_correctness_with_synchronized_deque() { + + DequeBasedSynchronizedStack deque = new DequeBasedSynchronizedStack<>(); + + // Serial execution of push on ConcurrentLinkedQueue will always result in correct execution. + range(1, 10000).forEach(value -> deque.push(value)); + + int sum = 0; + while(deque.peek() != null) { + sum += deque.pop(); + } + + Assert.assertEquals(49995000, sum); + + // Parallel execution of push on ConcurrentLinkedQueue will always result in correct execution. + range(1, 10000).parallel().forEach(value -> deque.push(value)); + + sum = 0; + while(deque.peek() != null) { + sum += deque.pop(); + } + + Assert.assertEquals(49995000, sum); + } + + @Test + public void test_multithreading_correctness_with_concurrent_linked_queue() { + + ConcurrentLinkedDeque deque = new ConcurrentLinkedDeque<>(); + + // Serial execution of push on ConcurrentLinkedQueue will always result in correct execution. + range(1, 10000).forEach(value -> deque.push(value)); + + int sum = 0; + while(deque.peek() != null) { + sum += deque.pop(); + } + + Assert.assertEquals(49995000, sum); + + // Parallel execution of push on ConcurrentLinkedQueue will always result in correct execution. + range(1, 10000).parallel().forEach(value -> deque.push(value)); + + sum = 0; + while(deque.peek() != null) { + sum += deque.pop(); + } + + Assert.assertEquals(49995000, sum); + } + + @Test + public void test_multithreading_correctness_with_array_deque() { + + ArrayDeque deque = new ArrayDeque<>(); + + // Serial execution of push on ArrayDeque will always result in correct execution. + range(1, 10000).forEach(value -> deque.push(value)); + + int sum = 0; + while(deque.peek() != null) { + sum += deque.pop(); + } + + Assert.assertEquals(49995000, sum); + + // Parallel execution of push on ArrayDeque will not result in correct execution. + range(1, 10000).parallel().forEach(value -> deque.push(value)); + + sum = 0; + while(deque.peek() != null) { + sum += deque.pop(); + } + + // This shouldn't happen. + if(sum == 49995000) { + System.out.println("Something wrong in the environment, Please try some big value and check"); + // To safe-guard build without test failures. + return; + } + + Assert.assertNotEquals(49995000, sum); + } +} diff --git a/core-java-collections/src/test/java/com/baeldung/stack_tests/StackTests.java b/core-java-collections/src/test/java/com/baeldung/stack_tests/StackTests.java new file mode 100644 index 0000000000..31a84c3a34 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/stack_tests/StackTests.java @@ -0,0 +1,63 @@ +package com.baeldung.stack_tests; + +import com.baeldung.thread_safe_lifo.DequeBasedSynchronizedStack; +import com.google.common.collect.Streams; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayDeque; +import java.util.Collection; +import java.util.Collections; +import java.util.Stack; +import java.util.concurrent.ConcurrentLinkedDeque; +import java.util.stream.Stream; + +import static java.util.stream.IntStream.range; + +/** + * These tests are to understand the Stack implementation in Java Collections. + */ +public class StackTests { + + @Test + public void test_basic_with_stack() { + Stack namesStack = new Stack<>(); + + namesStack.push("Bill Gates"); + namesStack.push("Elon Musk"); + + Assert.assertEquals("Elon Musk", namesStack.peek()); + Assert.assertEquals("Elon Musk", namesStack.pop()); + Assert.assertEquals("Bill Gates", namesStack.pop()); + + Assert.assertEquals(0, namesStack.size()); + } + + @Test + public void test_basic_with_synchronized_deque() { + DequeBasedSynchronizedStack namesStack = new DequeBasedSynchronizedStack<>(); + + namesStack.push("Bill Gates"); + namesStack.push("Elon Musk"); + + Assert.assertEquals("Elon Musk", namesStack.peek()); + Assert.assertEquals("Elon Musk", namesStack.pop()); + Assert.assertEquals("Bill Gates", namesStack.pop()); + + Assert.assertEquals(0, namesStack.size()); + } + + @Test + public void test_basic_with_concurrent_linked_queue() { + ConcurrentLinkedDeque namesStack = new ConcurrentLinkedDeque<>(); + + namesStack.push("Bill Gates"); + namesStack.push("Elon Musk"); + + Assert.assertEquals("Elon Musk", namesStack.peek()); + Assert.assertEquals("Elon Musk", namesStack.pop()); + Assert.assertEquals("Bill Gates", namesStack.pop()); + + Assert.assertEquals(0, namesStack.size()); + } +} From 3b0fef026637eeea7512002e95d1b0004e31d232 Mon Sep 17 00:00:00 2001 From: Karthikeyan Subbaraj Date: Mon, 30 Jul 2018 15:17:41 +0530 Subject: [PATCH 103/298] Unit tests method names and class names modified as per the guidelines --- ...s.java => MultithreadingCorrectnessStackUnitTest.java} | 8 ++++---- .../stack_tests/{StackTests.java => StackUnitTest.java} | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) rename core-java-collections/src/test/java/com/baeldung/stack_tests/{MultithreadingCorrectnessStackTests.java => MultithreadingCorrectnessStackUnitTest.java} (90%) rename core-java-collections/src/test/java/com/baeldung/stack_tests/{StackTests.java => StackUnitTest.java} (87%) diff --git a/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackTests.java b/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackUnitTest.java similarity index 90% rename from core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackTests.java rename to core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackUnitTest.java index 63f2d28902..4550994aa3 100644 --- a/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackTests.java +++ b/core-java-collections/src/test/java/com/baeldung/stack_tests/MultithreadingCorrectnessStackUnitTest.java @@ -12,10 +12,10 @@ import static java.util.stream.IntStream.range; /** * Correctness tests for Stack in multi threaded environment. */ -public class MultithreadingCorrectnessStackTests { +public class MultithreadingCorrectnessStackUnitTest { @Test - public void test_multithreading_correctness_with_synchronized_deque() { + public void givenSynchronizedDeque_whenExecutedParallel_thenWorkRight() { DequeBasedSynchronizedStack deque = new DequeBasedSynchronizedStack<>(); @@ -41,7 +41,7 @@ public class MultithreadingCorrectnessStackTests { } @Test - public void test_multithreading_correctness_with_concurrent_linked_queue() { + public void givenConcurrentLinkedQueue_whenExecutedParallel_thenWorkRight() { ConcurrentLinkedDeque deque = new ConcurrentLinkedDeque<>(); @@ -67,7 +67,7 @@ public class MultithreadingCorrectnessStackTests { } @Test - public void test_multithreading_correctness_with_array_deque() { + public void givenArrayDeque_whenExecutedParallel_thenShouldFail() { ArrayDeque deque = new ArrayDeque<>(); diff --git a/core-java-collections/src/test/java/com/baeldung/stack_tests/StackTests.java b/core-java-collections/src/test/java/com/baeldung/stack_tests/StackUnitTest.java similarity index 87% rename from core-java-collections/src/test/java/com/baeldung/stack_tests/StackTests.java rename to core-java-collections/src/test/java/com/baeldung/stack_tests/StackUnitTest.java index 31a84c3a34..07c4760186 100644 --- a/core-java-collections/src/test/java/com/baeldung/stack_tests/StackTests.java +++ b/core-java-collections/src/test/java/com/baeldung/stack_tests/StackUnitTest.java @@ -17,10 +17,10 @@ import static java.util.stream.IntStream.range; /** * These tests are to understand the Stack implementation in Java Collections. */ -public class StackTests { +public class StackUnitTest { @Test - public void test_basic_with_stack() { + public void givenStack_whenPushPopPeek_thenWorkRight() { Stack namesStack = new Stack<>(); namesStack.push("Bill Gates"); @@ -34,7 +34,7 @@ public class StackTests { } @Test - public void test_basic_with_synchronized_deque() { + public void givenSynchronizedDeque_whenPushPopPeek_thenWorkRight() { DequeBasedSynchronizedStack namesStack = new DequeBasedSynchronizedStack<>(); namesStack.push("Bill Gates"); @@ -48,7 +48,7 @@ public class StackTests { } @Test - public void test_basic_with_concurrent_linked_queue() { + public void givenConcurrentLinkedDeque_whenPushPopPeek_thenWorkRight() { ConcurrentLinkedDeque namesStack = new ConcurrentLinkedDeque<>(); namesStack.push("Bill Gates"); From 4aa77eb55d02c387d25e976562ca0fa7f36d9571 Mon Sep 17 00:00:00 2001 From: freddyaott Date: Fri, 3 Aug 2018 04:11:35 +0200 Subject: [PATCH 104/298] BAEL-1840 Builder Pattern in Kotlin (#4730) * builder pattern in kotlin * builder pattern in kotlin new-line * deleted Sandbox, added unit test * add other tests * named and default parameters builder * Make FoodOrderNamed a data class --- .../kotlin/com/baeldung/builder/FoodOrder.kt | 39 +++++ .../com/baeldung/builder/FoodOrderApply.kt | 8 + .../com/baeldung/builder/FoodOrderNamed.kt | 7 + .../builder/BuilderPatternUnitTest.kt | 139 ++++++++++++++++++ 4 files changed, 193 insertions(+) create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrder.kt create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderApply.kt create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderNamed.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/builder/BuilderPatternUnitTest.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrder.kt b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrder.kt new file mode 100644 index 0000000000..7d10d849b9 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrder.kt @@ -0,0 +1,39 @@ +package com.baeldung.builder + +class FoodOrder private constructor(builder: FoodOrder.Builder) { + + val bread: String? + val condiments: String? + val meat: String? + val fish: String? + + init { + this.bread = builder.bread + this.condiments = builder.condiments + this.meat = builder.meat + this.fish = builder.fish + } + + class Builder { + + var bread: String? = null + private set + var condiments: String? = null + private set + var meat: String? = null + private set + var fish: String? = null + private set + + fun bread(bread: String) = apply { this.bread = bread } + + fun condiments(condiments: String) = apply { this.condiments = condiments } + + fun meat(meat: String) = apply { this.meat = meat } + + fun fish(fish: String) = apply { this.fish = fish } + + fun build() = FoodOrder(this) + + } +} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderApply.kt b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderApply.kt new file mode 100644 index 0000000000..0a68832b00 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderApply.kt @@ -0,0 +1,8 @@ +package com.baeldung.builder + +class FoodOrderApply { + var bread: String? = null + var condiments: String? = null + var meat: String? = null + var fish: String? = null +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderNamed.kt b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderNamed.kt new file mode 100644 index 0000000000..6e20cf51b9 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderNamed.kt @@ -0,0 +1,7 @@ +package com.baeldung.builder + +data class FoodOrderNamed( + val bread: String? = null, + val condiments: String? = null, + val meat: String? = null, + val fish: String? = null) diff --git a/core-kotlin/src/test/kotlin/com/baeldung/builder/BuilderPatternUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/builder/BuilderPatternUnitTest.kt new file mode 100644 index 0000000000..17f5a43479 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/builder/BuilderPatternUnitTest.kt @@ -0,0 +1,139 @@ +package com.baeldung.builder + +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Test + +internal class BuilderPatternUnitTest { + + @Test + fun whenBuildingFoodOrderSettingValues_thenFieldsNotNull() { + + val foodOrder = FoodOrder.Builder() + .bread("white bread") + .meat("bacon") + .fish("salmon") + .condiments("olive oil") + .build() + + Assertions.assertNotNull(foodOrder.bread) + Assertions.assertNotNull(foodOrder.meat) + Assertions.assertNotNull(foodOrder.condiments) + Assertions.assertNotNull(foodOrder.fish) + } + + @Test + fun whenBuildingFoodOrderSettingValues_thenFieldsContainsValues() { + + val foodOrder = FoodOrder.Builder() + .bread("white bread") + .meat("bacon") + .fish("salmon") + .condiments("olive oil") + .build() + + Assertions.assertEquals("white bread", foodOrder.bread) + Assertions.assertEquals("bacon", foodOrder.meat) + Assertions.assertEquals("olive oil", foodOrder.condiments) + Assertions.assertEquals("salmon", foodOrder.fish) + } + + @Test + fun whenBuildingFoodOrderWithoutSettingValues_thenFieldsNull() { + + val foodOrder = FoodOrder.Builder() + .build() + + Assertions.assertNull(foodOrder.bread) + Assertions.assertNull(foodOrder.meat) + Assertions.assertNull(foodOrder.condiments) + Assertions.assertNull(foodOrder.fish) + } + + + @Test + fun whenBuildingFoodOrderNamedSettingValues_thenFieldsNotNull() { + + val foodOrder = FoodOrderNamed( + meat = "bacon", + fish = "salmon", + condiments = "olive oil", + bread = "white bread" + ) + + Assertions.assertNotNull(foodOrder.bread) + Assertions.assertNotNull(foodOrder.meat) + Assertions.assertNotNull(foodOrder.condiments) + Assertions.assertNotNull(foodOrder.fish) + } + + @Test + fun whenBuildingFoodOrderNamedSettingValues_thenFieldsContainsValues() { + + val foodOrder = FoodOrderNamed( + meat = "bacon", + fish = "salmon", + condiments = "olive oil", + bread = "white bread" + ) + + Assertions.assertEquals("white bread", foodOrder.bread) + Assertions.assertEquals("bacon", foodOrder.meat) + Assertions.assertEquals("olive oil", foodOrder.condiments) + Assertions.assertEquals("salmon", foodOrder.fish) + } + + @Test + fun whenBuildingFoodOrderNamedWithoutSettingValues_thenFieldsNull() { + + val foodOrder = FoodOrderNamed() + + Assertions.assertNull(foodOrder.bread) + Assertions.assertNull(foodOrder.meat) + Assertions.assertNull(foodOrder.condiments) + Assertions.assertNull(foodOrder.fish) + } + + @Test + fun whenBuildingFoodOrderApplySettingValues_thenFieldsNotNull() { + + val foodOrder = FoodOrderApply().apply { + meat = "bacon" + fish = "salmon" + condiments = "olive oil" + bread = "white bread" + } + + Assertions.assertNotNull(foodOrder.bread) + Assertions.assertNotNull(foodOrder.meat) + Assertions.assertNotNull(foodOrder.condiments) + Assertions.assertNotNull(foodOrder.fish) + } + + @Test + fun whenBuildingFoodOrderApplySettingValues_thenFieldsContainsValues() { + + val foodOrder = FoodOrderApply().apply { + meat = "bacon" + fish = "salmon" + condiments = "olive oil" + bread = "white bread" + } + + Assertions.assertEquals("white bread", foodOrder.bread) + Assertions.assertEquals("bacon", foodOrder.meat) + Assertions.assertEquals("olive oil", foodOrder.condiments) + Assertions.assertEquals("salmon", foodOrder.fish) + } + + @Test + fun whenBuildingFoodOrderApplyWithoutSettingValues_thenFieldsNull() { + + val foodOrder = FoodOrderApply() + + Assertions.assertNull(foodOrder.bread) + Assertions.assertNull(foodOrder.meat) + Assertions.assertNull(foodOrder.condiments) + Assertions.assertNull(foodOrder.fish) + } + +} \ No newline at end of file From 2fae0783706a6ef2f070139233fb3373b76a7783 Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Fri, 3 Aug 2018 10:32:50 +0400 Subject: [PATCH 105/298] added benchmark tests for set and list performance --- core-java-collections/pom.xml | 18 +++---- .../performance/CollectionsBenchmark.java | 53 +++++++++++++++++++ .../com/baeldung/performance/Employee.java | 31 +++++++++++ 3 files changed, 93 insertions(+), 9 deletions(-) create mode 100644 core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java create mode 100644 core-java-collections/src/main/java/com/baeldung/performance/Employee.java diff --git a/core-java-collections/pom.xml b/core-java-collections/pom.xml index ff06714bfe..f954e8542e 100644 --- a/core-java-collections/pom.xml +++ b/core-java-collections/pom.xml @@ -47,26 +47,26 @@ ${eclipse.collections.version} - org.assertj - assertj-core - ${assertj.version} - test + org.openjdk.jmh + jmh-core + ${openjdk.jmh.version} - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test + org.openjdk.jmh + jmh-generator-annprocess + ${openjdk.jmh.version} + + 1.19 1.2.0 3.5 4.1 4.01 1.7.0 3.6.1 - 9.2.0 + 7.1.0 diff --git a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java new file mode 100644 index 0000000000..64cff16cd7 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java @@ -0,0 +1,53 @@ +package com.baeldung.performance; + +import org.openjdk.jmh.annotations.*; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +public class CollectionsBenchmark { + + @State(Scope.Thread) + public static class MyState { + private Set employeeSet = new HashSet<>(); + private List employeeList = new ArrayList<>(); + + private final long m_count = 16; + + private Employee employee = new Employee(100L, "Harry"); + + @Setup(Level.Invocation) + public void setUp() { + + for (long ii = 0; ii < m_count; ii++) { + employeeSet.add(new Employee(ii, "John")); + employeeList.add(new Employee(ii, "John")); + + employeeList.add(employee); + employeeSet.add(employee); + } + } + } + + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + @OutputTimeUnit(TimeUnit.MINUTES) + public boolean testArrayList(MyState state) { + return state.employeeList.contains(state.employee); + } + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + @OutputTimeUnit(TimeUnit.MINUTES) + public boolean testHashSet(MyState state) { + return state.employeeSet.contains(state.employee); + } + + public static void main(String[] args) throws Exception { + org.openjdk.jmh.Main.main(args); + } +} diff --git a/core-java-collections/src/main/java/com/baeldung/performance/Employee.java b/core-java-collections/src/main/java/com/baeldung/performance/Employee.java new file mode 100644 index 0000000000..daa68ae2f1 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/performance/Employee.java @@ -0,0 +1,31 @@ +package com.baeldung.performance; + +public class Employee { + + private Long id; + private String name; + + public Employee(Long id, String name) { + this.name = name; + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Employee employee = (Employee) o; + + if (!id.equals(employee.id)) return false; + return name.equals(employee.name); + + } + + @Override + public int hashCode() { + int result = id.hashCode(); + result = 31 * result + name.hashCode(); + return result; + } +} From adb14c2b95dff9ef5aeab3701e26eefb4fb3e66a Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Fri, 3 Aug 2018 10:43:37 +0400 Subject: [PATCH 106/298] bring back dependencies --- core-java-collections/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core-java-collections/pom.xml b/core-java-collections/pom.xml index f954e8542e..f9c2ec8249 100644 --- a/core-java-collections/pom.xml +++ b/core-java-collections/pom.xml @@ -46,6 +46,18 @@ eclipse-collections ${eclipse.collections.version} + + org.assertj + assertj-core + ${assertj.version} + test + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + org.openjdk.jmh jmh-core From cc3b35566de34223587364755654f5d03a0a28d9 Mon Sep 17 00:00:00 2001 From: Predrag Maric Date: Fri, 3 Aug 2018 11:13:45 +0200 Subject: [PATCH 107/298] BAEL-1861 Replaced real tests with demo test "placeholders" (#4887) --- .../junit4/runfromjava/FirstUnitTest.java | 25 ++++++++++++ .../junit4/runfromjava/ListNodeUnitTest.java | 32 ---------------- .../runfromjava/MergeListsUnitTest.java | 36 ------------------ .../junit4/runfromjava/MyTestSuite.java | 2 +- .../RemovedNthElementUnitTest.java | 33 ---------------- .../runfromjava/RotateListUnitTest.java | 32 ---------------- .../junit4/runfromjava/RunJUnit4Tests.java | 10 ++--- .../junit4/runfromjava/SecondUnitTest.java | 18 +++++++++ .../junit4/runfromjava/SwapNodesUnitTest.java | 27 ------------- .../junit5/runfromjava/FirstUnitTest.java | 24 ++++++++++++ .../junit5/runfromjava/ListNodeUnitTest.java | 30 --------------- .../runfromjava/MergeListsUnitTest.java | 38 ------------------- .../RemovedNthElementUnitTest.java | 33 ---------------- .../runfromjava/RotateListUnitTest.java | 32 ---------------- .../junit5/runfromjava/RunJUnit5Tests.java | 14 +++---- .../junit5/runfromjava/SecondUnitTest.java | 18 +++++++++ .../junit5/runfromjava/SwapNodesUnitTest.java | 27 ------------- 17 files changed, 98 insertions(+), 333 deletions(-) create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/FirstUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/ListNodeUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MergeListsUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RemovedNthElementUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RotateListUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SecondUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SwapNodesUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/FirstUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/ListNodeUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/MergeListsUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RemovedNthElementUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RotateListUnitTest.java create mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SecondUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SwapNodesUnitTest.java diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/FirstUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/FirstUnitTest.java new file mode 100644 index 0000000000..588a1e5d66 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/FirstUnitTest.java @@ -0,0 +1,25 @@ +package com.baeldung.junit4.runfromjava; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + + +public class FirstUnitTest { + + @Test + public void whenThis_thenThat() { + assertTrue(true); + } + + @Test + public void whenSomething_thenSomething() { + assertTrue(true); + } + + @Test + public void whenSomethingElse_thenSomethingElse() { + assertTrue(true); + } + +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/ListNodeUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/ListNodeUnitTest.java deleted file mode 100644 index f7571b6c8d..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/ListNodeUnitTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.junit4.runfromjava; - -import org.junit.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; - -import static org.junit.Assert.*; - - -public class ListNodeUnitTest { - - @Test - public void whenListHasOneElement_thenGetExpectedValue() { - ListNode listNode = new ListNode(42); - assertEquals(listNode.getValue(), 42); - } - - @Test - public void whenInitSimpleList_thenGettersGiveExpectedValues() { - ListNode listNode = new ListNode(42, new ListNode(666, null)); - assertEquals(listNode.getValue(), 42); - assertEquals(listNode.getNext() - .getValue(), 666); - } - - @Test - public void whenConvertingListToString_thenGetExpectedValue() { - ListNode listNode = new ListNode(42, new ListNode(666, new ListNode(15, null))); - assertEquals(listNode.toString(), "42->666->15"); - } - -} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MergeListsUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MergeListsUnitTest.java deleted file mode 100644 index 3b9b5abd0c..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MergeListsUnitTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.junit4.runfromjava; - -import org.junit.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; -import com.baeldung.junit.runfromjava.listnode.MergeLists; - -import static org.junit.Assert.*; -import org.junit.Before; - -public class MergeListsUnitTest { - - private ListNode listNode1; - private ListNode listNode2; - private MergeLists mergeLists; - - @Before - public void setUp() throws Exception { - mergeLists = new MergeLists(); - listNode1 = new ListNode(2, new ListNode(4, new ListNode(6, new ListNode(8, null)))); - listNode2 = new ListNode(1, new ListNode(3, new ListNode(5, new ListNode(7, null)))); - } - - @Test - public void whenMergingNormalLists_thenGetExpectedString() { - assertEquals(mergeLists.merge(listNode1, listNode2) - .toString(), "1->2->3->4->5->6->7->8"); - } - - @Test - public void whenMergingNullLists_thenGetNull() { - listNode1 = null; - listNode2 = null; - assertNull(mergeLists.merge(listNode1, listNode2)); - } -} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java index c743491a48..4739b47b88 100644 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java @@ -4,7 +4,7 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses({ ListNodeUnitTest.class, MergeListsUnitTest.class }) +@Suite.SuiteClasses({ FirstUnitTest.class, SecondUnitTest.class }) public class MyTestSuite { } diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RemovedNthElementUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RemovedNthElementUnitTest.java deleted file mode 100644 index e237dc7b90..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RemovedNthElementUnitTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.junit4.runfromjava; - -import org.junit.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; -import com.baeldung.junit.runfromjava.listnode.RemovedNthElement; - -import static org.junit.Assert.*; -import org.junit.Before; - -public class RemovedNthElementUnitTest { - - private ListNode listNode; - private RemovedNthElement removedNthElement; - - @Before - public void setUp() throws Exception { - removedNthElement = new RemovedNthElement(); - listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); - } - - @Test - public void whenRemovingSecondElement_thenReturnExpectedList() { - assertEquals(removedNthElement.removeNthFromEnd(listNode, 2) - .toString(), "42->666->3"); - } - - @Test - public void whenRemovingThirdElement_thenReturnExpectedList() { - assertEquals(removedNthElement.removeNthFromEnd(listNode, 3) - .toString(), "42->15->3"); - } -} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RotateListUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RotateListUnitTest.java deleted file mode 100644 index bbe7f09cbe..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RotateListUnitTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.junit4.runfromjava; - -import org.junit.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; -import com.baeldung.junit.runfromjava.listnode.RotateList; - -import static org.junit.Assert.*; -import org.junit.Before; - -public class RotateListUnitTest { - private RotateList rotateList; - private ListNode listNode; - - @Before - public void setUp() throws Exception { - rotateList = new RotateList(); - listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); - } - - @Test - public void whenRotatingListTwice_thenReturnExpectedList() { - assertEquals(rotateList.rotateRight(listNode, 2) - .toString(), "15->3->42->666"); - } - - @Test - public void whenRotatingListThreeTimes_thenReturnExpectedList() { - assertEquals(rotateList.rotateRight(listNode, 3) - .toString(), "666->15->3->42"); - } -} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java index cc865a056e..69b821032a 100644 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java @@ -15,14 +15,14 @@ public class RunJUnit4Tests { public static void runOne() { JUnitCore junit = new JUnitCore(); junit.addListener(new TextListener(System.out)); - junit.run(MergeListsUnitTest.class); + junit.run(FirstUnitTest.class); } public static void runAllClasses() { JUnitCore junit = new JUnitCore(); junit.addListener(new TextListener(System.out)); - Result result = junit.run(ListNodeUnitTest.class, MergeListsUnitTest.class, RemovedNthElementUnitTest.class, RotateListUnitTest.class, SwapNodesUnitTest.class); + Result result = junit.run(FirstUnitTest.class, SecondUnitTest.class); for (Failure failure : result.getFailures()) { System.out.println(failure.toString()); @@ -44,7 +44,7 @@ public class RunJUnit4Tests { } public static void runRepeated() { - Test test = new JUnit4TestAdapter(MergeListsUnitTest.class); + Test test = new JUnit4TestAdapter(SecondUnitTest.class); RepeatedTest repeatedTest = new RepeatedTest(test, 5); JUnitCore junit = new JUnitCore(); @@ -59,8 +59,8 @@ public class RunJUnit4Tests { JUnitCore junit = new JUnitCore(); junit.addListener(new TextListener(System.out)); - mySuite.addTest(new RepeatedTest(new JUnit4TestAdapter(MergeListsUnitTest.class), 5)); - mySuite.addTest(new RepeatedTest(new JUnit4TestAdapter(RemovedNthElementUnitTest.class), 3)); + mySuite.addTest(new RepeatedTest(new JUnit4TestAdapter(FirstUnitTest.class), 5)); + mySuite.addTest(new RepeatedTest(new JUnit4TestAdapter(SecondUnitTest.class), 3)); junit.run(mySuite); } diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SecondUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SecondUnitTest.java new file mode 100644 index 0000000000..e2d75021cf --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SecondUnitTest.java @@ -0,0 +1,18 @@ +package com.baeldung.junit4.runfromjava; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +public class SecondUnitTest { + + @Test + public void whenSomething_thenSomething() { + assertTrue(true); + } + + @Test + public void whensomethingElse_thenSomethingElse() { + assertTrue(true); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SwapNodesUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SwapNodesUnitTest.java deleted file mode 100644 index 129f397485..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/SwapNodesUnitTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.junit4.runfromjava; - -import org.junit.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; -import com.baeldung.junit.runfromjava.listnode.SwapNodes; - -import static org.junit.Assert.*; -import org.junit.Before; - -public class SwapNodesUnitTest { - private SwapNodes swapNodes; - private ListNode listNode; - - @Before - public void setUp() throws Exception { - swapNodes = new SwapNodes(); - listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); - } - - @Test - public void whenSwappingPairs_thenReturnExpectedList() { - assertEquals(swapNodes.swapPairs(listNode) - .toString(), "666->42->3->15"); - } - -} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/FirstUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/FirstUnitTest.java new file mode 100644 index 0000000000..57c505781d --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/FirstUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.junit5.runfromjava; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +class FirstUnitTest { + + @Test + void whenThis_thenThat() { + assertTrue(true); + } + + @Test + void whenSomething_thenSomething() { + assertTrue(true); + } + + @Test + void whenSomethingElse_thenSomethingElse() { + assertTrue(true); + } + +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/ListNodeUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/ListNodeUnitTest.java deleted file mode 100644 index 7b76b114c3..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/ListNodeUnitTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.junit5.runfromjava; - -import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; - -class ListNodeUnitTest { - - @Test - void whenListHasOneElement_thenGetExpectedValue() { - ListNode listNode = new ListNode(42); - assertEquals(listNode.getValue(), 42); - } - - @Test - void whenInitSimpleList_thenGettersGiveExpectedValues() { - ListNode listNode = new ListNode(42, new ListNode(666, null)); - assertEquals(listNode.getValue(), 42); - assertEquals(listNode.getNext() - .getValue(), 666); - } - - @Test - void whenConvertingListToString_thenGetExpectedValue() { - ListNode listNode = new ListNode(42, new ListNode(666, new ListNode(15, null))); - assertEquals(listNode.toString(), "42->666->15"); - } - -} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/MergeListsUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/MergeListsUnitTest.java deleted file mode 100644 index 89224f840b..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/MergeListsUnitTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.junit5.runfromjava; - -import static org.junit.jupiter.api.Assertions.*; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.RepeatedTest; -import org.junit.jupiter.api.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; -import com.baeldung.junit.runfromjava.listnode.MergeLists; - -class MergeListsUnitTest { - - private ListNode listNode1; - private ListNode listNode2; - private MergeLists mergeLists; - - @BeforeEach - void setUp() throws Exception { - mergeLists = new MergeLists(); - listNode1 = new ListNode(2, new ListNode(4, new ListNode(6, new ListNode(8, null)))); - listNode2 = new ListNode(1, new ListNode(3, new ListNode(5, new ListNode(7, null)))); - } - - @RepeatedTest(10) - void whenMergingNormalLists_thenGetExpectedString() { - assertEquals(mergeLists - .merge(listNode1, listNode2) - .toString(), "1->2->3->4->5->6->7->8"); - } - - @RepeatedTest(5) - void whenMergingNullLists_thenGetNull() { - listNode1 = null; - listNode2 = null; - assertNull(mergeLists.merge(listNode1, listNode2)); - } -} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RemovedNthElementUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RemovedNthElementUnitTest.java deleted file mode 100644 index d226df1423..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RemovedNthElementUnitTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.junit5.runfromjava; - -import static org.junit.jupiter.api.Assertions.*; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; -import com.baeldung.junit.runfromjava.listnode.RemovedNthElement; - -class RemovedNthElementUnitTest { - - private ListNode listNode; - private RemovedNthElement removedNthElement; - - @BeforeEach - void setUp() throws Exception { - removedNthElement = new RemovedNthElement(); - listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); - } - - @Test - void whenRemovingSecondElement_thenReturnExpectedList() { - assertEquals(removedNthElement.removeNthFromEnd(listNode, 2) - .toString(), "42->666->3"); - } - - @Test - void whenRemovingThirdElement_thenReturnExpectedList() { - assertEquals(removedNthElement.removeNthFromEnd(listNode, 3) - .toString(), "42->15->3"); - } -} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RotateListUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RotateListUnitTest.java deleted file mode 100644 index 687786fcb5..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RotateListUnitTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.junit5.runfromjava; - -import static org.junit.jupiter.api.Assertions.*; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; -import com.baeldung.junit.runfromjava.listnode.RotateList; - -class RotateListUnitTest { - private RotateList rotateList; - private ListNode listNode; - - @BeforeEach - void setUp() throws Exception { - rotateList = new RotateList(); - listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); - } - - @Test - void whenRotatingListTwice_thenReturnExpectedList() { - assertEquals(rotateList.rotateRight(listNode, 2) - .toString(), "15->3->42->666"); - } - - @Test - void whenRotatingListThreeTimes_thenReturnExpectedList() { - assertEquals(rotateList.rotateRight(listNode, 3) - .toString(), "666->15->3->42"); - } -} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java index 58e7c9ad79..8a8f3aae17 100644 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java @@ -1,11 +1,5 @@ package com.baeldung.junit5.runfromjava; -import static org.junit.platform.engine.discovery.ClassNameFilter.includeClassNamePatterns; -import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; -import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage; - -import java.io.PrintWriter; - import org.junit.platform.launcher.Launcher; import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.launcher.TestPlan; @@ -14,13 +8,19 @@ import org.junit.platform.launcher.core.LauncherFactory; import org.junit.platform.launcher.listeners.SummaryGeneratingListener; import org.junit.platform.launcher.listeners.TestExecutionSummary; +import java.io.PrintWriter; + +import static org.junit.platform.engine.discovery.ClassNameFilter.includeClassNamePatterns; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage; + public class RunJUnit5Tests { SummaryGeneratingListener listener = new SummaryGeneratingListener(); public void runOne() { LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder .request() - .selectors(selectClass(RotateListUnitTest.class)) + .selectors(selectClass(FirstUnitTest.class)) .build(); Launcher launcher = LauncherFactory.create(); TestPlan testPlan = launcher.discover(request); diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SecondUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SecondUnitTest.java new file mode 100644 index 0000000000..fbfb68898b --- /dev/null +++ b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SecondUnitTest.java @@ -0,0 +1,18 @@ +package com.baeldung.junit5.runfromjava; + +import org.junit.jupiter.api.RepeatedTest; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +class SecondUnitTest { + + @RepeatedTest(10) + void whenSomething_thenSomething() { + assertTrue(true); + } + + @RepeatedTest(5) + void whenSomethingElse_thenSomethingElse() { + assertTrue(true); + } +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SwapNodesUnitTest.java b/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SwapNodesUnitTest.java deleted file mode 100644 index 73e3ff07fa..0000000000 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/SwapNodesUnitTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.junit5.runfromjava; - -import static org.junit.jupiter.api.Assertions.*; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import com.baeldung.junit.runfromjava.listnode.ListNode; -import com.baeldung.junit.runfromjava.listnode.SwapNodes; - -class SwapNodesUnitTest { - private SwapNodes swapNodes; - private ListNode listNode; - - @BeforeEach - void setUp() throws Exception { - swapNodes = new SwapNodes(); - listNode = new ListNode(42, new ListNode(666, new ListNode(15, new ListNode(3, null)))); - } - - @Test - void whenSwappingPairs_thenReturnExpectedList() { - assertEquals(swapNodes.swapPairs(listNode) - .toString(), "666->42->3->15"); - } - -} From b92dd4c51bf948f4b63cec80e671e23bac06dab4 Mon Sep 17 00:00:00 2001 From: cdjole Date: Fri, 3 Aug 2018 12:33:39 +0200 Subject: [PATCH 108/298] Spring Boot and Angular E-Commerce Application (#4874) * Spring Boot and Angular E-Commerce Application * Spring Boot and Angular E-Commerce Application pom.xml updated * Spring Boot and Angular E-Commerce Application tests added --- .gitignore | 7 +- pom.xml | 153 +- spring-boot-angular-ecommerce/README.md | 2 + spring-boot-angular-ecommerce/pom.xml | 84 + .../src/main/frontend/.editorconfig | 13 + .../src/main/frontend/README.md | 27 + .../src/main/frontend/angular.json | 128 + .../src/main/frontend/e2e/protractor.conf.js | 28 + .../src/main/frontend/e2e/src/app.e2e-spec.ts | 14 + .../src/main/frontend/e2e/src/app.po.ts | 11 + .../src/main/frontend/e2e/tsconfig.e2e.json | 13 + .../src/main/frontend/package-lock.json | 10591 ++++++++++++++++ .../src/main/frontend/package.json | 49 + .../src/main/frontend/proxy-conf.json | 6 + .../main/frontend/src/app/app.component.css | 3 + .../main/frontend/src/app/app.component.html | 3 + .../frontend/src/app/app.component.spec.ts | 27 + .../main/frontend/src/app/app.component.ts | 12 + .../src/main/frontend/src/app/app.module.ts | 31 + .../src/app/ecommerce/ecommerce.component.css | 0 .../app/ecommerce/ecommerce.component.html | 31 + .../app/ecommerce/ecommerce.component.spec.ts | 25 + .../src/app/ecommerce/ecommerce.component.ts | 44 + .../ecommerce/models/product-order.model.ts | 11 + .../ecommerce/models/product-orders.model.ts | 5 + .../src/app/ecommerce/models/product.model.ts | 13 + .../app/ecommerce/orders/orders.component.css | 0 .../ecommerce/orders/orders.component.html | 13 + .../ecommerce/orders/orders.component.spec.ts | 25 + .../app/ecommerce/orders/orders.component.ts | 39 + .../ecommerce/products/products.component.css | 4 + .../products/products.component.html | 28 + .../products/products.component.spec.ts | 25 + .../ecommerce/products/products.component.ts | 82 + .../ecommerce/services/EcommerceService.ts | 62 + .../shopping-cart/shopping-cart.component.css | 0 .../shopping-cart.component.html | 18 + .../shopping-cart.component.spec.ts | 25 + .../shopping-cart/shopping-cart.component.ts | 76 + .../src/main/frontend/src/assets/.gitkeep | 0 .../src/main/frontend/src/browserslist | 9 + .../src/environments/environment.prod.ts | 3 + .../frontend/src/environments/environment.ts | 15 + .../src/main/frontend/src/favicon.ico | Bin 0 -> 5430 bytes .../src/main/frontend/src/index.html | 14 + .../src/main/frontend/src/karma.conf.js | 31 + .../src/main/frontend/src/main.ts | 12 + .../src/main/frontend/src/polyfills.ts | 80 + .../src/main/frontend/src/styles.css | 1 + .../src/main/frontend/src/test.ts | 20 + .../src/main/frontend/src/tsconfig.app.json | 12 + .../src/main/frontend/src/tsconfig.spec.json | 19 + .../src/main/frontend/src/tslint.json | 17 + .../src/main/frontend/tsconfig.json | 20 + .../src/main/frontend/tslint.json | 130 + .../ecommerce/EcommerceApplication.java | 29 + .../ecommerce/controller/OrderController.java | 99 + .../controller/ProductController.java | 25 + .../ecommerce/dto/OrderProductDto.java | 25 + .../exception/ApiExceptionHandler.java | 81 + .../exception/ResourceNotFoundException.java | 22 + .../com/baeldung/ecommerce/model/Order.java | 78 + .../ecommerce/model/OrderProduct.java | 87 + .../ecommerce/model/OrderProductPK.java | 91 + .../baeldung/ecommerce/model/OrderStatus.java | 5 + .../com/baeldung/ecommerce/model/Product.java | 62 + .../repository/OrderProductRepository.java | 8 + .../ecommerce/repository/OrderRepository.java | 7 + .../repository/ProductRepository.java | 7 + .../service/OrderProductService.java | 13 + .../service/OrderProductServiceImpl.java | 22 + .../ecommerce/service/OrderService.java | 17 + .../ecommerce/service/OrderServiceImpl.java | 36 + .../ecommerce/service/ProductService.java | 17 + .../ecommerce/service/ProductServiceImpl.java | 35 + .../src/main/resources/application.properties | 8 + .../EcommerceApplicationIntegrationTest.java | 100 + 77 files changed, 12908 insertions(+), 77 deletions(-) create mode 100644 spring-boot-angular-ecommerce/README.md create mode 100644 spring-boot-angular-ecommerce/pom.xml create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/.editorconfig create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/README.md create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/angular.json create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/e2e/protractor.conf.js create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/e2e/src/app.e2e-spec.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/e2e/src/app.po.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/e2e/tsconfig.e2e.json create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/package-lock.json create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/package.json create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/proxy-conf.json create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.css create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.html create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.spec.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/app.module.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.css create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.html create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.spec.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-order.model.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-orders.model.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product.model.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.css create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.html create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.spec.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.css create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.html create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.spec.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/services/EcommerceService.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.css create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.html create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.spec.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/assets/.gitkeep create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/browserslist create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.prod.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/favicon.ico create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/index.html create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/karma.conf.js create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/main.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/polyfills.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/styles.css create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/test.ts create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.app.json create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.spec.json create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/src/tslint.json create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/tsconfig.json create mode 100644 spring-boot-angular-ecommerce/src/main/frontend/tslint.json create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/EcommerceApplication.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/OrderController.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/ProductController.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/dto/OrderProductDto.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ApiExceptionHandler.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ResourceNotFoundException.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Order.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProduct.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProductPK.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderStatus.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Product.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderProductRepository.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderRepository.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/ProductRepository.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductService.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductServiceImpl.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderService.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderServiceImpl.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductService.java create mode 100644 spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductServiceImpl.java create mode 100644 spring-boot-angular-ecommerce/src/main/resources/application.properties create mode 100644 spring-boot-angular-ecommerce/src/test/java/com/baeldung/ecommerce/EcommerceApplicationIntegrationTest.java diff --git a/.gitignore b/.gitignore index a0a519c8cb..180462a32f 100644 --- a/.gitignore +++ b/.gitignore @@ -56,4 +56,9 @@ core-java-io/hard_link.txt core-java-io/target_link.txt core-java/src/main/java/com/baeldung/manifest/MANIFEST.MF ethereum/logs/ -jmeter/src/main/resources/*-JMeter.csv \ No newline at end of file +jmeter/src/main/resources/*-JMeter.csv + +**/node_modules/ +**/dist +**/tmp +**/out-tsc diff --git a/pom.xml b/pom.xml index 3ad0f5a7c5..7386111e84 100644 --- a/pom.xml +++ b/pom.xml @@ -197,7 +197,7 @@ - org.eclipse.m2e @@ -552,7 +552,8 @@ spring-reactive-kotlin jnosql testing-modules/junit-abstract - sse-jaxrs + sse-jaxrs + spring-boot-angular-ecommerce @@ -601,35 +602,35 @@ - @@ -672,7 +673,7 @@ spring-amqp-simple spring-apache-camel spring-batch - testing-modules/junit-abstract + testing-modules/junit-abstract @@ -752,37 +753,37 @@ - @@ -795,7 +796,7 @@ integration-lite - + @@ -834,7 +835,7 @@ parent-spring-4 parent-spring-5 parent-java - + asm atomix apache-cayenne @@ -861,7 +862,7 @@ core-java-io core-java-8 core-groovy - + couchbase deltaspike dozer @@ -1078,16 +1079,16 @@ antlr maven-archetype apache-meecrowave - testing-modules/junit-abstract - + testing-modules/junit-abstract + spring-hibernate4 xml vertx metrics httpclient - + - - + - - + @@ -1121,7 +1122,7 @@ integration-heavy - + @@ -1160,7 +1161,7 @@ parent-spring-4 parent-spring-5 parent-java - + libraries geotools jhipster/jhipster-monolithic @@ -1238,4 +1239,4 @@ 3.8 - \ No newline at end of file + diff --git a/spring-boot-angular-ecommerce/README.md b/spring-boot-angular-ecommerce/README.md new file mode 100644 index 0000000000..933059bc45 --- /dev/null +++ b/spring-boot-angular-ecommerce/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [A Simple E-Commerce Implementation with Spring]() diff --git a/spring-boot-angular-ecommerce/pom.xml b/spring-boot-angular-ecommerce/pom.xml new file mode 100644 index 0000000000..dc92a91d02 --- /dev/null +++ b/spring-boot-angular-ecommerce/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + + spring-boot-angular-ecommerce + 0.0.1-SNAPSHOT + jar + + spring-boot-angular-ecommerce + Spring Boot Angular E-commerce Appliciation + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + + + + org.springframework.boot + spring-boot-starter-data-jpa + ${spring.boot.version} + + + org.springframework.boot + spring-boot-starter-web + ${spring.boot.version} + + + org.springframework.boot + spring-boot-devtools + ${spring.boot.version} + runtime + + + com.h2database + h2 + 1.4.197 + runtime + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + 2.9.6 + + + org.springframework.boot + spring-boot-starter-test + ${spring.boot.version} + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + + + UTF-8 + UTF-8 + 1.8 + 2.0.3.RELEASE + 2.0.4.RELEASE + + diff --git a/spring-boot-angular-ecommerce/src/main/frontend/.editorconfig b/spring-boot-angular-ecommerce/src/main/frontend/.editorconfig new file mode 100644 index 0000000000..9b7352176a --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/.editorconfig @@ -0,0 +1,13 @@ +# Editor configuration, see http://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/spring-boot-angular-ecommerce/src/main/frontend/README.md b/spring-boot-angular-ecommerce/src/main/frontend/README.md new file mode 100644 index 0000000000..4217895796 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/README.md @@ -0,0 +1,27 @@ +# Frontend + +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8. + +## Development server + +Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. + +## Code scaffolding + +Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. + +## Build + +Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. + +## Running unit tests + +Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Running end-to-end tests + +Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). diff --git a/spring-boot-angular-ecommerce/src/main/frontend/angular.json b/spring-boot-angular-ecommerce/src/main/frontend/angular.json new file mode 100644 index 0000000000..815c461f30 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/angular.json @@ -0,0 +1,128 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "frontend": { + "root": "", + "sourceRoot": "src", + "projectType": "application", + "prefix": "app", + "schematics": {}, + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/frontend", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "src/tsconfig.app.json", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "node_modules/bootstrap/dist/css/bootstrap.min.css", + "src/styles.css" + ], + "scripts": [] + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "frontend:build" + }, + "configurations": { + "production": { + "browserTarget": "frontend:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "frontend:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "src/tsconfig.spec.json", + "karmaConfig": "src/karma.conf.js", + "styles": [ + "src/styles.css" + ], + "scripts": [], + "assets": [ + "src/favicon.ico", + "src/assets" + ] + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "src/tsconfig.app.json", + "src/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + } + } + }, + "frontend-e2e": { + "root": "e2e/", + "projectType": "application", + "architect": { + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "e2e/protractor.conf.js", + "devServerTarget": "frontend:serve" + }, + "configurations": { + "production": { + "devServerTarget": "frontend:serve:production" + } + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": "e2e/tsconfig.e2e.json", + "exclude": [ + "**/node_modules/**" + ] + } + } + } + } + }, + "defaultProject": "frontend" +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/e2e/protractor.conf.js b/spring-boot-angular-ecommerce/src/main/frontend/e2e/protractor.conf.js new file mode 100644 index 0000000000..86776a391a --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/e2e/protractor.conf.js @@ -0,0 +1,28 @@ +// Protractor configuration file, see link for more information +// https://github.com/angular/protractor/blob/master/lib/config.ts + +const { SpecReporter } = require('jasmine-spec-reporter'); + +exports.config = { + allScriptsTimeout: 11000, + specs: [ + './src/**/*.e2e-spec.ts' + ], + capabilities: { + 'browserName': 'chrome' + }, + directConnect: true, + baseUrl: 'http://localhost:4200/', + framework: 'jasmine', + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000, + print: function() {} + }, + onPrepare() { + require('ts-node').register({ + project: require('path').join(__dirname, './tsconfig.e2e.json') + }); + jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); + } +}; \ No newline at end of file diff --git a/spring-boot-angular-ecommerce/src/main/frontend/e2e/src/app.e2e-spec.ts b/spring-boot-angular-ecommerce/src/main/frontend/e2e/src/app.e2e-spec.ts new file mode 100644 index 0000000000..87525cf2c7 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/e2e/src/app.e2e-spec.ts @@ -0,0 +1,14 @@ +import { AppPage } from './app.po'; + +describe('workspace-project App', () => { + let page: AppPage; + + beforeEach(() => { + page = new AppPage(); + }); + + it('should display welcome message', () => { + page.navigateTo(); + expect(page.getParagraphText()).toEqual('Welcome to frontend!'); + }); +}); diff --git a/spring-boot-angular-ecommerce/src/main/frontend/e2e/src/app.po.ts b/spring-boot-angular-ecommerce/src/main/frontend/e2e/src/app.po.ts new file mode 100644 index 0000000000..82ea75ba50 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/e2e/src/app.po.ts @@ -0,0 +1,11 @@ +import { browser, by, element } from 'protractor'; + +export class AppPage { + navigateTo() { + return browser.get('/'); + } + + getParagraphText() { + return element(by.css('app-root h1')).getText(); + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/e2e/tsconfig.e2e.json b/spring-boot-angular-ecommerce/src/main/frontend/e2e/tsconfig.e2e.json new file mode 100644 index 0000000000..a6dd622028 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/e2e/tsconfig.e2e.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "module": "commonjs", + "target": "es5", + "types": [ + "jasmine", + "jasminewd2", + "node" + ] + } +} \ No newline at end of file diff --git a/spring-boot-angular-ecommerce/src/main/frontend/package-lock.json b/spring-boot-angular-ecommerce/src/main/frontend/package-lock.json new file mode 100644 index 0000000000..d87b39cad5 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/package-lock.json @@ -0,0 +1,10591 @@ +{ + "name": "frontend", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@angular-devkit/architect": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.6.8.tgz", + "integrity": "sha512-ZKTm/zC61iY9IBHOEAKoMSzZpvhkmv+1O/HHzpHEuR551jCzu6vSyCmMY9Z7GBcccscCV+hjeSMwgFrFRcqlkw==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.6.8", + "rxjs": "^6.0.0" + } + }, + "@angular-devkit/build-angular": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-0.6.8.tgz", + "integrity": "sha512-VGqYAk8jpISraz2UHfsDre270NOUmV0CTSZw2p9sm5g/XIr5m+IHetFZz3gpoAr9+If2aFTs8Rt3sGdCRzwBqA==", + "dev": true, + "requires": { + "@angular-devkit/architect": "0.6.8", + "@angular-devkit/build-optimizer": "0.6.8", + "@angular-devkit/core": "0.6.8", + "@ngtools/webpack": "6.0.8", + "ajv": "~6.4.0", + "autoprefixer": "^8.4.1", + "cache-loader": "^1.2.2", + "chalk": "~2.2.2", + "circular-dependency-plugin": "^5.0.2", + "clean-css": "^4.1.11", + "copy-webpack-plugin": "^4.5.1", + "file-loader": "^1.1.11", + "glob": "^7.0.3", + "html-webpack-plugin": "^3.0.6", + "istanbul": "^0.4.5", + "istanbul-instrumenter-loader": "^3.0.1", + "karma-source-map-support": "^1.2.0", + "less": "^3.0.4", + "less-loader": "^4.1.0", + "license-webpack-plugin": "^1.3.1", + "lodash": "^4.17.4", + "memory-fs": "^0.4.1", + "mini-css-extract-plugin": "~0.4.0", + "minimatch": "^3.0.4", + "node-sass": "^4.9.0", + "opn": "^5.1.0", + "parse5": "^4.0.0", + "portfinder": "^1.0.13", + "postcss": "^6.0.22", + "postcss-import": "^11.1.0", + "postcss-loader": "^2.1.5", + "postcss-url": "^7.3.2", + "raw-loader": "^0.5.1", + "resolve": "^1.5.0", + "rxjs": "^6.0.0", + "sass-loader": "^7.0.1", + "silent-error": "^1.1.0", + "source-map-support": "^0.5.0", + "stats-webpack-plugin": "^0.6.2", + "style-loader": "^0.21.0", + "stylus": "^0.54.5", + "stylus-loader": "^3.0.2", + "tree-kill": "^1.2.0", + "uglifyjs-webpack-plugin": "^1.2.5", + "url-loader": "^1.0.1", + "webpack": "~4.8.1", + "webpack-dev-middleware": "^3.1.3", + "webpack-dev-server": "^3.1.4", + "webpack-merge": "^4.1.2", + "webpack-sources": "^1.1.0", + "webpack-subresource-integrity": "^1.1.0-rc.4" + } + }, + "@angular-devkit/build-optimizer": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/build-optimizer/-/build-optimizer-0.6.8.tgz", + "integrity": "sha512-of5syQbv3uNPp4AQkfRecfnp8AE8kvffbfYi+FFPZ6OGr7e59T1fGwk6+Zgb2qQFQg8HO2tzWI/uygtLIqmbmw==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "source-map": "^0.5.6", + "typescript": "~2.9.1", + "webpack-sources": "^1.1.0" + }, + "dependencies": { + "typescript": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "dev": true + } + } + }, + "@angular-devkit/core": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-0.6.8.tgz", + "integrity": "sha512-rkIa1OSVWTt4g9leLSK/PsqOj3HZbDKHbZjqlslyfVa3AyCeiumFoOgViOVXlYgPX3HHDbE5uH24nyUWSD8uww==", + "dev": true, + "requires": { + "ajv": "~6.4.0", + "chokidar": "^2.0.3", + "rxjs": "^6.0.0", + "source-map": "^0.5.6" + } + }, + "@angular-devkit/schematics": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-0.6.8.tgz", + "integrity": "sha512-R4YqAUdo62wtrhX/5HSRGSKXNTWqfQb66ZE6m8jj6GEJNFKdNXMdxOchxr07LCiKTxfh1w6G3nGzxIsu/+D4KA==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.6.8", + "rxjs": "^6.0.0" + } + }, + "@angular/animations": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-6.0.9.tgz", + "integrity": "sha512-UJTHlxVGZLefCDxTS7T0qZxrAIaQ8gGghHwDI7F3QXpXZTsAk4nHiGSt2EvneW5o6io83i6Hpr/9Fde+YvzWNg==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/cli": { + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-6.0.8.tgz", + "integrity": "sha512-DhH1Zq5Yonthw6zh6W07fhf+9XrAZbD1fcQ0MrmbxlieCfLlTAdBqyK2LavFCKwSZkUMLF6UHM3+jiNRVZSSIg==", + "dev": true, + "requires": { + "@angular-devkit/architect": "0.6.8", + "@angular-devkit/core": "0.6.8", + "@angular-devkit/schematics": "0.6.8", + "@schematics/angular": "0.6.8", + "@schematics/update": "0.6.8", + "opn": "~5.3.0", + "resolve": "^1.1.7", + "rxjs": "^6.0.0", + "semver": "^5.1.0", + "silent-error": "^1.0.0", + "symbol-observable": "^1.2.0", + "yargs-parser": "^10.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "@angular/common": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/common/-/common-6.0.9.tgz", + "integrity": "sha512-zjJ9WDW9787sTRiNeUvQaCvGZJu1dI8A3fYtSL8BKrGhxLsf24cSa3ljbrSmtIsCGImNxTToHzPFXo4sx2dvYg==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/compiler": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-6.0.9.tgz", + "integrity": "sha512-/A6U/W0settfkh3tmX9p3t7+OyZ0c2sIJMlQjhfF36do0ylnIl4wuqJtHF0BWr/wmmbQzg+qAsQyWrx8vp+2Iw==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/compiler-cli": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-6.0.9.tgz", + "integrity": "sha512-v3C5RyJLKoDcQocDt/U195t9v8UpBH+mwVaBkEM+nLkZAGC1Uvg9nPuUXisOwljuMm9VtOWG3A8hKQ5ZYieNBg==", + "dev": true, + "requires": { + "chokidar": "^1.4.2", + "minimist": "^1.2.0", + "reflect-metadata": "^0.1.2", + "tsickle": "^0.29.0" + }, + "dependencies": { + "anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "@angular/core": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/core/-/core-6.0.9.tgz", + "integrity": "sha512-NeEUgymsR/tLvWeEAA4mGEX/S4hHbIo/2uwPGGAQAvzlk+pL7xqPoFSMKeqQahdTnWSmYa/2+X33OdJgXKKXyg==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/forms": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-6.0.9.tgz", + "integrity": "sha512-hZxzoO/QAd9EetNUdGpb5Wiw4Lb7R+iOCjdV8sh+C8q6Ow5G35/dfiAlNanGXVqSi8e6Qqm1aO/r4cTUWFm6vw==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/http": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/http/-/http-6.0.9.tgz", + "integrity": "sha512-JaYvBQQ+hJ7SKqZ+zw4C20lc7b6U5kK50nSkams10tzhITke6L/+wK8g3kiNu4XcqE5nqcIN8S95UkMGPMsa7Q==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/language-service": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/language-service/-/language-service-6.0.9.tgz", + "integrity": "sha512-a9/Ee1DfRlj4duhDW17xl+52mO6zKlBLm3JOIyANrmJqoHCf/Nfvw3OmEhjMJ1A8O6xLCXyPF/Fq0WD9BfVSrg==", + "dev": true + }, + "@angular/platform-browser": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-6.0.9.tgz", + "integrity": "sha512-q/1UGlbWBwZ6c63p8SDmBsgjYgMQUxyByY9GGt0hd5XhOfVFzvBSzybKSRc3FBhmxQJMCtVhEbI0kIzqrDxcWg==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/platform-browser-dynamic": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-6.0.9.tgz", + "integrity": "sha512-HsmLafy0hpMIZlwHz1XRicXczZWCKb0H6oCY+TepFV4u3SLZgJEO7/HZrhO0kEviipXuXrgZSpafV3IYP6eWPQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@angular/router": { + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/@angular/router/-/router-6.0.9.tgz", + "integrity": "sha512-kS489FFpGWD4GEDDozfVb+eD5qf1E9cLYgsE7RO914uNMh/sJuRZt9PVu0bcX12fOOO7mTcOiWtlkefzUAJbkA==", + "requires": { + "tslib": "^1.9.0" + } + }, + "@ngtools/webpack": { + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-6.0.8.tgz", + "integrity": "sha512-jorGpTd82ILbyUwg4JQekovHFaYwSMlZan4f7x+sd3+2WgyL3Z1+ZbVSGKvXZWKS/mAVx7eLkRikzJkuC4FgHw==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.6.8", + "tree-kill": "^1.0.0", + "webpack-sources": "^1.1.0" + } + }, + "@schematics/angular": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-0.6.8.tgz", + "integrity": "sha512-9kRphqTYG5Df/I8fvnT1zMsw0YNDPO9tl18tQZXj4am4raT7l9UCr+WkwJdlBoA5pwG6baWE9sL0iGWV/bzF/g==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.6.8", + "@angular-devkit/schematics": "0.6.8", + "typescript": ">=2.6.2 <2.8" + } + }, + "@schematics/update": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/@schematics/update/-/update-0.6.8.tgz", + "integrity": "sha512-1Uq7LYnwL2wBwGVCgNz76QAR13ghAk+2vDDHOi+VX5+usHManxydrpoMGeX66OBPd+y5D3D2MFb+8mYHE7mygg==", + "dev": true, + "requires": { + "@angular-devkit/core": "0.6.8", + "@angular-devkit/schematics": "0.6.8", + "npm-registry-client": "^8.5.1", + "rxjs": "^6.0.0", + "semver": "^5.3.0", + "semver-intersect": "^1.1.2" + } + }, + "@types/jasmine": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.8.8.tgz", + "integrity": "sha512-OJSUxLaxXsjjhob2DBzqzgrkLmukM3+JMpRp0r0E4HTdT1nwDCWhaswjYxazPij6uOdzHCJfNbDjmQ1/rnNbCg==", + "dev": true + }, + "@types/jasminewd2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/jasminewd2/-/jasminewd2-2.0.3.tgz", + "integrity": "sha512-hYDVmQZT5VA2kigd4H4bv7vl/OhlympwREUemqBdOqtrYTo5Ytm12a5W5/nGgGYdanGVxj0x/VhZ7J3hOg/YKg==", + "dev": true, + "requires": { + "@types/jasmine": "*" + } + }, + "@types/node": { + "version": "8.9.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.9.5.tgz", + "integrity": "sha512-jRHfWsvyMtXdbhnz5CVHxaBgnV6duZnPlQuRSo/dm/GnmikNcmZhxIES4E9OZjUmQ8C+HCl4KJux+cXN/ErGDQ==", + "dev": true + }, + "@types/q": { + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/@types/q/-/q-0.0.32.tgz", + "integrity": "sha1-vShOV8hPEyXacCur/IKlMoGQwMU=", + "dev": true + }, + "@types/selenium-webdriver": { + "version": "2.53.43", + "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-2.53.43.tgz", + "integrity": "sha512-UBYHWph6P3tutkbXpW6XYg9ZPbTKjw/YC2hGG1/GEvWwTbvezBUv3h+mmUFw79T3RFPnmedpiXdOBbXX+4l0jg==", + "dev": true + }, + "@webassemblyjs/ast": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.4.3.tgz", + "integrity": "sha512-S6npYhPcTHDYe9nlsKa9CyWByFi8Vj8HovcAgtmMAQZUOczOZbQ8CnwMYKYC5HEZzxEE+oY0jfQk4cVlI3J59Q==", + "dev": true, + "requires": { + "@webassemblyjs/helper-wasm-bytecode": "1.4.3", + "@webassemblyjs/wast-parser": "1.4.3", + "debug": "^3.1.0", + "webassemblyjs": "1.4.3" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.4.3.tgz", + "integrity": "sha512-3zTkSFswwZOPNHnzkP9ONq4bjJSeKVMcuahGXubrlLmZP8fmTIJ58dW7h/zOVWiFSuG2em3/HH3BlCN7wyu9Rw==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.4.3.tgz", + "integrity": "sha512-e8+KZHh+RV8MUvoSRtuT1sFXskFnWG9vbDy47Oa166xX+l0dD5sERJ21g5/tcH8Yo95e9IN3u7Jc3NbhnUcSkw==", + "dev": true, + "requires": { + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.4.3.tgz", + "integrity": "sha512-9FgHEtNsZQYaKrGCtsjswBil48Qp1agrzRcPzCbQloCoaTbOXLJ9IRmqT+uEZbenpULLRNFugz3I4uw18hJM8w==", + "dev": true, + "requires": { + "@webassemblyjs/wast-printer": "1.4.3" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.4.3.tgz", + "integrity": "sha512-JINY76U+702IRf7ePukOt037RwmtH59JHvcdWbTTyHi18ixmQ+uOuNhcdCcQHTquDAH35/QgFlp3Y9KqtyJsCQ==", + "dev": true + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.4.3.tgz", + "integrity": "sha512-I7bS+HaO0K07Io89qhJv+z1QipTpuramGwUSDkwEaficbSvCcL92CUZEtgykfNtk5wb0CoLQwWlmXTwGbNZUeQ==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.4.3.tgz", + "integrity": "sha512-p0yeeO/h2r30PyjnJX9xXSR6EDcvJd/jC6xa/Pxg4lpfcNi7JUswOpqDToZQ55HMMVhXDih/yqkaywHWGLxqyQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3", + "@webassemblyjs/helper-buffer": "1.4.3", + "@webassemblyjs/helper-wasm-bytecode": "1.4.3", + "@webassemblyjs/wasm-gen": "1.4.3", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "@webassemblyjs/leb128": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.4.3.tgz", + "integrity": "sha512-4u0LJLSPzuRDWHwdqsrThYn+WqMFVqbI2ltNrHvZZkzFPO8XOZ0HFQ5eVc4jY/TNHgXcnwrHjONhPGYuuf//KQ==", + "dev": true, + "requires": { + "leb": "^0.3.0" + } + }, + "@webassemblyjs/validation": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/validation/-/validation-1.4.3.tgz", + "integrity": "sha512-R+rRMKfhd9mq0rj2mhU9A9NKI2l/Rw65vIYzz4lui7eTKPcCu1l7iZNi4b9Gen8D42Sqh/KGiaQNk/x5Tn/iBQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3" + } + }, + "@webassemblyjs/wasm-edit": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.4.3.tgz", + "integrity": "sha512-qzuwUn771PV6/LilqkXcS0ozJYAeY/OKbXIWU3a8gexuqb6De2p4ya/baBeH5JQ2WJdfhWhSvSbu86Vienttpw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3", + "@webassemblyjs/helper-buffer": "1.4.3", + "@webassemblyjs/helper-wasm-bytecode": "1.4.3", + "@webassemblyjs/helper-wasm-section": "1.4.3", + "@webassemblyjs/wasm-gen": "1.4.3", + "@webassemblyjs/wasm-opt": "1.4.3", + "@webassemblyjs/wasm-parser": "1.4.3", + "@webassemblyjs/wast-printer": "1.4.3", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.4.3.tgz", + "integrity": "sha512-eR394T8dHZfpLJ7U/Z5pFSvxl1L63JdREebpv9gYc55zLhzzdJPAuxjBYT4XqevUdW67qU2s0nNA3kBuNJHbaQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3", + "@webassemblyjs/helper-wasm-bytecode": "1.4.3", + "@webassemblyjs/leb128": "1.4.3" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.4.3.tgz", + "integrity": "sha512-7Gp+nschuKiDuAL1xmp4Xz0rgEbxioFXw4nCFYEmy+ytynhBnTeGc9W9cB1XRu1w8pqRU2lbj2VBBA4cL5Z2Kw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3", + "@webassemblyjs/helper-buffer": "1.4.3", + "@webassemblyjs/wasm-gen": "1.4.3", + "@webassemblyjs/wasm-parser": "1.4.3", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.4.3.tgz", + "integrity": "sha512-KXBjtlwA3BVukR/yWHC9GF+SCzBcgj0a7lm92kTOaa4cbjaTaa47bCjXw6cX4SGQpkncB9PU2hHGYVyyI7wFRg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3", + "@webassemblyjs/helper-wasm-bytecode": "1.4.3", + "@webassemblyjs/leb128": "1.4.3", + "@webassemblyjs/wasm-parser": "1.4.3", + "webassemblyjs": "1.4.3" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.4.3.tgz", + "integrity": "sha512-QhCsQzqV0CpsEkRYyTzQDilCNUZ+5j92f+g35bHHNqS22FppNTywNFfHPq8ZWZfYCgbectc+PoghD+xfzVFh1Q==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3", + "@webassemblyjs/floating-point-hex-parser": "1.4.3", + "@webassemblyjs/helper-code-frame": "1.4.3", + "@webassemblyjs/helper-fsm": "1.4.3", + "long": "^3.2.0", + "webassemblyjs": "1.4.3" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.4.3.tgz", + "integrity": "sha512-EgXk4anf8jKmuZJsqD8qy5bz2frEQhBvZruv+bqwNoLWUItjNSFygk8ywL3JTEz9KtxTlAmqTXNrdD1d9gNDtg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3", + "@webassemblyjs/wast-parser": "1.4.3", + "long": "^3.2.0" + } + }, + "@webpack-contrib/schema-utils": { + "version": "1.0.0-beta.0", + "resolved": "https://registry.npmjs.org/@webpack-contrib/schema-utils/-/schema-utils-1.0.0-beta.0.tgz", + "integrity": "sha512-LonryJP+FxQQHsjGBi6W786TQB1Oym+agTpY0c+Kj8alnIw+DLUJb6SI8Y1GHGhLCH1yPRrucjObUmxNICQ1pg==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0", + "chalk": "^2.3.2", + "strip-ansi": "^4.0.0", + "text-table": "^0.2.0", + "webpack-log": "^1.1.2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "dev": true + }, + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "dev": true, + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "acorn": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", + "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==", + "dev": true + }, + "acorn-dynamic-import": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", + "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", + "dev": true, + "requires": { + "acorn": "^5.0.0" + } + }, + "adm-zip": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.4.tgz", + "integrity": "sha1-ph7VrmkFw66lizplfSUDMJEFJzY=", + "dev": true + }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", + "dev": true + }, + "agent-base": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "ajv": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.4.0.tgz", + "integrity": "sha1-06/3jpJ3VJdx2vAWTP9ISCt1T8Y=", + "dev": true, + "requires": { + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0", + "uri-js": "^3.0.2" + } + }, + "ajv-keywords": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", + "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", + "dev": true + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-html": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", + "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "app-root-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-2.1.0.tgz", + "integrity": "sha1-mL9lmTJ+zqGZMJhm6BQDaP0uZGo=", + "dev": true + }, + "append-transform": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-1.0.0.tgz", + "integrity": "sha512-P009oYkeHyU742iSZJzZZywj4QRJdnTWffaKuJQLablCZ1uz6/cW4yaRgcDaoQ+uwOxxnt0gRUcwfsNP2ri0gw==", + "dev": true, + "requires": { + "default-require-extensions": "^2.0.0" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-flatten": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.1.tgz", + "integrity": "sha1-Qmu52oQJDBg42BLIFQryCoMx4pY=", + "dev": true + }, + "array-includes": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", + "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.7.0" + } + }, + "array-slice": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", + "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arraybuffer.slice": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", + "integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true, + "optional": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "dev": true, + "requires": { + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "async-foreach": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", + "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=", + "dev": true, + "optional": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", + "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", + "dev": true + }, + "autoprefixer": { + "version": "8.6.5", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-8.6.5.tgz", + "integrity": "sha512-PLWJN3Xo/rycNkx+mp8iBDMTm3FeWe4VmYaZDSqL5QQB9sLsQkG5k8n+LNDFnhh9kdq2K+egL/icpctOmDHwig==", + "dev": true, + "requires": { + "browserslist": "^3.2.8", + "caniuse-lite": "^1.0.30000864", + "normalize-range": "^0.1.2", + "num2fraction": "^1.2.2", + "postcss": "^6.0.23", + "postcss-value-parser": "^3.2.3" + } + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "babel-generator": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", + "dev": true, + "requires": { + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", + "dev": true + }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", + "dev": true + }, + "base64id": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz", + "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=", + "dev": true + }, + "batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "dev": true, + "requires": { + "callsite": "1.0.0" + } + }, + "big.js": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", + "dev": true + }, + "binary-extensions": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", + "dev": true + }, + "blob": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", + "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=", + "dev": true + }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "dev": true, + "optional": true, + "requires": { + "inherits": "~2.0.0" + } + }, + "blocking-proxy": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/blocking-proxy/-/blocking-proxy-1.0.1.tgz", + "integrity": "sha512-KE8NFMZr3mN2E0HcvCgRtX7DjhiIQrwle+nSVJVC/yqFb9+xznHl2ZcoBp2L9qzkI4t4cBFJ1efXF8Dwi132RA==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "bluebird": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", + "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", + "dev": true + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "dev": true + }, + "body-parser": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "dev": true, + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.1", + "http-errors": "~1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "~2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "~1.6.15" + }, + "dependencies": { + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "dev": true + } + } + }, + "bonjour": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz", + "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", + "dev": true, + "requires": { + "array-flatten": "^2.1.0", + "deep-equal": "^1.0.1", + "dns-equal": "^1.0.0", + "dns-txt": "^2.0.2", + "multicast-dns": "^6.0.1", + "multicast-dns-service-types": "^1.1.0" + } + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "bootstrap": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.1.2.tgz", + "integrity": "sha512-3bP609EdMc/8EwgGp8KgpN8HwnR4V4lZ9CTi5pImMrXNxpkw7dK1B05aMwQWpG1ZWmTLlBSN/uzkuz5GsmQNFA==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "dev": true, + "requires": { + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "browserslist": { + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz", + "integrity": "sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000844", + "electron-to-chromium": "^1.3.47" + } + }, + "buffer": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "buffer-from": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", + "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", + "dev": true + }, + "buffer-indexof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", + "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "dev": true + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, + "cacache": { + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", + "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", + "dev": true, + "requires": { + "bluebird": "^3.5.1", + "chownr": "^1.0.1", + "glob": "^7.1.2", + "graceful-fs": "^4.1.11", + "lru-cache": "^4.1.1", + "mississippi": "^2.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.2", + "ssri": "^5.2.4", + "unique-filename": "^1.1.0", + "y18n": "^4.0.0" + } + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "cache-loader": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cache-loader/-/cache-loader-1.2.2.tgz", + "integrity": "sha512-rsGh4SIYyB9glU+d0OcHwiXHXBoUgDhHZaQ1KAbiXqfz1CDPxtTboh1gPbJ0q2qdO8a9lfcjgC5CJ2Ms32y5bw==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "mkdirp": "^0.5.1", + "neo-async": "^2.5.0", + "schema-utils": "^0.4.2" + } + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", + "dev": true + }, + "camel-case": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", + "integrity": "sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=", + "dev": true, + "requires": { + "no-case": "^2.2.0", + "upper-case": "^1.1.1" + } + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, + "optional": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + } + } + }, + "caniuse-lite": { + "version": "1.0.30000865", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000865.tgz", + "integrity": "sha512-vs79o1mOSKRGv/1pSkp4EXgl4ZviWeYReXw60XfacPU64uQWZwJT6vZNmxRF9O+6zu71sJwMxLK5JXxbzuVrLw==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "optional": true, + "requires": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + } + }, + "chalk": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.2.2.tgz", + "integrity": "sha512-LvixLAQ4MYhbf7hgL4o5PeK32gJKvVzDRiSNIApDofQvyhl8adgG2lJVXn4+ekQoK7HL9RF8lqxwerpe0x2pCw==", + "dev": true, + "requires": { + "ansi-styles": "^3.1.0", + "escape-string-regexp": "^1.0.5", + "supports-color": "^4.0.0" + }, + "dependencies": { + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "^2.0.0" + } + } + } + }, + "chokidar": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", + "integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.0", + "braces": "^2.3.0", + "fsevents": "^1.2.2", + "glob-parent": "^3.1.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "lodash.debounce": "^4.0.8", + "normalize-path": "^2.1.1", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0", + "upath": "^1.0.5" + } + }, + "chownr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", + "dev": true + }, + "chrome-trace-event": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-0.1.3.tgz", + "integrity": "sha512-sjndyZHrrWiu4RY7AkHgjn80GfAM2ZSzUkZLV/Js59Ldmh6JDThf0SUmOHU53rFu2rVxxfCzJ30Ukcfch3Gb/A==", + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "circular-dependency-plugin": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/circular-dependency-plugin/-/circular-dependency-plugin-5.0.2.tgz", + "integrity": "sha512-oC7/DVAyfcY3UWKm0sN/oVoDedQDQiw/vIiAnuTWTpE5s0zWf7l3WY417Xw/Fbi/QbAjctAkxgMiS9P0s3zkmA==", + "dev": true + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "clean-css": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.1.11.tgz", + "integrity": "sha1-Ls3xRaujj1R0DybO/Q/z4D4SXWo=", + "dev": true, + "requires": { + "source-map": "0.5.x" + } + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "optional": true, + "requires": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, + "optional": true + } + } + }, + "clone": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.1.tgz", + "integrity": "sha1-0hfR6WERjjrJpLi7oyhVU79kfNs=", + "dev": true + }, + "clone-deep": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-2.0.2.tgz", + "integrity": "sha512-SZegPTKjCgpQH63E+eN6mVEEPdQBOUzjyJm5Pora4lrwWRFS8I0QAxV/KD6vV/i0WuijHZWQC1fMsPEdxfdVCQ==", + "dev": true, + "requires": { + "for-own": "^1.0.0", + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.0", + "shallow-clone": "^1.0.0" + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "codelyzer": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/codelyzer/-/codelyzer-4.2.1.tgz", + "integrity": "sha512-CKwfgpfkqi9dyzy4s6ELaxJ54QgJ6A8iTSsM4bzHbLuTpbKncvNc3DUlCvpnkHBhK47gEf4qFsWoYqLrJPhy6g==", + "dev": true, + "requires": { + "app-root-path": "^2.0.1", + "css-selector-tokenizer": "^0.7.0", + "cssauron": "^1.4.0", + "semver-dsl": "^1.0.1", + "source-map": "^0.5.6", + "sprintf-js": "^1.0.3" + } + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", + "dev": true, + "requires": { + "color-name": "1.1.1" + } + }, + "color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "combine-lists": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/combine-lists/-/combine-lists-1.0.1.tgz", + "integrity": "sha1-RYwH4J4NkA/Ci3Cj/sLazR0st/Y=", + "dev": true, + "requires": { + "lodash": "^4.5.0" + } + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.16.0.tgz", + "integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "compare-versions": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.3.0.tgz", + "integrity": "sha512-MAAAIOdi2s4Gl6rZ76PNcUa9IOYB+5ICdT41o5uMRf09aEu/F9RK+qhe8RjXNPwcTjGV7KU7h2P/fljThFVqyQ==", + "dev": true + }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", + "dev": true + }, + "compressible": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.14.tgz", + "integrity": "sha1-MmxfUH+7BV9UEWeCuWmoG2einac=", + "dev": true, + "requires": { + "mime-db": ">= 1.34.0 < 2" + } + }, + "compression": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.3.tgz", + "integrity": "sha512-HSjyBG5N1Nnz7tF2+O7A9XUhyjru71/fwgNb7oIsEVHR0WShfs2tIS/EySLgiTe98aOK18YDlMXpzjCXY/n9mg==", + "dev": true, + "requires": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.14", + "debug": "2.6.9", + "on-headers": "~1.0.1", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "connect": { + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.6.6.tgz", + "integrity": "sha1-Ce/2xVr3I24TcTWnJXSFi2eG9SQ=", + "dev": true, + "requires": { + "debug": "2.6.9", + "finalhandler": "1.1.0", + "parseurl": "~1.3.2", + "utils-merge": "1.0.1" + }, + "dependencies": { + "finalhandler": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", + "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" + } + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", + "dev": true + } + } + }, + "connect-history-api-fallback": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz", + "integrity": "sha1-sGhzk0vF40T+9hGhlqb6rgruAVo=", + "dev": true + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "^0.1.4" + } + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=", + "dev": true + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true + }, + "convert-source-map": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", + "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", + "dev": true + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "dev": true + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", + "dev": true + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "copy-webpack-plugin": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.5.2.tgz", + "integrity": "sha512-zmC33E8FFSq3AbflTvqvPvBo621H36Afsxlui91d+QyZxPIuXghfnTsa1CuqiAaCPgJoSUWfTFbKJnadZpKEbQ==", + "dev": true, + "requires": { + "cacache": "^10.0.4", + "find-cache-dir": "^1.0.0", + "globby": "^7.1.1", + "is-glob": "^4.0.0", + "loader-utils": "^1.1.0", + "minimatch": "^3.0.4", + "p-limit": "^1.0.0", + "serialize-javascript": "^1.4.0" + } + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cosmiconfig": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-4.0.0.tgz", + "integrity": "sha512-6e5vDdrXZD+t5v0L8CrurPeybg4Fmf+FCSYxXKYVAqLUtyCSbuyqE059d0kDthTNRzKVjL7QMgNpEUlsoYH3iQ==", + "dev": true, + "requires": { + "is-directory": "^0.3.1", + "js-yaml": "^3.9.0", + "parse-json": "^4.0.0", + "require-from-string": "^2.0.1" + }, + "dependencies": { + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + } + } + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", + "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", + "dev": true, + "optional": true, + "requires": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "dev": true, + "optional": true, + "requires": { + "boom": "2.x.x" + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "css-parse": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/css-parse/-/css-parse-1.7.0.tgz", + "integrity": "sha1-Mh9s9zeCpv91ERE5D8BeLGV9jJs=", + "dev": true + }, + "css-select": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", + "dev": true, + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-selector-tokenizer": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz", + "integrity": "sha1-5piEdK6MlTR3v15+/s/OzNnPTIY=", + "dev": true, + "requires": { + "cssesc": "^0.1.0", + "fastparse": "^1.1.1", + "regexpu-core": "^1.0.0" + } + }, + "css-what": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz", + "integrity": "sha1-lGfQMsOM+u+58teVASUwYvh/ob0=", + "dev": true + }, + "cssauron": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cssauron/-/cssauron-1.4.0.tgz", + "integrity": "sha1-pmAt/34EqDBtwNuaVR6S6LVmKtg=", + "dev": true, + "requires": { + "through": "X.X.X" + } + }, + "cssesc": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz", + "integrity": "sha1-yBSQPkViM3GgR3tAEJqq++6t27Q=", + "dev": true + }, + "cuint": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", + "integrity": "sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs=", + "dev": true + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "custom-event": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", + "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=", + "dev": true + }, + "cyclist": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", + "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", + "dev": true + }, + "d": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "dev": true, + "requires": { + "es5-ext": "^0.10.9" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "deep-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "default-require-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-2.0.0.tgz", + "integrity": "sha1-9fj7sYp9bVCyH2QfZJ67Uiz+JPc=", + "dev": true, + "requires": { + "strip-bom": "^3.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "define-properties": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", + "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", + "dev": true, + "requires": { + "foreach": "^2.0.5", + "object-keys": "^1.0.8" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "del": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", + "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", + "dev": true, + "requires": { + "globby": "^6.1.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "p-map": "^1.1.1", + "pify": "^3.0.0", + "rimraf": "^2.2.8" + }, + "dependencies": { + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", + "dev": true + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "detect-node": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.3.tgz", + "integrity": "sha1-ogM8CcyOFY03dI+951B4Mr1s4Sc=", + "dev": true + }, + "di": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", + "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", + "dev": true + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "dir-glob": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz", + "integrity": "sha512-37qirFDz8cA5fimp9feo43fSuRo2gHwaIn6dXL8Ber1dGwUosDrGZeCCXq57WnIqE4aQ+u3eQZzsk1yOzhdwag==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "path-type": "^3.0.0" + } + }, + "dns-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", + "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=", + "dev": true + }, + "dns-packet": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz", + "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", + "dev": true, + "requires": { + "ip": "^1.1.0", + "safe-buffer": "^5.0.1" + } + }, + "dns-txt": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz", + "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", + "dev": true, + "requires": { + "buffer-indexof": "^1.0.0" + } + }, + "dom-converter": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.1.4.tgz", + "integrity": "sha1-pF71cnuJDJv/5tfIduexnLDhfzs=", + "dev": true, + "requires": { + "utila": "~0.3" + }, + "dependencies": { + "utila": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/utila/-/utila-0.3.3.tgz", + "integrity": "sha1-1+jn1+MJEHCSsF+NloiCTWM6QiY=", + "dev": true + } + } + }, + "dom-serialize": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", + "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", + "dev": true, + "requires": { + "custom-event": "~1.0.0", + "ent": "~2.2.0", + "extend": "^3.0.0", + "void-elements": "^2.0.0" + } + }, + "dom-serializer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", + "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "dev": true, + "requires": { + "domelementtype": "~1.1.1", + "entities": "~1.1.1" + }, + "dependencies": { + "domelementtype": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", + "dev": true + } + } + }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true + }, + "domelementtype": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", + "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "dev": true + }, + "domhandler": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.1.0.tgz", + "integrity": "sha1-0mRvXlf2w7qxHPbLBdPArPdBJZQ=", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "duplexify": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", + "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", + "dev": true, + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "ejs": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.1.tgz", + "integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.52", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.52.tgz", + "integrity": "sha1-0tnxJwuko7lnuDHEDvcftNmrXOA=", + "dev": true + }, + "elliptic": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", + "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "engine.io": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.8.3.tgz", + "integrity": "sha1-jef5eJXSDTm4X4ju7nd7K9QrE9Q=", + "dev": true, + "requires": { + "accepts": "1.3.3", + "base64id": "1.0.0", + "cookie": "0.3.1", + "debug": "2.3.3", + "engine.io-parser": "1.3.2", + "ws": "1.1.2" + }, + "dependencies": { + "accepts": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz", + "integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=", + "dev": true, + "requires": { + "mime-types": "~2.1.11", + "negotiator": "0.6.1" + } + }, + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "engine.io-client": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.8.3.tgz", + "integrity": "sha1-F5jtk0USRkU9TG9jXXogH+lA1as=", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "component-inherit": "0.0.3", + "debug": "2.3.3", + "engine.io-parser": "1.3.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parsejson": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "1.1.2", + "xmlhttprequest-ssl": "1.5.3", + "yeast": "0.1.2" + }, + "dependencies": { + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "engine.io-parser": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.2.tgz", + "integrity": "sha1-k3sHnwAH0Ik+xW1GyyILjLQ1Igo=", + "dev": true, + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "0.0.6", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.4", + "has-binary": "0.1.7", + "wtf-8": "1.0.0" + } + }, + "enhanced-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", + "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.4.0", + "tapable": "^1.0.0" + } + }, + "ent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", + "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", + "dev": true + }, + "entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", + "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "dev": true + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "~1.0.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", + "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", + "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", + "dev": true, + "requires": { + "is-callable": "^1.1.1", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.1" + } + }, + "es5-ext": { + "version": "0.10.45", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.45.tgz", + "integrity": "sha512-FkfM6Vxxfmztilbxxz5UKSD4ICMf5tSpRFtDNtkAhOxZ0EKtX6qwmXNyH/sFyIbX2P/nU5AMiA9jilWsUGJzCQ==", + "dev": true, + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.1", + "next-tick": "1" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-promise": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", + "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } + }, + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escodegen": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "dev": true, + "requires": { + "esprima": "^2.7.1", + "estraverse": "^1.9.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.2.0" + }, + "dependencies": { + "source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", + "dev": true, + "optional": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "eslint-scope": { + "version": "3.7.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.3.tgz", + "integrity": "sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + }, + "dependencies": { + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + } + } + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + }, + "dependencies": { + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + } + } + }, + "estraverse": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", + "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true + }, + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==", + "dev": true + }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "dev": true + }, + "eventsource": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-0.1.6.tgz", + "integrity": "sha1-Cs7ehJ7X3RzMMsgRuxG5RNTykjI=", + "dev": true, + "requires": { + "original": ">=0.0.5" + } + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + } + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "expand-braces": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/expand-braces/-/expand-braces-0.1.2.tgz", + "integrity": "sha1-SIsdHSRRyz06axks/AMPRMWFX+o=", + "dev": true, + "requires": { + "array-slice": "^0.2.3", + "array-unique": "^0.2.1", + "braces": "^0.1.2" + }, + "dependencies": { + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-0.1.5.tgz", + "integrity": "sha1-wIVxEIUpHYt1/ddOqw+FlygHEeY=", + "dev": true, + "requires": { + "expand-range": "^0.1.0" + } + }, + "expand-range": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", + "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", + "dev": true, + "requires": { + "is-number": "^0.1.1", + "repeat-string": "^0.2.2" + } + }, + "is-number": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-0.1.1.tgz", + "integrity": "sha1-aaevEWlj1HIG7JvZtIoUIW8eOAY=", + "dev": true + }, + "repeat-string": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-0.2.2.tgz", + "integrity": "sha1-x6jTI2BoNiBZp+RlH8aITosftK4=", + "dev": true + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "^2.1.0" + }, + "dependencies": { + "fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "dev": true, + "requires": { + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" + } + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "express": { + "version": "4.16.3", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", + "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", + "dev": true, + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.2", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.3", + "qs": "6.5.1", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.1", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", + "dev": true + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "dev": true + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fastparse": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz", + "integrity": "sha1-0eJkOzipTXWDtHkGDmxK/8lAcfg=", + "dev": true + }, + "faye-websocket": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", + "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", + "dev": true, + "requires": { + "websocket-driver": ">=0.5.1" + } + }, + "file-loader": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", + "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", + "dev": true, + "requires": { + "loader-utils": "^1.0.2", + "schema-utils": "^0.4.5" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fileset": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", + "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", + "dev": true, + "requires": { + "glob": "^7.0.3", + "minimatch": "^3.0.3" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + } + }, + "find-cache-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", + "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^1.0.0", + "pkg-dir": "^2.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "flush-write-stream": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", + "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.4" + } + }, + "follow-redirects": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.1.tgz", + "integrity": "sha512-v9GI1hpaqq1ZZR6pBD1+kI7O24PhDvNGNodjS3MdcEqyrahCp8zbtpv+2B/krUnSmUH80lbAS7MrdeK5IylgKg==", + "dev": true, + "requires": { + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", + "dev": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true + }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "fs-access": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", + "dev": true, + "requires": { + "null-check": "^1.0.0" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.21", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": "^2.1.0" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "minipass": { + "version": "2.2.4", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-buffer": { + "version": "5.1.1", + "bundled": true, + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.5.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true, + "dev": true + } + } + }, + "fstream": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "gaze": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", + "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", + "dev": true, + "optional": true, + "requires": { + "globule": "^1.0.0" + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" + }, + "dependencies": { + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + } + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "globby": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz", + "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + } + }, + "globule": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/globule/-/globule-1.2.1.tgz", + "integrity": "sha512-g7QtgWF4uYSL5/dn71WxubOrS7JVGCnFPEnoeChJmBnyR9Mw8nGoEwOgJL/RC2Te0WhbsEUCejfH8SZNJ+adYQ==", + "dev": true, + "optional": true, + "requires": { + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "handle-thing": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", + "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=", + "dev": true + }, + "handlebars": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", + "dev": true, + "requires": { + "async": "^1.4.0", + "optimist": "^0.6.1", + "source-map": "^0.4.4", + "uglify-js": "^2.6" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, + "optional": true, + "requires": { + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "optional": true + } + } + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "dev": true, + "requires": { + "ajv": "^5.1.0", + "har-schema": "^2.0.0" + }, + "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + } + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-binary": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz", + "integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=", + "dev": true, + "requires": { + "isarray": "0.0.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "dev": true, + "optional": true, + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "dev": true + }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, + "hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "html-entities": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz", + "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=", + "dev": true + }, + "html-minifier": { + "version": "3.5.19", + "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.19.tgz", + "integrity": "sha512-Qr2JC9nsjK8oCrEmuB430ZIA8YWbF3D5LSjywD75FTuXmeqacwHgIM8wp3vHYzzPbklSjp53RdmDuzR4ub2HzA==", + "dev": true, + "requires": { + "camel-case": "3.0.x", + "clean-css": "4.1.x", + "commander": "2.16.x", + "he": "1.1.x", + "param-case": "2.1.x", + "relateurl": "0.2.x", + "uglify-js": "3.4.x" + } + }, + "html-webpack-plugin": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-3.2.0.tgz", + "integrity": "sha1-sBq71yOsqqeze2r0SS69oD2d03s=", + "dev": true, + "requires": { + "html-minifier": "^3.2.3", + "loader-utils": "^0.2.16", + "lodash": "^4.17.3", + "pretty-error": "^2.0.2", + "tapable": "^1.0.0", + "toposort": "^1.0.0", + "util.promisify": "1.0.0" + }, + "dependencies": { + "loader-utils": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", + "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0", + "object-assign": "^4.0.1" + } + } + } + }, + "htmlparser2": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.3.0.tgz", + "integrity": "sha1-zHDQWln2VC5D8OaFyYLhTJJKnv4=", + "dev": true, + "requires": { + "domelementtype": "1", + "domhandler": "2.1", + "domutils": "1.1", + "readable-stream": "1.0" + }, + "dependencies": { + "domutils": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.1.6.tgz", + "integrity": "sha1-vdw94Jm5ou+sxRxiPyj0FuzFdIU=", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", + "dev": true + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-parser-js": { + "version": "0.4.13", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.13.tgz", + "integrity": "sha1-O9bW/ebjFyyTNMOzO2wZPYD+ETc=", + "dev": true + }, + "http-proxy": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", + "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", + "dev": true, + "requires": { + "eventemitter3": "^3.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, + "http-proxy-middleware": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz", + "integrity": "sha512-Fs25KVMPAIIcgjMZkVHJoKg9VcXcC1C8yb9JUgeDvVXY0S/zgVIhMb+qVswDIgtJe2DfckMSY2d6TuTEutlk6Q==", + "dev": true, + "requires": { + "http-proxy": "^1.16.2", + "is-glob": "^4.0.0", + "lodash": "^4.17.5", + "micromatch": "^3.1.9" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "https-proxy-agent": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", + "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", + "dev": true, + "requires": { + "agent-base": "^4.1.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + }, + "ieee754": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", + "dev": true + }, + "iferr": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, + "ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "dev": true + }, + "image-size": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", + "integrity": "sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=", + "dev": true, + "optional": true + }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=", + "dev": true + }, + "import-cwd": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", + "integrity": "sha1-qmzzbnInYShcs3HsZRn1PiQ1sKk=", + "dev": true, + "requires": { + "import-from": "^2.1.0" + } + }, + "import-from": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-from/-/import-from-2.1.0.tgz", + "integrity": "sha1-M1238qev/VOqpHHUuAId7ja387E=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "import-local": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-1.0.0.tgz", + "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", + "dev": true, + "requires": { + "pkg-dir": "^2.0.0", + "resolve-cwd": "^2.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "in-publish": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.0.tgz", + "integrity": "sha1-4g/146KvwmkDILbcVSaCqcf631E=", + "dev": true, + "optional": true + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "internal-ip": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-1.2.0.tgz", + "integrity": "sha1-rp+/k7mEh4eF1QqN4bNWlWBYz1w=", + "dev": true, + "requires": { + "meow": "^3.3.0" + } + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "dev": true + }, + "ipaddr.js": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", + "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", + "dev": true + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "^2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "dev": true, + "requires": { + "is-path-inside": "^1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "^1.0.1" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "^1.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-symbol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", + "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isbinaryfile": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.2.tgz", + "integrity": "sha1-Sj6XTsDLqQBNP8bN5yCeppNopiE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istanbul": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", + "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", + "dev": true, + "requires": { + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" + }, + "dependencies": { + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + } + } + }, + "istanbul-api": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.3.1.tgz", + "integrity": "sha512-duj6AlLcsWNwUpfyfHt0nWIeRiZpuShnP40YTxOGQgtaN8fd6JYSxsvxUphTDy8V5MfDXo4s/xVCIIvVCO808g==", + "dev": true, + "requires": { + "async": "^2.1.4", + "compare-versions": "^3.1.0", + "fileset": "^2.0.2", + "istanbul-lib-coverage": "^1.2.0", + "istanbul-lib-hook": "^1.2.0", + "istanbul-lib-instrument": "^1.10.1", + "istanbul-lib-report": "^1.1.4", + "istanbul-lib-source-maps": "^1.2.4", + "istanbul-reports": "^1.3.0", + "js-yaml": "^3.7.0", + "mkdirp": "^0.5.1", + "once": "^1.4.0" + }, + "dependencies": { + "async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "dev": true, + "requires": { + "lodash": "^4.17.10" + } + } + } + }, + "istanbul-instrumenter-loader": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-instrumenter-loader/-/istanbul-instrumenter-loader-3.0.1.tgz", + "integrity": "sha512-a5SPObZgS0jB/ixaKSMdn6n/gXSrK2S6q/UfRJBT3e6gQmVjwZROTODQsYW5ZNwOu78hG62Y3fWlebaVOL0C+w==", + "dev": true, + "requires": { + "convert-source-map": "^1.5.0", + "istanbul-lib-instrument": "^1.7.3", + "loader-utils": "^1.1.0", + "schema-utils": "^0.3.0" + }, + "dependencies": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "schema-utils": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.3.0.tgz", + "integrity": "sha1-9YdyIs4+kx7a4DnxfrNxbnE3+M8=", + "dev": true, + "requires": { + "ajv": "^5.0.0" + } + } + } + }, + "istanbul-lib-coverage": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.2.0.tgz", + "integrity": "sha512-GvgM/uXRwm+gLlvkWHTjDAvwynZkL9ns15calTrmhGgowlwJBbWMYzWbKqE2DT6JDP1AFXKa+Zi0EkqNCUqY0A==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.2.1.tgz", + "integrity": "sha512-eLAMkPG9FU0v5L02lIkcj/2/Zlz9OuluaXikdr5iStk8FDbSwAixTK9TkYxbF0eNnzAJTwM2fkV2A1tpsIp4Jg==", + "dev": true, + "requires": { + "append-transform": "^1.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.10.1.tgz", + "integrity": "sha512-1dYuzkOCbuR5GRJqySuZdsmsNKPL3PTuyPevQfoCXJePT9C8y1ga75neU+Tuy9+yS3G/dgx8wgOmp2KLpgdoeQ==", + "dev": true, + "requires": { + "babel-generator": "^6.18.0", + "babel-template": "^6.16.0", + "babel-traverse": "^6.18.0", + "babel-types": "^6.18.0", + "babylon": "^6.18.0", + "istanbul-lib-coverage": "^1.2.0", + "semver": "^5.3.0" + } + }, + "istanbul-lib-report": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.4.tgz", + "integrity": "sha512-Azqvq5tT0U09nrncK3q82e/Zjkxa4tkFZv7E6VcqP0QCPn6oNljDPfrZEC/umNXds2t7b8sRJfs6Kmpzt8m2kA==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^1.2.0", + "mkdirp": "^0.5.1", + "path-parse": "^1.0.5", + "supports-color": "^3.1.2" + }, + "dependencies": { + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.5.tgz", + "integrity": "sha512-8O2T/3VhrQHn0XcJbP1/GN7kXMiRAlPi+fj3uEHrjBD8Oz7Py0prSC25C09NuAZS6bgW1NNKAvCSHZXB0irSGA==", + "dev": true, + "requires": { + "debug": "^3.1.0", + "istanbul-lib-coverage": "^1.2.0", + "mkdirp": "^0.5.1", + "rimraf": "^2.6.1", + "source-map": "^0.5.3" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "istanbul-reports": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.3.0.tgz", + "integrity": "sha512-y2Z2IMqE1gefWUaVjrBm0mSKvUkaBy9Vqz8iwr/r40Y9hBbIteH5wqHG/9DLTfJ9xUnUT2j7A3+VVJ6EaYBllA==", + "dev": true, + "requires": { + "handlebars": "^4.0.3" + } + }, + "jasmine": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.8.0.tgz", + "integrity": "sha1-awicChFXax8W3xG4AUbZHU6Lij4=", + "dev": true, + "requires": { + "exit": "^0.1.2", + "glob": "^7.0.6", + "jasmine-core": "~2.8.0" + }, + "dependencies": { + "jasmine-core": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.8.0.tgz", + "integrity": "sha1-vMl5rh+f0FcB5F5S5l06XWPxok4=", + "dev": true + } + } + }, + "jasmine-core": { + "version": "2.99.1", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", + "dev": true + }, + "jasmine-spec-reporter": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", + "integrity": "sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==", + "dev": true, + "requires": { + "colors": "1.1.2" + } + }, + "jasminewd2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/jasminewd2/-/jasminewd2-2.2.0.tgz", + "integrity": "sha1-43zwsX8ZnM4jvqcbIDk5Uka07E4=", + "dev": true + }, + "js-base64": { + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.8.tgz", + "integrity": "sha512-hm2nYpDrwoO/OzBhdcqs/XGT6XjSuSSCVEpia+Kl2J6x4CYt5hISlVL/AYU1khoDXv0AQVgxtdJySb9gjAn56Q==", + "dev": true, + "optional": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + } + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "optional": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true, + "optional": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jszip": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.1.5.tgz", + "integrity": "sha512-5W8NUaFRFRqTOL7ZDDrx5qWHJyBXy6velVudIzQUSoqAAYqzSh2Z7/m0Rf1QbmQJccegD0r+YZxBjzqoBiEeJQ==", + "dev": true, + "requires": { + "core-js": "~2.3.0", + "es6-promise": "~3.0.2", + "lie": "~3.1.0", + "pako": "~1.0.2", + "readable-stream": "~2.0.6" + }, + "dependencies": { + "core-js": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz", + "integrity": "sha1-+rg/uwstjchfpjbEudNMdUIMbWU=", + "dev": true + }, + "es6-promise": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz", + "integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=", + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "karma": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/karma/-/karma-1.7.1.tgz", + "integrity": "sha512-k5pBjHDhmkdaUccnC7gE3mBzZjcxyxYsYVaqiL2G5AqlfLyBO5nw2VdNK+O16cveEPd/gIOWULH7gkiYYwVNHg==", + "dev": true, + "requires": { + "bluebird": "^3.3.0", + "body-parser": "^1.16.1", + "chokidar": "^1.4.1", + "colors": "^1.1.0", + "combine-lists": "^1.0.0", + "connect": "^3.6.0", + "core-js": "^2.2.0", + "di": "^0.0.1", + "dom-serialize": "^2.2.0", + "expand-braces": "^0.1.1", + "glob": "^7.1.1", + "graceful-fs": "^4.1.2", + "http-proxy": "^1.13.0", + "isbinaryfile": "^3.0.0", + "lodash": "^3.8.0", + "log4js": "^0.6.31", + "mime": "^1.3.4", + "minimatch": "^3.0.2", + "optimist": "^0.6.1", + "qjobs": "^1.1.4", + "range-parser": "^1.2.0", + "rimraf": "^2.6.0", + "safe-buffer": "^5.0.1", + "socket.io": "1.7.3", + "source-map": "^0.5.3", + "tmp": "0.0.31", + "useragent": "^2.1.12" + }, + "dependencies": { + "anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + } + } + }, + "karma-chrome-launcher": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", + "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", + "dev": true, + "requires": { + "fs-access": "^1.0.0", + "which": "^1.2.1" + } + }, + "karma-coverage-istanbul-reporter": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-2.0.1.tgz", + "integrity": "sha512-UcgrHkFehI5+ivMouD8NH/UOHiX4oCAtwaANylzPFdcAuD52fnCUuelacq2gh8tZ4ydhU3+xiXofSq7j5Ehygw==", + "dev": true, + "requires": { + "istanbul-api": "^1.3.1", + "minimatch": "^3.0.4" + } + }, + "karma-jasmine": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-1.1.2.tgz", + "integrity": "sha1-OU8rJf+0pkS5rabyLUQ+L9CIhsM=", + "dev": true + }, + "karma-jasmine-html-reporter": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-0.2.2.tgz", + "integrity": "sha1-SKjl7xiAdhfuK14zwRlMNbQ5Ukw=", + "dev": true, + "requires": { + "karma-jasmine": "^1.0.2" + } + }, + "karma-source-map-support": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.3.0.tgz", + "integrity": "sha512-HcPqdAusNez/ywa+biN4EphGz62MmQyPggUsDfsHqa7tSe4jdsxgvTKuDfIazjL+IOxpVWyT7Pr4dhAV+sxX5Q==", + "dev": true, + "requires": { + "source-map-support": "^0.5.5" + } + }, + "killable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.0.tgz", + "integrity": "sha1-2ouEvUfeU5WHj5XWTQLyRJ/gXms=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, + "optional": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "leb": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/leb/-/leb-0.3.0.tgz", + "integrity": "sha1-Mr7p+tFoMo1q6oUi2DP0GA7tHaM=", + "dev": true + }, + "less": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/less/-/less-3.7.1.tgz", + "integrity": "sha512-Cmf5XJlzNklkBC8eAa+Ef16AHUBAkApHNAw3x9Vmn84h2BvGrri5Id7kf6H1n6SN74Fc0WdHIRPlFMxsl0eJkA==", + "dev": true, + "requires": { + "errno": "^0.1.1", + "graceful-fs": "^4.1.2", + "image-size": "~0.5.0", + "mime": "^1.4.1", + "mkdirp": "^0.5.0", + "promise": "^7.1.1", + "request": "^2.83.0", + "source-map": "~0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true + } + } + }, + "less-loader": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/less-loader/-/less-loader-4.1.0.tgz", + "integrity": "sha512-KNTsgCE9tMOM70+ddxp9yyt9iHqgmSs0yTZc5XH5Wo+g80RWRIYNqE58QJKm/yMud5wZEvz50ugRDuzVIkyahg==", + "dev": true, + "requires": { + "clone": "^2.1.1", + "loader-utils": "^1.1.0", + "pify": "^3.0.0" + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "license-webpack-plugin": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/license-webpack-plugin/-/license-webpack-plugin-1.3.1.tgz", + "integrity": "sha512-NqAFodJdpBUuf1iD+Ij8hQvF0rCFKlO2KaieoQzAPhFgzLCtJnC7Z7x5gQbGNjoe++wOKAtAmwVEIBLqq2Yp1A==", + "dev": true, + "requires": { + "ejs": "^2.5.7" + } + }, + "lie": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", + "integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=", + "dev": true, + "requires": { + "immediate": "~3.0.5" + } + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "loader-runner": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.0.tgz", + "integrity": "sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=", + "dev": true + }, + "loader-utils": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", + "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + }, + "lodash.assign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", + "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", + "dev": true, + "optional": true + }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lodash.mergewith": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz", + "integrity": "sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ==", + "dev": true, + "optional": true + }, + "lodash.tail": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.tail/-/lodash.tail-4.1.1.tgz", + "integrity": "sha1-0jM6NtnncXyK0vfKyv7HwytERmQ=", + "dev": true + }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, + "log4js": { + "version": "0.6.38", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz", + "integrity": "sha1-LElBFmldb7JUgJQ9P8hy5mKlIv0=", + "dev": true, + "requires": { + "readable-stream": "~1.0.2", + "semver": "~4.3.3" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "semver": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", + "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "loglevel": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", + "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=", + "dev": true + }, + "loglevelnext": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/loglevelnext/-/loglevelnext-1.0.5.tgz", + "integrity": "sha512-V/73qkPuJmx4BcBF19xPBr+0ZRVBhc4POxvZTZdMeXpJ4NItXSJ/MSwuFT0kQJlCbXvdlZoQQ/418bS1y9Jh6A==", + "dev": true, + "requires": { + "es6-symbol": "^3.1.1", + "object.assign": "^4.1.0" + } + }, + "long": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", + "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", + "dev": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lower-case": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", + "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", + "dev": true + }, + "lru-cache": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "make-error": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz", + "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==", + "dev": true + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "math-random": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", + "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", + "dev": true + }, + "md5.js": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", + "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, + "mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", + "dev": true + }, + "mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "dev": true, + "requires": { + "mime-db": "~1.35.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "mini-css-extract-plugin": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.1.tgz", + "integrity": "sha512-XWuB3G61Rtasq/gLe7cp5cuozehE6hN+E4sxCamRR/WDiHTg+f7ZIAS024r8UJQffY+e2gGELXQZgQoFDfNDCg==", + "dev": true, + "requires": { + "@webpack-contrib/schema-utils": "^1.0.0-beta.0", + "loader-utils": "^1.1.0", + "webpack-sources": "^1.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mississippi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", + "integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==", + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^2.0.1", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + } + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mixin-object": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", + "integrity": "sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4=", + "dev": true, + "requires": { + "for-in": "^0.1.3", + "is-extendable": "^0.1.1" + }, + "dependencies": { + "for-in": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.8.tgz", + "integrity": "sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE=", + "dev": true + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "multicast-dns": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz", + "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", + "dev": true, + "requires": { + "dns-packet": "^1.3.1", + "thunky": "^1.0.2" + } + }, + "multicast-dns-service-types": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", + "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", + "dev": true + }, + "nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "dev": true, + "optional": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", + "dev": true + }, + "neo-async": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.1.tgz", + "integrity": "sha512-3KL3fvuRkZ7s4IFOMfztb7zJp3QaVWnBeGoJlgB38XnCRPj/0tLzzLG5IB8NYOHbJ8g8UGrgZv44GLDk6CxTxA==", + "dev": true + }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", + "dev": true + }, + "no-case": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", + "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", + "dev": true, + "requires": { + "lower-case": "^1.1.1" + } + }, + "node-forge": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz", + "integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ==", + "dev": true + }, + "node-gyp": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.7.0.tgz", + "integrity": "sha512-qDQE/Ft9xXP6zphwx4sD0t+VhwV7yFaloMpfbL2QnnDZcyaiakWlLdtFGGQfTAwpFHdpbRhRxVhIHN1OKAjgbg==", + "dev": true, + "optional": true, + "requires": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": ">=2.9.0 <2.82.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "dependencies": { + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "dev": true, + "optional": true, + "requires": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + } + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "dev": true, + "optional": true + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "dev": true, + "optional": true + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "dev": true, + "optional": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" + } + }, + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", + "dev": true, + "optional": true + }, + "har-validator": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", + "dev": true, + "optional": true, + "requires": { + "ajv": "^4.9.1", + "har-schema": "^1.0.5" + } + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "dev": true, + "optional": true, + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "performance-now": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "dev": true, + "optional": true + }, + "qs": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", + "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", + "dev": true, + "optional": true + }, + "request": { + "version": "2.81.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", + "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", + "dev": true, + "optional": true, + "requires": { + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~4.2.1", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "performance-now": "^0.2.0", + "qs": "~6.4.0", + "safe-buffer": "^5.0.1", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.0.0" + } + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "dev": true, + "optional": true + } + } + }, + "node-libs-browser": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", + "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", + "dev": true, + "requires": { + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^1.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "0.0.0", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.10.3", + "vm-browserify": "0.0.4" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, + "node-sass": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.9.2.tgz", + "integrity": "sha512-LdxoJLZutx0aQXHtWIYwJKMj+9pTjneTcLWJgzf2XbGu0q5pRNqW5QvFCEdm3mc5rJOdru/mzln5d0EZLacf6g==", + "dev": true, + "optional": true, + "requires": { + "async-foreach": "^0.1.3", + "chalk": "^1.1.1", + "cross-spawn": "^3.0.0", + "gaze": "^1.0.0", + "get-stdin": "^4.0.1", + "glob": "^7.0.3", + "in-publish": "^2.0.0", + "lodash.assign": "^4.2.0", + "lodash.clonedeep": "^4.3.2", + "lodash.mergewith": "^4.6.0", + "meow": "^3.7.0", + "mkdirp": "^0.5.1", + "nan": "^2.10.0", + "node-gyp": "^3.3.1", + "npmlog": "^4.0.0", + "request": "2.87.0", + "sass-graph": "^2.2.4", + "stdout-stream": "^1.4.0", + "true-case-path": "^1.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true, + "optional": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "optional": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true, + "optional": true + } + } + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", + "dev": true + }, + "npm-package-arg": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.0.tgz", + "integrity": "sha512-zYbhP2k9DbJhA0Z3HKUePUgdB1x7MfIfKssC+WLPFMKTBZKpZh5m13PgexJjCq6KW7j17r0jHWcCpxEqnnncSA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.6.0", + "osenv": "^0.1.5", + "semver": "^5.5.0", + "validate-npm-package-name": "^3.0.0" + } + }, + "npm-registry-client": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-8.6.0.tgz", + "integrity": "sha512-Qs6P6nnopig+Y8gbzpeN/dkt+n7IyVd8f45NTMotGk6Qo7GfBmzwYx6jRLoOOgKiMnaQfYxsuyQlD8Mc3guBhg==", + "dev": true, + "requires": { + "concat-stream": "^1.5.2", + "graceful-fs": "^4.1.6", + "normalize-package-data": "~1.0.1 || ^2.0.0", + "npm-package-arg": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0", + "npmlog": "2 || ^3.1.0 || ^4.0.0", + "once": "^1.3.3", + "request": "^2.74.0", + "retry": "^0.10.0", + "safe-buffer": "^5.1.1", + "semver": "2 >=2.2.1 || 3.x || 4 || 5", + "slide": "^1.1.3", + "ssri": "^5.2.4" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "nth-check": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.1.tgz", + "integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=", + "dev": true, + "requires": { + "boolbase": "~1.0.0" + } + }, + "null-check": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/null-check/-/null-check-1.0.0.tgz", + "integrity": "sha1-l33/1xdgErnsMNKjnbXPcqBDnt0=", + "dev": true + }, + "num2fraction": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", + "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=", + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-keys": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" + }, + "dependencies": { + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + } + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", + "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "opn": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/opn/-/opn-5.3.0.tgz", + "integrity": "sha512-bYJHo/LOmoTd+pfiYhfZDnf9zekVJrY+cnS2a5F2x+w5ppvTqObojTP7WiFG+kVZs9Inw+qQ/lw7TroWwhdd2g==", + "dev": true, + "requires": { + "is-wsl": "^1.1.0" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + } + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + } + }, + "options": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", + "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=", + "dev": true + }, + "original": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/original/-/original-1.0.1.tgz", + "integrity": "sha512-IEvtB5vM5ULvwnqMxWBLxkS13JIEXbakizMSo3yoPNPCIWzg8TG3Usn/UhXoZFM/m+FuEA20KdzPSFq/0rS+UA==", + "dev": true, + "requires": { + "url-parse": "~1.4.0" + } + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true, + "optional": true, + "requires": { + "lcid": "^1.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "dev": true + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "pako": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", + "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", + "dev": true + }, + "parallel-transform": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", + "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", + "dev": true, + "requires": { + "cyclist": "~0.2.2", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + } + }, + "param-case": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", + "integrity": "sha1-35T9jPZTHs915r75oIWPvHK+Ikc=", + "dev": true, + "requires": { + "no-case": "^2.2.0" + } + }, + "parse-asn1": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", + "dev": true, + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" + } + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" + }, + "dependencies": { + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + } + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "parse5": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", + "dev": true + }, + "parsejson": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.3.tgz", + "integrity": "sha1-q343WfIJ7OmUN5c/fQ8fZK4OZKs=", + "dev": true, + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "dev": true, + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "dev": true, + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=", + "dev": true + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", + "dev": true + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pbkdf2": { + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", + "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, + "portfinder": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.13.tgz", + "integrity": "sha1-uzLs2HwnEErm7kS1o8y/Drsa7ek=", + "dev": true, + "requires": { + "async": "^1.5.2", + "debug": "^2.2.0", + "mkdirp": "0.5.x" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.4.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "postcss-import": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-11.1.0.tgz", + "integrity": "sha512-5l327iI75POonjxkXgdRCUS+AlzAdBx4pOvMEhTKTCjb1p8IEeVR9yx3cPbmN7LIWJLbfnIXxAhoB4jpD0c/Cw==", + "dev": true, + "requires": { + "postcss": "^6.0.1", + "postcss-value-parser": "^3.2.3", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + } + }, + "postcss-load-config": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-2.0.0.tgz", + "integrity": "sha512-V5JBLzw406BB8UIfsAWSK2KSwIJ5yoEIVFb4gVkXci0QdKgA24jLmHZ/ghe/GgX0lJ0/D1uUK1ejhzEY94MChQ==", + "dev": true, + "requires": { + "cosmiconfig": "^4.0.0", + "import-cwd": "^2.0.0" + } + }, + "postcss-loader": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-2.1.6.tgz", + "integrity": "sha512-hgiWSc13xVQAq25cVw80CH0l49ZKlAnU1hKPOdRrNj89bokRr/bZF2nT+hebPPF9c9xs8c3gw3Fr2nxtmXYnNg==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "postcss": "^6.0.0", + "postcss-load-config": "^2.0.0", + "schema-utils": "^0.4.0" + } + }, + "postcss-url": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/postcss-url/-/postcss-url-7.3.2.tgz", + "integrity": "sha512-QMV5mA+pCYZQcUEPQkmor9vcPQ2MT+Ipuu8qdi1gVxbNiIiErEGft+eny1ak19qALoBkccS5AHaCaCDzh7b9MA==", + "dev": true, + "requires": { + "mime": "^1.4.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.0", + "postcss": "^6.0.1", + "xxhashjs": "^0.2.1" + } + }, + "postcss-value-parser": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz", + "integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU=", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "pretty-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", + "integrity": "sha1-X0+HyPkeWuPzuoerTPXgOxoX8aM=", + "dev": true, + "requires": { + "renderkid": "^2.0.1", + "utila": "~0.4" + } + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "dev": true, + "optional": true, + "requires": { + "asap": "~2.0.3" + } + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "protractor": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/protractor/-/protractor-5.3.2.tgz", + "integrity": "sha512-pw4uwwiy5lHZjIguxNpkEwJJa7hVz+bJsvaTI+IbXlfn2qXwzbF8eghW/RmrZwE2sGx82I8etb8lVjQ+JrjejA==", + "dev": true, + "requires": { + "@types/node": "^6.0.46", + "@types/q": "^0.0.32", + "@types/selenium-webdriver": "~2.53.39", + "blocking-proxy": "^1.0.0", + "chalk": "^1.1.3", + "glob": "^7.0.3", + "jasmine": "2.8.0", + "jasminewd2": "^2.1.0", + "optimist": "~0.6.0", + "q": "1.4.1", + "saucelabs": "^1.5.0", + "selenium-webdriver": "3.6.0", + "source-map-support": "~0.4.0", + "webdriver-js-extender": "^1.0.0", + "webdriver-manager": "^12.0.6" + }, + "dependencies": { + "@types/node": { + "version": "6.0.114", + "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.114.tgz", + "integrity": "sha512-5ViC9dwf1VIAtrOFTvOuN04lJgw28eKjuy0Vg2Bd/fSlxKP2feCSkIw04ZgOENL2ywdWrtbkthp1XVLEjJmouw==", + "dev": true + }, + "adm-zip": { + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.11.tgz", + "integrity": "sha512-L8vcjDTCOIJk7wFvmlEUN7AsSb8T+2JrdP7KINBjzr24TJ5Mwj590sLu3BC7zNZowvJWa/JtPmD8eJCzdtDWjA==", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "del": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", + "dev": true, + "requires": { + "globby": "^5.0.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "rimraf": "^2.2.8" + } + }, + "globby": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "^0.5.6" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "webdriver-manager": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/webdriver-manager/-/webdriver-manager-12.1.0.tgz", + "integrity": "sha512-oEc5fmkpz6Yh6udhwir5m0eN5mgRPq9P/NU5YWuT3Up5slt6Zz+znhLU7q4+8rwCZz/Qq3Fgpr/4oao7NPCm2A==", + "dev": true, + "requires": { + "adm-zip": "^0.4.9", + "chalk": "^1.1.1", + "del": "^2.2.0", + "glob": "^7.0.3", + "ini": "^1.3.4", + "minimist": "^1.2.0", + "q": "^1.4.1", + "request": "^2.87.0", + "rimraf": "^2.5.2", + "semver": "^5.3.0", + "xml2js": "^0.4.17" + } + } + } + }, + "proxy-addr": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", + "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", + "dev": true, + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.6.0" + } + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "public-encrypt": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", + "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "q": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", + "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=", + "dev": true + }, + "qjobs": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", + "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "querystringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.0.0.tgz", + "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==", + "dev": true + }, + "randomatic": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.0.0.tgz", + "integrity": "sha512-VdxFOIEY3mNO5PtSRkkle/hPJDHvQhK21oa73K4yAc9qmp6N429gAyF1gZMOTMeS0/AYzaV/2Trcef+NaIonSA==", + "dev": true, + "requires": { + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + } + } + }, + "randombytes": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", + "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=", + "dev": true + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "dev": true, + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=", + "dev": true + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "dev": true, + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": ">= 1.3.1 < 2" + } + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=", + "dev": true + } + } + }, + "raw-loader": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-0.5.1.tgz", + "integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao=", + "dev": true + }, + "read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha1-5mTvMRYRZsl1HNvo28+GtftY93Q=", + "dev": true, + "requires": { + "pify": "^2.3.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "dependencies": { + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + } + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "reflect-metadata": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.12.tgz", + "integrity": "sha512-n+IyV+nGz3+0q3/Yf1ra12KpCyi001bi4XFxSjbiWWjfqb52iTTtpGXmCCAOWWIAn9KEuFZKGqBERHmrtScZ3A==", + "dev": true + }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "^0.1.3" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexpu-core": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", + "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", + "dev": true, + "requires": { + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "relateurl": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", + "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=", + "dev": true + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "renderkid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-2.0.1.tgz", + "integrity": "sha1-iYyr/Ivt5Le5ETWj/9Mj5YwNsxk=", + "dev": true, + "requires": { + "css-select": "^1.1.0", + "dom-converter": "~0.1", + "htmlparser2": "~3.3.0", + "strip-ansi": "^3.0.0", + "utila": "~0.3" + }, + "dependencies": { + "utila": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/utila/-/utila-0.3.3.tgz", + "integrity": "sha1-1+jn1+MJEHCSsF+NloiCTWM6QiY=", + "dev": true + } + } + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "request": { + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "retry": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", + "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", + "dev": true + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "optional": true, + "requires": { + "align-text": "^0.1.1" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + }, + "rxjs": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.2.tgz", + "integrity": "sha512-0MI8+mkKAXZUF9vMrEoPnaoHkfzBPP4IGwUYRJhIRJF6/w3uByO1e91bEHn8zd43RdkTMKiooYKmwz7RH6zfOQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "sass-graph": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.4.tgz", + "integrity": "sha1-E/vWPNHK8JCLn9k0dq1DpR0eC0k=", + "dev": true, + "optional": true, + "requires": { + "glob": "^7.0.0", + "lodash": "^4.0.0", + "scss-tokenizer": "^0.2.3", + "yargs": "^7.0.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true, + "optional": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true, + "optional": true + }, + "yargs": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", + "integrity": "sha1-a6MY6xaWFyf10oT46gA+jWFU0Mg=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^1.4.0", + "read-pkg-up": "^1.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^1.0.2", + "which-module": "^1.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^5.0.0" + } + } + } + }, + "sass-loader": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-7.0.3.tgz", + "integrity": "sha512-iaSFtQcGo4SSgDw5Aes5p4VTrA5jCGSA7sGmhPIcOloBlgI1VktM2MUrk2IHHjbNagckXlPz+HWq1vAAPrcYxA==", + "dev": true, + "requires": { + "clone-deep": "^2.0.1", + "loader-utils": "^1.0.1", + "lodash.tail": "^4.1.1", + "neo-async": "^2.5.0", + "pify": "^3.0.0" + } + }, + "saucelabs": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/saucelabs/-/saucelabs-1.5.0.tgz", + "integrity": "sha512-jlX3FGdWvYf4Q3LFfFWS1QvPg3IGCGWxIc8QBFdPTbpTJnt/v17FHXYVAn7C8sHf1yUXo2c7yIM0isDryfYtHQ==", + "dev": true, + "requires": { + "https-proxy-agent": "^2.2.1" + } + }, + "sax": { + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz", + "integrity": "sha1-1HLbIo6zMcJQaw6MFVJK25OdEsE=", + "dev": true + }, + "schema-utils": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", + "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0" + } + }, + "scss-tokenizer": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz", + "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", + "dev": true, + "optional": true, + "requires": { + "js-base64": "^2.1.8", + "source-map": "^0.4.2" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "optional": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", + "dev": true + }, + "selenium-webdriver": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz", + "integrity": "sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q==", + "dev": true, + "requires": { + "jszip": "^3.1.3", + "rimraf": "^2.5.4", + "tmp": "0.0.30", + "xml2js": "^0.4.17" + }, + "dependencies": { + "tmp": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz", + "integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + } + } + }, + "selfsigned": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.3.tgz", + "integrity": "sha512-vmZenZ+8Al3NLHkWnhBQ0x6BkML1eCP2xEi3JE+f3D9wW9fipD9NNJHYtE9XJM4TsPaHGZJIamrSI6MTg1dU2Q==", + "dev": true, + "requires": { + "node-forge": "0.7.5" + } + }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + }, + "semver-dsl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/semver-dsl/-/semver-dsl-1.0.1.tgz", + "integrity": "sha1-02eN5VVeimH2Ke7QJTZq5fJzQKA=", + "dev": true, + "requires": { + "semver": "^5.3.0" + } + }, + "semver-intersect": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/semver-intersect/-/semver-intersect-1.3.1.tgz", + "integrity": "sha1-j6hKnhAovSOeRTDRo+GB5pjYhLo=", + "dev": true, + "requires": { + "semver": "^5.0.0" + } + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "dev": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", + "dev": true + } + } + }, + "serialize-javascript": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz", + "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==", + "dev": true + }, + "serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "dev": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shallow-clone": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-1.0.0.tgz", + "integrity": "sha512-oeXreoKR/SyNJtRJMAKPDSvd28OqEwG4eR/xc856cRGBII7gX9lvAqDxusPm0846z/w/hWYjI1NpKwJ00NHzRA==", + "dev": true, + "requires": { + "is-extendable": "^0.1.1", + "kind-of": "^5.0.0", + "mixin-object": "^2.0.1" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "silent-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/silent-error/-/silent-error-1.1.0.tgz", + "integrity": "sha1-IglwbxyFCp8dENDYQJGLRvJuG8k=", + "dev": true, + "requires": { + "debug": "^2.2.0" + } + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "dev": true, + "optional": true, + "requires": { + "hoek": "2.x.x" + } + }, + "socket.io": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.7.3.tgz", + "integrity": "sha1-uK+cq6AJSeVo42nxMn6pvp6iRhs=", + "dev": true, + "requires": { + "debug": "2.3.3", + "engine.io": "1.8.3", + "has-binary": "0.1.7", + "object-assign": "4.1.0", + "socket.io-adapter": "0.5.0", + "socket.io-client": "1.7.3", + "socket.io-parser": "2.3.1" + }, + "dependencies": { + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + }, + "object-assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", + "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=", + "dev": true + } + } + }, + "socket.io-adapter": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.5.0.tgz", + "integrity": "sha1-y21LuL7IHhB4uZZ3+c7QBGBmu4s=", + "dev": true, + "requires": { + "debug": "2.3.3", + "socket.io-parser": "2.3.1" + }, + "dependencies": { + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "socket.io-client": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.7.3.tgz", + "integrity": "sha1-sw6GqhDV7zVGYBwJzeR2Xjgdo3c=", + "dev": true, + "requires": { + "backo2": "1.0.2", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "2.3.3", + "engine.io-client": "1.8.3", + "has-binary": "0.1.7", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseuri": "0.0.5", + "socket.io-parser": "2.3.1", + "to-array": "0.1.4" + }, + "dependencies": { + "debug": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.3.3.tgz", + "integrity": "sha1-QMRT5n5uE8kB3ewxeviYbNqe/4w=", + "dev": true, + "requires": { + "ms": "0.7.2" + } + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + } + } + }, + "socket.io-parser": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.3.1.tgz", + "integrity": "sha1-3VMgJRA85Clpcya+/WQAX8/ltKA=", + "dev": true, + "requires": { + "component-emitter": "1.1.2", + "debug": "2.2.0", + "isarray": "0.0.1", + "json3": "3.3.2" + }, + "dependencies": { + "component-emitter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz", + "integrity": "sha1-KWWU8nU9qmOZbSrwjRWpURbJrsM=", + "dev": true + }, + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "dev": true, + "requires": { + "ms": "0.7.1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "dev": true + } + } + }, + "sockjs": { + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.19.tgz", + "integrity": "sha512-V48klKZl8T6MzatbLlzzRNhMepEys9Y4oGFpypBFFn1gLI/QQ9HtLLyWJNbPlwGLelOVOEijUbTTJeLLI59jLw==", + "dev": true, + "requires": { + "faye-websocket": "^0.10.0", + "uuid": "^3.0.1" + } + }, + "sockjs-client": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.1.5.tgz", + "integrity": "sha1-G7fA9yIsQPQq3xT0RCy9Eml3GoM=", + "dev": true, + "requires": { + "debug": "^2.6.6", + "eventsource": "0.1.6", + "faye-websocket": "~0.11.0", + "inherits": "^2.0.1", + "json3": "^3.3.2", + "url-parse": "^1.1.8" + }, + "dependencies": { + "faye-websocket": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.1.tgz", + "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", + "dev": true, + "requires": { + "websocket-driver": ">=0.5.1" + } + } + } + }, + "source-list-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", + "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz", + "integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "spdx-correct": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", + "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", + "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", + "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", + "dev": true + }, + "spdy": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-3.4.7.tgz", + "integrity": "sha1-Qv9B7OXMD5mjpsKKq7c/XDsDrLw=", + "dev": true, + "requires": { + "debug": "^2.6.8", + "handle-thing": "^1.2.5", + "http-deceiver": "^1.2.7", + "safe-buffer": "^5.0.1", + "select-hose": "^2.0.0", + "spdy-transport": "^2.0.18" + } + }, + "spdy-transport": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-2.1.0.tgz", + "integrity": "sha512-bpUeGpZcmZ692rrTiqf9/2EUakI6/kXX1Rpe0ib/DyOzbiexVfXkw6GnvI9hVGvIwVaUhkaBojjCZwLNRGQg1g==", + "dev": true, + "requires": { + "debug": "^2.6.8", + "detect-node": "^2.0.3", + "hpack.js": "^2.1.6", + "obuf": "^1.1.1", + "readable-stream": "^2.2.9", + "safe-buffer": "^5.0.1", + "wbuf": "^1.7.2" + } + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "ssri": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", + "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.1" + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "stats-webpack-plugin": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/stats-webpack-plugin/-/stats-webpack-plugin-0.6.2.tgz", + "integrity": "sha1-LFlJtTHgf4eojm6k3PrFOqjHWis=", + "dev": true, + "requires": { + "lodash": "^4.17.4" + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", + "dev": true + }, + "stdout-stream": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.0.tgz", + "integrity": "sha1-osfIWH5U2UJ+qe2zrD8s1SLfN4s=", + "dev": true, + "optional": true, + "requires": { + "readable-stream": "^2.0.1" + } + }, + "stream-browserify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", + "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-each": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.2.tgz", + "integrity": "sha512-mc1dbFhGBxvTM3bIWmAAINbqiuAk9TATcfIQC8P+/+HJefgaiTlMn2dHvkX8qlI12KeYKSQ1Ua9RrIqrn1VPoA==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "stringstream": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", + "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==", + "dev": true, + "optional": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + } + }, + "style-loader": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-0.21.0.tgz", + "integrity": "sha512-T+UNsAcl3Yg+BsPKs1vd22Fr8sVT+CJMtzqc6LEw9bbJZb43lm9GoeIfUcDEefBSWC0BhYbcdupV1GtI4DGzxg==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "schema-utils": "^0.4.5" + } + }, + "stylus": { + "version": "0.54.5", + "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.54.5.tgz", + "integrity": "sha1-QrlWCTHKcJDOhRWnmLqeaqPW3Hk=", + "dev": true, + "requires": { + "css-parse": "1.7.x", + "debug": "*", + "glob": "7.0.x", + "mkdirp": "0.5.x", + "sax": "0.5.x", + "source-map": "0.1.x" + }, + "dependencies": { + "glob": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", + "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "source-map": { + "version": "0.1.43", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "stylus-loader": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/stylus-loader/-/stylus-loader-3.0.2.tgz", + "integrity": "sha512-+VomPdZ6a0razP+zinir61yZgpw2NfljeSsdUF5kJuEzlo3khXhY19Fn6l8QQz1GRJGtMCo8nG5C04ePyV7SUA==", + "dev": true, + "requires": { + "loader-utils": "^1.0.2", + "lodash.clonedeep": "^4.5.0", + "when": "~3.6.x" + } + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", + "dev": true + }, + "tapable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.0.0.tgz", + "integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==", + "dev": true + }, + "tar": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "dev": true, + "optional": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" + } + }, + "thunky": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.0.2.tgz", + "integrity": "sha1-qGLgGOP7HqLsP85dVWBc9X8kc3E=", + "dev": true + }, + "timers-browserify": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", + "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", + "dev": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "tmp": { + "version": "0.0.31", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", + "integrity": "sha1-jzirlDjhcxXl29izZX6L+yd65Kc=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", + "dev": true + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "toposort": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/toposort/-/toposort-1.0.7.tgz", + "integrity": "sha1-LmhELZ9k7HILjMieZEOsbKqVACk=", + "dev": true + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "dev": true, + "requires": { + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, + "tree-kill": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.0.tgz", + "integrity": "sha512-DlX6dR0lOIRDFxI0mjL9IYg6OTncLm/Zt+JiBhE5OlFcAR8yc9S7FFXU9so0oda47frdM/JFsk7UjNt9vscKcg==", + "dev": true + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "true-case-path": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.2.tgz", + "integrity": "sha1-fskRMJJHZsf1c74wIMNPj9/QDWI=", + "dev": true, + "optional": true, + "requires": { + "glob": "^6.0.4" + }, + "dependencies": { + "glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "dev": true, + "optional": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "ts-node": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-5.0.1.tgz", + "integrity": "sha512-XK7QmDcNHVmZkVtkiwNDWiERRHPyU8nBqZB1+iv2UhOG0q3RQ9HsZ2CMqISlFbxjrYFGfG2mX7bW4dAyxBVzUw==", + "dev": true, + "requires": { + "arrify": "^1.0.0", + "chalk": "^2.3.0", + "diff": "^3.1.0", + "make-error": "^1.1.1", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "source-map-support": "^0.5.3", + "yn": "^2.0.0" + }, + "dependencies": { + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, + "tsickle": { + "version": "0.29.0", + "resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.29.0.tgz", + "integrity": "sha512-JpID0Lv8/irRtPmqJJxb5fCwfZhjZeKmav9Zna7UjqVuJoSbI49Wue/c2PPybX1SbRrjl7bbI/JsCl0dSUJygA==", + "dev": true, + "requires": { + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "source-map": "^0.6.0", + "source-map-support": "^0.5.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" + }, + "tslint": { + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.9.1.tgz", + "integrity": "sha1-ElX4ej/1frCw4fDmEKi0dIBGya4=", + "dev": true, + "requires": { + "babel-code-frame": "^6.22.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^3.2.0", + "glob": "^7.1.1", + "js-yaml": "^3.7.0", + "minimatch": "^3.0.4", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.12.1" + }, + "dependencies": { + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + } + } + }, + "tsutils": { + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.28.0.tgz", + "integrity": "sha512-bh5nAtW0tuhvOJnx1GLRn5ScraRLICGyJV5wJhtRWOLsxW70Kk5tZtpK3O/hW6LDnqKS9mlUMPZj9fEMJ0gxqA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "dev": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "typescript": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.7.2.tgz", + "integrity": "sha512-p5TCYZDAO0m4G344hD+wx/LATebLWZNkkh2asWUFqSsD2OrDNhbAHuSjobrmsUmdzjJjEeZVU9g1h3O6vpstnw==", + "dev": true + }, + "uglify-js": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.5.tgz", + "integrity": "sha512-Fm52gLqJqFBnT+Sn411NPDnsgaWiYeRLw42x7Va/mS8TKgaepwoGY7JLXHSEef3d3PmdFXSz1Zx7KMLL89E2QA==", + "dev": true, + "requires": { + "commander": "~2.16.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, + "uglifyjs-webpack-plugin": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.7.tgz", + "integrity": "sha512-1VicfKhCYHLS8m1DCApqBhoulnASsEoJ/BvpUpP4zoNAPpKzdH+ghk0olGJMmwX2/jprK2j3hAHdUbczBSy2FA==", + "dev": true, + "requires": { + "cacache": "^10.0.4", + "find-cache-dir": "^1.0.0", + "schema-utils": "^0.4.5", + "serialize-javascript": "^1.4.0", + "source-map": "^0.6.1", + "uglify-es": "^3.3.4", + "webpack-sources": "^1.1.0", + "worker-farm": "^1.5.2" + }, + "dependencies": { + "commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "dev": true, + "requires": { + "commander": "~2.13.0", + "source-map": "~0.6.1" + } + } + } + }, + "ultron": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", + "integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=", + "dev": true + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "unique-filename": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.0.tgz", + "integrity": "sha1-0F8v5AMlYIcfMOk8vnNe6iAVFPM=", + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.0.tgz", + "integrity": "sha1-22Z258fMBimHj/GWCXx4hVrp9Ks=", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "upath": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", + "dev": true + }, + "upper-case": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", + "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", + "dev": true + }, + "uri-js": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-3.0.2.tgz", + "integrity": "sha1-+QuFhQf4HepNz7s8TD2/orVX+qo=", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "url-join": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.0.tgz", + "integrity": "sha1-TTNA6AfTdzvamZH4MFrNzCpmXSo=", + "dev": true + }, + "url-loader": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-1.0.1.tgz", + "integrity": "sha512-rAonpHy7231fmweBKUFe0bYnlGDty77E+fm53NZdij7j/YOpyGzc7ttqG1nAXl3aRs0k41o0PC3TvGXQiw2Zvw==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "mime": "^2.0.3", + "schema-utils": "^0.4.3" + }, + "dependencies": { + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true + } + } + }, + "url-parse": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.1.tgz", + "integrity": "sha512-x95Td74QcvICAA0+qERaVkRpTGKyBHHYdwL2LXZm5t/gBtCB9KQSO/0zQgSTYEV1p0WcvSg79TLNPSvd5IDJMQ==", + "dev": true, + "requires": { + "querystringify": "^2.0.0", + "requires-port": "^1.0.0" + } + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "useragent": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.3.0.tgz", + "integrity": "sha512-4AoH4pxuSvHCjqLO04sU6U/uE65BYza8l/KKBS0b0hnUPWi+cQ2BpeTEwejCSx9SPV5/U03nniDTrWx5NrmKdw==", + "dev": true, + "requires": { + "lru-cache": "4.1.x", + "tmp": "0.0.x" + } + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, + "utila": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", + "integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw=", + "dev": true + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", + "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "dev": true, + "requires": { + "builtins": "^1.0.3" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "dev": true, + "requires": { + "indexof": "0.0.1" + } + }, + "void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", + "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", + "dev": true + }, + "watchpack": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", + "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", + "dev": true, + "requires": { + "chokidar": "^2.0.2", + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0" + } + }, + "wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "requires": { + "minimalistic-assert": "^1.0.0" + } + }, + "webassemblyjs": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/webassemblyjs/-/webassemblyjs-1.4.3.tgz", + "integrity": "sha512-4lOV1Lv6olz0PJkDGQEp82HempAn147e6BXijWDzz9g7/2nSebVP9GVg62Fz5ZAs55mxq13GA0XLyvY8XkyDjg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3", + "@webassemblyjs/validation": "1.4.3", + "@webassemblyjs/wasm-parser": "1.4.3", + "@webassemblyjs/wast-parser": "1.4.3", + "long": "^3.2.0" + } + }, + "webdriver-js-extender": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/webdriver-js-extender/-/webdriver-js-extender-1.0.0.tgz", + "integrity": "sha1-gcUzqeM9W/tZe05j4s2yW1R3dRU=", + "dev": true, + "requires": { + "@types/selenium-webdriver": "^2.53.35", + "selenium-webdriver": "^2.53.2" + }, + "dependencies": { + "sax": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-0.6.1.tgz", + "integrity": "sha1-VjsZx8HeiS4Jv8Ty/DDjwn8JUrk=", + "dev": true + }, + "selenium-webdriver": { + "version": "2.53.3", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-2.53.3.tgz", + "integrity": "sha1-0p/1qVff8aG0ncRXdW5OS/vc4IU=", + "dev": true, + "requires": { + "adm-zip": "0.4.4", + "rimraf": "^2.2.8", + "tmp": "0.0.24", + "ws": "^1.0.1", + "xml2js": "0.4.4" + } + }, + "tmp": { + "version": "0.0.24", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.24.tgz", + "integrity": "sha1-1qXhmNFKmDXMby18PZ4wJCjIzxI=", + "dev": true + }, + "xml2js": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.4.tgz", + "integrity": "sha1-MREBAAMAiuGSQOuhdJe1fHKcVV0=", + "dev": true, + "requires": { + "sax": "0.6.x", + "xmlbuilder": ">=1.0.0" + } + } + } + }, + "webpack": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.8.3.tgz", + "integrity": "sha512-/hfAjBISycdK597lxONjKEFX7dSIU1PsYwC3XlXUXoykWBlv9QV5HnO+ql3HvrrgfBJ7WXdnjO9iGPR2aAc5sw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.4.3", + "@webassemblyjs/wasm-edit": "1.4.3", + "@webassemblyjs/wasm-parser": "1.4.3", + "acorn": "^5.0.0", + "acorn-dynamic-import": "^3.0.0", + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0", + "chrome-trace-event": "^0.1.1", + "enhanced-resolve": "^4.0.0", + "eslint-scope": "^3.7.1", + "loader-runner": "^2.3.0", + "loader-utils": "^1.1.0", + "memory-fs": "~0.4.1", + "micromatch": "^3.1.8", + "mkdirp": "~0.5.0", + "neo-async": "^2.5.0", + "node-libs-browser": "^2.0.0", + "schema-utils": "^0.4.4", + "tapable": "^1.0.0", + "uglifyjs-webpack-plugin": "^1.2.4", + "watchpack": "^1.5.0", + "webpack-sources": "^1.0.1" + } + }, + "webpack-core": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/webpack-core/-/webpack-core-0.6.9.tgz", + "integrity": "sha1-/FcViMhVjad76e+23r3Fo7FyvcI=", + "dev": true, + "requires": { + "source-list-map": "~0.1.7", + "source-map": "~0.4.1" + }, + "dependencies": { + "source-list-map": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-0.1.8.tgz", + "integrity": "sha1-xVCyq1Qn9rPyH1r+rYjE9Vh7IQY=", + "dev": true + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "webpack-dev-middleware": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-3.1.3.tgz", + "integrity": "sha512-I6Mmy/QjWU/kXwCSFGaiOoL5YEQIVmbb0o45xMoCyQAg/mClqZVTcsX327sPfekDyJWpCxb+04whNyLOIxpJdQ==", + "dev": true, + "requires": { + "loud-rejection": "^1.6.0", + "memory-fs": "~0.4.1", + "mime": "^2.1.0", + "path-is-absolute": "^1.0.0", + "range-parser": "^1.0.3", + "url-join": "^4.0.0", + "webpack-log": "^1.0.1" + }, + "dependencies": { + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true + } + } + }, + "webpack-dev-server": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.1.5.tgz", + "integrity": "sha512-LVHg+EPwZLHIlfvokSTgtJqO/vI5CQi89fASb5JEDtVMDjY0yuIEqPPdMiKaBJIB/Ab7v/UN/sYZ7WsZvntQKw==", + "dev": true, + "requires": { + "ansi-html": "0.0.7", + "array-includes": "^3.0.3", + "bonjour": "^3.5.0", + "chokidar": "^2.0.0", + "compression": "^1.5.2", + "connect-history-api-fallback": "^1.3.0", + "debug": "^3.1.0", + "del": "^3.0.0", + "express": "^4.16.2", + "html-entities": "^1.2.0", + "http-proxy-middleware": "~0.18.0", + "import-local": "^1.0.0", + "internal-ip": "1.2.0", + "ip": "^1.1.5", + "killable": "^1.0.0", + "loglevel": "^1.4.1", + "opn": "^5.1.0", + "portfinder": "^1.0.9", + "selfsigned": "^1.9.1", + "serve-index": "^1.7.2", + "sockjs": "0.3.19", + "sockjs-client": "1.1.5", + "spdy": "^3.4.1", + "strip-ansi": "^3.0.0", + "supports-color": "^5.1.0", + "webpack-dev-middleware": "3.1.3", + "webpack-log": "^1.1.2", + "yargs": "11.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yargs": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.0.0.tgz", + "integrity": "sha512-Rjp+lMYQOWtgqojx1dEWorjCofi1YN7AoFvYV7b1gx/7dAAeuI4kN5SZiEvr0ZmsZTOpDRcCqrpI10L31tFkBw==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^9.0.2" + } + }, + "yargs-parser": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", + "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, + "webpack-log": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-1.2.0.tgz", + "integrity": "sha512-U9AnICnu50HXtiqiDxuli5gLB5PGBo7VvcHx36jRZHwK4vzOYLbImqT4lwWwoMHdQWwEKw736fCHEekokTEKHA==", + "dev": true, + "requires": { + "chalk": "^2.1.0", + "log-symbols": "^2.1.0", + "loglevelnext": "^1.0.1", + "uuid": "^3.1.0" + } + }, + "webpack-merge": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.1.3.tgz", + "integrity": "sha512-zxwAIGK7nKdu5CIZL0BjTQoq3elV0t0MfB7rUC1zj668geid52abs6hN/ACwZdK6LeMS8dC9B6WmtF978zH5mg==", + "dev": true, + "requires": { + "lodash": "^4.17.5" + } + }, + "webpack-sources": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz", + "integrity": "sha512-aqYp18kPphgoO5c/+NaUvEeACtZjMESmDChuD3NBciVpah3XpMEU9VAAtIaB1BsfJWWTSdv8Vv1m3T0aRk2dUw==", + "dev": true, + "requires": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "webpack-subresource-integrity": { + "version": "1.1.0-rc.4", + "resolved": "https://registry.npmjs.org/webpack-subresource-integrity/-/webpack-subresource-integrity-1.1.0-rc.4.tgz", + "integrity": "sha1-xcTj1pD50vZKlVDgeodn+Xlqpdg=", + "dev": true, + "requires": { + "webpack-core": "^0.6.8" + } + }, + "websocket-driver": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", + "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", + "dev": true, + "requires": { + "http-parser-js": ">=0.4.0", + "websocket-extensions": ">=0.1.1" + } + }, + "websocket-extensions": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz", + "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==", + "dev": true + }, + "when": { + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/when/-/when-3.6.4.tgz", + "integrity": "sha1-RztRfsFZ4rhQBUl6E5g/CVQS404=", + "dev": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", + "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=", + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, + "optional": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "worker-farm": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz", + "integrity": "sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ==", + "dev": true, + "requires": { + "errno": "~0.1.7" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "ws": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.2.tgz", + "integrity": "sha1-iiRPoFJAHgjJiGz0SoUYnh/UBn8=", + "dev": true, + "requires": { + "options": ">=0.0.5", + "ultron": "1.0.x" + } + }, + "wtf-8": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wtf-8/-/wtf-8-1.0.0.tgz", + "integrity": "sha1-OS2LotDxw00e4tYw8V0O+2jhBIo=", + "dev": true + }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "dev": true, + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + }, + "dependencies": { + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + } + } + }, + "xmlbuilder": { + "version": "9.0.7", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "dev": true + }, + "xmlhttprequest-ssl": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz", + "integrity": "sha1-GFqIjATspGw+QHDZn3tJ3jUomS0=", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "xxhashjs": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/xxhashjs/-/xxhashjs-0.2.2.tgz", + "integrity": "sha512-AkTuIuVTET12tpsVIQo+ZU6f/qDmKuRUcjaqR+OIvm+aCBsZ95i7UVY5WJ9TMsSaZ0DA2WxoZ4acu0sPH+OKAw==", + "dev": true, + "requires": { + "cuint": "^0.2.2" + } + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + }, + "yargs-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-5.0.0.tgz", + "integrity": "sha1-J17PDX/+Bcd+ZOfIbkzZS/DhIoo=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "^3.0.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", + "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=", + "dev": true, + "optional": true + } + } + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", + "dev": true + }, + "yn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", + "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", + "dev": true + }, + "zone.js": { + "version": "0.8.26", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.26.tgz", + "integrity": "sha512-W9Nj+UmBJG251wkCacIkETgra4QgBo/vgoEkb4a2uoLzpQG7qF9nzwoLXWU5xj3Fg2mxGvEDh47mg24vXccYjA==" + } + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/package.json b/spring-boot-angular-ecommerce/src/main/frontend/package.json new file mode 100644 index 0000000000..28e716b9a6 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/package.json @@ -0,0 +1,49 @@ +{ + "name": "frontend", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve --proxy-config proxy-conf.json", + "build": "ng build", + "test": "ng test", + "lint": "ng lint", + "e2e": "ng e2e" + }, + "private": true, + "dependencies": { + "@angular/animations": "^6.0.3", + "@angular/common": "^6.0.3", + "@angular/compiler": "^6.0.3", + "@angular/core": "^6.0.3", + "@angular/forms": "^6.0.3", + "@angular/http": "^6.0.3", + "@angular/platform-browser": "^6.0.3", + "@angular/platform-browser-dynamic": "^6.0.3", + "@angular/router": "^6.0.3", + "bootstrap": "^4.1.2", + "core-js": "^2.5.4", + "rxjs": "^6.0.0", + "zone.js": "^0.8.26" + }, + "devDependencies": { + "@angular/compiler-cli": "^6.0.3", + "@angular-devkit/build-angular": "~0.6.8", + "typescript": "~2.7.2", + "@angular/cli": "~6.0.8", + "@angular/language-service": "^6.0.3", + "@types/jasmine": "~2.8.6", + "@types/jasminewd2": "~2.0.3", + "@types/node": "~8.9.4", + "codelyzer": "~4.2.1", + "jasmine-core": "~2.99.1", + "jasmine-spec-reporter": "~4.2.1", + "karma": "~1.7.1", + "karma-chrome-launcher": "~2.2.0", + "karma-coverage-istanbul-reporter": "~2.0.0", + "karma-jasmine": "~1.1.1", + "karma-jasmine-html-reporter": "^0.2.2", + "protractor": "~5.3.0", + "ts-node": "~5.0.1", + "tslint": "~5.9.1" + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/proxy-conf.json b/spring-boot-angular-ecommerce/src/main/frontend/proxy-conf.json new file mode 100644 index 0000000000..534224beb5 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/proxy-conf.json @@ -0,0 +1,6 @@ +{ + "/api": { + "target": "http://localhost:8080", + "secure": false + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.css b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.css new file mode 100644 index 0000000000..f8fb0a460e --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.css @@ -0,0 +1,3 @@ +.container { + padding-top: 65px; +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.html b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.html new file mode 100644 index 0000000000..1b0ca2464f --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.spec.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.spec.ts new file mode 100644 index 0000000000..decc558568 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.spec.ts @@ -0,0 +1,27 @@ +import { TestBed, async } from '@angular/core/testing'; +import { AppComponent } from './app.component'; +describe('AppComponent', () => { + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ + AppComponent + ], + }).compileComponents(); + })); + it('should create the app', async(() => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + })); + it(`should have as title 'app'`, async(() => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app.title).toEqual('app'); + })); + it('should render title in a h1 tag', async(() => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.debugElement.nativeElement; + expect(compiled.querySelector('h1').textContent).toContain('Welcome to frontend!'); + })); +}); diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.ts new file mode 100644 index 0000000000..6840b14af1 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.component.ts @@ -0,0 +1,12 @@ +import {Component} from '@angular/core'; +import {EcommerceService} from "./ecommerce/services/EcommerceService"; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'], + providers: [EcommerceService] +}) +export class AppComponent { + +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.module.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.module.ts new file mode 100644 index 0000000000..279d2eb2d5 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/app.module.ts @@ -0,0 +1,31 @@ +import {BrowserModule} from '@angular/platform-browser'; +import {NgModule} from '@angular/core'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {HttpClientModule} from '@angular/common/http'; + +import {AppComponent} from './app.component'; +import {EcommerceComponent} from './ecommerce/ecommerce.component'; +import {ProductsComponent} from './ecommerce/products/products.component'; +import {ShoppingCartComponent} from './ecommerce/shopping-cart/shopping-cart.component'; +import {OrdersComponent} from './ecommerce/orders/orders.component'; +import {EcommerceService} from "./ecommerce/services/EcommerceService"; + +@NgModule({ + declarations: [ + AppComponent, + EcommerceComponent, + ProductsComponent, + ShoppingCartComponent, + OrdersComponent + ], + imports: [ + BrowserModule, + HttpClientModule, + FormsModule, + ReactiveFormsModule + ], + providers: [EcommerceService], + bootstrap: [AppComponent] +}) +export class AppModule { +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.css b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.html b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.html new file mode 100644 index 0000000000..682f0374b5 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.html @@ -0,0 +1,31 @@ + +
+
+ +
+
+ +
+
+ +
+
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.spec.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.spec.ts new file mode 100644 index 0000000000..90ac7d9b58 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EcommerceComponent } from './ecommerce.component'; + +describe('EcommerceComponent', () => { + let component: EcommerceComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ EcommerceComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(EcommerceComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.ts new file mode 100644 index 0000000000..901fdef6e6 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/ecommerce.component.ts @@ -0,0 +1,44 @@ +import {Component, OnInit, ViewChild} from '@angular/core'; +import {ProductsComponent} from "./products/products.component"; +import {ShoppingCartComponent} from "./shopping-cart/shopping-cart.component"; +import {OrdersComponent} from "./orders/orders.component"; + +@Component({ + selector: 'app-ecommerce', + templateUrl: './ecommerce.component.html', + styleUrls: ['./ecommerce.component.css'] +}) +export class EcommerceComponent implements OnInit { + private collapsed = true; + orderFinished = false; + + @ViewChild('productsC') + productsC: ProductsComponent; + + @ViewChild('shoppingCartC') + shoppingCartC: ShoppingCartComponent; + + @ViewChild('ordersC') + ordersC: OrdersComponent; + + constructor() { + } + + ngOnInit() { + } + + toggleCollapsed(): void { + this.collapsed = !this.collapsed; + } + + finishOrder(orderFinished: boolean) { + this.orderFinished = orderFinished; + } + + reset() { + this.orderFinished = false; + this.productsC.reset(); + this.shoppingCartC.reset(); + this.ordersC.paid = false; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-order.model.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-order.model.ts new file mode 100644 index 0000000000..0e1d9b03c8 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-order.model.ts @@ -0,0 +1,11 @@ +import {Product} from "./product.model"; + +export class ProductOrder { + product: Product; + quantity: number; + + constructor(product: Product, quantity: number) { + this.product = product; + this.quantity = quantity; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-orders.model.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-orders.model.ts new file mode 100644 index 0000000000..d6b1f321a9 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product-orders.model.ts @@ -0,0 +1,5 @@ +import {ProductOrder} from "./product-order.model"; + +export class ProductOrders { + productOrders: ProductOrder[] = []; +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product.model.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product.model.ts new file mode 100644 index 0000000000..258753f62e --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/models/product.model.ts @@ -0,0 +1,13 @@ +export class Product { + id: number; + name: string; + price: number; + pictureUrl: string; + + constructor(id: number, name: string, price: number, pictureUrl: string) { + this.id = id; + this.name = name; + this.price = price; + this.pictureUrl = pictureUrl; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.css b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.html b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.html new file mode 100644 index 0000000000..e4a8b50c63 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.html @@ -0,0 +1,13 @@ +

ORDER

+
    +
  • + {{ order.product.name }} - ${{ order.product.price }} x {{ order.quantity}} pcs. +
  • +
+

Total amount: ${{ total }}

+ + + + diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.spec.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.spec.ts new file mode 100644 index 0000000000..b8efbb0f4e --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OrdersComponent } from './orders.component'; + +describe('OrdersComponent', () => { + let component: OrdersComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ OrdersComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OrdersComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.ts new file mode 100644 index 0000000000..c3348ed396 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/orders/orders.component.ts @@ -0,0 +1,39 @@ +import {Component, OnInit} from '@angular/core'; +import {ProductOrders} from "../models/product-orders.model"; +import {Subscription} from "rxjs/internal/Subscription"; +import {EcommerceService} from "../services/EcommerceService"; + +@Component({ + selector: 'app-orders', + templateUrl: './orders.component.html', + styleUrls: ['./orders.component.css'] +}) +export class OrdersComponent implements OnInit { + orders: ProductOrders; + total: number; + paid: boolean; + sub: Subscription; + + constructor(private ecommerceService: EcommerceService) { + this.orders = this.ecommerceService.ProductOrders; + } + + ngOnInit() { + this.paid = false; + this.sub = this.ecommerceService.OrdersChanged.subscribe(() => { + this.orders = this.ecommerceService.ProductOrders; + }); + this.loadTotal(); + } + + pay() { + this.paid = true; + this.ecommerceService.saveOrder(this.orders).subscribe(); + } + + loadTotal() { + this.sub = this.ecommerceService.TotalChanged.subscribe(() => { + this.total = this.ecommerceService.Total; + }); + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.css b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.css new file mode 100644 index 0000000000..dce4e4caf2 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.css @@ -0,0 +1,4 @@ +.padding-0 { + padding-right: 0; + padding-left: 1; +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.html b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.html new file mode 100644 index 0000000000..f9d422b024 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.html @@ -0,0 +1,28 @@ +
+
+
+
+

{{order.product.name}}

+
+
+ +
${{order.product.price}}
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.spec.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.spec.ts new file mode 100644 index 0000000000..563ae953e1 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProductsComponent } from './products.component'; + +describe('ProductsComponent', () => { + let component: ProductsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ProductsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ProductsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.ts new file mode 100644 index 0000000000..520d0b106a --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/products/products.component.ts @@ -0,0 +1,82 @@ +import {Component, OnInit} from '@angular/core'; +import {ProductOrder} from "../models/product-order.model"; +import {EcommerceService} from "../services/EcommerceService"; +import {Subscription} from "rxjs/internal/Subscription"; +import {ProductOrders} from "../models/product-orders.model"; +import {Product} from "../models/product.model"; + +@Component({ + selector: 'app-products', + templateUrl: './products.component.html', + styleUrls: ['./products.component.css'] +}) +export class ProductsComponent implements OnInit { + productOrders: ProductOrder[] = []; + products: Product[] = []; + selectedProductOrder: ProductOrder; + private shoppingCartOrders: ProductOrders; + sub: Subscription; + productSelected: boolean = false; + + constructor(private ecommerceService: EcommerceService) { + } + + ngOnInit() { + this.productOrders = []; + this.loadProducts(); + this.loadOrders(); + } + + addToCart(order: ProductOrder) { + this.ecommerceService.SelectedProductOrder = order; + this.selectedProductOrder = this.ecommerceService.SelectedProductOrder; + this.productSelected = true; + } + + removeFromCart(productOrder: ProductOrder) { + let index = this.getProductIndex(productOrder.product); + if (index > -1) { + this.shoppingCartOrders.productOrders.splice( + this.getProductIndex(productOrder.product), 1); + } + this.ecommerceService.ProductOrders = this.shoppingCartOrders; + this.shoppingCartOrders = this.ecommerceService.ProductOrders; + this.productSelected = false; + } + + getProductIndex(product: Product): number { + return this.ecommerceService.ProductOrders.productOrders.findIndex( + value => value.product === product); + } + + isProductSelected(product: Product): boolean { + return this.getProductIndex(product) > -1; + } + + loadProducts() { + this.ecommerceService.getAllProducts() + .subscribe( + (products: any[]) => { + this.products = products; + this.products.forEach(product => { + this.productOrders.push(new ProductOrder(product, 0)); + }) + }, + (error) => console.log(error) + ); + } + + loadOrders() { + this.sub = this.ecommerceService.OrdersChanged.subscribe(() => { + this.shoppingCartOrders = this.ecommerceService.ProductOrders; + }); + } + + reset() { + this.productOrders = []; + this.loadProducts(); + this.ecommerceService.ProductOrders.productOrders = []; + this.loadOrders(); + this.productSelected = false; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/services/EcommerceService.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/services/EcommerceService.ts new file mode 100644 index 0000000000..d22b740c41 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/services/EcommerceService.ts @@ -0,0 +1,62 @@ +import {ProductOrder} from "../models/product-order.model"; +import {Subject} from "rxjs/internal/Subject"; +import {ProductOrders} from "../models/product-orders.model"; +import {HttpClient} from '@angular/common/http'; +import {Injectable} from "@angular/core"; + +@Injectable() +export class EcommerceService { + private productsUrl = "/api/products"; + private ordersUrl = "/api/orders"; + + private productOrder: ProductOrder; + private orders: ProductOrders = new ProductOrders(); + + private productOrderSubject = new Subject(); + private ordersSubject = new Subject(); + private totalSubject = new Subject(); + + private total: number; + + ProductOrderChanged = this.productOrderSubject.asObservable(); + OrdersChanged = this.ordersSubject.asObservable(); + TotalChanged = this.totalSubject.asObservable(); + + constructor(private http: HttpClient) { + } + + getAllProducts() { + return this.http.get(this.productsUrl); + } + + saveOrder(order: ProductOrders) { + return this.http.post(this.ordersUrl, order); + } + + set SelectedProductOrder(value: ProductOrder) { + this.productOrder = value; + this.productOrderSubject.next(); + } + + get SelectedProductOrder() { + return this.productOrder; + } + + set ProductOrders(value: ProductOrders) { + this.orders = value; + this.ordersSubject.next(); + } + + get ProductOrders() { + return this.orders; + } + + get Total() { + return this.total; + } + + set Total(value: number) { + this.total = value; + this.totalSubject.next(); + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.css b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.html b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.html new file mode 100644 index 0000000000..b18a02b93c --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.html @@ -0,0 +1,18 @@ +
+
Shopping Cart
+
+
Total: ${{total}}
+
+
Items bought:
+ +
    +
  • + {{ order.product.name }} - {{ order.quantity}} pcs. +
  • +
+ + +
+
diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.spec.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.spec.ts new file mode 100644 index 0000000000..5d7735477c --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ShoppingCartComponent } from './shopping-cart.component'; + +describe('ShoppingCartComponent', () => { + let component: ShoppingCartComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ShoppingCartComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ShoppingCartComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.ts new file mode 100644 index 0000000000..81a6514eb7 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/app/ecommerce/shopping-cart/shopping-cart.component.ts @@ -0,0 +1,76 @@ +import {Component, EventEmitter, OnDestroy, OnInit, Output} from '@angular/core'; +import {ProductOrders} from "../models/product-orders.model"; +import {ProductOrder} from "../models/product-order.model"; +import {EcommerceService} from "../services/EcommerceService"; +import {Subscription} from "rxjs/internal/Subscription"; + +@Component({ + selector: 'app-shopping-cart', + templateUrl: './shopping-cart.component.html', + styleUrls: ['./shopping-cart.component.css'] +}) +export class ShoppingCartComponent implements OnInit, OnDestroy { + orderFinished: boolean; + orders: ProductOrders; + total: number; + sub: Subscription; + + @Output() onOrderFinished: EventEmitter; + + constructor(private ecommerceService: EcommerceService) { + this.total = 0; + this.orderFinished = false; + this.onOrderFinished = new EventEmitter(); + } + + ngOnInit() { + this.orders = new ProductOrders(); + this.loadCart(); + this.loadTotal(); + } + + private calculateTotal(products: ProductOrder[]): number { + let sum = 0; + products.forEach(value => { + sum += (value.product.price * value.quantity); + }); + return sum; + } + + ngOnDestroy() { + this.sub.unsubscribe(); + } + + finishOrder() { + this.orderFinished = true; + this.ecommerceService.Total = this.total; + this.onOrderFinished.emit(this.orderFinished); + } + + loadTotal() { + this.sub = this.ecommerceService.OrdersChanged.subscribe(() => { + this.total = this.calculateTotal(this.orders.productOrders); + }); + } + + loadCart() { + this.sub = this.ecommerceService.ProductOrderChanged.subscribe(() => { + let productOrder = this.ecommerceService.SelectedProductOrder; + if (productOrder) { + this.orders.productOrders.push(new ProductOrder( + productOrder.product, productOrder.quantity)); + } + this.ecommerceService.ProductOrders = this.orders; + this.orders = this.ecommerceService.ProductOrders; + this.total = this.calculateTotal(this.orders.productOrders); + }); + } + + reset() { + this.orderFinished = false; + this.orders = new ProductOrders(); + this.orders.productOrders = [] + this.loadTotal(); + this.total = 0; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/assets/.gitkeep b/spring-boot-angular-ecommerce/src/main/frontend/src/assets/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/browserslist b/spring-boot-angular-ecommerce/src/main/frontend/src/browserslist new file mode 100644 index 0000000000..8e09ab492e --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/browserslist @@ -0,0 +1,9 @@ +# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries +# For IE 9-11 support, please uncomment the last line of the file and adjust as needed +> 0.5% +last 2 versions +Firefox ESR +not dead +# IE 9-11 \ No newline at end of file diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.prod.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.prod.ts new file mode 100644 index 0000000000..3612073bc3 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.ts new file mode 100644 index 0000000000..012182efa3 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/environments/environment.ts @@ -0,0 +1,15 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false +}; + +/* + * In development mode, to ignore zone related error stack frames such as + * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can + * import the following file, but please comment it out in production mode + * because it will have performance impact when throw error + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/favicon.ico b/spring-boot-angular-ecommerce/src/main/frontend/src/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8081c7ceaf2be08bf59010158c586170d9d2d517 GIT binary patch literal 5430 zcmc(je{54#6vvCoAI3i*G5%$U7!sA3wtMZ$fH6V9C`=eXGJb@R1%(I_{vnZtpD{6n z5Pl{DmxzBDbrB>}`90e12m8T*36WoeDLA&SD_hw{H^wM!cl_RWcVA!I+x87ee975; z@4kD^=bYPn&pmG@(+JZ`rqQEKxW<}RzhW}I!|ulN=fmjVi@x{p$cC`)5$a!)X&U+blKNvN5tg=uLvuLnuqRM;Yc*swiexsoh#XPNu{9F#c`G zQLe{yWA(Y6(;>y|-efAy11k<09(@Oo1B2@0`PtZSkqK&${ zgEY}`W@t{%?9u5rF?}Y7OL{338l*JY#P!%MVQY@oqnItpZ}?s z!r?*kwuR{A@jg2Chlf0^{q*>8n5Ir~YWf*wmsh7B5&EpHfd5@xVaj&gqsdui^spyL zB|kUoblGoO7G(MuKTfa9?pGH0@QP^b#!lM1yHWLh*2iq#`C1TdrnO-d#?Oh@XV2HK zKA{`eo{--^K&MW66Lgsktfvn#cCAc*(}qsfhrvOjMGLE?`dHVipu1J3Kgr%g?cNa8 z)pkmC8DGH~fG+dlrp(5^-QBeEvkOvv#q7MBVLtm2oD^$lJZx--_=K&Ttd=-krx(Bb zcEoKJda@S!%%@`P-##$>*u%T*mh+QjV@)Qa=Mk1?#zLk+M4tIt%}wagT{5J%!tXAE;r{@=bb%nNVxvI+C+$t?!VJ@0d@HIyMJTI{vEw0Ul ze(ha!e&qANbTL1ZneNl45t=#Ot??C0MHjjgY8%*mGisN|S6%g3;Hlx#fMNcL<87MW zZ>6moo1YD?P!fJ#Jb(4)_cc50X5n0KoDYfdPoL^iV`k&o{LPyaoqMqk92wVM#_O0l z09$(A-D+gVIlq4TA&{1T@BsUH`Bm=r#l$Z51J-U&F32+hfUP-iLo=jg7Xmy+WLq6_tWv&`wDlz#`&)Jp~iQf zZP)tu>}pIIJKuw+$&t}GQuqMd%Z>0?t%&BM&Wo^4P^Y z)c6h^f2R>X8*}q|bblAF?@;%?2>$y+cMQbN{X$)^R>vtNq_5AB|0N5U*d^T?X9{xQnJYeU{ zoZL#obI;~Pp95f1`%X3D$Mh*4^?O?IT~7HqlWguezmg?Ybq|7>qQ(@pPHbE9V?f|( z+0xo!#m@Np9PljsyxBY-UA*{U*la#8Wz2sO|48_-5t8%_!n?S$zlGe+NA%?vmxjS- zHE5O3ZarU=X}$7>;Okp(UWXJxI%G_J-@IH;%5#Rt$(WUX?6*Ux!IRd$dLP6+SmPn= z8zjm4jGjN772R{FGkXwcNv8GBcZI#@Y2m{RNF_w8(Z%^A*!bS*!}s6sh*NnURytky humW;*g7R+&|Ledvc- + + + + Frontend + + + + + + + + + diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/karma.conf.js b/spring-boot-angular-ecommerce/src/main/frontend/src/karma.conf.js new file mode 100644 index 0000000000..b6e00421c9 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/karma.conf.js @@ -0,0 +1,31 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + dir: require('path').join(__dirname, '../coverage'), + reports: ['html', 'lcovonly'], + fixWebpackSourcePaths: true + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false + }); +}; \ No newline at end of file diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/main.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/main.ts new file mode 100644 index 0000000000..91ec6da5f0 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/main.ts @@ -0,0 +1,12 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.log(err)); diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/polyfills.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/polyfills.ts new file mode 100644 index 0000000000..d310405a68 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/polyfills.ts @@ -0,0 +1,80 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ +// import 'core-js/es6/symbol'; +// import 'core-js/es6/object'; +// import 'core-js/es6/function'; +// import 'core-js/es6/parse-int'; +// import 'core-js/es6/parse-float'; +// import 'core-js/es6/number'; +// import 'core-js/es6/math'; +// import 'core-js/es6/string'; +// import 'core-js/es6/date'; +// import 'core-js/es6/array'; +// import 'core-js/es6/regexp'; +// import 'core-js/es6/map'; +// import 'core-js/es6/weak-map'; +// import 'core-js/es6/set'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** IE10 and IE11 requires the following for the Reflect API. */ +// import 'core-js/es6/reflect'; + + +/** Evergreen browsers require these. **/ +// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. +import 'core-js/es7/reflect'; + + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + **/ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + */ + + // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + + /* + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + */ +// (window as any).__Zone_enable_cross_context_check = true; + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/styles.css b/spring-boot-angular-ecommerce/src/main/frontend/src/styles.css new file mode 100644 index 0000000000..90d4ee0072 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/test.ts b/spring-boot-angular-ecommerce/src/main/frontend/src/test.ts new file mode 100644 index 0000000000..16317897b1 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/test.ts @@ -0,0 +1,20 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: any; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.app.json b/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.app.json new file mode 100644 index 0000000000..722c370d58 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.app.json @@ -0,0 +1,12 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/app", + "module": "es2015", + "types": [] + }, + "exclude": [ + "src/test.ts", + "**/*.spec.ts" + ] +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.spec.json b/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.spec.json new file mode 100644 index 0000000000..8f7cedecab --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/tsconfig.spec.json @@ -0,0 +1,19 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/spec", + "module": "commonjs", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "test.ts", + "polyfills.ts" + ], + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/src/tslint.json b/spring-boot-angular-ecommerce/src/main/frontend/src/tslint.json new file mode 100644 index 0000000000..52e2c1a5a7 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/src/tslint.json @@ -0,0 +1,17 @@ +{ + "extends": "../tslint.json", + "rules": { + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ] + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/tsconfig.json b/spring-boot-angular-ecommerce/src/main/frontend/tsconfig.json new file mode 100644 index 0000000000..ef44e2862b --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2017", + "dom" + ] + } +} diff --git a/spring-boot-angular-ecommerce/src/main/frontend/tslint.json b/spring-boot-angular-ecommerce/src/main/frontend/tslint.json new file mode 100644 index 0000000000..3ea984c776 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/frontend/tslint.json @@ -0,0 +1,130 @@ +{ + "rulesDirectory": [ + "node_modules/codelyzer" + ], + "rules": { + "arrow-return-shorthand": true, + "callable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "deprecation": { + "severity": "warn" + }, + "eofline": true, + "forin": true, + "import-blacklist": [ + true, + "rxjs/Rx" + ], + "import-spacing": true, + "indent": [ + true, + "spaces" + ], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": [ + true, + 140 + ], + "member-access": false, + "member-ordering": [ + true, + { + "order": [ + "static-field", + "instance-field", + "static-method", + "instance-method" + ] + } + ], + "no-arg": true, + "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "prefer-const": true, + "quotemark": [ + true, + "single" + ], + "radix": true, + "semicolon": [ + true, + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "unified-signatures": true, + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "no-output-on-prefix": true, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/EcommerceApplication.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/EcommerceApplication.java new file mode 100644 index 0000000000..b1fa14e9a9 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/EcommerceApplication.java @@ -0,0 +1,29 @@ +package com.baeldung.ecommerce; + +import com.baeldung.ecommerce.model.Product; +import com.baeldung.ecommerce.service.ProductService; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class EcommerceApplication { + + public static void main(String[] args) { + SpringApplication.run(EcommerceApplication.class, args); + } + + @Bean + CommandLineRunner runner(ProductService productService) { + return args -> { + productService.save(new Product(1L, "TV Set", 300.00, "http://placehold.it/200x100")); + productService.save(new Product(2L, "Game Console", 200.00, "http://placehold.it/200x100")); + productService.save(new Product(3L, "Sofa", 100.00, "http://placehold.it/200x100")); + productService.save(new Product(4L, "Icecream", 5.00, "http://placehold.it/200x100")); + productService.save(new Product(5L, "Beer", 3.00, "http://placehold.it/200x100")); + productService.save(new Product(6L, "Phone", 500.00, "http://placehold.it/200x100")); + productService.save(new Product(7L, "Watch", 30.00, "http://placehold.it/200x100")); + }; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/OrderController.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/OrderController.java new file mode 100644 index 0000000000..c239496708 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/OrderController.java @@ -0,0 +1,99 @@ +package com.baeldung.ecommerce.controller; + +import com.baeldung.ecommerce.dto.OrderProductDto; +import com.baeldung.ecommerce.exception.ResourceNotFoundException; +import com.baeldung.ecommerce.model.Order; +import com.baeldung.ecommerce.model.OrderProduct; +import com.baeldung.ecommerce.model.OrderStatus; +import com.baeldung.ecommerce.service.OrderProductService; +import com.baeldung.ecommerce.service.OrderService; +import com.baeldung.ecommerce.service.ProductService; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; + +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/api/orders") +public class OrderController { + + ProductService productService; + OrderService orderService; + OrderProductService orderProductService; + + public OrderController(ProductService productService, OrderService orderService, OrderProductService orderProductService) { + this.productService = productService; + this.orderService = orderService; + this.orderProductService = orderProductService; + } + + @GetMapping + @ResponseStatus(HttpStatus.OK) + public @NotNull Iterable list() { + return this.orderService.getAllOrders(); + } + + @PostMapping + public ResponseEntity create(@RequestBody OrderForm form) { + List formDtos = form.getProductOrders(); + validateProductsExistence(formDtos); + Order order = new Order(); + order.setStatus(OrderStatus.PAID.name()); + order = this.orderService.create(order); + + List orderProducts = new ArrayList<>(); + for (OrderProductDto dto : formDtos) { + orderProducts.add(orderProductService.create(new OrderProduct(order, productService.getProduct(dto + .getProduct() + .getId()), dto.getQuantity()))); + } + + order.setOrderProducts(orderProducts); + + this.orderService.update(order); + + String uri = ServletUriComponentsBuilder + .fromCurrentServletMapping() + .path("/orders/{id}") + .buildAndExpand(order.getId()) + .toString(); + HttpHeaders headers = new HttpHeaders(); + headers.add("Location", uri); + + return new ResponseEntity<>(order, headers, HttpStatus.CREATED); + } + + private void validateProductsExistence(List orderProducts) { + List list = orderProducts + .stream() + .filter(op -> Objects.isNull(productService.getProduct(op + .getProduct() + .getId()))) + .collect(Collectors.toList()); + + if (!CollectionUtils.isEmpty(list)) { + new ResourceNotFoundException("Product not found"); + } + } + + public static class OrderForm { + + private List productOrders; + + public List getProductOrders() { + return productOrders; + } + + public void setProductOrders(List productOrders) { + this.productOrders = productOrders; + } + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/ProductController.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/ProductController.java new file mode 100644 index 0000000000..0f5af0af4b --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/controller/ProductController.java @@ -0,0 +1,25 @@ +package com.baeldung.ecommerce.controller; + +import com.baeldung.ecommerce.model.Product; +import com.baeldung.ecommerce.service.ProductService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.constraints.NotNull; + +@RestController +@RequestMapping("/api/products") +public class ProductController { + + private ProductService productService; + + public ProductController(ProductService productService) { + this.productService = productService; + } + + @GetMapping(value = { "", "/" }) + public @NotNull Iterable getProducts() { + return productService.getAllProducts(); + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/dto/OrderProductDto.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/dto/OrderProductDto.java new file mode 100644 index 0000000000..f4c92ee28e --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/dto/OrderProductDto.java @@ -0,0 +1,25 @@ +package com.baeldung.ecommerce.dto; + +import com.baeldung.ecommerce.model.Product; + +public class OrderProductDto { + + private Product product; + private Integer quantity; + + public Product getProduct() { + return product; + } + + public void setProduct(Product product) { + this.product = product; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ApiExceptionHandler.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ApiExceptionHandler.java new file mode 100644 index 0000000000..aae7e39ffc --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ApiExceptionHandler.java @@ -0,0 +1,81 @@ +package com.baeldung.ecommerce.exception; + +import com.fasterxml.jackson.annotation.JsonInclude; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import java.util.ArrayList; +import java.util.List; + +@RestControllerAdvice +public class ApiExceptionHandler { + + @SuppressWarnings("rawtypes") + @ExceptionHandler(ConstraintViolationException.class) + public ResponseEntity handle(ConstraintViolationException e) { + ErrorResponse errors = new ErrorResponse(); + for (ConstraintViolation violation : e.getConstraintViolations()) { + ErrorItem error = new ErrorItem(); + error.setCode(violation.getMessageTemplate()); + error.setMessage(violation.getMessage()); + errors.addError(error); + } + + return new ResponseEntity<>(errors, HttpStatus.BAD_REQUEST); + } + + @SuppressWarnings("rawtypes") + @ExceptionHandler(ResourceNotFoundException.class) + public ResponseEntity handle(ResourceNotFoundException e) { + ErrorItem error = new ErrorItem(); + error.setMessage(e.getMessage()); + + return new ResponseEntity<>(error, HttpStatus.NOT_FOUND); + } + + public static class ErrorItem { + + @JsonInclude(JsonInclude.Include.NON_NULL) private String code; + + private String message; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + } + + public static class ErrorResponse { + + private List errors = new ArrayList<>(); + + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + } + + public void addError(ErrorItem error) { + this.errors.add(error); + } + + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ResourceNotFoundException.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ResourceNotFoundException.java new file mode 100644 index 0000000000..3d8e47326c --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/exception/ResourceNotFoundException.java @@ -0,0 +1,22 @@ +package com.baeldung.ecommerce.exception; + +public class ResourceNotFoundException extends RuntimeException { + + private static final long serialVersionUID = 5861310537366287163L; + + public ResourceNotFoundException() { + super(); + } + + public ResourceNotFoundException(final String message, final Throwable cause) { + super(message, cause); + } + + public ResourceNotFoundException(final String message) { + super(message); + } + + public ResourceNotFoundException(final Throwable cause) { + super(cause); + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Order.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Order.java new file mode 100644 index 0000000000..5b91bc0956 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Order.java @@ -0,0 +1,78 @@ +package com.baeldung.ecommerce.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.JsonManagedReference; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + +import javax.persistence.*; +import javax.validation.Valid; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + +@Entity +@Table(name = "orders") +@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="orderProducts") +public class Order { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @JsonFormat(pattern = "dd/MM/yyyy") private LocalDate dateCreated; + + private String status; + + @OneToMany(mappedBy = "pk.order") + @Valid + private List orderProducts = new ArrayList<>(); + + @Transient + public Double getTotalOrderPrice() { + double sum = 0D; + List orderProducts = getOrderProducts(); + for (OrderProduct op : orderProducts) { + sum += op.getTotalPrice(); + } + + return sum; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public LocalDate getDateCreated() { + return dateCreated; + } + + public void setDateCreated(LocalDate dateCreated) { + this.dateCreated = dateCreated; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public List getOrderProducts() { + return orderProducts; + } + + public void setOrderProducts(List orderProducts) { + this.orderProducts = orderProducts; + } + + @Transient + public int getNumberOfProducts() { + return this.orderProducts.size(); + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProduct.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProduct.java new file mode 100644 index 0000000000..eb1b9876c3 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProduct.java @@ -0,0 +1,87 @@ +package com.baeldung.ecommerce.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Transient; + +@Entity +public class OrderProduct { + + @EmbeddedId + @JsonIgnore + private OrderProductPK pk; + + @Column(nullable = false) private Integer quantity; + + public OrderProduct() { + super(); + } + + public OrderProduct(Order order, Product product, Integer quantity) { + pk = new OrderProductPK(); + pk.setOrder(order); + pk.setProduct(product); + this.quantity = quantity; + } + + @Transient + public Product getProduct() { + return this.pk.getProduct(); + } + + @Transient + public Double getTotalPrice() { + return getProduct().getPrice() * getQuantity(); + } + + public OrderProductPK getPk() { + return pk; + } + + public void setPk(OrderProductPK pk) { + this.pk = pk; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pk == null) ? 0 : pk.hashCode()); + + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + OrderProduct other = (OrderProduct) obj; + if (pk == null) { + if (other.pk != null) { + return false; + } + } else if (!pk.equals(other.pk)) { + return false; + } + + return true; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProductPK.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProductPK.java new file mode 100644 index 0000000000..8440a363c1 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderProductPK.java @@ -0,0 +1,91 @@ +package com.baeldung.ecommerce.model; + +import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.ObjectIdGenerators; + +import javax.persistence.Embeddable; +import javax.persistence.FetchType; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import java.io.Serializable; + +@Embeddable +@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "order") +public class OrderProductPK implements Serializable { + + private static final long serialVersionUID = 476151177562655457L; + + @ManyToOne(optional = false, fetch = FetchType.LAZY) + @JoinColumn(name = "order_id") + private Order order; + + @ManyToOne(optional = false, fetch = FetchType.LAZY) + @JoinColumn(name = "product_id") + private Product product; + + public Order getOrder() { + return order; + } + + public void setOrder(Order order) { + this.order = order; + } + + public Product getProduct() { + return product; + } + + public void setProduct(Product product) { + this.product = product; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + + result = prime * result + ((order.getId() == null) + ? 0 + : order + .getId() + .hashCode()); + result = prime * result + ((product.getId() == null) + ? 0 + : product + .getId() + .hashCode()); + + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + OrderProductPK other = (OrderProductPK) obj; + if (order == null) { + if (other.order != null) { + return false; + } + } else if (!order.equals(other.order)) { + return false; + } + + if (product == null) { + if (other.product != null) { + return false; + } + } else if (!product.equals(other.product)) { + return false; + } + + return true; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderStatus.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderStatus.java new file mode 100644 index 0000000000..36bcd5e30d --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/OrderStatus.java @@ -0,0 +1,5 @@ +package com.baeldung.ecommerce.model; + +public enum OrderStatus { + PAID +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Product.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Product.java new file mode 100644 index 0000000000..fe2061fab5 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/model/Product.java @@ -0,0 +1,62 @@ +package com.baeldung.ecommerce.model; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +@Entity +public class Product { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotNull(message = "Product name is required.") + @Basic(optional = false) + private String name; + + private Double price; + + private String pictureUrl; + + public Product(Long id, @NotNull(message = "Product name is required.") String name, Double price, String pictureUrl) { + this.id = id; + this.name = name; + this.price = price; + this.pictureUrl = pictureUrl; + } + + public Product() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public String getPictureUrl() { + return pictureUrl; + } + + public void setPictureUrl(String pictureUrl) { + this.pictureUrl = pictureUrl; + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderProductRepository.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderProductRepository.java new file mode 100644 index 0000000000..f596ef8520 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderProductRepository.java @@ -0,0 +1,8 @@ +package com.baeldung.ecommerce.repository; + +import com.baeldung.ecommerce.model.OrderProduct; +import com.baeldung.ecommerce.model.OrderProductPK; +import org.springframework.data.repository.CrudRepository; + +public interface OrderProductRepository extends CrudRepository { +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderRepository.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderRepository.java new file mode 100644 index 0000000000..c6ed21707a --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/OrderRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.ecommerce.repository; + +import com.baeldung.ecommerce.model.Order; +import org.springframework.data.repository.CrudRepository; + +public interface OrderRepository extends CrudRepository { +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/ProductRepository.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/ProductRepository.java new file mode 100644 index 0000000000..ff56b54527 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/repository/ProductRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.ecommerce.repository; + +import com.baeldung.ecommerce.model.Product; +import org.springframework.data.repository.CrudRepository; + +public interface ProductRepository extends CrudRepository { +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductService.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductService.java new file mode 100644 index 0000000000..575cd68e88 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductService.java @@ -0,0 +1,13 @@ +package com.baeldung.ecommerce.service; + +import com.baeldung.ecommerce.model.OrderProduct; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +@Validated +public interface OrderProductService { + + OrderProduct create(@NotNull(message = "The products for order cannot be null.") @Valid OrderProduct orderProduct); +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductServiceImpl.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductServiceImpl.java new file mode 100644 index 0000000000..239201d929 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderProductServiceImpl.java @@ -0,0 +1,22 @@ +package com.baeldung.ecommerce.service; + +import com.baeldung.ecommerce.model.OrderProduct; +import com.baeldung.ecommerce.repository.OrderProductRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class OrderProductServiceImpl implements OrderProductService { + + private OrderProductRepository orderProductRepository; + + public OrderProductServiceImpl(OrderProductRepository orderProductRepository) { + this.orderProductRepository = orderProductRepository; + } + + @Override + public OrderProduct create(OrderProduct orderProduct) { + return this.orderProductRepository.save(orderProduct); + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderService.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderService.java new file mode 100644 index 0000000000..babc5f88c6 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderService.java @@ -0,0 +1,17 @@ +package com.baeldung.ecommerce.service; + +import com.baeldung.ecommerce.model.Order; +import org.springframework.validation.annotation.Validated; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +@Validated +public interface OrderService { + + @NotNull Iterable getAllOrders(); + + Order create(@NotNull(message = "The order cannot be null.") @Valid Order order); + + void update(@NotNull(message = "The order cannot be null.") @Valid Order order); +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderServiceImpl.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderServiceImpl.java new file mode 100644 index 0000000000..2833cfcfb6 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/OrderServiceImpl.java @@ -0,0 +1,36 @@ +package com.baeldung.ecommerce.service; + +import com.baeldung.ecommerce.model.Order; +import com.baeldung.ecommerce.repository.OrderRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDate; + +@Service +@Transactional +public class OrderServiceImpl implements OrderService { + + private OrderRepository orderRepository; + + public OrderServiceImpl(OrderRepository orderRepository) { + this.orderRepository = orderRepository; + } + + @Override + public Iterable getAllOrders() { + return this.orderRepository.findAll(); + } + + @Override + public Order create(Order order) { + order.setDateCreated(LocalDate.now()); + + return this.orderRepository.save(order); + } + + @Override + public void update(Order order) { + this.orderRepository.save(order); + } +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductService.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductService.java new file mode 100644 index 0000000000..0887f326cb --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductService.java @@ -0,0 +1,17 @@ +package com.baeldung.ecommerce.service; + +import com.baeldung.ecommerce.model.Product; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; + +@Validated +public interface ProductService { + + @NotNull Iterable getAllProducts(); + + Product getProduct(@Min(value = 1L, message = "Invalid product ID.") long id); + + Product save(Product product); +} diff --git a/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductServiceImpl.java b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductServiceImpl.java new file mode 100644 index 0000000000..af0cc1aaa8 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/java/com/baeldung/ecommerce/service/ProductServiceImpl.java @@ -0,0 +1,35 @@ +package com.baeldung.ecommerce.service; + +import com.baeldung.ecommerce.exception.ResourceNotFoundException; +import com.baeldung.ecommerce.model.Product; +import com.baeldung.ecommerce.repository.ProductRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class ProductServiceImpl implements ProductService { + + private ProductRepository productRepository; + + public ProductServiceImpl(ProductRepository productRepository) { + this.productRepository = productRepository; + } + + @Override + public Iterable getAllProducts() { + return productRepository.findAll(); + } + + @Override + public Product getProduct(long id) { + return productRepository + .findById(id) + .orElseThrow(() -> new ResourceNotFoundException("Product not found")); + } + + @Override + public Product save(Product product) { + return productRepository.save(product); + } +} diff --git a/spring-boot-angular-ecommerce/src/main/resources/application.properties b/spring-boot-angular-ecommerce/src/main/resources/application.properties new file mode 100644 index 0000000000..63a81576af --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/resources/application.properties @@ -0,0 +1,8 @@ +management.security.enabled=false + +spring.datasource.name=ecommercedb +spring.jpa.show-sql=false + +#H2 settings +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console diff --git a/spring-boot-angular-ecommerce/src/test/java/com/baeldung/ecommerce/EcommerceApplicationIntegrationTest.java b/spring-boot-angular-ecommerce/src/test/java/com/baeldung/ecommerce/EcommerceApplicationIntegrationTest.java new file mode 100644 index 0000000000..03450ea7b2 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/test/java/com/baeldung/ecommerce/EcommerceApplicationIntegrationTest.java @@ -0,0 +1,100 @@ +package com.baeldung.ecommerce; + +import com.baeldung.ecommerce.controller.OrderController; +import com.baeldung.ecommerce.controller.ProductController; +import com.baeldung.ecommerce.dto.OrderProductDto; +import com.baeldung.ecommerce.model.Order; +import com.baeldung.ecommerce.model.Product; +import org.assertj.core.api.Assertions; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.Collections; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasProperty; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = { EcommerceApplication.class }, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class EcommerceApplicationIntegrationTest { + + @Autowired private TestRestTemplate restTemplate; + + @LocalServerPort private int port; + + @Autowired private ProductController productController; + + @Autowired private OrderController orderController; + + @Test + public void contextLoads() { + Assertions + .assertThat(productController) + .isNotNull(); + Assertions + .assertThat(orderController) + .isNotNull(); + } + + @Test + public void givenGetProductsApiCall_whenProductListRetrieved_thenSizeMatchAndListContainsProductNames() { + ResponseEntity> responseEntity = restTemplate.exchange("http://localhost:" + port + "/api/products", HttpMethod.GET, null, new ParameterizedTypeReference>() { + }); + Iterable products = responseEntity.getBody(); + Assertions + .assertThat(products) + .hasSize(7); + + assertThat(products, hasItem(hasProperty("name", is("TV Set")))); + assertThat(products, hasItem(hasProperty("name", is("Game Console")))); + assertThat(products, hasItem(hasProperty("name", is("Sofa")))); + assertThat(products, hasItem(hasProperty("name", is("Icecream")))); + assertThat(products, hasItem(hasProperty("name", is("Beer")))); + assertThat(products, hasItem(hasProperty("name", is("Phone")))); + assertThat(products, hasItem(hasProperty("name", is("Watch")))); + } + + @Test + public void givenGetOrdersApiCall_whenProductListRetrieved_thenSizeMatchAndListContainsProductNames() { + ResponseEntity> responseEntity = restTemplate.exchange("http://localhost:" + port + "/api/orders", HttpMethod.GET, null, new ParameterizedTypeReference>() { + }); + + Iterable orders = responseEntity.getBody(); + Assertions + .assertThat(orders) + .hasSize(0); + } + + @Test + public void givenPostOrder_whenBodyRequestMatcherJson_thenResponseContainsEqualObjectProperties() { + final ResponseEntity postResponse = restTemplate.postForEntity("http://localhost:" + port + "/api/orders", prepareOrderForm(), Order.class); + Order order = postResponse.getBody(); + Assertions + .assertThat(postResponse.getStatusCode()) + .isEqualByComparingTo(HttpStatus.CREATED); + + assertThat(order, hasProperty("status", is("PAID"))); + assertThat(order.getOrderProducts(), hasItem(hasProperty("quantity", is(2)))); + } + + private OrderController.OrderForm prepareOrderForm() { + OrderController.OrderForm orderForm = new OrderController.OrderForm(); + OrderProductDto productDto = new OrderProductDto(); + productDto.setProduct(new Product(1L, "TV Set", 300.00, "http://placehold.it/200x100")); + productDto.setQuantity(2); + orderForm.setProductOrders(Collections.singletonList(productDto)); + + return orderForm; + } +} From 695c31a14d8900af02a98bc3b255cb1c11a197b7 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Fri, 3 Aug 2018 17:36:10 +0530 Subject: [PATCH 109/298] BAEL-7965 JMH module fails when build (#4888) * BAEL-7965 JMH module fails when build -Added jmh module in default profile in parent pom * Update pom.xml moved jmh module to integration profile --- jmh/README.md | 1 + pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/jmh/README.md b/jmh/README.md index 2a2c6a173a..9c5a70e3c2 100644 --- a/jmh/README.md +++ b/jmh/README.md @@ -1,3 +1,4 @@ ## Relevant articles: - [Microbenchmarking with Java](http://www.baeldung.com/java-microbenchmark-harness) + diff --git a/pom.xml b/pom.xml index 7386111e84..34b55fd1f4 100644 --- a/pom.xml +++ b/pom.xml @@ -673,8 +673,8 @@ spring-amqp-simple spring-apache-camel spring-batch - testing-modules/junit-abstract - + testing-modules/junit-abstract + jmh From d4371b3d2ee185ec52a97a43d9b3f4ec54659b28 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Tue, 31 Jul 2018 02:23:08 +0530 Subject: [PATCH 110/298] Create pom.xml --- testing-modules/parallel-tests-junit/pom.xml | 50 ++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 testing-modules/parallel-tests-junit/pom.xml diff --git a/testing-modules/parallel-tests-junit/pom.xml b/testing-modules/parallel-tests-junit/pom.xml new file mode 100644 index 0000000000..1a42437b1b --- /dev/null +++ b/testing-modules/parallel-tests-junit/pom.xml @@ -0,0 +1,50 @@ + + 4.0.0 + + com.baeldung + parallel-tests-junit + 0.0.1-SNAPSHOT + jar + + parallel-tests-junit + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 4.12 + test + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.0 + + all + 10 + 2 + 2 + 6 + 3.5 + 5 + true + + FunctionTestSuite.class + + + + + + + + From be6d6cff8cbe5d33302c0070bb6ab88a573fc645 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Tue, 31 Jul 2018 02:25:09 +0530 Subject: [PATCH 111/298] Create FunctionTestSuite.java BAEL-1857 --- .../src/test/java/com/baeldung/FunctionTestSuite.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java diff --git a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java new file mode 100644 index 0000000000..42bd7bbcbc --- /dev/null +++ b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java @@ -0,0 +1,11 @@ +package com.baeldung; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({StringFunctionTest.class, MathFunctionTest.class}) +public class FunctionTestSuite { + +} From ff1b1fc8f4a9c7b6d51de074d4dbfcbc040c5105 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Tue, 31 Jul 2018 02:26:30 +0530 Subject: [PATCH 112/298] BAEL-1857 Running Parallel JUnit Tests with Maven --- .../java/com/baeldung/FunctionTestSuite.java | 22 +++++++------- .../java/com/baeldung/MathFunctionTest.java | 29 +++++++++++++++++++ .../java/com/baeldung/StringFunctionTest.java | 18 ++++++++++++ 3 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 testing-modules/parallel-tests-junit/src/test/java/com/baeldung/MathFunctionTest.java create mode 100644 testing-modules/parallel-tests-junit/src/test/java/com/baeldung/StringFunctionTest.java diff --git a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java index 42bd7bbcbc..c7f4050b18 100644 --- a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java +++ b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java @@ -1,11 +1,11 @@ -package com.baeldung; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@RunWith(Suite.class) -@SuiteClasses({StringFunctionTest.class, MathFunctionTest.class}) -public class FunctionTestSuite { - -} +package com.baeldung; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({StringFunctionTest.class, MathFunctionTest.class}) +public class FunctionTestSuite { + +} diff --git a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/MathFunctionTest.java b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/MathFunctionTest.java new file mode 100644 index 0000000000..9a609c3e93 --- /dev/null +++ b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/MathFunctionTest.java @@ -0,0 +1,29 @@ +package com.baeldung; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class MathFunctionTest { + + @Test + public void test_addingIntegers_returnsSum() throws InterruptedException { + assertEquals(22, Math.addExact(10, 12)); + + } + + @Test + public void test_multiplyingIntegers_returnsProduct() { + assertEquals(120, Math.multiplyExact(10, 12)); + } + + @Test + public void test_subtractingIntegers_returnsDifference() { + assertEquals(2, Math.subtractExact(12, 10)); + } + + @Test + public void test_minimumInteger() { + assertEquals(10, Math.min(10, 12)); + } +} diff --git a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/StringFunctionTest.java b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/StringFunctionTest.java new file mode 100644 index 0000000000..9adfea8ff0 --- /dev/null +++ b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/StringFunctionTest.java @@ -0,0 +1,18 @@ +package com.baeldung; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class StringFunctionTest { + + @Test + public void test_upperCase() { + assertEquals("TESTCASE", "testCase".toUpperCase()); + } + + @Test + public void test_indexOf() { + assertEquals(1, "testCase".indexOf("e")); + } +} From 0cc05d9802e7c608e7d2fdfecdca6e36d29dd36e Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Fri, 3 Aug 2018 20:58:06 -0500 Subject: [PATCH 113/298] BAEL-1901 and BAEL-1555 add links (#4892) * 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 --- core-java-8/README.md | 1 + spring-5-mvc/README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/core-java-8/README.md b/core-java-8/README.md index 8e4e5f95b5..e69641b25c 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -56,3 +56,4 @@ - [Generalized Target-Type Inference in Java](http://www.baeldung.com/java-generalized-target-type-inference) - [Image to Base64 String Conversion](http://www.baeldung.com/java-base64-image-string) - [Calculate Age in Java](http://www.baeldung.com/java-get-age) +- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date) diff --git a/spring-5-mvc/README.md b/spring-5-mvc/README.md index c031a9d10e..71b7a19b43 100644 --- a/spring-5-mvc/README.md +++ b/spring-5-mvc/README.md @@ -1,2 +1,3 @@ ### Relevant Articles: - [Spring Boot and Kotlin](http://www.baeldung.com/spring-boot-kotlin) +- [Spring MVC Streaming and SSE Request Processing](http://www.baeldung.com/spring-mvc-sse-streams) From 8e0985f80af9bc063019af92ca324a5b8a891611 Mon Sep 17 00:00:00 2001 From: Kirti Deo Date: Sat, 4 Aug 2018 11:21:44 +0530 Subject: [PATCH 114/298] BAEL-2024 : java.lang.ClassCastException: java.util.Arrays$ArrayList cannot be cast to java.util.ArrayList : Kirti Deo --- .../ClassCastException.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java diff --git a/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java b/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java new file mode 100644 index 0000000000..754713dadb --- /dev/null +++ b/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java @@ -0,0 +1,39 @@ +package com.baeldung.classcastexception; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class ClassCastException { + + public static void main(String[] args) { + + List> personList = new ArrayList>(); + // To correct the Exception at line #18, modify the line #11 code as: + // List> personList = new ArrayList >(); + // Line #18 code as personList.add(Arrays.asList(personArray)); + Person p1 = new Person(1, "John"); + Person p2 = new Person(2, "Snow"); + Person[] personArray = new Person[] { p1, p2 }; + personList.add((ArrayList) Arrays.asList(personArray)); + System.out.println("Personlist: " + personList); + + } + +} + +class Person { + int id; + String name; + + Person(int id, String name) { + this.id = id; + this.name = name; + } + + @Override + public String toString() { + return "Person [id=" + id + ", name=" + name + "]"; + } + +} From b2aeac4eb88dc7ebdf7cb7252c087032a32da0f2 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Sat, 4 Aug 2018 16:45:02 +0400 Subject: [PATCH 115/298] Moving file parser inside the core-java module. Adding Test cases for reading files. --- .../fileparser/BufferedReaderExample.java | 12 +----- .../baeldung/fileparser/FileConstants.java | 8 ++++ .../fileparser/FileReaderExample.java | 31 ++++++++++++++++ .../fileparser/FilesReadLinesExample.java | 18 +++++++++ .../fileparser/ScannerIntExample.java | 12 +----- .../fileparser/ScannerStringExample.java | 12 +----- .../fileparser/BufferedReaderUnitTest.java | 19 ++++++++++ .../fileparser/FileReaderUnitTest.java | 19 ++++++++++ .../fileparser/FilesReadAllLinesUnitTest.java | 19 ++++++++++ .../fileparser/ScannerIntUnitTest.java | 19 ++++++++++ .../fileparser/ScannerStringUnitTest.java | 19 ++++++++++ .../src/test/resources/sampleNumberFile.txt | 2 + .../src/test/resources/sampleTextFile.txt | 2 + .../fileparser/FileReaderExample.java | 37 ------------------- .../fileparser/FilesReadLineExample.java | 28 -------------- 15 files changed, 159 insertions(+), 98 deletions(-) rename {file-parser/src => core-java/src/main/java}/com/baeldung/fileparser/BufferedReaderExample.java (54%) create mode 100644 core-java/src/main/java/com/baeldung/fileparser/FileConstants.java create mode 100644 core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java create mode 100644 core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java rename {file-parser/src => core-java/src/main/java}/com/baeldung/fileparser/ScannerIntExample.java (53%) rename {file-parser/src => core-java/src/main/java}/com/baeldung/fileparser/ScannerStringExample.java (54%) create mode 100644 core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java create mode 100644 core-java/src/test/resources/sampleNumberFile.txt create mode 100644 core-java/src/test/resources/sampleTextFile.txt delete mode 100644 file-parser/src/com/baeldung/fileparser/FileReaderExample.java delete mode 100644 file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java diff --git a/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java b/core-java/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java similarity index 54% rename from file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java rename to core-java/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java index a139ed80ab..45ff486a79 100644 --- a/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java +++ b/core-java/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java @@ -7,18 +7,8 @@ import java.util.ArrayList; public class BufferedReaderExample { - private static final String FILENAME = "src/resources/txt.txt"; + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { - ArrayList result = new ArrayList<>(); try (BufferedReader br = new BufferedReader(new FileReader(filename))) { diff --git a/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java b/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java new file mode 100644 index 0000000000..1d3cce79f2 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java @@ -0,0 +1,8 @@ +package com.baeldung.fileparser; + +public class FileConstants { + + protected static final String TEXT_FILENAME = "src/main/resources/sampleTextFile.txt"; + + protected static final String NNUMBER_FILENAME = "src/main/resources/sampleNumberFile.txt"; +} diff --git a/core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java b/core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java new file mode 100644 index 0000000000..f9dd2a9ec5 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java @@ -0,0 +1,31 @@ +package com.baeldung.fileparser; + +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; + +public class FileReaderExample { + + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (FileReader f = new FileReader(filename)) { + StringBuffer sb = new StringBuffer(); + while (f.ready()) { + char c = (char) f.read(); + if (c == '\n') { + result.add(sb.toString()); + sb = new StringBuffer(); + } else { + sb.append(c); + } + } + if (sb.length() > 0) { + result.add(sb.toString()); + } + } + + return result; + } +} diff --git a/core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java b/core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java new file mode 100644 index 0000000000..8e74f7d386 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java @@ -0,0 +1,18 @@ +package com.baeldung.fileparser; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +public class FilesReadLinesExample { + + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { + + List result = Files.readAllLines(Paths.get(filename)); + + return (ArrayList) result; + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java b/core-java/src/main/java/com/baeldung/fileparser/ScannerIntExample.java similarity index 53% rename from file-parser/src/com/baeldung/fileparser/ScannerIntExample.java rename to core-java/src/main/java/com/baeldung/fileparser/ScannerIntExample.java index aab7455c30..25d17af4ea 100644 --- a/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java +++ b/core-java/src/main/java/com/baeldung/fileparser/ScannerIntExample.java @@ -7,17 +7,7 @@ import java.util.Scanner; public class ScannerIntExample { - private static final String FILENAME = "src/resources/num.txt"; - - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { ArrayList result = new ArrayList<>(); diff --git a/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java b/core-java/src/main/java/com/baeldung/fileparser/ScannerStringExample.java similarity index 54% rename from file-parser/src/com/baeldung/fileparser/ScannerStringExample.java rename to core-java/src/main/java/com/baeldung/fileparser/ScannerStringExample.java index fc18b53609..ec213c9490 100644 --- a/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java +++ b/core-java/src/main/java/com/baeldung/fileparser/ScannerStringExample.java @@ -7,17 +7,7 @@ import java.util.Scanner; public class ScannerStringExample { - private static final String FILENAME = "src/resources/txt.txt"; - - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { ArrayList result = new ArrayList<>(); diff --git a/core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java new file mode 100644 index 0000000000..78f900d796 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class BufferedReaderUnitTest { + + protected static final String TEXT_FILENAME = "src/test/resources/sampleTextFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetArrayList() throws IOException { + List lines = BufferedReaderExample.generateArrayListFromFile(TEXT_FILENAME); + assertTrue("File does not has 2 lines", lines.size() == 2); + } +} diff --git a/core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java new file mode 100644 index 0000000000..a38e58d348 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class FileReaderUnitTest { + + protected static final String TEXT_FILENAME = "src/test/resources/sampleTextFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetArrayList() throws IOException { + List lines = FileReaderExample.generateArrayListFromFile(TEXT_FILENAME); + assertTrue("File does not has 2 lines", lines.size() == 2); + } +} diff --git a/core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java new file mode 100644 index 0000000000..c0b742fd47 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class FilesReadAllLinesUnitTest { + + protected static final String TEXT_FILENAME = "src/test/resources/sampleTextFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetArrayList() throws IOException { + List lines = FilesReadLinesExample.generateArrayListFromFile(TEXT_FILENAME); + assertTrue("File does not has 2 lines", lines.size() == 2); + } +} diff --git a/core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java new file mode 100644 index 0000000000..0a398ba7c6 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class ScannerIntUnitTest { + + protected static final String NUMBER_FILENAME = "src/test/resources/sampleNumberFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetIntArrayList() throws IOException { + List numbers = ScannerIntExample.generateArrayListFromFile(NUMBER_FILENAME); + assertTrue("File does not has 2 lines", numbers.size() == 2); + } +} diff --git a/core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java new file mode 100644 index 0000000000..8f9b0a56c0 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class ScannerStringUnitTest { + + protected static final String TEXT_FILENAME = "src/test/resources/sampleTextFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetArrayList() throws IOException { + List lines = ScannerStringExample.generateArrayListFromFile(TEXT_FILENAME); + assertTrue("File does not has 2 lines", lines.size() == 2); + } +} diff --git a/core-java/src/test/resources/sampleNumberFile.txt b/core-java/src/test/resources/sampleNumberFile.txt new file mode 100644 index 0000000000..7787faa3c1 --- /dev/null +++ b/core-java/src/test/resources/sampleNumberFile.txt @@ -0,0 +1,2 @@ +111 +222 \ No newline at end of file diff --git a/core-java/src/test/resources/sampleTextFile.txt b/core-java/src/test/resources/sampleTextFile.txt new file mode 100644 index 0000000000..75cb50aafa --- /dev/null +++ b/core-java/src/test/resources/sampleTextFile.txt @@ -0,0 +1,2 @@ +Hello +World \ No newline at end of file diff --git a/file-parser/src/com/baeldung/fileparser/FileReaderExample.java b/file-parser/src/com/baeldung/fileparser/FileReaderExample.java deleted file mode 100644 index 1ab98973c7..0000000000 --- a/file-parser/src/com/baeldung/fileparser/FileReaderExample.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.fileparser; - -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; - -public class FileReaderExample { - - private static final String FILENAME = "src/resources/txt.txt"; - - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { - - ArrayList result = new ArrayList<>(); - - try (FileReader f = new FileReader(filename)) { - - while (f.ready()) { - char c = (char) f.read(); - - if (c != ' ' && c != '\t' && c != '\n') { - result.add(c); - } - } - return result; - } - - } - -} diff --git a/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java b/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java deleted file mode 100644 index 7f94525c22..0000000000 --- a/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.fileparser; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; - -public class FilesReadLineExample { - - private static final String FILENAME = "src/resources/txt.txt"; - - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { - - List result = Files.readAllLines(Paths.get(filename)); - - return (ArrayList) result; - } - -} From 406146f959fbf4ccefc95bc786ad97d74ddb7140 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Sat, 4 Aug 2018 16:52:27 +0400 Subject: [PATCH 116/298] Removing unused file. --- .../main/java/com/baeldung/fileparser/FileConstants.java | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 core-java/src/main/java/com/baeldung/fileparser/FileConstants.java diff --git a/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java b/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java deleted file mode 100644 index 1d3cce79f2..0000000000 --- a/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.fileparser; - -public class FileConstants { - - protected static final String TEXT_FILENAME = "src/main/resources/sampleTextFile.txt"; - - protected static final String NNUMBER_FILENAME = "src/main/resources/sampleNumberFile.txt"; -} From 38327e77714ec3890356cf19718a96c66cae40d7 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Sat, 4 Aug 2018 16:53:38 +0400 Subject: [PATCH 117/298] Removing unused files. --- file-parser/src/resources/num.txt | 2 -- file-parser/src/resources/txt.txt | 2 -- 2 files changed, 4 deletions(-) delete mode 100644 file-parser/src/resources/num.txt delete mode 100644 file-parser/src/resources/txt.txt diff --git a/file-parser/src/resources/num.txt b/file-parser/src/resources/num.txt deleted file mode 100644 index 7787faa3c1..0000000000 --- a/file-parser/src/resources/num.txt +++ /dev/null @@ -1,2 +0,0 @@ -111 -222 \ No newline at end of file diff --git a/file-parser/src/resources/txt.txt b/file-parser/src/resources/txt.txt deleted file mode 100644 index 75cb50aafa..0000000000 --- a/file-parser/src/resources/txt.txt +++ /dev/null @@ -1,2 +0,0 @@ -Hello -World \ No newline at end of file From b6e56ef57aa80d4a142b66f85cf86742a005fa5e Mon Sep 17 00:00:00 2001 From: kartiksingla Date: Sat, 4 Aug 2018 20:23:10 +0530 Subject: [PATCH 118/298] [BAEL-1967] - Custom validation MessageSource in Spring Boot --- .../springbootmvc/LoginController.java | 20 +++++++++++ .../SpringBootMvcApplication.java | 7 ++-- .../CustomMessageSourceConfiguration.java | 27 ++++++++++++++ .../config/FaviconConfiguration.java | 11 +++--- .../springbootmvc/model/LoginForm.java | 32 +++++++++++++++++ .../src/main/resources/messages.properties | 1 + .../src/main/resources/messages_fr.properties | 1 + .../LoginControllerUnitTest.java | 35 +++++++++++++++++++ 8 files changed, 125 insertions(+), 9 deletions(-) create mode 100644 spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/LoginController.java create mode 100644 spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/CustomMessageSourceConfiguration.java create mode 100644 spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/model/LoginForm.java create mode 100644 spring-boot-mvc/src/main/resources/messages.properties create mode 100644 spring-boot-mvc/src/main/resources/messages_fr.properties create mode 100644 spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/LoginControllerUnitTest.java diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/LoginController.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/LoginController.java new file mode 100644 index 0000000000..589024c0bc --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/LoginController.java @@ -0,0 +1,20 @@ +package com.baeldung.springbootmvc; + +import javax.validation.Valid; + +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.springbootmvc.model.LoginForm; + +@RestController +@RequestMapping("/") +public class LoginController { + + @PostMapping("loginform") + public String processLogin(@Valid LoginForm form) { + return "Success"; + + } +} diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java index c4213af0a3..df8f72f500 100644 --- a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/SpringBootMvcApplication.java @@ -2,12 +2,11 @@ package com.baeldung.springbootmvc; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; @SpringBootApplication public class SpringBootMvcApplication { - public static void main(String[] args) { - SpringApplication.run(SpringBootMvcApplication.class, args); - } + public static void main(String[] args) { + SpringApplication.run(SpringBootMvcApplication.class, args); + } } diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/CustomMessageSourceConfiguration.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/CustomMessageSourceConfiguration.java new file mode 100644 index 0000000000..e83f15a366 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/CustomMessageSourceConfiguration.java @@ -0,0 +1,27 @@ +package com.baeldung.springbootmvc.config; + +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ReloadableResourceBundleMessageSource; +import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; + +@Configuration +public class CustomMessageSourceConfiguration { + + @Bean + public MessageSource messageSource() { + ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); + messageSource.setBasename("classpath:messages"); + messageSource.setDefaultEncoding("UTF-8"); + return messageSource; + } + + @Bean + public LocalValidatorFactoryBean getValidator() { + LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean(); + bean.setValidationMessageSource(messageSource()); + return bean; + } + +} diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java index 1ee13ccec2..9a1f47b5cb 100644 --- a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/config/FaviconConfiguration.java @@ -32,12 +32,13 @@ public class FaviconConfiguration { requestHandler.setLocations(locations); return requestHandler; } - - //@Controller + + // @Controller static class FaviconController { - - @RequestMapping(value="favicon.ico", method=RequestMethod.GET) + + @RequestMapping(value = "favicon.ico", method = RequestMethod.GET) @ResponseBody - void favicon() {} + void favicon() { + } } } diff --git a/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/model/LoginForm.java b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/model/LoginForm.java new file mode 100644 index 0000000000..107cd1bbf1 --- /dev/null +++ b/spring-boot-mvc/src/main/java/com/baeldung/springbootmvc/model/LoginForm.java @@ -0,0 +1,32 @@ +package com.baeldung.springbootmvc.model; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +public class LoginForm { + + @NotEmpty(message = "{email.notempty}") + @Email + private String email; + + @NotNull + private String password; + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + +} diff --git a/spring-boot-mvc/src/main/resources/messages.properties b/spring-boot-mvc/src/main/resources/messages.properties new file mode 100644 index 0000000000..9794c89651 --- /dev/null +++ b/spring-boot-mvc/src/main/resources/messages.properties @@ -0,0 +1 @@ +email.notempty=Please provide valid email id. \ No newline at end of file diff --git a/spring-boot-mvc/src/main/resources/messages_fr.properties b/spring-boot-mvc/src/main/resources/messages_fr.properties new file mode 100644 index 0000000000..070f4e0bfc --- /dev/null +++ b/spring-boot-mvc/src/main/resources/messages_fr.properties @@ -0,0 +1 @@ +email.notempty=Veuillez fournir un identifiant de messagerie valide. \ No newline at end of file diff --git a/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/LoginControllerUnitTest.java b/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/LoginControllerUnitTest.java new file mode 100644 index 0000000000..68229f459c --- /dev/null +++ b/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/LoginControllerUnitTest.java @@ -0,0 +1,35 @@ +package com.baeldung.springbootmvc; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.RequestBuilder; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +import com.baeldung.springbootmvc.config.CustomMessageSourceConfiguration; + +@RunWith(SpringRunner.class) +@WebMvcTest(value = LoginController.class, secure = false) +@ContextConfiguration(classes = { SpringBootMvcApplication.class, CustomMessageSourceConfiguration.class }) +public class LoginControllerUnitTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void givenLoginForm_whenEmailFieldNotProvided_testCustomValidMessageIsReturned() throws Exception { + + RequestBuilder builder = MockMvcRequestBuilders.post("/loginform").param("email", "").param("password", "helo"); + + // header("accept-language", "fr"). + MvcResult perform = mockMvc.perform(builder).andReturn(); + Assert.assertTrue(perform.getResolvedException().getMessage().contains("valid email")); + + } +} \ No newline at end of file From 8efb09daec7d1192d90dcd039d17116742f7d819 Mon Sep 17 00:00:00 2001 From: kartiksingla Date: Sat, 4 Aug 2018 20:28:15 +0530 Subject: [PATCH 119/298] POM file updated for BAEL-1967 --- spring-boot-mvc/pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index f4a1d75673..453a05d8e7 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.2.RELEASE + 2.0.4.RELEASE @@ -27,6 +27,11 @@ spring-boot-starter-test test
+ + + org.springframework.boot + spring-boot-starter-validation + From 7df9bffeb8f7b4e439a914cc2b66b9181671935d Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 4 Aug 2018 23:48:03 +0300 Subject: [PATCH 120/298] Update WebConfig.java --- .../src/main/java/org/baeldung/boot/config/WebConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java b/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java index 825e38f622..9554facb12 100644 --- a/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java +++ b/spring-boot/src/main/java/org/baeldung/boot/config/WebConfig.java @@ -17,3 +17,4 @@ public class WebConfig implements WebMvcConfigurer { registry.addConverter(new GenericBigDecimalConverter()); } } + From cae67c041e5f3589f5ed106324e1973aa25b7e89 Mon Sep 17 00:00:00 2001 From: Patryk Date: Sun, 5 Aug 2018 00:51:01 +0200 Subject: [PATCH 121/298] BAEL-1704: Non-Trivial Work in Kotlin vs Java (#4861) * BAEL-1704: Non-Trivial Work in Kotlin vs Java * BAEL-1704: Non-Trivial Work in Kotlin vs Java Renaming one test class --- .../kotlinvsjava/CompanionObjectTest.kt | 21 ++++++ .../baeldung/kotlinvsjava/ConstructorTest.kt | 18 +++++ .../baeldung/kotlinvsjava/DataClassTest.kt | 33 +++++++++ .../baeldung/kotlinvsjava/DelegationTest.kt | 27 +++++++ .../baeldung/kotlinvsjava/ExceptionsTest.kt | 34 +++++++++ .../kotlinvsjava/ExtensionFunctionsTest.kt | 30 ++++++++ .../baeldung/kotlinvsjava/FunctionsTest.kt | 70 +++++++++++++++++++ .../baeldung/kotlinvsjava/IsOperatorTest.kt | 36 ++++++++++ .../baeldung/kotlinvsjava/NullSafetyTest.kt | 67 ++++++++++++++++++ .../kotlinvsjava/OperatorsOverloadingTest.kt | 61 ++++++++++++++++ .../baeldung/kotlinvsjava/PropertiesTest.kt | 32 +++++++++ 11 files changed, 429 insertions(+) create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/CompanionObjectTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ConstructorTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DataClassTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DelegationTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExtensionFunctionsTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/FunctionsTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/IsOperatorTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/NullSafetyTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/OperatorsOverloadingTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/PropertiesTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/CompanionObjectTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/CompanionObjectTest.kt new file mode 100644 index 0000000000..69573fb75b --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/CompanionObjectTest.kt @@ -0,0 +1,21 @@ +package com.baeldung.kotlinvsjava + +import org.junit.Test +import kotlin.test.assertEquals + +class CompanionObjectTest { + + @Test + fun givenAClassWithCompanionObject_whenCallingMethodTheSameAsStaticOne_thenWeGetAResult() { + assertEquals("A", A.returnClassName()) + } + +} + +class A { + companion object { + fun returnClassName(): String { + return "A" + } + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ConstructorTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ConstructorTest.kt new file mode 100644 index 0000000000..fdb5d05db5 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ConstructorTest.kt @@ -0,0 +1,18 @@ +package com.baeldung.kotlinvsjava + +import org.junit.Test +import kotlin.test.assertEquals + +class ConstructorTests { + + @Test + fun givenAClassWithPrimaryConstructor_whenCreatingAnInstance_thenWeGetObject() { + var example = Example(1, "Example") + + assertEquals(1, example.id) + assertEquals("Example", example.name) + } + +} + +class Example constructor(val id: Int, var name: String) \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DataClassTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DataClassTest.kt new file mode 100644 index 0000000000..ad79538d3c --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DataClassTest.kt @@ -0,0 +1,33 @@ +package com.baeldung.kotlinvsjava + +import org.junit.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse + +class DataClassTest { + + @Test + fun givenASampleDataClass_whenCallingToStringMethod_thenItReturnsAllProperties() { + val student = Student(1, "John", "Smith") + + assertEquals(1, student.id) + assertEquals("John", student.name) + assertEquals("Smith", student.lastName) + assertEquals("Student(id=1, name=John, lastName=Smith)", student.toString()) + } + + @Test + fun givenASampleDataClass_whenCreatingACopyWithGeneratedFunction_thenItReturnsACopyWithRequestedChanges() { + val student = Student(1, "John", "Smith") + val student2 = student.copy(id = 2, name = "Anne") + + assertEquals(2, student2.id) + assertEquals("Anne", student2.name) + assertEquals("Smith", student2.lastName) + assertEquals("Student(id=2, name=Anne, lastName=Smith)", student2.toString()) + assertFalse(student.equals(student2)) + } + +} + +data class Student(val id: Int, val name: String, val lastName: String) \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DelegationTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DelegationTest.kt new file mode 100644 index 0000000000..2da824c2db --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DelegationTest.kt @@ -0,0 +1,27 @@ +package com.baeldung.kotlinvsjava + +import org.junit.Test +import kotlin.test.assertEquals + +class DelegationTest { + + @Test + fun givenAClassWithDelegation_whenCallDelegatedMethod_thenWeGetAResultDefinedInPassedObject() { + val car = Car(V6Engine()) + + assertEquals("Vroom", car.makeSound()) + } + +} + +interface Engine { + fun makeSound(): String +} + +class V6Engine: Engine { + override fun makeSound(): String { + return "Vroom" + } +} + +class Car(e: Engine) : Engine by e \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt new file mode 100644 index 0000000000..d1b3390544 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt @@ -0,0 +1,34 @@ +package com.baeldung.kotlinvsjava + +import java.io.IOException +import kotlin.test.Test +import kotlin.test.assertEquals + +class ExceptionsTest { + + @Test + fun givenATryExpression_whenReturning5InLastExpressionOfTryBlock_thenWeGet5() { + val value: Int = try { 5 } catch (e: IOException) { 6 } + + assertEquals(5, value) + } + + @Test + fun givenATryExpression_whenReturning6InLastExpressionOfCatchBlock_thenWeGet6() { + val value: Int = try { funThrowingException() } catch (e: IOException) { 6 } + + assertEquals(6, value) + } + + @org.junit.Test(expected = IllegalArgumentException::class) + fun givenANullString_whenUsingElvisOperator_thenExceptionIsThrown() { + val sampleString: String? = null + + val length: Int = sampleString?.length ?: throw IllegalArgumentException("String must not be null") + } + + private fun funThrowingException(): Nothing { + throw IOException() + } + +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExtensionFunctionsTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExtensionFunctionsTest.kt new file mode 100644 index 0000000000..3db73b6d2d --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExtensionFunctionsTest.kt @@ -0,0 +1,30 @@ +package com.baeldung.kotlinvsjava + +import org.junit.Test +import kotlin.test.assertEquals + +class ExtensionFunctionsTest { + + @Test + fun givenAStringWithAnExtensionFunction_whenCallingThatFunction_thenItConcatenatesStrings() { + val sampleString = "ABC" + val concatenatedString = sampleString.appendString("DEF") + + assertEquals("ABCDEF", concatenatedString) + } + + @Test + fun givenAStringWithAnExtensionProperty_whenReadingProperty_thenItReturnsLengthOfString() { + val sampleString = "ABC" + + assertEquals(3, sampleString.size) + } + + fun String.appendString(str : String): String { + return plus(str) + } + + val String.size: Int + get() = length + +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/FunctionsTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/FunctionsTest.kt new file mode 100644 index 0000000000..6176478dfe --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/FunctionsTest.kt @@ -0,0 +1,70 @@ +package com.baeldung.kotlinvsjava + +import org.junit.Test +import kotlin.test.assertEquals + +class FunctionsTest { + + @Test + fun givenALambdaExpressionConcatenatingString_whenUsingTheFunctionWithAAndBString_thenWeGetAB() { + val concat: (String, String) -> String = { a, b -> a + b } + + assertEquals("AB", concat("A","B")) + } + + @Test + fun givenAnAnonymousFunctionConcatenatingString_whenUsingTheFunctionWithAAndBString_thenWeGetAB() { + val concat: (String, String) -> String = fun(a: String, b: String): String { return a + b } + + assertEquals("AB", concat("A","B")) + } + + @Test + fun givenAnPlusMethodOfString_whenUsingTheFunctionWithAAndBString_thenWeGetAB() { + val concat = String::plus + + assertEquals("AB", concat("A","B")) + } + + @Test + fun givenAStringConstractorAssignedToFunction_whenUsingFunctionReference_thenWeGetNewString() { + val concat = ::String + + assertEquals("A", concat().plus("A")) + } + + @Test + fun givenAClassImplementingAFunctionType_whenUsingTheFunctionWithAAndBString_thenWeGetAB() { + val concat = StringConcatenation() + + assertEquals("AB", concat("A", "B")) + } + + @Test + fun givenALambdaExpressionWithReceiver_whenUsingTheFunctionWithReceiver_thenWeGetABC() { + val concat: String.(String, String) -> String = { a, b -> plus(a).plus(b) } + + assertEquals("ABC", "A".concat("B", "C")) + } + + @Test + fun givenALambdaExpressionWithinLambdaExpression_whenUsingTheFunction_thenWeGetAB() { + val concat: (String) -> ((String) -> String) = { a -> {b -> a + b} } + + assertEquals("AB", (concat("A")("B"))) + } + + @Test + fun given3NestedLambdaExpression_whenUsingTheFunction_thenWeGetABC() { + val concat: (String) -> (String) -> (String) -> String = { a -> {b -> { c -> a + b + c} } } + + assertEquals("ABC", concat("A")("B")("C")) + } + +} + +class StringConcatenation: (String, String) -> String { + override fun invoke(p1: String, p2: String): String { + return p1 + p2 + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/IsOperatorTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/IsOperatorTest.kt new file mode 100644 index 0000000000..1817602cdf --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/IsOperatorTest.kt @@ -0,0 +1,36 @@ +package com.baeldung.kotlinvsjava + +import org.junit.Test +import kotlin.math.absoluteValue +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class IsOperatorTest { + + @Test + fun givenSampleValue_whenUsingIsOperatorInIfStatement_thenItCastsAutomaticallyToString() { + val value: Any = "string" + + if(value is String) { + assertEquals(6, value.length) + } + } + + @Test + fun givenSampleValue_whenUsingIsOperatorWithAndOperator_thenItCastsAutomaticallyToString() { + val value: Any = "string" + + assertTrue(value is String && value.length == 6) + } + + @Test + fun givenSampleValue_whenUsingWithWhenOperator_thenItCastsAutomaticallyToString() { + val value: Any = "string" + + when(value) { + is String -> assertEquals(6, value.length) + is Int -> assertEquals(6, value.absoluteValue) + } + } + +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/NullSafetyTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/NullSafetyTest.kt new file mode 100644 index 0000000000..8cb3cbc761 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/NullSafetyTest.kt @@ -0,0 +1,67 @@ +package com.baeldung.kotlinvsjava + +import kotlin.test.Test +import java.lang.NullPointerException +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertNull + +class NullSafetyTest { + + @Test + fun givenStringAndNull_whenUsingSafeCallOperatorWithLengthMethod_thenReturnsLengthForStringAndNullForNull() { + val stringValue: String? = "string" + val nullValue: String? = null + + assertNotNull(stringValue?.length) + assertNull(nullValue?.length) + } + + @Test(expected = NullPointerException::class) + fun givenNullReference_whenUsingTheNotNullAssertionOperator_thenItThrowsNullPointerException() { + val stringValue: String? = "string" + val nullValue: String? = null + + assertNotNull(stringValue!!.length) + nullValue!!.length + } + + @Test + fun givenStringAndNull_whenUsingElvisOperator_thenItTestsAgainstNullAndReturnsTheProperValue() { + val stringValue: String? = "string" + val nullValue: String? = null + + val shouldBeLength: Int = stringValue?.length ?: -1 + val souldBeMinusOne: Int = nullValue?.length ?: -1 + + assertEquals(6, shouldBeLength) + assertEquals(-1, souldBeMinusOne) + } + + @Test + fun givenString_whenCastingToInt_thenItReturnsNull() { + val stringValue: String? = "string" + + val intValue: Int? = stringValue as? Int + + assertNull(intValue) + } + + @Test + fun givenCollectionWithNulls_whenFilterNonNull_thenItReturnsCollectionWithoutNulls() { + val list: List = listOf("a", "b", null) + val nonNullList = list.filterNotNull() + + assertEquals(2, nonNullList.size) + assertEquals(nonNullList, listOf("a", "b")) + } + + @Test + fun givenCollectionWithNulls_whenLetWithSafeCallOperator_thenItOmitsNulls() { + val list: List = listOf("a", "b", null) + for(elem in list) { + elem?.let { assertNotNull(it) } + } + } + +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/OperatorsOverloadingTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/OperatorsOverloadingTest.kt new file mode 100644 index 0000000000..a28008da20 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/OperatorsOverloadingTest.kt @@ -0,0 +1,61 @@ +package com.baeldung.kotlinvsjava + +import org.junit.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class OperatorsOverloadingTest { + + @Test + fun givenThePlaneClassWithOverloadedIncrementationOperator_whenCallingTheOperator_thenItIncreasesSpeed(){ + var plane = Plane(0.0) + + plane++ + assertEquals(50.0, plane.currentSpeed) + } + + @Test + fun givenThePlaneClassWithOverloadedMinusOperator_whenCallingTheOperator_thenItDecreaseSpeed(){ + var plane = Plane(1000.0) + + plane - 500.0 + assertEquals(500.0, plane.currentSpeed) + } + + @Test + fun givenThePlaneClassWithOverloadedInvokeOperator_whenCallingTheOperator_thenItSetSpeed(){ + var plane = Plane(0.0) + + plane(150.0) + assertEquals(150.0, plane.currentSpeed) + } + + @Test + fun given2PlaneObjectWithOverloadedComparisonOperator_whenCallingTheOperator_thenItComparesSpeedValues(){ + var plane = Plane(0.0) + var plane2 = Plane(150.0) + + assertTrue(plane < (plane2)) + } + +} + +class Plane(var currentSpeed: Double) { + + operator fun inc(): Plane { + currentSpeed += 50.0 + return this + } + + operator fun minus(number: Double) { + currentSpeed = if(currentSpeed < number) 0.0 else currentSpeed - number + } + + operator fun invoke(speed: Double) { + currentSpeed = speed + } + + operator fun compareTo(plane: Plane): Int { + return currentSpeed.compareTo(plane.currentSpeed) + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/PropertiesTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/PropertiesTest.kt new file mode 100644 index 0000000000..95abcd68a2 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/PropertiesTest.kt @@ -0,0 +1,32 @@ +package com.baeldung.kotlinvsjava + +import org.junit.Test +import java.math.BigDecimal +import kotlin.test.assertEquals + +class PropertiesTest { + + @Test + fun givenASampleClassWithValAndVarProperties_whenSettingPrice_thenWeGetZeroOrOne() { + val product = Product() + product.price = BigDecimal(10) + + val product2 = Product() + product2.price = null + + assertEquals("empty", product.id) + assertEquals("empty", product2.id) + assertEquals(BigDecimal(10), product.price) + assertEquals(BigDecimal(1), product2.price) + } + +} + +class Product { + + val id: String? = "empty" + + var price: BigDecimal? = BigDecimal.ZERO + set(value) = if(value == null) { field = BigDecimal.ONE} else { field = value } + +} \ No newline at end of file From 41750614347f5842367797f3147a6954f3ffe214 Mon Sep 17 00:00:00 2001 From: Timoteo Ponce <248934+timoteoponce@users.noreply.github.com> Date: Sun, 5 Aug 2018 05:36:26 -0400 Subject: [PATCH 122/298] Bael 1964 (#4881) * Added initial code for BAEL-1964, in-memory authentication application * Switched to default security encoder instead of a specific one --- .../inmemory/InMemoryAuthApplication.java | 14 ++++++ .../inmemory/InMemoryAuthController.java | 21 ++++++++ .../InMemoryAuthWebSecurityConfigurer.java | 34 +++++++++++++ .../inmemory/InMemoryAuthControllerTest.java | 48 +++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthApplication.java create mode 100644 spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthController.java create mode 100644 spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthWebSecurityConfigurer.java create mode 100644 spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java diff --git a/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthApplication.java b/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthApplication.java new file mode 100644 index 0000000000..6ccfd04553 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthApplication.java @@ -0,0 +1,14 @@ +package com.baeldung.inmemory; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class InMemoryAuthApplication { + + public static void main(String[] args) { + SpringApplication.run(InMemoryAuthApplication.class, args); + } + + +} diff --git a/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthController.java b/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthController.java new file mode 100644 index 0000000000..ff7ae9a131 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthController.java @@ -0,0 +1,21 @@ +package com.baeldung.inmemory; + +import java.util.Arrays; +import java.util.List; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class InMemoryAuthController { + + @GetMapping("/public/hello") + public List publicHello() { + return Arrays.asList("Hello", "World", "from", "Public"); + } + + @GetMapping("/private/hello") + public List privateHello() { + return Arrays.asList("Hello", "World", "from", "Private"); + } + +} diff --git a/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthWebSecurityConfigurer.java b/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthWebSecurityConfigurer.java new file mode 100644 index 0000000000..4b32a1126e --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryAuthWebSecurityConfigurer.java @@ -0,0 +1,34 @@ +package com.baeldung.inmemory; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.crypto.factory.PasswordEncoderFactories; +import org.springframework.security.crypto.password.PasswordEncoder; + +@Configuration +public class InMemoryAuthWebSecurityConfigurer extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder(); + auth.inMemoryAuthentication() + .passwordEncoder(encoder) + .withUser("spring") + .password(encoder.encode("secret")) + .roles("USER"); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/private/**") + .authenticated() + .antMatchers("/public/**") + .permitAll() + .and() + .httpBasic(); + } + +} diff --git a/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java b/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java new file mode 100644 index 0000000000..7a8ea7b248 --- /dev/null +++ b/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java @@ -0,0 +1,48 @@ +package com.baeldung.inmemory; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = InMemoryAuthApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) +public class InMemoryAuthControllerTest { + + @Autowired + private TestRestTemplate template; + + @Test + public void givenRequestOnPublicService_shouldSucceedWith200() throws Exception { + ResponseEntity result = template.getForEntity("/public/hello", String.class); + assertEquals(HttpStatus.OK, result.getStatusCode()); + } + + @Test + public void givenRequestOnPrivateService_shouldFailWith401() throws Exception { + ResponseEntity result = template.getForEntity("/private/hello", String.class); + assertEquals(HttpStatus.UNAUTHORIZED, result.getStatusCode()); + } + + @Test + public void givenAuthRequestOnPrivateService_shouldSucceedWith200() throws Exception { + ResponseEntity result = template.withBasicAuth("spring", "secret") + .getForEntity("/private/hello", String.class); + assertEquals(HttpStatus.OK, result.getStatusCode()); + } + + @Test + public void givenInvalidAuthRequestOnPrivateService_shouldSucceedWith200() throws Exception { + ResponseEntity result = template.withBasicAuth("spring", "wrong") + .getForEntity("/private/hello", String.class); + assertEquals(HttpStatus.UNAUTHORIZED, result.getStatusCode()); + } + +} From be115a073c63fd26b79af1f06a4460819155b3cf Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 5 Aug 2018 13:10:06 +0300 Subject: [PATCH 123/298] Fix typo (#4897) * add new module * fix typo --- .../org/baeldung/common/error/MyCustomErrorController.java | 2 +- .../org/baeldung/common/error/controller/ErrorController.java | 4 ++-- .../properties/MyServletContainerCustomizationBean.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-boot/src/main/java/org/baeldung/common/error/MyCustomErrorController.java b/spring-boot/src/main/java/org/baeldung/common/error/MyCustomErrorController.java index e4e20de671..6b342a1bfb 100644 --- a/spring-boot/src/main/java/org/baeldung/common/error/MyCustomErrorController.java +++ b/spring-boot/src/main/java/org/baeldung/common/error/MyCustomErrorController.java @@ -13,7 +13,7 @@ public class MyCustomErrorController implements ErrorController { @GetMapping(value = PATH) public String error() { - return "Error heaven"; + return "Error haven"; } @Override diff --git a/spring-boot/src/main/java/org/baeldung/common/error/controller/ErrorController.java b/spring-boot/src/main/java/org/baeldung/common/error/controller/ErrorController.java index d503f5da6d..3e26f8c9d8 100644 --- a/spring-boot/src/main/java/org/baeldung/common/error/controller/ErrorController.java +++ b/spring-boot/src/main/java/org/baeldung/common/error/controller/ErrorController.java @@ -14,9 +14,9 @@ public class ErrorController { return "Error Code: 400 occured."; } - @GetMapping("/errorHeaven") + @GetMapping("/errorHaven") String errorHeaven() { - return "You have reached the heaven of errors!!!"; + return "You have reached the haven of errors!!!"; } } diff --git a/spring-boot/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java b/spring-boot/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java index 2d955bac9b..f6ab017298 100644 --- a/spring-boot/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java +++ b/spring-boot/src/main/java/org/baeldung/common/properties/MyServletContainerCustomizationBean.java @@ -19,7 +19,7 @@ public class MyServletContainerCustomizationBean implements WebServerFactoryCust container.setContextPath("/springbootapp"); container.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/400")); - container.addErrorPages(new ErrorPage("/errorHeaven")); + container.addErrorPages(new ErrorPage("/errorHaven")); } } From d268ffa5c92026ec5ff584b7d818ce01e8a67dbe Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 5 Aug 2018 18:40:49 +0530 Subject: [PATCH 124/298] [BAEL-7670] Added logback.xml in missing modules in src/main/resources --- JGit/src/main/resources/logback.xml | 13 +++++++++++++ Twitter4J/src/main/resources/logback.xml | 13 +++++++++++++ activejdbc/src/main/resources/logback.xml | 13 +++++++++++++ akka-streams/src/main/resources/logback.xml | 13 +++++++++++++ algorithms/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../annotation-user/src/main/resources/logback.xml | 13 +++++++++++++ antlr/src/main/resources/logback.xml | 13 +++++++++++++ apache-avro/src/main/resources/logback.xml | 13 +++++++++++++ apache-bval/src/main/resources/logback.xml | 13 +++++++++++++ apache-cayenne/src/main/resources/logback.xml | 13 +++++++++++++ apache-curator/src/main/resources/logback.xml | 13 +++++++++++++ apache-cxf/cxf-aegis/src/main/resources/logback.xml | 13 +++++++++++++ .../cxf-introduction/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../cxf-spring/src/main/resources/logback.xml | 13 +++++++++++++ apache-meecrowave/src/main/resources/logback.xml | 13 +++++++++++++ apache-opennlp/src/main/resources/logback.xml | 13 +++++++++++++ apache-poi/src/main/resources/logback.xml | 13 +++++++++++++ apache-solrj/src/main/resources/logback.xml | 13 +++++++++++++ apache-spark/src/main/resources/logback.xml | 13 +++++++++++++ apache-thrift/src/main/resources/logback.xml | 13 +++++++++++++ apache-tika/src/main/resources/logback.xml | 13 +++++++++++++ apache-zookeeper/src/main/resources/logback.xml | 13 +++++++++++++ asciidoctor/src/main/resources/logback.xml | 13 +++++++++++++ asm/src/main/resources/logback.xml | 13 +++++++++++++ atomix/src/main/resources/logback.xml | 13 +++++++++++++ autovalue/src/main/resources/logback.xml | 13 +++++++++++++ aws-lambda/src/main/resources/logback.xml | 13 +++++++++++++ aws/src/main/resources/logback.xml | 13 +++++++++++++ axon/src/main/resources/logback.xml | 13 +++++++++++++ azure/src/main/resources/logback.xml | 13 +++++++++++++ bootique/src/main/resources/logback.xml | 13 +++++++++++++ cas/cas-secured-app/src/main/resources/logback.xml | 13 +++++++++++++ cdi/src/main/resources/logback.xml | 13 +++++++++++++ checker-plugin/src/main/resources/logback.xml | 13 +++++++++++++ core-groovy/src/main/resources/logback.xml | 13 +++++++++++++ core-java-10/src/main/resources/logback.xml | 13 +++++++++++++ core-java-11/src/main/resources/logback.xml | 13 +++++++++++++ core-java-8/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ core-kotlin/src/main/resources/logback.xml | 13 +++++++++++++ custom-pmd/src/main/resources/logback.xml | 13 +++++++++++++ dagger/src/main/resources/logback.xml | 13 +++++++++++++ data-structures/src/main/resources/logback.xml | 13 +++++++++++++ deeplearning4j/src/main/resources/logback.xml | 13 +++++++++++++ deltaspike/src/main/resources/logback.xml | 13 +++++++++++++ disruptor/src/main/resources/logback.xml | 13 +++++++++++++ dozer/src/main/resources/logback.xml | 13 +++++++++++++ drools/src/main/resources/logback.xml | 13 +++++++++++++ dubbo/src/main/resources/logback.xml | 13 +++++++++++++ ejb/ejb-client/src/main/resources/logback.xml | 13 +++++++++++++ ejb/ejb-remote/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../widlfly-web/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../wildfly-ejb/src/main/resources/logback.xml | 13 +++++++++++++ .../wildfly-jpa/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ ethereum/src/main/resources/logback.xml | 13 +++++++++++++ ethereumj/src/main/resources/logback.xml | 13 +++++++++++++ feign/src/main/resources/logback.xml | 13 +++++++++++++ flips/src/main/resources/logback.xml | 13 +++++++++++++ geotools/src/main/resources/logback.xml | 13 +++++++++++++ google-cloud/src/main/resources/logback.xml | 13 +++++++++++++ google-web-toolkit/src/main/resources/logback.xml | 13 +++++++++++++ graphql/graphql-java/src/main/resources/logback.xml | 13 +++++++++++++ grpc/src/main/resources/logback.xml | 13 +++++++++++++ .../guava-18/src/main/resources/logback.xml | 13 +++++++++++++ .../guava-19/src/main/resources/logback.xml | 13 +++++++++++++ .../guava-21/src/main/resources/logback.xml | 13 +++++++++++++ guest/core-java-9/src/main/resources/logback.xml | 13 +++++++++++++ guest/deep-jsf/src/main/resources/logback.xml | 13 +++++++++++++ .../remote-debugging/src/main/resources/logback.xml | 13 +++++++++++++ .../spring-boot-app/src/main/resources/logback.xml | 13 +++++++++++++ guest/spring-mvc/src/main/resources/logback.xml | 13 +++++++++++++ .../spring-security/src/main/resources/logback.xml | 13 +++++++++++++ guest/thread-pools/src/main/resources/logback.xml | 13 +++++++++++++ guest/tomcat-app/src/main/resources/logback.xml | 13 +++++++++++++ .../rest-server/src/main/resources/logback.xml | 13 +++++++++++++ .../soap_client/src/main/resources/logback.xml | 13 +++++++++++++ .../soap_example/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ guice/src/main/resources/logback.xml | 13 +++++++++++++ hbase/src/main/resources/logback.xml | 13 +++++++++++++ hystrix/src/main/resources/logback.xml | 13 +++++++++++++ image-processing/src/main/resources/logback.xml | 13 +++++++++++++ immutables/src/main/resources/logback.xml | 13 +++++++++++++ influxdb/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ java-lite/src/main/resources/logback.xml | 13 +++++++++++++ java-rmi/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ java-vavr-stream/src/main/resources/logback.xml | 13 +++++++++++++ java-websocket/src/main/resources/logback.xml | 13 +++++++++++++ javafx/src/main/resources/logback.xml | 13 +++++++++++++ javax-servlets/src/main/resources/logback.xml | 13 +++++++++++++ javaxval/src/main/resources/logback.xml | 13 +++++++++++++ jee-7/src/main/resources/logback.xml | 13 +++++++++++++ jenkins/hello-world/src/main/resources/logback.xml | 13 +++++++++++++ jgroups/src/main/resources/logback.xml | 13 +++++++++++++ jjwt/src/main/resources/logback.xml | 13 +++++++++++++ jmeter/src/main/resources/logback.xml | 13 +++++++++++++ jmh/src/main/resources/logback.xml | 13 +++++++++++++ jni/src/main/resources/logback.xml | 13 +++++++++++++ .../jnosql-artemis/src/main/resources/logback.xml | 13 +++++++++++++ jnosql/jnosql-diana/src/main/resources/logback.xml | 13 +++++++++++++ jooby/src/main/resources/logback.xml | 13 +++++++++++++ jpa-storedprocedure/src/main/resources/logback.xml | 13 +++++++++++++ json-path/src/main/resources/logback.xml | 13 +++++++++++++ json/src/main/resources/logback.xml | 13 +++++++++++++ jsonb/src/main/resources/logback.xml | 13 +++++++++++++ jws/src/main/resources/logback.xml | 13 +++++++++++++ kotlin-js/src/main/resources/logback.xml | 13 +++++++++++++ lagom/greeting-api/src/main/resources/logback.xml | 13 +++++++++++++ lagom/greeting-impl/src/main/resources/logback.xml | 13 +++++++++++++ lagom/weather-api/src/main/resources/logback.xml | 13 +++++++++++++ lagom/weather-impl/src/main/resources/logback.xml | 13 +++++++++++++ libraries-data/src/main/resources/logback.xml | 13 +++++++++++++ libraries-server/src/main/resources/logback.xml | 13 +++++++++++++ libraries/src/main/resources/logback.xml | 13 +++++++++++++ linkrest/src/main/resources/logback.xml | 13 +++++++++++++ lombok/src/main/resources/logback.xml | 13 +++++++++++++ lucene/src/main/resources/logback.xml | 13 +++++++++++++ mapstruct/src/main/resources/logback.xml | 13 +++++++++++++ maven-archetype/src/main/resources/logback.xml | 13 +++++++++++++ maven/src/main/resources/logback.xml | 13 +++++++++++++ meecrowave/src/main/resources/logback.xml | 13 +++++++++++++ mesos-marathon/src/main/resources/logback.xml | 13 +++++++++++++ metrics/src/main/resources/logback.xml | 13 +++++++++++++ microprofile/src/main/resources/logback.xml | 13 +++++++++++++ msf4j/src/main/resources/logback.xml | 13 +++++++++++++ mustache/src/main/resources/logback.xml | 13 +++++++++++++ mvn-wrapper/src/main/resources/logback.xml | 13 +++++++++++++ mybatis/src/main/resources/logback.xml | 13 +++++++++++++ noexception/src/main/resources/logback.xml | 13 +++++++++++++ orientdb/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../front-controller/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ pdf/src/main/resources/logback.xml | 13 +++++++++++++ performance-tests/src/main/resources/logback.xml | 13 +++++++++++++ .../java-cassandra/src/main/resources/logback.xml | 13 +++++++++++++ .../java-cockroachdb/src/main/resources/logback.xml | 13 +++++++++++++ .../java-jpa/src/main/resources/logback.xml | 13 +++++++++++++ .../java-mongodb/src/main/resources/logback.xml | 13 +++++++++++++ .../liquibase/src/main/resources/logback.xml | 13 +++++++++++++ .../redis/src/main/resources/logback.xml | 13 +++++++++++++ .../solr/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../spring-data-solr/src/main/resources/logback.xml | 13 +++++++++++++ protobuffer/src/main/resources/logback.xml | 13 +++++++++++++ rabbitmq/src/main/resources/logback.xml | 13 +++++++++++++ ratpack/src/main/resources/logback.xml | 13 +++++++++++++ rest-with-spark-java/src/main/resources/logback.xml | 13 +++++++++++++ resteasy/src/main/resources/logback.xml | 13 +++++++++++++ .../easy-rules/src/main/resources/logback.xml | 13 +++++++++++++ .../openl-tablets/src/main/resources/logback.xml | 13 +++++++++++++ .../rulebook/src/main/resources/logback.xml | 13 +++++++++++++ rxjava/src/main/resources/logback.xml | 13 +++++++++++++ saas/src/main/resources/logback.xml | 13 +++++++++++++ spark-java/src/main/resources/logback.xml | 13 +++++++++++++ spring-4/src/main/resources/logback.xml | 13 +++++++++++++ spring-5-mvc/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-5-reactive/src/main/resources/logback.xml | 13 +++++++++++++ spring-5-security/src/main/resources/logback.xml | 13 +++++++++++++ spring-5/src/main/resources/logback.xml | 13 +++++++++++++ spring-activiti/src/main/resources/logback.xml | 13 +++++++++++++ spring-akka/src/main/resources/logback.xml | 13 +++++++++++++ spring-amqp-simple/src/main/resources/logback.xml | 13 +++++++++++++ spring-amqp/src/main/resources/logback.xml | 13 +++++++++++++ spring-apache-camel/src/main/resources/logback.xml | 13 +++++++++++++ spring-bom/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../greeter-library/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-boot-gradle/src/main/resources/logback.xml | 13 +++++++++++++ spring-boot-jasypt/src/main/resources/logback.xml | 13 +++++++++++++ spring-boot-keycloak/src/main/resources/logback.xml | 13 +++++++++++++ spring-boot-mvc/src/main/resources/logback.xml | 13 +++++++++++++ spring-boot-ops/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-boot-security/src/main/resources/logback.xml | 13 +++++++++++++ spring-boot-vue/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../batch-job/src/main/resources/logback.xml | 13 +++++++++++++ .../data-flow-server/src/main/resources/logback.xml | 13 +++++++++++++ .../data-flow-shell/src/main/resources/logback.xml | 13 +++++++++++++ .../log-sink/src/main/resources/logback.xml | 13 +++++++++++++ .../time-processor/src/main/resources/logback.xml | 13 +++++++++++++ .../time-source/src/main/resources/logback.xml | 13 +++++++++++++ .../spring-cloud-aws/src/main/resources/logback.xml | 13 +++++++++++++ .../config/src/main/resources/logback.xml | 13 +++++++++++++ .../discovery/src/main/resources/logback.xml | 13 +++++++++++++ .../gateway/src/main/resources/logback.xml | 13 +++++++++++++ .../svc-book/src/main/resources/logback.xml | 13 +++++++++++++ .../svc-rating/src/main/resources/logback.xml | 13 +++++++++++++ .../zipkin/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../rest-consumer/src/main/resources/logback.xml | 13 +++++++++++++ .../rest-producer/src/main/resources/logback.xml | 13 +++++++++++++ .../demo-backend/src/main/resources/logback.xml | 13 +++++++++++++ .../demo-frontend/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../auth-client/src/main/resources/logback.xml | 13 +++++++++++++ .../auth-resource/src/main/resources/logback.xml | 13 +++++++++++++ .../auth-server/src/main/resources/logback.xml | 13 +++++++++++++ .../boot/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../Greeting/src/main/resources/logback.xml | 13 +++++++++++++ .../HelloWorld/src/main/resources/logback.xml | 13 +++++++++++++ .../eureka-client/src/main/resources/logback.xml | 13 +++++++++++++ .../eureka-server/src/main/resources/logback.xml | 13 +++++++++++++ .../zuul-server/src/main/resources/logback.xml | 13 +++++++++++++ spring-core/src/main/resources/logback.xml | 13 +++++++++++++ spring-cucumber/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-data-jpa/src/main/resources/logback.xml | 13 +++++++++++++ spring-data-keyvalue/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-data-rest/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-drools/src/main/resources/logback.xml | 13 +++++++++++++ spring-ejb/ejb-beans/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-freemarker/src/main/resources/logback.xml | 13 +++++++++++++ spring-groovy/src/main/resources/logback.xml | 13 +++++++++++++ spring-hibernate3/src/main/resources/logback.xml | 13 +++++++++++++ spring-integration/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-jinq/src/main/resources/logback.xml | 13 +++++++++++++ spring-jms/src/main/resources/logback.xml | 13 +++++++++++++ spring-jooq/src/main/resources/logback.xml | 13 +++++++++++++ spring-kafka/src/main/resources/logback.xml | 13 +++++++++++++ spring-katharsis/src/main/resources/logback.xml | 13 +++++++++++++ spring-mobile/src/main/resources/logback.xml | 13 +++++++++++++ spring-mockito/src/main/resources/logback.xml | 13 +++++++++++++ spring-mustache/src/main/resources/logback.xml | 13 +++++++++++++ spring-mvc-forms-jsp/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-mvc-kotlin/src/main/resources/logback.xml | 13 +++++++++++++ spring-mvc-simple/src/main/resources/logback.xml | 13 +++++++++++++ spring-mvc-velocity/src/main/resources/logback.xml | 13 +++++++++++++ spring-mybatis/src/main/resources/logback.xml | 13 +++++++++++++ spring-protobuf/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-reactor/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../client/src/main/resources/logback.xml | 13 +++++++++++++ .../server/src/main/resources/logback.xml | 13 +++++++++++++ .../client/src/main/resources/logback.xml | 13 +++++++++++++ .../server/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-rest-angular/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-rest-shell/src/main/resources/logback.xml | 13 +++++++++++++ spring-rest-template/src/main/resources/logback.xml | 13 +++++++++++++ spring-roo/src/main/resources/logback.xml | 13 +++++++++++++ spring-security-acl/src/main/resources/logback.xml | 13 +++++++++++++ .../server/src/main/resources/logback.xml | 13 +++++++++++++ .../server/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-security-core/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-sleuth/src/main/resources/logback.xml | 13 +++++++++++++ spring-social-login/src/main/resources/logback.xml | 13 +++++++++++++ spring-spel/src/main/resources/logback.xml | 13 +++++++++++++ spring-state-machine/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ spring-userservice/src/main/resources/logback.xml | 13 +++++++++++++ spring-vertx/src/main/resources/logback.xml | 13 +++++++++++++ spring-webflux-amqp/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../spring-zuul-ui/src/main/resources/logback.xml | 13 +++++++++++++ .../sse-jaxrs-client/src/main/resources/logback.xml | 13 +++++++++++++ .../sse-jaxrs-server/src/main/resources/logback.xml | 13 +++++++++++++ static-analysis/src/main/resources/logback.xml | 13 +++++++++++++ stripe/src/main/resources/logback.xml | 13 +++++++++++++ structurizr/src/main/resources/logback.xml | 13 +++++++++++++ struts-2/src/main/resources/logback.xml | 13 +++++++++++++ .../junit-5/src/main/resources/logback.xml | 13 +++++++++++++ .../junit-abstract/src/main/resources/logback.xml | 13 +++++++++++++ .../mockito-2/src/main/resources/logback.xml | 13 +++++++++++++ .../mocks/jmockit/src/main/resources/logback.xml | 13 +++++++++++++ .../mock-comparisons/src/main/resources/logback.xml | 13 +++++++++++++ .../mockserver/src/main/resources/logback.xml | 13 +++++++++++++ .../runjunitfromjava/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ .../spring-testing/src/main/resources/logback.xml | 13 +++++++++++++ .../testing/src/main/resources/logback.xml | 13 +++++++++++++ twilio/src/main/resources/logback.xml | 13 +++++++++++++ undertow/src/main/resources/logback.xml | 13 +++++++++++++ vaadin-spring/src/main/resources/logback.xml | 13 +++++++++++++ vaadin/src/main/resources/logback.xml | 13 +++++++++++++ vavr/src/main/resources/logback.xml | 13 +++++++++++++ .../src/main/resources/logback.xml | 13 +++++++++++++ wicket/src/main/resources/logback.xml | 13 +++++++++++++ xml/src/main/resources/logback.xml | 13 +++++++++++++ xmlunit-2/src/main/resources/logback.xml | 13 +++++++++++++ 357 files changed, 4641 insertions(+) create mode 100644 JGit/src/main/resources/logback.xml create mode 100644 Twitter4J/src/main/resources/logback.xml create mode 100644 activejdbc/src/main/resources/logback.xml create mode 100644 akka-streams/src/main/resources/logback.xml create mode 100644 algorithms/src/main/resources/logback.xml create mode 100644 animal-sniffer-mvn-plugin/src/main/resources/logback.xml create mode 100644 annotations/annotation-processing/src/main/resources/logback.xml create mode 100644 annotations/annotation-user/src/main/resources/logback.xml create mode 100644 antlr/src/main/resources/logback.xml create mode 100644 apache-avro/src/main/resources/logback.xml create mode 100644 apache-bval/src/main/resources/logback.xml create mode 100644 apache-cayenne/src/main/resources/logback.xml create mode 100644 apache-curator/src/main/resources/logback.xml create mode 100644 apache-cxf/cxf-aegis/src/main/resources/logback.xml create mode 100644 apache-cxf/cxf-introduction/src/main/resources/logback.xml create mode 100644 apache-cxf/cxf-jaxrs-implementation/src/main/resources/logback.xml create mode 100644 apache-cxf/cxf-spring/src/main/resources/logback.xml create mode 100644 apache-meecrowave/src/main/resources/logback.xml create mode 100644 apache-opennlp/src/main/resources/logback.xml create mode 100644 apache-poi/src/main/resources/logback.xml create mode 100644 apache-solrj/src/main/resources/logback.xml create mode 100644 apache-spark/src/main/resources/logback.xml create mode 100644 apache-thrift/src/main/resources/logback.xml create mode 100644 apache-tika/src/main/resources/logback.xml create mode 100644 apache-zookeeper/src/main/resources/logback.xml create mode 100644 asciidoctor/src/main/resources/logback.xml create mode 100644 asm/src/main/resources/logback.xml create mode 100644 atomix/src/main/resources/logback.xml create mode 100644 autovalue/src/main/resources/logback.xml create mode 100644 aws-lambda/src/main/resources/logback.xml create mode 100644 aws/src/main/resources/logback.xml create mode 100644 axon/src/main/resources/logback.xml create mode 100644 azure/src/main/resources/logback.xml create mode 100644 bootique/src/main/resources/logback.xml create mode 100644 cas/cas-secured-app/src/main/resources/logback.xml create mode 100644 cdi/src/main/resources/logback.xml create mode 100644 checker-plugin/src/main/resources/logback.xml create mode 100644 core-groovy/src/main/resources/logback.xml create mode 100644 core-java-10/src/main/resources/logback.xml create mode 100644 core-java-11/src/main/resources/logback.xml create mode 100644 core-java-8/src/main/resources/logback.xml create mode 100644 core-java-collections/src/main/resources/logback.xml create mode 100644 core-java-persistence/src/main/resources/logback.xml create mode 100644 core-kotlin/src/main/resources/logback.xml create mode 100644 custom-pmd/src/main/resources/logback.xml create mode 100644 dagger/src/main/resources/logback.xml create mode 100644 data-structures/src/main/resources/logback.xml create mode 100644 deeplearning4j/src/main/resources/logback.xml create mode 100644 deltaspike/src/main/resources/logback.xml create mode 100644 disruptor/src/main/resources/logback.xml create mode 100644 dozer/src/main/resources/logback.xml create mode 100644 drools/src/main/resources/logback.xml create mode 100644 dubbo/src/main/resources/logback.xml create mode 100644 ejb/ejb-client/src/main/resources/logback.xml create mode 100644 ejb/ejb-remote/src/main/resources/logback.xml create mode 100644 ejb/ejb-session-beans/src/main/resources/logback.xml create mode 100644 ejb/wildfly/widlfly-web/src/main/resources/logback.xml create mode 100644 ejb/wildfly/wildfly-ejb-interfaces/src/main/resources/logback.xml create mode 100644 ejb/wildfly/wildfly-ejb/src/main/resources/logback.xml create mode 100644 ejb/wildfly/wildfly-jpa/src/main/resources/logback.xml create mode 100644 enterprise-patterns/intercepting-filter-pattern/src/main/resources/logback.xml create mode 100644 ethereum/src/main/resources/logback.xml create mode 100644 ethereumj/src/main/resources/logback.xml create mode 100644 feign/src/main/resources/logback.xml create mode 100644 flips/src/main/resources/logback.xml create mode 100644 geotools/src/main/resources/logback.xml create mode 100644 google-cloud/src/main/resources/logback.xml create mode 100644 google-web-toolkit/src/main/resources/logback.xml create mode 100644 graphql/graphql-java/src/main/resources/logback.xml create mode 100644 grpc/src/main/resources/logback.xml create mode 100644 guava-modules/guava-18/src/main/resources/logback.xml create mode 100644 guava-modules/guava-19/src/main/resources/logback.xml create mode 100644 guava-modules/guava-21/src/main/resources/logback.xml create mode 100644 guest/core-java-9/src/main/resources/logback.xml create mode 100644 guest/deep-jsf/src/main/resources/logback.xml create mode 100644 guest/remote-debugging/src/main/resources/logback.xml create mode 100644 guest/spring-boot-app/src/main/resources/logback.xml create mode 100644 guest/spring-mvc/src/main/resources/logback.xml create mode 100644 guest/spring-security/src/main/resources/logback.xml create mode 100644 guest/thread-pools/src/main/resources/logback.xml create mode 100644 guest/tomcat-app/src/main/resources/logback.xml create mode 100644 guest/webservices/rest-server/src/main/resources/logback.xml create mode 100644 guest/webservices/soap_client/src/main/resources/logback.xml create mode 100644 guest/webservices/soap_example/src/main/resources/logback.xml create mode 100644 guest/webservices/spring-rest-service/src/main/resources/logback.xml create mode 100644 guice/src/main/resources/logback.xml create mode 100644 hbase/src/main/resources/logback.xml create mode 100644 hystrix/src/main/resources/logback.xml create mode 100644 image-processing/src/main/resources/logback.xml create mode 100644 immutables/src/main/resources/logback.xml create mode 100644 influxdb/src/main/resources/logback.xml create mode 100644 java-ee-8-security-api/app-auth-basic-store-db/src/main/resources/logback.xml create mode 100644 java-ee-8-security-api/app-auth-custom-form-store-custom/src/main/resources/logback.xml create mode 100644 java-ee-8-security-api/app-auth-custom-no-store/src/main/resources/logback.xml create mode 100644 java-ee-8-security-api/app-auth-form-store-ldap/src/main/resources/logback.xml create mode 100644 java-lite/src/main/resources/logback.xml create mode 100644 java-rmi/src/main/resources/logback.xml create mode 100644 java-spi/exchange-rate-api/src/main/resources/logback.xml create mode 100644 java-spi/exchange-rate-app/src/main/resources/logback.xml create mode 100644 java-spi/exchange-rate-impl/src/main/resources/logback.xml create mode 100644 java-vavr-stream/src/main/resources/logback.xml create mode 100644 java-websocket/src/main/resources/logback.xml create mode 100644 javafx/src/main/resources/logback.xml create mode 100644 javax-servlets/src/main/resources/logback.xml create mode 100644 javaxval/src/main/resources/logback.xml create mode 100644 jee-7/src/main/resources/logback.xml create mode 100644 jenkins/hello-world/src/main/resources/logback.xml create mode 100644 jgroups/src/main/resources/logback.xml create mode 100644 jjwt/src/main/resources/logback.xml create mode 100644 jmeter/src/main/resources/logback.xml create mode 100644 jmh/src/main/resources/logback.xml create mode 100644 jni/src/main/resources/logback.xml create mode 100644 jnosql/jnosql-artemis/src/main/resources/logback.xml create mode 100644 jnosql/jnosql-diana/src/main/resources/logback.xml create mode 100644 jooby/src/main/resources/logback.xml create mode 100644 jpa-storedprocedure/src/main/resources/logback.xml create mode 100644 json-path/src/main/resources/logback.xml create mode 100644 json/src/main/resources/logback.xml create mode 100644 jsonb/src/main/resources/logback.xml create mode 100644 jws/src/main/resources/logback.xml create mode 100644 kotlin-js/src/main/resources/logback.xml create mode 100644 lagom/greeting-api/src/main/resources/logback.xml create mode 100644 lagom/greeting-impl/src/main/resources/logback.xml create mode 100644 lagom/weather-api/src/main/resources/logback.xml create mode 100644 lagom/weather-impl/src/main/resources/logback.xml create mode 100644 libraries-data/src/main/resources/logback.xml create mode 100644 libraries-server/src/main/resources/logback.xml create mode 100644 libraries/src/main/resources/logback.xml create mode 100644 linkrest/src/main/resources/logback.xml create mode 100644 lombok/src/main/resources/logback.xml create mode 100644 lucene/src/main/resources/logback.xml create mode 100644 mapstruct/src/main/resources/logback.xml create mode 100644 maven-archetype/src/main/resources/logback.xml create mode 100644 maven/src/main/resources/logback.xml create mode 100644 meecrowave/src/main/resources/logback.xml create mode 100644 mesos-marathon/src/main/resources/logback.xml create mode 100644 metrics/src/main/resources/logback.xml create mode 100644 microprofile/src/main/resources/logback.xml create mode 100644 msf4j/src/main/resources/logback.xml create mode 100644 mustache/src/main/resources/logback.xml create mode 100644 mvn-wrapper/src/main/resources/logback.xml create mode 100644 mybatis/src/main/resources/logback.xml create mode 100644 noexception/src/main/resources/logback.xml create mode 100644 orientdb/src/main/resources/logback.xml create mode 100644 osgi/osgi-intro-sample-activator/src/main/resources/logback.xml create mode 100644 osgi/osgi-intro-sample-client/src/main/resources/logback.xml create mode 100644 osgi/osgi-intro-sample-service/src/main/resources/logback.xml create mode 100644 patterns/front-controller/src/main/resources/logback.xml create mode 100644 patterns/intercepting-filter/src/main/resources/logback.xml create mode 100644 pdf/src/main/resources/logback.xml create mode 100644 performance-tests/src/main/resources/logback.xml create mode 100644 persistence-modules/java-cassandra/src/main/resources/logback.xml create mode 100644 persistence-modules/java-cockroachdb/src/main/resources/logback.xml create mode 100644 persistence-modules/java-jpa/src/main/resources/logback.xml create mode 100644 persistence-modules/java-mongodb/src/main/resources/logback.xml create mode 100644 persistence-modules/liquibase/src/main/resources/logback.xml create mode 100644 persistence-modules/redis/src/main/resources/logback.xml create mode 100644 persistence-modules/solr/src/main/resources/logback.xml create mode 100644 persistence-modules/spring-data-eclipselink/src/main/resources/logback.xml create mode 100644 persistence-modules/spring-data-gemfire/src/main/resources/logback.xml create mode 100644 persistence-modules/spring-data-solr/src/main/resources/logback.xml create mode 100644 protobuffer/src/main/resources/logback.xml create mode 100644 rabbitmq/src/main/resources/logback.xml create mode 100644 ratpack/src/main/resources/logback.xml create mode 100644 rest-with-spark-java/src/main/resources/logback.xml create mode 100644 resteasy/src/main/resources/logback.xml create mode 100644 rule-engines/easy-rules/src/main/resources/logback.xml create mode 100644 rule-engines/openl-tablets/src/main/resources/logback.xml create mode 100644 rule-engines/rulebook/src/main/resources/logback.xml create mode 100644 rxjava/src/main/resources/logback.xml create mode 100644 saas/src/main/resources/logback.xml create mode 100644 spark-java/src/main/resources/logback.xml create mode 100644 spring-4/src/main/resources/logback.xml create mode 100644 spring-5-mvc/src/main/resources/logback.xml create mode 100644 spring-5-reactive-functional/src/main/resources/logback.xml create mode 100644 spring-5-reactive/src/main/resources/logback.xml create mode 100644 spring-5-security/src/main/resources/logback.xml create mode 100644 spring-5/src/main/resources/logback.xml create mode 100644 spring-activiti/src/main/resources/logback.xml create mode 100644 spring-akka/src/main/resources/logback.xml create mode 100644 spring-amqp-simple/src/main/resources/logback.xml create mode 100644 spring-amqp/src/main/resources/logback.xml create mode 100644 spring-apache-camel/src/main/resources/logback.xml create mode 100644 spring-bom/src/main/resources/logback.xml create mode 100644 spring-boot-angular-ecommerce/src/main/resources/logback.xml create mode 100644 spring-boot-autoconfiguration/src/main/resources/logback.xml create mode 100644 spring-boot-bootstrap/src/main/resources/logback.xml create mode 100644 spring-boot-ctx-fluent/src/main/resources/logback.xml create mode 100644 spring-boot-custom-starter/greeter-library/src/main/resources/logback.xml create mode 100644 spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/main/resources/logback.xml create mode 100644 spring-boot-custom-starter/greeter-spring-boot-sample-app/src/main/resources/logback.xml create mode 100644 spring-boot-gradle/src/main/resources/logback.xml create mode 100644 spring-boot-jasypt/src/main/resources/logback.xml create mode 100644 spring-boot-keycloak/src/main/resources/logback.xml create mode 100644 spring-boot-mvc/src/main/resources/logback.xml create mode 100644 spring-boot-ops/src/main/resources/logback.xml create mode 100644 spring-boot-persistence/src/main/resources/logback.xml create mode 100644 spring-boot-property-exp/property-exp-custom-config/src/main/resources/logback.xml create mode 100644 spring-boot-property-exp/property-exp-default-config/src/main/resources/logback.xml create mode 100644 spring-boot-security/src/main/resources/logback.xml create mode 100644 spring-boot-vue/src/main/resources/logback.xml create mode 100644 spring-cloud-bus/spring-cloud-config-client/src/main/resources/logback.xml create mode 100644 spring-cloud-bus/spring-cloud-config-server/src/main/resources/logback.xml create mode 100644 spring-cloud-data-flow/batch-job/src/main/resources/logback.xml create mode 100644 spring-cloud-data-flow/data-flow-server/src/main/resources/logback.xml create mode 100644 spring-cloud-data-flow/data-flow-shell/src/main/resources/logback.xml create mode 100644 spring-cloud-data-flow/log-sink/src/main/resources/logback.xml create mode 100644 spring-cloud-data-flow/time-processor/src/main/resources/logback.xml create mode 100644 spring-cloud-data-flow/time-source/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-aws/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-bootstrap/config/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-bootstrap/zipkin/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-connectors-heroku/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-consul/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-gateway/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-hystrix/rest-consumer/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-hystrix/rest-producer/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-ribbon-client/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-security/auth-client/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-security/auth-resource/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-security/auth-server/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-stream-starters/boot/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-task/springcloudtaskbatch/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-task/springcloudtasksink/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/main/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/logback.xml create mode 100644 spring-core/src/main/resources/logback.xml create mode 100644 spring-cucumber/src/main/resources/logback.xml create mode 100644 spring-data-5-reactive/src/main/resources/logback.xml create mode 100644 spring-data-jpa/src/main/resources/logback.xml create mode 100644 spring-data-keyvalue/src/main/resources/logback.xml create mode 100644 spring-data-rest-querydsl/src/main/resources/logback.xml create mode 100644 spring-data-rest/src/main/resources/logback.xml create mode 100644 spring-data-spring-security/src/main/resources/logback.xml create mode 100644 spring-dispatcher-servlet/src/main/resources/logback.xml create mode 100644 spring-drools/src/main/resources/logback.xml create mode 100644 spring-ejb/ejb-beans/src/main/resources/logback.xml create mode 100644 spring-ejb/ejb-remote-for-spring/src/main/resources/logback.xml create mode 100644 spring-ejb/spring-ejb-client/src/main/resources/logback.xml create mode 100644 spring-freemarker/src/main/resources/logback.xml create mode 100644 spring-groovy/src/main/resources/logback.xml create mode 100644 spring-hibernate3/src/main/resources/logback.xml create mode 100644 spring-integration/src/main/resources/logback.xml create mode 100644 spring-jenkins-pipeline/src/main/resources/logback.xml create mode 100644 spring-jinq/src/main/resources/logback.xml create mode 100644 spring-jms/src/main/resources/logback.xml create mode 100644 spring-jooq/src/main/resources/logback.xml create mode 100644 spring-kafka/src/main/resources/logback.xml create mode 100644 spring-katharsis/src/main/resources/logback.xml create mode 100644 spring-mobile/src/main/resources/logback.xml create mode 100644 spring-mockito/src/main/resources/logback.xml create mode 100644 spring-mustache/src/main/resources/logback.xml create mode 100644 spring-mvc-forms-jsp/src/main/resources/logback.xml create mode 100644 spring-mvc-forms-thymeleaf/src/main/resources/logback.xml create mode 100644 spring-mvc-kotlin/src/main/resources/logback.xml create mode 100644 spring-mvc-simple/src/main/resources/logback.xml create mode 100644 spring-mvc-velocity/src/main/resources/logback.xml create mode 100644 spring-mybatis/src/main/resources/logback.xml create mode 100644 spring-protobuf/src/main/resources/logback.xml create mode 100644 spring-reactive-kotlin/src/main/resources/logback.xml create mode 100644 spring-reactor/src/main/resources/logback.xml create mode 100644 spring-remoting/remoting-amqp/remoting-amqp-client/src/main/resources/logback.xml create mode 100644 spring-remoting/remoting-amqp/remoting-amqp-server/src/main/resources/logback.xml create mode 100644 spring-remoting/remoting-hessian-burlap/client/src/main/resources/logback.xml create mode 100644 spring-remoting/remoting-hessian-burlap/server/src/main/resources/logback.xml create mode 100644 spring-remoting/remoting-http/client/src/main/resources/logback.xml create mode 100644 spring-remoting/remoting-http/server/src/main/resources/logback.xml create mode 100644 spring-remoting/remoting-jms/remoting-jms-client/src/main/resources/logback.xml create mode 100644 spring-remoting/remoting-jms/remoting-jms-server/src/main/resources/logback.xml create mode 100644 spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/resources/logback.xml create mode 100644 spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/resources/logback.xml create mode 100644 spring-rest-angular/src/main/resources/logback.xml create mode 100644 spring-rest-embedded-tomcat/src/main/resources/logback.xml create mode 100644 spring-rest-hal-browser/src/main/resources/logback.xml create mode 100644 spring-rest-shell/src/main/resources/logback.xml create mode 100644 spring-rest-template/src/main/resources/logback.xml create mode 100644 spring-roo/src/main/resources/logback.xml create mode 100644 spring-security-acl/src/main/resources/logback.xml create mode 100644 spring-security-anguar/server/src/main/resources/logback.xml create mode 100644 spring-security-angular/server/src/main/resources/logback.xml create mode 100644 spring-security-cache-control/src/main/resources/logback.xml create mode 100644 spring-security-client/spring-security-jsp-authentication/src/main/resources/logback.xml create mode 100644 spring-security-client/spring-security-jsp-authorize/src/main/resources/logback.xml create mode 100644 spring-security-client/spring-security-jsp-config/src/main/resources/logback.xml create mode 100644 spring-security-client/spring-security-mvc/src/main/resources/logback.xml create mode 100644 spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/logback.xml create mode 100644 spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/logback.xml create mode 100644 spring-security-client/spring-security-thymeleaf-config/src/main/resources/logback.xml create mode 100644 spring-security-core/src/main/resources/logback.xml create mode 100644 spring-security-mvc-boot/src/main/resources/logback.xml create mode 100644 spring-security-mvc-socket/src/main/resources/logback.xml create mode 100644 spring-security-openid/src/main/resources/logback.xml create mode 100644 spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml create mode 100644 spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml create mode 100644 spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml create mode 100644 spring-security-stormpath/src/main/resources/logback.xml create mode 100644 spring-security-thymeleaf/src/main/resources/logback.xml create mode 100644 spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml create mode 100644 spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml create mode 100644 spring-session/spring-session-jdbc/src/main/resources/logback.xml create mode 100644 spring-session/spring-session-redis/src/main/resources/logback.xml create mode 100644 spring-sleuth/src/main/resources/logback.xml create mode 100644 spring-social-login/src/main/resources/logback.xml create mode 100644 spring-spel/src/main/resources/logback.xml create mode 100644 spring-state-machine/src/main/resources/logback.xml create mode 100644 spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/resources/logback.xml create mode 100644 spring-swagger-codegen/spring-swagger-codegen-app/src/main/resources/logback.xml create mode 100644 spring-userservice/src/main/resources/logback.xml create mode 100644 spring-vertx/src/main/resources/logback.xml create mode 100644 spring-webflux-amqp/src/main/resources/logback.xml create mode 100644 spring-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml create mode 100644 spring-zuul/spring-zuul-ui/src/main/resources/logback.xml create mode 100644 sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml create mode 100644 sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml create mode 100644 static-analysis/src/main/resources/logback.xml create mode 100644 stripe/src/main/resources/logback.xml create mode 100644 structurizr/src/main/resources/logback.xml create mode 100644 struts-2/src/main/resources/logback.xml create mode 100644 testing-modules/junit-5/src/main/resources/logback.xml create mode 100644 testing-modules/junit-abstract/src/main/resources/logback.xml create mode 100644 testing-modules/mockito-2/src/main/resources/logback.xml create mode 100644 testing-modules/mocks/jmockit/src/main/resources/logback.xml create mode 100644 testing-modules/mocks/mock-comparisons/src/main/resources/logback.xml create mode 100644 testing-modules/mockserver/src/main/resources/logback.xml create mode 100644 testing-modules/runjunitfromjava/src/main/resources/logback.xml create mode 100644 testing-modules/selenium-junit-testng/src/main/resources/logback.xml create mode 100644 testing-modules/spring-testing/src/main/resources/logback.xml create mode 100644 testing-modules/testing/src/main/resources/logback.xml create mode 100644 twilio/src/main/resources/logback.xml create mode 100644 undertow/src/main/resources/logback.xml create mode 100644 vaadin-spring/src/main/resources/logback.xml create mode 100644 vaadin/src/main/resources/logback.xml create mode 100644 vavr/src/main/resources/logback.xml create mode 100644 video-tutorials/jackson-annotations/src/main/resources/logback.xml create mode 100644 wicket/src/main/resources/logback.xml create mode 100644 xml/src/main/resources/logback.xml create mode 100644 xmlunit-2/src/main/resources/logback.xml diff --git a/JGit/src/main/resources/logback.xml b/JGit/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/JGit/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/Twitter4J/src/main/resources/logback.xml b/Twitter4J/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/Twitter4J/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/activejdbc/src/main/resources/logback.xml b/activejdbc/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/activejdbc/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/akka-streams/src/main/resources/logback.xml b/akka-streams/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/akka-streams/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/algorithms/src/main/resources/logback.xml b/algorithms/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/algorithms/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/animal-sniffer-mvn-plugin/src/main/resources/logback.xml b/animal-sniffer-mvn-plugin/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/animal-sniffer-mvn-plugin/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/annotations/annotation-processing/src/main/resources/logback.xml b/annotations/annotation-processing/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/annotations/annotation-processing/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/annotations/annotation-user/src/main/resources/logback.xml b/annotations/annotation-user/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/annotations/annotation-user/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/antlr/src/main/resources/logback.xml b/antlr/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/antlr/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-avro/src/main/resources/logback.xml b/apache-avro/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-avro/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-bval/src/main/resources/logback.xml b/apache-bval/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-bval/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-cayenne/src/main/resources/logback.xml b/apache-cayenne/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-cayenne/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-curator/src/main/resources/logback.xml b/apache-curator/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-curator/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-cxf/cxf-aegis/src/main/resources/logback.xml b/apache-cxf/cxf-aegis/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-cxf/cxf-aegis/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-cxf/cxf-introduction/src/main/resources/logback.xml b/apache-cxf/cxf-introduction/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-cxf/cxf-introduction/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/resources/logback.xml b/apache-cxf/cxf-jaxrs-implementation/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-cxf/cxf-jaxrs-implementation/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-cxf/cxf-spring/src/main/resources/logback.xml b/apache-cxf/cxf-spring/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-cxf/cxf-spring/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-meecrowave/src/main/resources/logback.xml b/apache-meecrowave/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-meecrowave/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-opennlp/src/main/resources/logback.xml b/apache-opennlp/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-opennlp/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-poi/src/main/resources/logback.xml b/apache-poi/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-poi/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-solrj/src/main/resources/logback.xml b/apache-solrj/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-solrj/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-spark/src/main/resources/logback.xml b/apache-spark/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-spark/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-thrift/src/main/resources/logback.xml b/apache-thrift/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-thrift/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-tika/src/main/resources/logback.xml b/apache-tika/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-tika/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-zookeeper/src/main/resources/logback.xml b/apache-zookeeper/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-zookeeper/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/asciidoctor/src/main/resources/logback.xml b/asciidoctor/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/asciidoctor/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/asm/src/main/resources/logback.xml b/asm/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/asm/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/atomix/src/main/resources/logback.xml b/atomix/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/atomix/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/autovalue/src/main/resources/logback.xml b/autovalue/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/autovalue/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/aws-lambda/src/main/resources/logback.xml b/aws-lambda/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/aws-lambda/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/aws/src/main/resources/logback.xml b/aws/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/aws/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/axon/src/main/resources/logback.xml b/axon/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/axon/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/azure/src/main/resources/logback.xml b/azure/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/azure/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/bootique/src/main/resources/logback.xml b/bootique/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/bootique/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/cas/cas-secured-app/src/main/resources/logback.xml b/cas/cas-secured-app/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/cas/cas-secured-app/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/cdi/src/main/resources/logback.xml b/cdi/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/cdi/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/checker-plugin/src/main/resources/logback.xml b/checker-plugin/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/checker-plugin/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-groovy/src/main/resources/logback.xml b/core-groovy/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-groovy/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-java-10/src/main/resources/logback.xml b/core-java-10/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-java-10/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-java-11/src/main/resources/logback.xml b/core-java-11/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-java-11/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-java-8/src/main/resources/logback.xml b/core-java-8/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-java-8/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-java-collections/src/main/resources/logback.xml b/core-java-collections/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-java-collections/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-java-persistence/src/main/resources/logback.xml b/core-java-persistence/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-java-persistence/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-kotlin/src/main/resources/logback.xml b/core-kotlin/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-kotlin/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/custom-pmd/src/main/resources/logback.xml b/custom-pmd/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/custom-pmd/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/dagger/src/main/resources/logback.xml b/dagger/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/dagger/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/data-structures/src/main/resources/logback.xml b/data-structures/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/data-structures/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/deeplearning4j/src/main/resources/logback.xml b/deeplearning4j/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/deeplearning4j/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/deltaspike/src/main/resources/logback.xml b/deltaspike/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/deltaspike/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/disruptor/src/main/resources/logback.xml b/disruptor/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/disruptor/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/dozer/src/main/resources/logback.xml b/dozer/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/dozer/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/drools/src/main/resources/logback.xml b/drools/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/drools/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/dubbo/src/main/resources/logback.xml b/dubbo/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/dubbo/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/ejb-client/src/main/resources/logback.xml b/ejb/ejb-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ejb/ejb-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/ejb-remote/src/main/resources/logback.xml b/ejb/ejb-remote/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ejb/ejb-remote/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/ejb-session-beans/src/main/resources/logback.xml b/ejb/ejb-session-beans/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ejb/ejb-session-beans/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/wildfly/widlfly-web/src/main/resources/logback.xml b/ejb/wildfly/widlfly-web/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ejb/wildfly/widlfly-web/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/wildfly/wildfly-ejb-interfaces/src/main/resources/logback.xml b/ejb/wildfly/wildfly-ejb-interfaces/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ejb/wildfly/wildfly-ejb-interfaces/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/wildfly/wildfly-ejb/src/main/resources/logback.xml b/ejb/wildfly/wildfly-ejb/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ejb/wildfly/wildfly-ejb/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ejb/wildfly/wildfly-jpa/src/main/resources/logback.xml b/ejb/wildfly/wildfly-jpa/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ejb/wildfly/wildfly-jpa/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/enterprise-patterns/intercepting-filter-pattern/src/main/resources/logback.xml b/enterprise-patterns/intercepting-filter-pattern/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/enterprise-patterns/intercepting-filter-pattern/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ethereum/src/main/resources/logback.xml b/ethereum/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ethereum/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ethereumj/src/main/resources/logback.xml b/ethereumj/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ethereumj/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/feign/src/main/resources/logback.xml b/feign/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/feign/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/flips/src/main/resources/logback.xml b/flips/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/flips/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/geotools/src/main/resources/logback.xml b/geotools/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/geotools/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/google-cloud/src/main/resources/logback.xml b/google-cloud/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/google-cloud/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/google-web-toolkit/src/main/resources/logback.xml b/google-web-toolkit/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/google-web-toolkit/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/graphql/graphql-java/src/main/resources/logback.xml b/graphql/graphql-java/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/graphql/graphql-java/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/grpc/src/main/resources/logback.xml b/grpc/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/grpc/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guava-modules/guava-18/src/main/resources/logback.xml b/guava-modules/guava-18/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guava-modules/guava-18/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guava-modules/guava-19/src/main/resources/logback.xml b/guava-modules/guava-19/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guava-modules/guava-19/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guava-modules/guava-21/src/main/resources/logback.xml b/guava-modules/guava-21/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guava-modules/guava-21/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/core-java-9/src/main/resources/logback.xml b/guest/core-java-9/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/core-java-9/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/deep-jsf/src/main/resources/logback.xml b/guest/deep-jsf/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/deep-jsf/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/remote-debugging/src/main/resources/logback.xml b/guest/remote-debugging/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/remote-debugging/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/spring-boot-app/src/main/resources/logback.xml b/guest/spring-boot-app/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/spring-boot-app/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/spring-mvc/src/main/resources/logback.xml b/guest/spring-mvc/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/spring-mvc/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/spring-security/src/main/resources/logback.xml b/guest/spring-security/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/spring-security/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/thread-pools/src/main/resources/logback.xml b/guest/thread-pools/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/thread-pools/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/tomcat-app/src/main/resources/logback.xml b/guest/tomcat-app/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/tomcat-app/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/webservices/rest-server/src/main/resources/logback.xml b/guest/webservices/rest-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/webservices/rest-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/webservices/soap_client/src/main/resources/logback.xml b/guest/webservices/soap_client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/webservices/soap_client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/webservices/soap_example/src/main/resources/logback.xml b/guest/webservices/soap_example/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/webservices/soap_example/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guest/webservices/spring-rest-service/src/main/resources/logback.xml b/guest/webservices/spring-rest-service/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guest/webservices/spring-rest-service/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/guice/src/main/resources/logback.xml b/guice/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/guice/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/hbase/src/main/resources/logback.xml b/hbase/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/hbase/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/hystrix/src/main/resources/logback.xml b/hystrix/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/hystrix/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/image-processing/src/main/resources/logback.xml b/image-processing/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/image-processing/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/immutables/src/main/resources/logback.xml b/immutables/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/immutables/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/influxdb/src/main/resources/logback.xml b/influxdb/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/influxdb/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-ee-8-security-api/app-auth-basic-store-db/src/main/resources/logback.xml b/java-ee-8-security-api/app-auth-basic-store-db/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-ee-8-security-api/app-auth-basic-store-db/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-ee-8-security-api/app-auth-custom-form-store-custom/src/main/resources/logback.xml b/java-ee-8-security-api/app-auth-custom-form-store-custom/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-ee-8-security-api/app-auth-custom-form-store-custom/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-ee-8-security-api/app-auth-custom-no-store/src/main/resources/logback.xml b/java-ee-8-security-api/app-auth-custom-no-store/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-ee-8-security-api/app-auth-custom-no-store/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-ee-8-security-api/app-auth-form-store-ldap/src/main/resources/logback.xml b/java-ee-8-security-api/app-auth-form-store-ldap/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-ee-8-security-api/app-auth-form-store-ldap/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-lite/src/main/resources/logback.xml b/java-lite/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-lite/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-rmi/src/main/resources/logback.xml b/java-rmi/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-rmi/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-spi/exchange-rate-api/src/main/resources/logback.xml b/java-spi/exchange-rate-api/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-spi/exchange-rate-api/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-spi/exchange-rate-app/src/main/resources/logback.xml b/java-spi/exchange-rate-app/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-spi/exchange-rate-app/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-spi/exchange-rate-impl/src/main/resources/logback.xml b/java-spi/exchange-rate-impl/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-spi/exchange-rate-impl/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-vavr-stream/src/main/resources/logback.xml b/java-vavr-stream/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-vavr-stream/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-websocket/src/main/resources/logback.xml b/java-websocket/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-websocket/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/javafx/src/main/resources/logback.xml b/javafx/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/javafx/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/javax-servlets/src/main/resources/logback.xml b/javax-servlets/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/javax-servlets/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/javaxval/src/main/resources/logback.xml b/javaxval/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/javaxval/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jee-7/src/main/resources/logback.xml b/jee-7/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jee-7/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jenkins/hello-world/src/main/resources/logback.xml b/jenkins/hello-world/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jenkins/hello-world/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jgroups/src/main/resources/logback.xml b/jgroups/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jgroups/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jjwt/src/main/resources/logback.xml b/jjwt/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jjwt/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jmeter/src/main/resources/logback.xml b/jmeter/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jmeter/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jmh/src/main/resources/logback.xml b/jmh/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jmh/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jni/src/main/resources/logback.xml b/jni/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jni/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jnosql/jnosql-artemis/src/main/resources/logback.xml b/jnosql/jnosql-artemis/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jnosql/jnosql-artemis/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jnosql/jnosql-diana/src/main/resources/logback.xml b/jnosql/jnosql-diana/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jnosql/jnosql-diana/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jooby/src/main/resources/logback.xml b/jooby/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jooby/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jpa-storedprocedure/src/main/resources/logback.xml b/jpa-storedprocedure/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jpa-storedprocedure/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/json-path/src/main/resources/logback.xml b/json-path/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/json-path/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/json/src/main/resources/logback.xml b/json/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/json/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jsonb/src/main/resources/logback.xml b/jsonb/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jsonb/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/jws/src/main/resources/logback.xml b/jws/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/jws/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/kotlin-js/src/main/resources/logback.xml b/kotlin-js/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/kotlin-js/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/lagom/greeting-api/src/main/resources/logback.xml b/lagom/greeting-api/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/lagom/greeting-api/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/lagom/greeting-impl/src/main/resources/logback.xml b/lagom/greeting-impl/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/lagom/greeting-impl/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/lagom/weather-api/src/main/resources/logback.xml b/lagom/weather-api/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/lagom/weather-api/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/lagom/weather-impl/src/main/resources/logback.xml b/lagom/weather-impl/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/lagom/weather-impl/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/libraries-data/src/main/resources/logback.xml b/libraries-data/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/libraries-data/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/libraries-server/src/main/resources/logback.xml b/libraries-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/libraries-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/libraries/src/main/resources/logback.xml b/libraries/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/libraries/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/linkrest/src/main/resources/logback.xml b/linkrest/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/linkrest/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/lombok/src/main/resources/logback.xml b/lombok/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/lombok/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/lucene/src/main/resources/logback.xml b/lucene/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/lucene/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/mapstruct/src/main/resources/logback.xml b/mapstruct/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/mapstruct/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/maven-archetype/src/main/resources/logback.xml b/maven-archetype/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/maven-archetype/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/maven/src/main/resources/logback.xml b/maven/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/maven/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/meecrowave/src/main/resources/logback.xml b/meecrowave/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/meecrowave/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/mesos-marathon/src/main/resources/logback.xml b/mesos-marathon/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/mesos-marathon/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/metrics/src/main/resources/logback.xml b/metrics/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/metrics/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/microprofile/src/main/resources/logback.xml b/microprofile/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/microprofile/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/msf4j/src/main/resources/logback.xml b/msf4j/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/msf4j/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/mustache/src/main/resources/logback.xml b/mustache/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/mustache/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/mvn-wrapper/src/main/resources/logback.xml b/mvn-wrapper/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/mvn-wrapper/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/mybatis/src/main/resources/logback.xml b/mybatis/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/mybatis/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/noexception/src/main/resources/logback.xml b/noexception/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/noexception/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/orientdb/src/main/resources/logback.xml b/orientdb/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/orientdb/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/osgi/osgi-intro-sample-activator/src/main/resources/logback.xml b/osgi/osgi-intro-sample-activator/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/osgi/osgi-intro-sample-activator/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/osgi/osgi-intro-sample-client/src/main/resources/logback.xml b/osgi/osgi-intro-sample-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/osgi/osgi-intro-sample-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/osgi/osgi-intro-sample-service/src/main/resources/logback.xml b/osgi/osgi-intro-sample-service/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/osgi/osgi-intro-sample-service/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/patterns/front-controller/src/main/resources/logback.xml b/patterns/front-controller/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/patterns/front-controller/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/patterns/intercepting-filter/src/main/resources/logback.xml b/patterns/intercepting-filter/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/patterns/intercepting-filter/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/pdf/src/main/resources/logback.xml b/pdf/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/pdf/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/performance-tests/src/main/resources/logback.xml b/performance-tests/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/performance-tests/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/java-cassandra/src/main/resources/logback.xml b/persistence-modules/java-cassandra/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/java-cassandra/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/java-cockroachdb/src/main/resources/logback.xml b/persistence-modules/java-cockroachdb/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/java-cockroachdb/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/java-jpa/src/main/resources/logback.xml b/persistence-modules/java-jpa/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/java-jpa/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/java-mongodb/src/main/resources/logback.xml b/persistence-modules/java-mongodb/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/java-mongodb/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/liquibase/src/main/resources/logback.xml b/persistence-modules/liquibase/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/liquibase/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/redis/src/main/resources/logback.xml b/persistence-modules/redis/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/redis/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/solr/src/main/resources/logback.xml b/persistence-modules/solr/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/solr/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-eclipselink/src/main/resources/logback.xml b/persistence-modules/spring-data-eclipselink/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/spring-data-eclipselink/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-gemfire/src/main/resources/logback.xml b/persistence-modules/spring-data-gemfire/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/spring-data-gemfire/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-solr/src/main/resources/logback.xml b/persistence-modules/spring-data-solr/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/spring-data-solr/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/protobuffer/src/main/resources/logback.xml b/protobuffer/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/protobuffer/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/rabbitmq/src/main/resources/logback.xml b/rabbitmq/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/rabbitmq/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/ratpack/src/main/resources/logback.xml b/ratpack/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/ratpack/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/rest-with-spark-java/src/main/resources/logback.xml b/rest-with-spark-java/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/rest-with-spark-java/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/resteasy/src/main/resources/logback.xml b/resteasy/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/resteasy/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/rule-engines/easy-rules/src/main/resources/logback.xml b/rule-engines/easy-rules/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/rule-engines/easy-rules/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/rule-engines/openl-tablets/src/main/resources/logback.xml b/rule-engines/openl-tablets/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/rule-engines/openl-tablets/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/rule-engines/rulebook/src/main/resources/logback.xml b/rule-engines/rulebook/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/rule-engines/rulebook/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/rxjava/src/main/resources/logback.xml b/rxjava/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/rxjava/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/saas/src/main/resources/logback.xml b/saas/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/saas/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spark-java/src/main/resources/logback.xml b/spark-java/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spark-java/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-4/src/main/resources/logback.xml b/spring-4/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-4/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-5-mvc/src/main/resources/logback.xml b/spring-5-mvc/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-5-mvc/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-5-reactive-functional/src/main/resources/logback.xml b/spring-5-reactive-functional/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-5-reactive-functional/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-5-reactive/src/main/resources/logback.xml b/spring-5-reactive/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-5-reactive/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-5-security/src/main/resources/logback.xml b/spring-5-security/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-5-security/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-5/src/main/resources/logback.xml b/spring-5/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-5/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-activiti/src/main/resources/logback.xml b/spring-activiti/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-activiti/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-akka/src/main/resources/logback.xml b/spring-akka/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-akka/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-amqp-simple/src/main/resources/logback.xml b/spring-amqp-simple/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-amqp-simple/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-amqp/src/main/resources/logback.xml b/spring-amqp/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-amqp/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-apache-camel/src/main/resources/logback.xml b/spring-apache-camel/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-apache-camel/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-bom/src/main/resources/logback.xml b/spring-bom/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-bom/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-angular-ecommerce/src/main/resources/logback.xml b/spring-boot-angular-ecommerce/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-angular-ecommerce/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-autoconfiguration/src/main/resources/logback.xml b/spring-boot-autoconfiguration/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-autoconfiguration/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-bootstrap/src/main/resources/logback.xml b/spring-boot-bootstrap/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-bootstrap/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-ctx-fluent/src/main/resources/logback.xml b/spring-boot-ctx-fluent/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-ctx-fluent/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-custom-starter/greeter-library/src/main/resources/logback.xml b/spring-boot-custom-starter/greeter-library/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-custom-starter/greeter-library/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/main/resources/logback.xml b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/main/resources/logback.xml b/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-gradle/src/main/resources/logback.xml b/spring-boot-gradle/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-gradle/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-jasypt/src/main/resources/logback.xml b/spring-boot-jasypt/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-jasypt/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-keycloak/src/main/resources/logback.xml b/spring-boot-keycloak/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-keycloak/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-mvc/src/main/resources/logback.xml b/spring-boot-mvc/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-mvc/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-ops/src/main/resources/logback.xml b/spring-boot-ops/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-ops/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-persistence/src/main/resources/logback.xml b/spring-boot-persistence/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-persistence/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-property-exp/property-exp-custom-config/src/main/resources/logback.xml b/spring-boot-property-exp/property-exp-custom-config/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-property-exp/property-exp-custom-config/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-property-exp/property-exp-default-config/src/main/resources/logback.xml b/spring-boot-property-exp/property-exp-default-config/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-property-exp/property-exp-default-config/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-security/src/main/resources/logback.xml b/spring-boot-security/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-security/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-boot-vue/src/main/resources/logback.xml b/spring-boot-vue/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-boot-vue/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud-bus/spring-cloud-config-client/src/main/resources/logback.xml b/spring-cloud-bus/spring-cloud-config-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud-bus/spring-cloud-config-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud-bus/spring-cloud-config-server/src/main/resources/logback.xml b/spring-cloud-bus/spring-cloud-config-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud-bus/spring-cloud-config-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud-data-flow/batch-job/src/main/resources/logback.xml b/spring-cloud-data-flow/batch-job/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud-data-flow/batch-job/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud-data-flow/data-flow-server/src/main/resources/logback.xml b/spring-cloud-data-flow/data-flow-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud-data-flow/data-flow-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud-data-flow/data-flow-shell/src/main/resources/logback.xml b/spring-cloud-data-flow/data-flow-shell/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud-data-flow/data-flow-shell/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud-data-flow/log-sink/src/main/resources/logback.xml b/spring-cloud-data-flow/log-sink/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud-data-flow/log-sink/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud-data-flow/time-processor/src/main/resources/logback.xml b/spring-cloud-data-flow/time-processor/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud-data-flow/time-processor/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud-data-flow/time-source/src/main/resources/logback.xml b/spring-cloud-data-flow/time-source/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud-data-flow/time-source/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-aws/src/main/resources/logback.xml b/spring-cloud/spring-cloud-aws/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-aws/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/zipkin/src/main/resources/logback.xml b/spring-cloud/spring-cloud-bootstrap/zipkin/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/zipkin/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-connectors-heroku/src/main/resources/logback.xml b/spring-cloud/spring-cloud-connectors-heroku/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-connectors-heroku/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-consul/src/main/resources/logback.xml b/spring-cloud/spring-cloud-consul/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-consul/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/src/main/resources/logback.xml b/spring-cloud/spring-cloud-gateway/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-hystrix/rest-consumer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-hystrix/rest-consumer/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-hystrix/rest-consumer/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-hystrix/rest-producer/src/main/resources/logback.xml b/spring-cloud/spring-cloud-hystrix/rest-producer/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-hystrix/rest-producer/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/logback.xml b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/main/resources/logback.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/main/resources/logback.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-ribbon-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-ribbon-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-ribbon-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-security/auth-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-security/auth-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-security/auth-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-security/auth-resource/src/main/resources/logback.xml b/spring-cloud/spring-cloud-security/auth-resource/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-security/auth-resource/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-security/auth-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-security/auth-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-security/auth-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-stream-starters/boot/src/main/resources/logback.xml b/spring-cloud/spring-cloud-stream-starters/boot/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-stream-starters/boot/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/main/resources/logback.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/main/resources/logback.xml b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/src/main/resources/logback.xml b/spring-cloud/spring-cloud-task/springcloudtasksink/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-task/springcloudtasksink/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-zookeeper/HelloWorld/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/logback.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-core/src/main/resources/logback.xml b/spring-core/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-core/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-cucumber/src/main/resources/logback.xml b/spring-cucumber/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-cucumber/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-data-5-reactive/src/main/resources/logback.xml b/spring-data-5-reactive/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-data-5-reactive/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-data-jpa/src/main/resources/logback.xml b/spring-data-jpa/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-data-jpa/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-data-keyvalue/src/main/resources/logback.xml b/spring-data-keyvalue/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-data-keyvalue/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-data-rest-querydsl/src/main/resources/logback.xml b/spring-data-rest-querydsl/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-data-rest-querydsl/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-data-rest/src/main/resources/logback.xml b/spring-data-rest/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-data-rest/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-data-spring-security/src/main/resources/logback.xml b/spring-data-spring-security/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-data-spring-security/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-dispatcher-servlet/src/main/resources/logback.xml b/spring-dispatcher-servlet/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-dispatcher-servlet/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-drools/src/main/resources/logback.xml b/spring-drools/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-drools/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-ejb/ejb-beans/src/main/resources/logback.xml b/spring-ejb/ejb-beans/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-ejb/ejb-beans/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-ejb/ejb-remote-for-spring/src/main/resources/logback.xml b/spring-ejb/ejb-remote-for-spring/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-ejb/ejb-remote-for-spring/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-ejb/spring-ejb-client/src/main/resources/logback.xml b/spring-ejb/spring-ejb-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-ejb/spring-ejb-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-freemarker/src/main/resources/logback.xml b/spring-freemarker/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-freemarker/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-groovy/src/main/resources/logback.xml b/spring-groovy/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-groovy/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-hibernate3/src/main/resources/logback.xml b/spring-hibernate3/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-hibernate3/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-integration/src/main/resources/logback.xml b/spring-integration/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-integration/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-jenkins-pipeline/src/main/resources/logback.xml b/spring-jenkins-pipeline/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-jenkins-pipeline/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-jinq/src/main/resources/logback.xml b/spring-jinq/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-jinq/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-jms/src/main/resources/logback.xml b/spring-jms/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-jms/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-jooq/src/main/resources/logback.xml b/spring-jooq/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-jooq/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-kafka/src/main/resources/logback.xml b/spring-kafka/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-kafka/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-katharsis/src/main/resources/logback.xml b/spring-katharsis/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-katharsis/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-mobile/src/main/resources/logback.xml b/spring-mobile/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-mobile/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-mockito/src/main/resources/logback.xml b/spring-mockito/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-mockito/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-mustache/src/main/resources/logback.xml b/spring-mustache/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-mustache/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-forms-jsp/src/main/resources/logback.xml b/spring-mvc-forms-jsp/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-mvc-forms-jsp/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml b/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-mvc-forms-thymeleaf/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-kotlin/src/main/resources/logback.xml b/spring-mvc-kotlin/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-mvc-kotlin/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-simple/src/main/resources/logback.xml b/spring-mvc-simple/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-mvc-simple/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-mvc-velocity/src/main/resources/logback.xml b/spring-mvc-velocity/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-mvc-velocity/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-mybatis/src/main/resources/logback.xml b/spring-mybatis/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-mybatis/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-protobuf/src/main/resources/logback.xml b/spring-protobuf/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-protobuf/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-reactive-kotlin/src/main/resources/logback.xml b/spring-reactive-kotlin/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-reactive-kotlin/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-reactor/src/main/resources/logback.xml b/spring-reactor/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-reactor/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/remoting-amqp/remoting-amqp-client/src/main/resources/logback.xml b/spring-remoting/remoting-amqp/remoting-amqp-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/remoting-amqp/remoting-amqp-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/remoting-amqp/remoting-amqp-server/src/main/resources/logback.xml b/spring-remoting/remoting-amqp/remoting-amqp-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/remoting-amqp/remoting-amqp-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/remoting-hessian-burlap/client/src/main/resources/logback.xml b/spring-remoting/remoting-hessian-burlap/client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/remoting-hessian-burlap/server/src/main/resources/logback.xml b/spring-remoting/remoting-hessian-burlap/server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/remoting-http/client/src/main/resources/logback.xml b/spring-remoting/remoting-http/client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/remoting-http/client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/remoting-http/server/src/main/resources/logback.xml b/spring-remoting/remoting-http/server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/remoting-http/server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/remoting-jms/remoting-jms-client/src/main/resources/logback.xml b/spring-remoting/remoting-jms/remoting-jms-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/remoting-jms/remoting-jms-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/remoting-jms/remoting-jms-server/src/main/resources/logback.xml b/spring-remoting/remoting-jms/remoting-jms-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/remoting-jms/remoting-jms-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/resources/logback.xml b/spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/resources/logback.xml b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-rest-angular/src/main/resources/logback.xml b/spring-rest-angular/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-rest-angular/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-rest-embedded-tomcat/src/main/resources/logback.xml b/spring-rest-embedded-tomcat/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-rest-embedded-tomcat/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-rest-hal-browser/src/main/resources/logback.xml b/spring-rest-hal-browser/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-rest-hal-browser/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-rest-shell/src/main/resources/logback.xml b/spring-rest-shell/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-rest-shell/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-rest-template/src/main/resources/logback.xml b/spring-rest-template/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-rest-template/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-roo/src/main/resources/logback.xml b/spring-roo/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-roo/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-acl/src/main/resources/logback.xml b/spring-security-acl/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-acl/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-anguar/server/src/main/resources/logback.xml b/spring-security-anguar/server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-anguar/server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-angular/server/src/main/resources/logback.xml b/spring-security-angular/server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-angular/server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-cache-control/src/main/resources/logback.xml b/spring-security-cache-control/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-cache-control/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-client/spring-security-jsp-authentication/src/main/resources/logback.xml b/spring-security-client/spring-security-jsp-authentication/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-client/spring-security-jsp-authentication/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-client/spring-security-jsp-authorize/src/main/resources/logback.xml b/spring-security-client/spring-security-jsp-authorize/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-client/spring-security-jsp-authorize/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-client/spring-security-jsp-config/src/main/resources/logback.xml b/spring-security-client/spring-security-jsp-config/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-client/spring-security-jsp-config/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-client/spring-security-mvc/src/main/resources/logback.xml b/spring-security-client/spring-security-mvc/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-client/spring-security-mvc/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/logback.xml b/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-client/spring-security-thymeleaf-authentication/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/logback.xml b/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-client/spring-security-thymeleaf-authorize/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-client/spring-security-thymeleaf-config/src/main/resources/logback.xml b/spring-security-client/spring-security-thymeleaf-config/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-client/spring-security-thymeleaf-config/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-core/src/main/resources/logback.xml b/spring-security-core/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-core/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-mvc-boot/src/main/resources/logback.xml b/spring-security-mvc-boot/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-mvc-boot/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-mvc-socket/src/main/resources/logback.xml b/spring-security-mvc-socket/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-mvc-socket/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-openid/src/main/resources/logback.xml b/spring-security-openid/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-openid/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml b/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml b/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml b/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-stormpath/src/main/resources/logback.xml b/spring-security-stormpath/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-stormpath/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-thymeleaf/src/main/resources/logback.xml b/spring-security-thymeleaf/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-thymeleaf/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml b/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml b/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-session/spring-session-jdbc/src/main/resources/logback.xml b/spring-session/spring-session-jdbc/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-session/spring-session-jdbc/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-session/spring-session-redis/src/main/resources/logback.xml b/spring-session/spring-session-redis/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-session/spring-session-redis/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-sleuth/src/main/resources/logback.xml b/spring-sleuth/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-sleuth/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-social-login/src/main/resources/logback.xml b/spring-social-login/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-social-login/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-spel/src/main/resources/logback.xml b/spring-spel/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-spel/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-state-machine/src/main/resources/logback.xml b/spring-state-machine/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-state-machine/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/resources/logback.xml b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/main/resources/logback.xml b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-app/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-userservice/src/main/resources/logback.xml b/spring-userservice/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-userservice/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-vertx/src/main/resources/logback.xml b/spring-vertx/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-vertx/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-webflux-amqp/src/main/resources/logback.xml b/spring-webflux-amqp/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-webflux-amqp/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml b/spring-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-zuul/spring-zuul-foos-resource/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-zuul/spring-zuul-ui/src/main/resources/logback.xml b/spring-zuul/spring-zuul-ui/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-zuul/spring-zuul-ui/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml b/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml b/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/static-analysis/src/main/resources/logback.xml b/static-analysis/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/static-analysis/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/stripe/src/main/resources/logback.xml b/stripe/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/stripe/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/structurizr/src/main/resources/logback.xml b/structurizr/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/structurizr/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/struts-2/src/main/resources/logback.xml b/struts-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/struts-2/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/junit-5/src/main/resources/logback.xml b/testing-modules/junit-5/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/junit-5/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/junit-abstract/src/main/resources/logback.xml b/testing-modules/junit-abstract/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/junit-abstract/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/mockito-2/src/main/resources/logback.xml b/testing-modules/mockito-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/mockito-2/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/mocks/jmockit/src/main/resources/logback.xml b/testing-modules/mocks/jmockit/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/mocks/jmockit/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/mocks/mock-comparisons/src/main/resources/logback.xml b/testing-modules/mocks/mock-comparisons/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/mocks/mock-comparisons/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/mockserver/src/main/resources/logback.xml b/testing-modules/mockserver/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/mockserver/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/runjunitfromjava/src/main/resources/logback.xml b/testing-modules/runjunitfromjava/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/runjunitfromjava/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/selenium-junit-testng/src/main/resources/logback.xml b/testing-modules/selenium-junit-testng/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/selenium-junit-testng/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/spring-testing/src/main/resources/logback.xml b/testing-modules/spring-testing/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/spring-testing/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/testing-modules/testing/src/main/resources/logback.xml b/testing-modules/testing/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/testing-modules/testing/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/twilio/src/main/resources/logback.xml b/twilio/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/twilio/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/undertow/src/main/resources/logback.xml b/undertow/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/undertow/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/vaadin-spring/src/main/resources/logback.xml b/vaadin-spring/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/vaadin-spring/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/vaadin/src/main/resources/logback.xml b/vaadin/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/vaadin/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/vavr/src/main/resources/logback.xml b/vavr/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/vavr/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/video-tutorials/jackson-annotations/src/main/resources/logback.xml b/video-tutorials/jackson-annotations/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/video-tutorials/jackson-annotations/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/wicket/src/main/resources/logback.xml b/wicket/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/wicket/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/xml/src/main/resources/logback.xml b/xml/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/xml/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/xmlunit-2/src/main/resources/logback.xml b/xmlunit-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/xmlunit-2/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file From ee52998f6b95954202f425439dace219a3d40bca Mon Sep 17 00:00:00 2001 From: Felipe Santiago Corro Date: Sun, 5 Aug 2018 14:33:27 -0300 Subject: [PATCH 125/298] Collection to Stream without nulls in core-java-collections (#4903) --- ...lectionStreamsUsingCommonsEmptyIfNull.java | 19 ++++++++++ ...ionStreamsUsingJava8OptionalContainer.java | 21 ++++++++++ ...ctionStreamsUsingNullDereferenceCheck.java | 19 ++++++++++ ...treamsUsingCommonsEmptyIfNullUnitTest.java | 37 ++++++++++++++++++ ...msUsingJava8OptionalContainerUnitTest.java | 37 ++++++++++++++++++ ...eamsUsingNullDereferenceCheckUnitTest.java | 38 +++++++++++++++++++ 6 files changed, 171 insertions(+) create mode 100644 core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java create mode 100644 core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java create mode 100644 core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java create mode 100644 core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java create mode 100644 core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java create mode 100644 core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java diff --git a/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java b/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java new file mode 100644 index 0000000000..2405c26aac --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNull.java @@ -0,0 +1,19 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Collection; +import java.util.stream.Stream; +import static org.apache.commons.collections4.CollectionUtils.emptyIfNull; + +public class NullSafeCollectionStreamsUsingCommonsEmptyIfNull { + + /** + * This method shows how to make a null safe stream from a collection through the use of + * emptyIfNull() method from Apache Commons CollectionUtils library + * + * @param collection The collection that is to be converted into a stream + * @return The stream that has been created from the collection or an empty stream if the collection is null + */ + public Stream collectionAsStream(Collection collection) { + return emptyIfNull(collection).stream(); + } +} diff --git a/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java b/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java new file mode 100644 index 0000000000..da767d4563 --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainer.java @@ -0,0 +1,21 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Collection; +import java.util.Optional; +import java.util.stream.Stream; + +public class NullSafeCollectionStreamsUsingJava8OptionalContainer { + + /** + * This method shows how to make a null safe stream from a collection through the use of + * Java SE 8’s Optional Container + * + * @param collection The collection that is to be converted into a stream + * @return The stream that has been created from the collection or an empty stream if the collection is null + */ + public Stream collectionAsStream(Collection collection) { + return Optional.ofNullable(collection) + .map(Collection::stream) + .orElseGet(Stream::empty); + } +} \ No newline at end of file diff --git a/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java b/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java new file mode 100644 index 0000000000..0c10f1cebc --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheck.java @@ -0,0 +1,19 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Collection; +import java.util.stream.Stream; + +public class NullSafeCollectionStreamsUsingNullDereferenceCheck { + + /** + * This method shows how to make a null safe stream from a collection through the use of a check + * to prevent null dereferences + * + * @param collection The collection that is to be converted into a stream + * @return The stream that has been created from the collection or an empty stream if the collection is null + */ + public Stream collectionAsStream(Collection collection) { + return collection == null ? Stream.empty() : collection.stream(); + } + +} diff --git a/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java b/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java new file mode 100644 index 0000000000..875045946d --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.stream.Stream; +import org.junit.Test; +import static org.junit.Assert.*; + +public class NullSafeCollectionStreamsUsingCommonsEmptyIfNullUnitTest { + + private final NullSafeCollectionStreamsUsingCommonsEmptyIfNull instance = + new NullSafeCollectionStreamsUsingCommonsEmptyIfNull(); + @Test + public void whenCollectionIsNull_thenExpectAnEmptyStream() { + Collection collection = null; + Stream expResult = Stream.empty(); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + } + + @Test + public void whenCollectionHasElements_thenExpectAStreamOfExactlyTheSameElements() { + Collection collection = Arrays.asList("a", "b", "c"); + Stream expResult = Arrays.stream(new String[] { "a", "b", "c" }); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + } + + private static void assertStreamEquals(Stream s1, Stream s2) { + Iterator iter1 = s1.iterator(), iter2 = s2.iterator(); + while (iter1.hasNext() && iter2.hasNext()) + assertEquals(iter1.next(), iter2.next()); + assert !iter1.hasNext() && !iter2.hasNext(); + } + +} diff --git a/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java b/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java new file mode 100644 index 0000000000..402f1a6a19 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.stream.Stream; +import org.junit.Test; +import static org.junit.Assert.*; + +public class NullSafeCollectionStreamsUsingJava8OptionalContainerUnitTest { + + private final NullSafeCollectionStreamsUsingJava8OptionalContainer instance = + new NullSafeCollectionStreamsUsingJava8OptionalContainer(); + @Test + public void whenCollectionIsNull_thenExpectAnEmptyStream() { + Collection collection = null; + Stream expResult = Stream.empty(); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + } + + @Test + public void whenCollectionHasElements_thenExpectAStreamOfExactlyTheSameElements() { + Collection collection = Arrays.asList("a", "b", "c"); + Stream expResult = Arrays.stream(new String[] { "a", "b", "c" }); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + } + + private static void assertStreamEquals(Stream s1, Stream s2) { + Iterator iter1 = s1.iterator(), iter2 = s2.iterator(); + while (iter1.hasNext() && iter2.hasNext()) + assertEquals(iter1.next(), iter2.next()); + assert !iter1.hasNext() && !iter2.hasNext(); + } + +} diff --git a/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java b/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java new file mode 100644 index 0000000000..bb6152371d --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/nullsafecollectionstreams/NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.nullsafecollectionstreams; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.stream.Stream; +import org.junit.Test; +import static org.junit.Assert.*; + +public class NullSafeCollectionStreamsUsingNullDereferenceCheckUnitTest { + + private final NullSafeCollectionStreamsUsingNullDereferenceCheck instance = + new NullSafeCollectionStreamsUsingNullDereferenceCheck(); + + @Test + public void whenCollectionIsNull_thenExpectAnEmptyStream() { + Collection collection = null; + Stream expResult = Stream.empty(); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + } + + @Test + public void whenCollectionHasElements_thenExpectAStreamOfExactlyTheSameElements() { + Collection collection = Arrays.asList("a", "b", "c"); + Stream expResult = Arrays.stream(new String[] { "a", "b", "c" }); + Stream result = instance.collectionAsStream(collection); + assertStreamEquals(expResult, result); + } + + private static void assertStreamEquals(Stream s1, Stream s2) { + Iterator iter1 = s1.iterator(), iter2 = s2.iterator(); + while (iter1.hasNext() && iter2.hasNext()) + assertEquals(iter1.next(), iter2.next()); + assert !iter1.hasNext() && !iter2.hasNext(); + } + +} From a7689c4ae239dbed3fe852eda2c419355f49bb8d Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 5 Aug 2018 23:17:35 +0530 Subject: [PATCH 126/298] [BAEL-7819] - Added standard parent pom and fixed tests in those modules --- apache-shiro/pom.xml | 7 ++++--- cas/cas-secured-app/pom.xml | 8 ++++---- guest/remote-debugging/pom.xml | 8 ++++---- guest/spring-boot-app/pom.xml | 7 ++++--- guest/spring-mvc/pom.xml | 8 ++++---- guest/spring-security/pom.xml | 8 ++++---- guest/webservices/spring-rest-service/pom.xml | 7 ++++--- mustache/pom.xml | 9 ++++----- spring-4/pom.xml | 8 ++++---- spring-5-reactive-client/pom.xml | 8 ++++---- spring-activiti/pom.xml | 8 ++++---- spring-boot-jasypt/pom.xml | 8 ++++---- spring-boot-logging-log4j2/pom.xml | 8 ++++---- spring-boot-mvc/pom.xml | 10 +++++----- spring-boot-vue/pom.xml | 10 +++++----- spring-cloud-bus/spring-cloud-config-client/pom.xml | 7 ++++--- ...ests.java => SpringCloudConfigClientLiveTest.java} | 2 +- spring-cloud-bus/spring-cloud-config-server/pom.xml | 7 ++++--- spring-cloud-data-flow/data-flow-server/pom.xml | 8 ++++---- spring-cloud/spring-cloud-aws/pom.xml | 8 ++++---- spring-cloud/spring-cloud-connectors-heroku/pom.xml | 8 ++++---- .../spring-cloud-security/auth-client/pom.xml | 8 ++++---- .../springoath2/Springoath2ApplicationTests.java | 4 +++- .../spring-cloud-security/auth-resource/pom.xml | 8 ++++---- .../spring-cloud-security/auth-server/pom.xml | 7 ++++--- .../spring-cloud-stream-starters/boot/pom.xml | 7 ++++--- .../spring-cloud-task/springcloudtaskbatch/pom.xml | 8 ++++---- .../spring-cloud-task/springcloudtasksink/pom.xml | 8 ++++---- .../SpringCloudTaskFinal/TaskSinkConfiguration.java | 0 spring-data-5-reactive/pom.xml | 8 ++++---- spring-data-keyvalue/pom.xml | 8 ++++---- spring-data-rest-querydsl/pom.xml | 7 ++++--- spring-mustache/pom.xml | 9 ++++----- spring-mvc-forms-thymeleaf/pom.xml | 8 ++++---- spring-reactive-kotlin/pom.xml | 10 +++++----- spring-rest-shell/pom.xml | 8 ++++---- spring-rest-simple/pom.xml | 11 ++++++----- spring-security-openid/pom.xml | 8 ++++---- spring-vertx/pom.xml | 9 ++++----- vaadin-spring/pom.xml | 7 ++++--- 40 files changed, 157 insertions(+), 148 deletions(-) rename spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/{SpringCloudConfigClientApplicationTests.java => SpringCloudConfigClientLiveTest.java} (84%) rename spring-cloud/spring-cloud-task/springcloudtasksink/src/{main => test}/java/com/baeldung/SpringCloudTaskFinal/TaskSinkConfiguration.java (100%) diff --git a/apache-shiro/pom.xml b/apache-shiro/pom.xml index 9e11f6948f..3a72804ab1 100644 --- a/apache-shiro/pom.xml +++ b/apache-shiro/pom.xml @@ -8,9 +8,10 @@ 1.0-SNAPSHOT - org.springframework.boot - spring-boot-starter-parent - 1.5.2.RELEASE + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 diff --git a/cas/cas-secured-app/pom.xml b/cas/cas-secured-app/pom.xml index 98213b2b78..22d1522fbe 100644 --- a/cas/cas-secured-app/pom.xml +++ b/cas/cas-secured-app/pom.xml @@ -10,10 +10,10 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 1.5.13.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-1 diff --git a/guest/remote-debugging/pom.xml b/guest/remote-debugging/pom.xml index 67fed3f1a1..4e08741154 100644 --- a/guest/remote-debugging/pom.xml +++ b/guest/remote-debugging/pom.xml @@ -8,10 +8,10 @@ war - org.springframework.boot - spring-boot-starter-parent - 1.5.8.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-1 diff --git a/guest/spring-boot-app/pom.xml b/guest/spring-boot-app/pom.xml index 7daa8f668e..a329df0f61 100644 --- a/guest/spring-boot-app/pom.xml +++ b/guest/spring-boot-app/pom.xml @@ -7,9 +7,10 @@ war - org.springframework.boot - spring-boot-starter-parent - 1.5.3.RELEASE + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-1 diff --git a/guest/spring-mvc/pom.xml b/guest/spring-mvc/pom.xml index 42543b5be0..e80357e4e6 100644 --- a/guest/spring-mvc/pom.xml +++ b/guest/spring-mvc/pom.xml @@ -10,10 +10,10 @@ Spring MVC sample project - org.springframework.boot - spring-boot-starter-parent - 2.0.0.M5 - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 diff --git a/guest/spring-security/pom.xml b/guest/spring-security/pom.xml index baca3bce85..a8d95060df 100644 --- a/guest/spring-security/pom.xml +++ b/guest/spring-security/pom.xml @@ -9,10 +9,10 @@ Spring Security Sample Project - org.springframework.boot - spring-boot-starter-parent - 2.0.0.M6 - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 diff --git a/guest/webservices/spring-rest-service/pom.xml b/guest/webservices/spring-rest-service/pom.xml index 49d35766e8..e67832e0d6 100644 --- a/guest/webservices/spring-rest-service/pom.xml +++ b/guest/webservices/spring-rest-service/pom.xml @@ -7,9 +7,10 @@ war - org.springframework.boot - spring-boot-starter-parent - 1.5.4.RELEASE + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../../parent-boot-1 diff --git a/mustache/pom.xml b/mustache/pom.xml index 863027b845..6012c9a15a 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -8,11 +8,10 @@ mustache - org.springframework.boot - spring-boot-starter-parent - 1.5.4.RELEASE - - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 diff --git a/spring-4/pom.xml b/spring-4/pom.xml index c8f821f1e7..d2632b5f55 100644 --- a/spring-4/pom.xml +++ b/spring-4/pom.xml @@ -8,10 +8,10 @@ spring-4 - org.springframework.boot - spring-boot-starter-parent - 1.5.10.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index b907013b91..9388ee83c1 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -11,10 +11,10 @@ spring 5 sample project about new features - org.springframework.boot - spring-boot-starter-parent - 2.0.0.M7 - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml index b15fc48d7c..1b9e831a29 100644 --- a/spring-activiti/pom.xml +++ b/spring-activiti/pom.xml @@ -10,10 +10,10 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 1.5.4.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 diff --git a/spring-boot-jasypt/pom.xml b/spring-boot-jasypt/pom.xml index 7767130a43..8b7a475824 100644 --- a/spring-boot-jasypt/pom.xml +++ b/spring-boot-jasypt/pom.xml @@ -12,10 +12,10 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 diff --git a/spring-boot-logging-log4j2/pom.xml b/spring-boot-logging-log4j2/pom.xml index 3417043e91..61f949b820 100644 --- a/spring-boot-logging-log4j2/pom.xml +++ b/spring-boot-logging-log4j2/pom.xml @@ -10,10 +10,10 @@ Demo project for Spring Boot Logging with Log4J2 - org.springframework.boot - spring-boot-starter-parent - 2.0.3.RELEASE - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index 453a05d8e7..d0fce26bb5 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -10,11 +10,11 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 2.0.4.RELEASE - - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + diff --git a/spring-boot-vue/pom.xml b/spring-boot-vue/pom.xml index 151fd293bb..d581b11d68 100644 --- a/spring-boot-vue/pom.xml +++ b/spring-boot-vue/pom.xml @@ -12,11 +12,11 @@ Demo project for Spring Boot Vue project - org.springframework.boot - spring-boot-starter-parent - 2.0.2.RELEASE - - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + UTF-8 diff --git a/spring-cloud-bus/spring-cloud-config-client/pom.xml b/spring-cloud-bus/spring-cloud-config-client/pom.xml index 0c7d4648c4..bd9fb45587 100644 --- a/spring-cloud-bus/spring-cloud-config-client/pom.xml +++ b/spring-cloud-bus/spring-cloud-config-client/pom.xml @@ -12,9 +12,10 @@ Demo Spring Cloud Config Client - org.springframework.boot - spring-boot-starter-parent - 1.5.4.RELEASE + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-1 diff --git a/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientApplicationTests.java b/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java similarity index 84% rename from spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientApplicationTests.java rename to spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java index 3b361f385a..364368713a 100644 --- a/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientApplicationTests.java +++ b/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class SpringCloudConfigClientApplicationTests { +public class SpringCloudConfigClientLiveTest { @Test public void contextLoads() { diff --git a/spring-cloud-bus/spring-cloud-config-server/pom.xml b/spring-cloud-bus/spring-cloud-config-server/pom.xml index 122f7bbce3..194289ea1e 100644 --- a/spring-cloud-bus/spring-cloud-config-server/pom.xml +++ b/spring-cloud-bus/spring-cloud-config-server/pom.xml @@ -12,9 +12,10 @@ Demo Spring Cloud Config Server - org.springframework.boot - spring-boot-starter-parent - 1.5.4.RELEASE + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-1 diff --git a/spring-cloud-data-flow/data-flow-server/pom.xml b/spring-cloud-data-flow/data-flow-server/pom.xml index 3b04985618..0133d65978 100644 --- a/spring-cloud-data-flow/data-flow-server/pom.xml +++ b/spring-cloud-data-flow/data-flow-server/pom.xml @@ -11,10 +11,10 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 1.4.3.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-1 diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml index c15387044a..773bf27fc2 100644 --- a/spring-cloud/spring-cloud-aws/pom.xml +++ b/spring-cloud/spring-cloud-aws/pom.xml @@ -10,10 +10,10 @@ Spring Cloud AWS Examples - org.springframework.boot - spring-boot-starter-parent - 1.5.8.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-1 diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml index e782052b29..875aa5ceaa 100644 --- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml +++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml @@ -7,10 +7,10 @@ 1.0.0-SNAPSHOT - spring-boot-starter-parent - org.springframework.boot - 1.4.4.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-1 diff --git a/spring-cloud/spring-cloud-security/auth-client/pom.xml b/spring-cloud/spring-cloud-security/auth-client/pom.xml index d4cd4d1856..f2d6308374 100644 --- a/spring-cloud/spring-cloud-security/auth-client/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-client/pom.xml @@ -10,10 +10,10 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 1.5.9.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../../parent-boot-1 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/com/example/springoath2/Springoath2ApplicationTests.java index 5fa51a61c3..ca89575ee0 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/com/example/springoath2/Springoath2ApplicationTests.java @@ -5,8 +5,10 @@ import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.CloudSite; + @RunWith(SpringRunner.class) -@SpringBootTest +@SpringBootTest(classes = CloudSite.class) public class Springoath2ApplicationTests { @Test diff --git a/spring-cloud/spring-cloud-security/auth-resource/pom.xml b/spring-cloud/spring-cloud-security/auth-resource/pom.xml index e1ed33b46d..0115259108 100644 --- a/spring-cloud/spring-cloud-security/auth-resource/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-resource/pom.xml @@ -12,10 +12,10 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 1.5.9.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../../parent-boot-1 diff --git a/spring-cloud/spring-cloud-security/auth-server/pom.xml b/spring-cloud/spring-cloud-security/auth-server/pom.xml index 4515ecd610..b4367935e3 100644 --- a/spring-cloud/spring-cloud-security/auth-server/pom.xml +++ b/spring-cloud/spring-cloud-security/auth-server/pom.xml @@ -7,9 +7,10 @@ 0.0.1-SNAPSHOT - org.springframework.boot - spring-boot-starter-parent - 1.5.9.RELEASE + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../../parent-boot-1 diff --git a/spring-cloud/spring-cloud-stream-starters/boot/pom.xml b/spring-cloud/spring-cloud-stream-starters/boot/pom.xml index b5a465d846..bf725da5cf 100644 --- a/spring-cloud/spring-cloud-stream-starters/boot/pom.xml +++ b/spring-cloud/spring-cloud-stream-starters/boot/pom.xml @@ -9,9 +9,10 @@ twitterhdfs - org.springframework.boot - spring-boot-starter-parent - 1.5.8.RELEASE + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../../parent-boot-1 diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml index c86c092b2e..afe609288d 100644 --- a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml +++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml @@ -6,10 +6,10 @@ 0.0.1-SNAPSHOT - org.springframework.boot - spring-boot-starter-parent - 1.5.10.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../../parent-boot-1 diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml index 0acd197c50..fdcbabdd51 100644 --- a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml +++ b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml @@ -11,10 +11,10 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 1.5.10.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../../parent-boot-1 diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/src/main/java/com/baeldung/SpringCloudTaskFinal/TaskSinkConfiguration.java b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/TaskSinkConfiguration.java similarity index 100% rename from spring-cloud/spring-cloud-task/springcloudtasksink/src/main/java/com/baeldung/SpringCloudTaskFinal/TaskSinkConfiguration.java rename to spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/TaskSinkConfiguration.java diff --git a/spring-data-5-reactive/pom.xml b/spring-data-5-reactive/pom.xml index 806eafa2d6..36ace53da2 100644 --- a/spring-data-5-reactive/pom.xml +++ b/spring-data-5-reactive/pom.xml @@ -8,10 +8,10 @@ jar - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 diff --git a/spring-data-keyvalue/pom.xml b/spring-data-keyvalue/pom.xml index e6be025cb4..6ab928303d 100644 --- a/spring-data-keyvalue/pom.xml +++ b/spring-data-keyvalue/pom.xml @@ -6,10 +6,10 @@ 1.0 - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 diff --git a/spring-data-rest-querydsl/pom.xml b/spring-data-rest-querydsl/pom.xml index 251eb2d9bb..55ff78f0cb 100644 --- a/spring-data-rest-querydsl/pom.xml +++ b/spring-data-rest-querydsl/pom.xml @@ -8,9 +8,10 @@ spring-data-rest-querydsl - org.springframework.boot - spring-boot-starter-parent - 1.5.9.RELEASE + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 diff --git a/spring-mustache/pom.xml b/spring-mustache/pom.xml index 3a53c63f8c..4e7a1ba5a3 100644 --- a/spring-mustache/pom.xml +++ b/spring-mustache/pom.xml @@ -11,11 +11,10 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 1.5.4.RELEASE - - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 diff --git a/spring-mvc-forms-thymeleaf/pom.xml b/spring-mvc-forms-thymeleaf/pom.xml index 429bf3a5d4..07c49766ee 100644 --- a/spring-mvc-forms-thymeleaf/pom.xml +++ b/spring-mvc-forms-thymeleaf/pom.xml @@ -11,10 +11,10 @@ spring forms examples using thymeleaf - org.springframework.boot - spring-boot-starter-parent - 2.0.0.RELEASE - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 diff --git a/spring-reactive-kotlin/pom.xml b/spring-reactive-kotlin/pom.xml index 1425adc191..8eafe9f217 100644 --- a/spring-reactive-kotlin/pom.xml +++ b/spring-reactive-kotlin/pom.xml @@ -12,11 +12,11 @@ Demo project for Spring Boot - org.springframework.boot - spring-boot-starter-parent - 2.0.3.RELEASE - - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + UTF-8 diff --git a/spring-rest-shell/pom.xml b/spring-rest-shell/pom.xml index e591c16427..2f7d1c8933 100644 --- a/spring-rest-shell/pom.xml +++ b/spring-rest-shell/pom.xml @@ -10,10 +10,10 @@ A simple project to demonstrate Spring REST Shell features. - org.springframework.boot - spring-boot-starter-parent - 1.5.8.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 diff --git a/spring-rest-simple/pom.xml b/spring-rest-simple/pom.xml index f7981ee05c..f5ce46ade4 100644 --- a/spring-rest-simple/pom.xml +++ b/spring-rest-simple/pom.xml @@ -8,9 +8,10 @@ war - org.springframework.boot - spring-boot-starter-parent - 1.4.3.RELEASE + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 @@ -154,7 +155,7 @@ com.jayway.restassured rest-assured - ${rest-assured.version} + ${jayway-rest-assured.version} com.google.protobuf @@ -333,7 +334,7 @@ 20.0 - 2.9.0 + 2.9.0 1.6.0 diff --git a/spring-security-openid/pom.xml b/spring-security-openid/pom.xml index 108636ca8e..9c498f3700 100644 --- a/spring-security-openid/pom.xml +++ b/spring-security-openid/pom.xml @@ -11,10 +11,10 @@ Spring OpenID sample project - org.springframework.boot - spring-boot-starter-parent - 2.0.0.M7 - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 diff --git a/spring-vertx/pom.xml b/spring-vertx/pom.xml index 339c72bcdf..4ba90b841e 100644 --- a/spring-vertx/pom.xml +++ b/spring-vertx/pom.xml @@ -11,11 +11,10 @@ A demo project with vertx spring integration - org.springframework.boot - spring-boot-starter-parent - 1.5.3.RELEASE - - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 diff --git a/vaadin-spring/pom.xml b/vaadin-spring/pom.xml index 3f411cc7a1..09f79f2676 100644 --- a/vaadin-spring/pom.xml +++ b/vaadin-spring/pom.xml @@ -9,9 +9,10 @@ 0.1.0 - org.springframework.boot - spring-boot-starter-parent - 2.0.3.RELEASE + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 From e8397ff0cb4cdcb40f4e1eb5c36cb571d6ad07bf Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 5 Aug 2018 23:36:58 +0530 Subject: [PATCH 127/298] [BAEL-7819] - Added standard parent pom and added start class in sprig-jooq module --- spring-jooq/pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml index 713f7eb5ad..e1c13ef774 100644 --- a/spring-jooq/pom.xml +++ b/spring-jooq/pom.xml @@ -5,10 +5,10 @@ 0.0.1-SNAPSHOT - org.springframework.boot - spring-boot-starter-parent - 1.4.4.RELEASE - + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 @@ -192,13 +192,13 @@ 3.8.6 1.4.193 - 4.3.4.RELEASE + 4.3.17.RELEASE 1.0.0 1.5 1.0.0 - 1.4.4.RELEASE - + 1.5.13.RELEASE + org.jooq.example.spring.Application \ No newline at end of file From 671bf20fe81831f51707d332860ac0c4644f21b0 Mon Sep 17 00:00:00 2001 From: charlesgonzales <39999268+charlesgonzales@users.noreply.github.com> Date: Mon, 6 Aug 2018 02:30:25 +0800 Subject: [PATCH 128/298] add/fix links - team BAEL-7962 (#4891) * 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 * Update README.md * Update README.MD * Update README.md * Create README.md * Update README.md * Create README.md * Update README.md * Update README.md * Create README.md * Create README.md --- apache-avro/README.md | 2 ++ core-java-10/README.md | 1 + core-java-8/README.md | 3 +++ core-java-collections/README.md | 3 +++ core-java-concurrency/README.md | 1 + core-java/README.md | 3 +++ core-kotlin/README.md | 1 + ejb/README.md | 1 + jnosql/README.md | 2 ++ libraries-data/README.md | 3 ++- maven/README.md | 1 + micronaut/README.md | 2 ++ spring-5-reactive/README.md | 3 +++ spring-5/README.md | 1 + spring-all/README.md | 1 + spring-batch/README.md | 1 + spring-boot-vue/README.md | 2 ++ spring-boot/README.MD | 1 + spring-reactive-kotlin/README.md | 2 ++ spring-rest-hal-browser/README.md | 2 ++ spring-rest-simple/README.md | 2 +- spring-rest-template/README.md | 5 +++++ spring-security-mvc-login/README.md | 1 + spring-session/README.md | 2 +- spring-session/spring-session-jdbc/README.MD | 2 +- 25 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 apache-avro/README.md create mode 100644 jnosql/README.md create mode 100644 micronaut/README.md create mode 100644 spring-boot-vue/README.md create mode 100644 spring-reactive-kotlin/README.md create mode 100644 spring-rest-hal-browser/README.md diff --git a/apache-avro/README.md b/apache-avro/README.md new file mode 100644 index 0000000000..32d84ecc76 --- /dev/null +++ b/apache-avro/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Guide to Apache Avro](http://www.baeldung.com/java-apache-avro) diff --git a/core-java-10/README.md b/core-java-10/README.md index 863448c194..84fa381a26 100644 --- a/core-java-10/README.md +++ b/core-java-10/README.md @@ -3,3 +3,4 @@ - [Java 10 LocalVariable Type-Inference](http://www.baeldung.com/java-10-local-variable-type-inference) - [Guide to Java 10](http://www.baeldung.com/java-10-overview) +- [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another) diff --git a/core-java-8/README.md b/core-java-8/README.md index e69641b25c..6f31a8b886 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -56,4 +56,7 @@ - [Generalized Target-Type Inference in Java](http://www.baeldung.com/java-generalized-target-type-inference) - [Image to Base64 String Conversion](http://www.baeldung.com/java-base64-image-string) - [Calculate Age in Java](http://www.baeldung.com/java-get-age) +- [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another) +- [Increment Date in Java](http://www.baeldung.com/java-increment-date) - [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date) +- [Overriding System Time for Testing in Java](http://www.baeldung.com/java-override-system-time) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index 7b3745b486..ea721ee402 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -31,3 +31,6 @@ - [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys) - [Getting the Size of an Iterable in Java](http://www.baeldung.com/java-iterable-size) - [Iterating Backward Through a List](http://www.baeldung.com/java-list-iterate-backwards) +- [Remove the First Element from a List](http://www.baeldung.com/java-remove-first-element-from-list) +- [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map) +- [Initializing HashSet at the Time of Construction](http://www.baeldung.com/java-initialize-hashset) diff --git a/core-java-concurrency/README.md b/core-java-concurrency/README.md index 8192a8e301..a16d885b0c 100644 --- a/core-java-concurrency/README.md +++ b/core-java-concurrency/README.md @@ -38,3 +38,4 @@ - [Priority-based Job Scheduling in Java](http://www.baeldung.com/java-priority-job-schedule) - [A Custom Spring SecurityConfigurer](http://www.baeldung.com/spring-security-custom-configurer) - [Life Cycle of a Thread in Java](http://www.baeldung.com/java-thread-lifecycle) +- [Runnable vs. Callable in Java](http://www.baeldung.com/java-runnable-callable) diff --git a/core-java/README.md b/core-java/README.md index e22ee505ba..77a7a63dab 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -168,3 +168,6 @@ - [Encrypting and Decrypting Files in Java](http://www.baeldung.com/java-cipher-input-output-stream) - [How to Get the Size of an Object in Java](http://www.baeldung.com/java-size-of-object) - [Exception Handling in Java](http://www.baeldung.com/java-exceptions) +- [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) +- [Guide to Java Instrumentation](http://www.baeldung.com/java-instrumentation) +- [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) diff --git a/core-kotlin/README.md b/core-kotlin/README.md index 9bef17e0d4..734b2c08b3 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -37,3 +37,4 @@ - [Create a Java and Kotlin Project with Maven](http://www.baeldung.com/kotlin-maven-java-project) - [Reflection with Kotlin](http://www.baeldung.com/kotlin-reflection) - [Get a Random Number in Kotlin](http://www.baeldung.com/kotlin-random-number) +- [Idiomatic Logging in Kotlin](http://www.baeldung.com/kotlin-logging) diff --git a/ejb/README.md b/ejb/README.md index 994781b064..f47277bf8f 100644 --- a/ejb/README.md +++ b/ejb/README.md @@ -3,3 +3,4 @@ - [Guide to EJB Set-up](http://www.baeldung.com/ejb-intro) - [Java EE Session Beans](http://www.baeldung.com/ejb-session-beans) - [Introduction to EJB JNDI Lookup on WildFly Application Server](http://www.baeldung.com/wildfly-ejb-jndi) +- [A Guide to Message Driven Beans in EJB](http://www.baeldung.com/ejb-message-driven-beans) diff --git a/jnosql/README.md b/jnosql/README.md new file mode 100644 index 0000000000..6777ecc88c --- /dev/null +++ b/jnosql/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [A Guide to Eclipse JNoSQL](http://www.baeldung.com/eclipse-jnosql) diff --git a/libraries-data/README.md b/libraries-data/README.md index 718f38d703..fbe49e9f74 100644 --- a/libraries-data/README.md +++ b/libraries-data/README.md @@ -8,4 +8,5 @@ - [Introduction to HikariCP](http://www.baeldung.com/hikaricp) - [Introduction to JCache](http://www.baeldung.com/jcache) - [A Guide to Apache Ignite](http://www.baeldung.com/apache-ignite) -- [Apache Ignite with Spring Data](http://www.baeldung.com/apache-ignite-spring-data) \ No newline at end of file +- [Apache Ignite with Spring Data](http://www.baeldung.com/apache-ignite-spring-data) +- [Guide to JMapper](https://github.com/eugenp/tutorials/tree/master/libraries-data) diff --git a/maven/README.md b/maven/README.md index 7c3779143a..c5b875ce02 100644 --- a/maven/README.md +++ b/maven/README.md @@ -7,3 +7,4 @@ - [The Maven Failsafe Plugin](http://www.baeldung.com/maven-failsafe-plugin) - [The Maven Verifier Plugin](http://www.baeldung.com/maven-verifier-plugin) - [The Maven Clean Plugin](http://www.baeldung.com/maven-clean-plugin) +- [Build a Jar with Maven and Ignore the Test Results](http://www.baeldung.com/maven-ignore-test-results) diff --git a/micronaut/README.md b/micronaut/README.md new file mode 100644 index 0000000000..10a68ff2f8 --- /dev/null +++ b/micronaut/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Introduction to Micronaut Framework](http://www.baeldung.com/micronaut) diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md index 8a67b4d86d..94a891e717 100644 --- a/spring-5-reactive/README.md +++ b/spring-5-reactive/README.md @@ -13,3 +13,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Reactive WebSockets with Spring 5](http://www.baeldung.com/spring-5-reactive-websockets) - [Spring Webflux Filters](http://www.baeldung.com/spring-webflux-filters) - [How to Set a Header on a Response with Spring 5](http://www.baeldung.com/spring-response-header) +- [Handling Errors in Spring WebFlux](http://www.baeldung.com/spring-webflux-errors) +- [Guide to Spring 5 WebFlux](http://www.baeldung.com/spring-webflux) +- [Spring Webflux and CORS](http://www.baeldung.com/spring-webflux-cors) diff --git a/spring-5/README.md b/spring-5/README.md index baf03fb3b3..47bae09862 100644 --- a/spring-5/README.md +++ b/spring-5/README.md @@ -12,3 +12,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Introduction to Spring REST Docs](http://www.baeldung.com/spring-rest-docs) - [Spring ResponseStatusException](http://www.baeldung.com/spring-response-status-exception) - [Spring Assert Statements](http://www.baeldung.com/spring-assert) +- [Spring Security 5 – OAuth2 Login](http://www.baeldung.com/spring-security-5-oauth2-login) diff --git a/spring-all/README.md b/spring-all/README.md index 215f9a64d2..ded5e26285 100644 --- a/spring-all/README.md +++ b/spring-all/README.md @@ -29,3 +29,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Quick Guide to the Spring @Order Annotation](http://www.baeldung.com/spring-order) - [Spring Web Contexts](http://www.baeldung.com/spring-web-contexts) - [Spring Cache – Creating a Custom KeyGenerator](http://www.baeldung.com/spring-cache-custom-keygenerator) +- [Spring @Primary Annotation](http://www.baeldung.com/spring-primary) diff --git a/spring-batch/README.md b/spring-batch/README.md index 754fc5f980..737e7e13f5 100644 --- a/spring-batch/README.md +++ b/spring-batch/README.md @@ -7,3 +7,4 @@ - [Introduction to Spring Batch](http://www.baeldung.com/introduction-to-spring-batch) - [Spring Batch using Partitioner](http://www.baeldung.com/spring-batch-partitioner) - [Spring Batch Tasklets vs Chunks Approach](http://www.baeldung.com/spring-batch-tasklet-chunk) +- [How to Trigger and Stop a Scheduled Spring Batch Job](http://www.baeldung.com/spring-batch-start-stop-job) diff --git a/spring-boot-vue/README.md b/spring-boot-vue/README.md new file mode 100644 index 0000000000..e68f961e51 --- /dev/null +++ b/spring-boot-vue/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Vue.js Frontend with a Spring Boot Backend](http://www.baeldung.com/spring-boot-vue-js) diff --git a/spring-boot/README.MD b/spring-boot/README.MD index a572a16b67..1532889a5c 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -35,3 +35,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Guide to the Favicon in Spring Boot](http://www.baeldung.com/spring-boot-favicon) - [Spring Shutdown Callbacks](http://www.baeldung.com/spring-shutdown-callbacks) - [Spring Boot Integration Testing with Embedded MongoDB](http://www.baeldung.com/spring-boot-embedded-mongodb) +- [Container Configuration in Spring Boot 2](http://www.baeldung.com/embeddedservletcontainercustomizer-configurableembeddedservletcontainer-spring-boot) diff --git a/spring-reactive-kotlin/README.md b/spring-reactive-kotlin/README.md new file mode 100644 index 0000000000..cf5debc617 --- /dev/null +++ b/spring-reactive-kotlin/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Spring Webflux with Kotlin](http://www.baeldung.com/spring-webflux-kotlin) diff --git a/spring-rest-hal-browser/README.md b/spring-rest-hal-browser/README.md new file mode 100644 index 0000000000..d9760c8295 --- /dev/null +++ b/spring-rest-hal-browser/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Spring REST and HAL Browser](http://www.baeldung.com/spring-rest-hal) diff --git a/spring-rest-simple/README.md b/spring-rest-simple/README.md index 9345cb70cc..ae853ba787 100644 --- a/spring-rest-simple/README.md +++ b/spring-rest-simple/README.md @@ -7,4 +7,4 @@ - [ETags for REST with Spring](http://www.baeldung.com/etags-for-rest-with-spring) - [Spring and Apache FileUpload](http://www.baeldung.com/spring-apache-file-upload) - [Spring RestTemplate Error Handling](http://www.baeldung.com/spring-rest-template-error-handling) - +- [Test a REST API with curl](http://www.baeldung.com/curl-rest) diff --git a/spring-rest-template/README.md b/spring-rest-template/README.md index bf35f0d32c..dd03317f72 100644 --- a/spring-rest-template/README.md +++ b/spring-rest-template/README.md @@ -2,3 +2,8 @@ ### The Course The "REST With Spring" Classes: http://bit.ly/restwithspring + +### Relevant Articles: +================================ + +- [Uploading MultipartFile with Spring RestTemplate](http://www.baeldung.com/spring-rest-template-multipart-upload) diff --git a/spring-security-mvc-login/README.md b/spring-security-mvc-login/README.md index f7eb314869..c19cbc87a5 100644 --- a/spring-security-mvc-login/README.md +++ b/spring-security-mvc-login/README.md @@ -12,6 +12,7 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com - [Spring HTTP/HTTPS Channel Security](http://www.baeldung.com/spring-channel-security-https) - [Spring Security - Customize the 403 Forbidden/Access Denied Page](http://www.baeldung.com/spring-security-custom-access-denied-page) - [Spring Security – Redirect to the Previous URL After Login](http://www.baeldung.com/spring-security-redirect-login) +- [Spring Security Custom AuthenticationFailureHandler](http://www.baeldung.com/spring-security-custom-authentication-failure-handler) ### Build the Project ``` diff --git a/spring-session/README.md b/spring-session/README.md index 733c9edfb9..30f70996cf 100644 --- a/spring-session/README.md +++ b/spring-session/README.md @@ -4,4 +4,4 @@ ### Relevant Articles: - [Introduction to Spring Session](http://www.baeldung.com/spring-session) -- [Spring Session with JDBC](http://www.baeldung.com) +- [Spring Session with JDBC](http://www.baeldung.com/spring-session-jdbc) diff --git a/spring-session/spring-session-jdbc/README.MD b/spring-session/spring-session-jdbc/README.MD index e22b7317c9..9293dfc953 100644 --- a/spring-session/spring-session-jdbc/README.MD +++ b/spring-session/spring-session-jdbc/README.MD @@ -3,4 +3,4 @@ Jira BAEL-1911 ### Relevant Articles: -- [Spring Session with JDBC](http://www.baeldung.com) +- [Spring Session with JDBC](http://www.baeldung.com/spring-session-jdbc) From b26def79cfb6b152732114911cd8d5829d7a13e7 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Mon, 6 Aug 2018 00:10:51 +0530 Subject: [PATCH 129/298] [BAEL-7819] - Reverted guest folder parent changes im pom.xml --- guest/remote-debugging/pom.xml | 8 ++++---- guest/spring-boot-app/pom.xml | 7 +++---- guest/spring-mvc/pom.xml | 8 ++++---- guest/spring-security/pom.xml | 8 ++++---- guest/webservices/spring-rest-service/pom.xml | 7 +++---- 5 files changed, 18 insertions(+), 20 deletions(-) diff --git a/guest/remote-debugging/pom.xml b/guest/remote-debugging/pom.xml index 4e08741154..1f0b5b2a65 100644 --- a/guest/remote-debugging/pom.xml +++ b/guest/remote-debugging/pom.xml @@ -8,10 +8,10 @@ war - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-1 + org.springframework.boot + spring-boot-starter-parent + 1.5.8.RELEASE + diff --git a/guest/spring-boot-app/pom.xml b/guest/spring-boot-app/pom.xml index a329df0f61..d1a5832d66 100644 --- a/guest/spring-boot-app/pom.xml +++ b/guest/spring-boot-app/pom.xml @@ -7,10 +7,9 @@ war - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-1 + org.springframework.boot + spring-boot-starter-parent + 1.5.3.RELEASE diff --git a/guest/spring-mvc/pom.xml b/guest/spring-mvc/pom.xml index e80357e4e6..d24f17a4fb 100644 --- a/guest/spring-mvc/pom.xml +++ b/guest/spring-mvc/pom.xml @@ -10,10 +10,10 @@ Spring MVC sample project - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-2 + org.springframework.boot + spring-boot-starter-parent + 2.0.0.M5 + diff --git a/guest/spring-security/pom.xml b/guest/spring-security/pom.xml index a8d95060df..4c408b0c39 100644 --- a/guest/spring-security/pom.xml +++ b/guest/spring-security/pom.xml @@ -9,10 +9,10 @@ Spring Security Sample Project - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-2 + org.springframework.boot + spring-boot-starter-parent + 2.0.0.M6 + diff --git a/guest/webservices/spring-rest-service/pom.xml b/guest/webservices/spring-rest-service/pom.xml index e67832e0d6..b613378f0c 100644 --- a/guest/webservices/spring-rest-service/pom.xml +++ b/guest/webservices/spring-rest-service/pom.xml @@ -7,10 +7,9 @@ war - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../../parent-boot-1 + org.springframework.boot + spring-boot-starter-parent + 1.5.4.RELEASE From 3aedd43cca6dc92a5c18b591c98d1fb443b24c8d Mon Sep 17 00:00:00 2001 From: amit2103 Date: Mon, 6 Aug 2018 00:13:02 +0530 Subject: [PATCH 130/298] [BAEL-7819] - Reverted guest folder parent changes im pom.xml - Fixed wrong push --- guest/remote-debugging/pom.xml | 4 ++-- guest/spring-boot-app/pom.xml | 4 ++-- guest/spring-mvc/pom.xml | 4 ++-- guest/spring-security/pom.xml | 4 ++-- guest/webservices/spring-rest-service/pom.xml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/guest/remote-debugging/pom.xml b/guest/remote-debugging/pom.xml index 1f0b5b2a65..67fed3f1a1 100644 --- a/guest/remote-debugging/pom.xml +++ b/guest/remote-debugging/pom.xml @@ -8,8 +8,8 @@ war - org.springframework.boot - spring-boot-starter-parent + org.springframework.boot + spring-boot-starter-parent 1.5.8.RELEASE diff --git a/guest/spring-boot-app/pom.xml b/guest/spring-boot-app/pom.xml index d1a5832d66..7daa8f668e 100644 --- a/guest/spring-boot-app/pom.xml +++ b/guest/spring-boot-app/pom.xml @@ -7,8 +7,8 @@ war - org.springframework.boot - spring-boot-starter-parent + org.springframework.boot + spring-boot-starter-parent 1.5.3.RELEASE diff --git a/guest/spring-mvc/pom.xml b/guest/spring-mvc/pom.xml index d24f17a4fb..42543b5be0 100644 --- a/guest/spring-mvc/pom.xml +++ b/guest/spring-mvc/pom.xml @@ -10,8 +10,8 @@ Spring MVC sample project - org.springframework.boot - spring-boot-starter-parent + org.springframework.boot + spring-boot-starter-parent 2.0.0.M5 diff --git a/guest/spring-security/pom.xml b/guest/spring-security/pom.xml index 4c408b0c39..baca3bce85 100644 --- a/guest/spring-security/pom.xml +++ b/guest/spring-security/pom.xml @@ -9,8 +9,8 @@ Spring Security Sample Project - org.springframework.boot - spring-boot-starter-parent + org.springframework.boot + spring-boot-starter-parent 2.0.0.M6 diff --git a/guest/webservices/spring-rest-service/pom.xml b/guest/webservices/spring-rest-service/pom.xml index b613378f0c..49d35766e8 100644 --- a/guest/webservices/spring-rest-service/pom.xml +++ b/guest/webservices/spring-rest-service/pom.xml @@ -7,8 +7,8 @@ war - org.springframework.boot - spring-boot-starter-parent + org.springframework.boot + spring-boot-starter-parent 1.5.4.RELEASE From 1f0aabed072fb8bd59b455899aa1e019636b77d4 Mon Sep 17 00:00:00 2001 From: Jon Cook Date: Sun, 29 Jul 2018 17:22:14 +0200 Subject: [PATCH 131/298] BAEL-1552 - Jersey MVC Support --- jersey/pom.xml | 29 ++++++++++ .../server/config/ViewApplicationConfig.java | 14 +++++ .../server/http/EmbeddedHttpServer.java | 35 ++++++++++++ .../baeldung/jersey/server/model/Fruit.java | 23 ++++++++ .../jersey/server/rest/FruitResource.java | 55 +++++++++++++++++++ .../resources/templates/freemarker/all.ftl | 14 +++++ .../resources/templates/freemarker/error.ftl | 8 +++ .../resources/templates/freemarker/index.ftl | 8 +++ .../resources/templates/freemarker/named.ftl | 8 +++ .../rest/FruitResourceIntegrationTest.java | 42 ++++++++++++++ 10 files changed, 236 insertions(+) create mode 100644 jersey/src/main/java/com/baeldung/jersey/server/config/ViewApplicationConfig.java create mode 100644 jersey/src/main/java/com/baeldung/jersey/server/http/EmbeddedHttpServer.java create mode 100644 jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java create mode 100644 jersey/src/main/java/com/baeldung/jersey/server/rest/FruitResource.java create mode 100644 jersey/src/main/resources/templates/freemarker/all.ftl create mode 100644 jersey/src/main/resources/templates/freemarker/error.ftl create mode 100644 jersey/src/main/resources/templates/freemarker/index.ftl create mode 100644 jersey/src/main/resources/templates/freemarker/named.ftl create mode 100644 jersey/src/test/java/com/baeldung/jersey/server/rest/FruitResourceIntegrationTest.java diff --git a/jersey/pom.xml b/jersey/pom.xml index 78e6d621ad..e248f9cf90 100644 --- a/jersey/pom.xml +++ b/jersey/pom.xml @@ -29,6 +29,28 @@ jaxrs-ri ${jersey.version} + + org.glassfish.jersey.containers + jersey-container-grizzly2-servlet + ${jersey.version} + + + org.glassfish.jersey.ext + jersey-mvc-freemarker + ${jersey.version} + + + org.glassfish.jersey.test-framework + jersey-test-framework-core + ${jersey.version} + test + + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-grizzly2 + ${jersey.version} + test + @@ -41,6 +63,13 @@ false + + org.codehaus.mojo + exec-maven-plugin + + com.baeldung.jersey.server.http.EmbeddedHttpServer + + diff --git a/jersey/src/main/java/com/baeldung/jersey/server/config/ViewApplicationConfig.java b/jersey/src/main/java/com/baeldung/jersey/server/config/ViewApplicationConfig.java new file mode 100644 index 0000000000..d4744066c4 --- /dev/null +++ b/jersey/src/main/java/com/baeldung/jersey/server/config/ViewApplicationConfig.java @@ -0,0 +1,14 @@ +package com.baeldung.jersey.server.config; + +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.server.mvc.freemarker.FreemarkerMvcFeature; + +public class ViewApplicationConfig extends ResourceConfig { + + public ViewApplicationConfig() { + packages("com.baeldung.jersey.server"); + property(FreemarkerMvcFeature.TEMPLATE_BASE_PATH, "templates/freemarker"); + register(FreemarkerMvcFeature.class);; + } + +} diff --git a/jersey/src/main/java/com/baeldung/jersey/server/http/EmbeddedHttpServer.java b/jersey/src/main/java/com/baeldung/jersey/server/http/EmbeddedHttpServer.java new file mode 100644 index 0000000000..4afa086858 --- /dev/null +++ b/jersey/src/main/java/com/baeldung/jersey/server/http/EmbeddedHttpServer.java @@ -0,0 +1,35 @@ +package com.baeldung.jersey.server.http; + +import java.io.IOException; +import java.net.URI; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.glassfish.grizzly.http.server.HttpServer; +import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; + +import com.baeldung.jersey.server.config.ViewApplicationConfig; + +public class EmbeddedHttpServer { + + private static final URI BASE_URI = URI.create("http://localhost:8082/"); + + public static void main(String[] args) { + try { + final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, new ViewApplicationConfig(), false); + + Runtime.getRuntime() + .addShutdownHook(new Thread(() -> { + server.shutdownNow(); + })); + + server.start(); + + System.out.println(String.format("Application started.\nTry out %s\nStop the application using CTRL+C", BASE_URI + "fruit")); + } catch (IOException ex) { + Logger.getLogger(EmbeddedHttpServer.class.getName()) + .log(Level.SEVERE, null, ex); + } + + } +} diff --git a/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java b/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java new file mode 100644 index 0000000000..da4865e9ab --- /dev/null +++ b/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java @@ -0,0 +1,23 @@ +package com.baeldung.jersey.server.model; + +public class Fruit { + + private final String name; + private final String colour; + + public Fruit(String name, String colour) { + this.name = name; + this.colour = colour; + } + + public String getName() { + return name; + } + + public String getColour() { + return colour; + } + + + +} diff --git a/jersey/src/main/java/com/baeldung/jersey/server/rest/FruitResource.java b/jersey/src/main/java/com/baeldung/jersey/server/rest/FruitResource.java new file mode 100644 index 0000000000..4e1fa4aa11 --- /dev/null +++ b/jersey/src/main/java/com/baeldung/jersey/server/rest/FruitResource.java @@ -0,0 +1,55 @@ +package com.baeldung.jersey.server.rest; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.glassfish.jersey.server.mvc.ErrorTemplate; +import org.glassfish.jersey.server.mvc.Template; +import org.glassfish.jersey.server.mvc.Viewable; + +import com.baeldung.jersey.server.model.Fruit; + +@Path("/fruit") +public class FruitResource { + + @GET + public Viewable get() { + return new Viewable("/index.ftl", "Fruit Index Page"); + } + + @GET + @Template(name = "/all.ftl") + @Path("/all") + @Produces(MediaType.TEXT_HTML) + public Map getAllFruit() { + final List fruits = new ArrayList<>(); + fruits.add(new Fruit("banana", "yellow")); + fruits.add(new Fruit("apple", "red")); + fruits.add(new Fruit("kiwi", "green")); + + final Map model = new HashMap(); + model.put("items", fruits); + return model; + } + + @GET + @ErrorTemplate(name = "/error.ftl") + @Template(name = "/named.ftl") + @Path("{name}") + @Produces(MediaType.TEXT_HTML) + public String getFruitByName(@PathParam("name") String name) { + if (!"banana".equalsIgnoreCase(name)) { + throw new IllegalArgumentException("Fruit not found: " + name); + } + return name; + } + +} diff --git a/jersey/src/main/resources/templates/freemarker/all.ftl b/jersey/src/main/resources/templates/freemarker/all.ftl new file mode 100644 index 0000000000..59406a60ca --- /dev/null +++ b/jersey/src/main/resources/templates/freemarker/all.ftl @@ -0,0 +1,14 @@ + + + All fruit! + + +

All fruit!

+

Fruits:

+
    + <#list items as fruit> +
  • ${fruit.name}
  • + +
+ + \ No newline at end of file diff --git a/jersey/src/main/resources/templates/freemarker/error.ftl b/jersey/src/main/resources/templates/freemarker/error.ftl new file mode 100644 index 0000000000..8ea6828ba5 --- /dev/null +++ b/jersey/src/main/resources/templates/freemarker/error.ftl @@ -0,0 +1,8 @@ + + + Welcome! + + +

Error - ${model.message}!

+ + \ No newline at end of file diff --git a/jersey/src/main/resources/templates/freemarker/index.ftl b/jersey/src/main/resources/templates/freemarker/index.ftl new file mode 100644 index 0000000000..01447f24e8 --- /dev/null +++ b/jersey/src/main/resources/templates/freemarker/index.ftl @@ -0,0 +1,8 @@ + + + Welcome! + + +

Welcome ${model}!

+ + \ No newline at end of file diff --git a/jersey/src/main/resources/templates/freemarker/named.ftl b/jersey/src/main/resources/templates/freemarker/named.ftl new file mode 100644 index 0000000000..ccde3307e6 --- /dev/null +++ b/jersey/src/main/resources/templates/freemarker/named.ftl @@ -0,0 +1,8 @@ + + + Welcome! + + +

Found fruit - ${model}!

+ + \ No newline at end of file diff --git a/jersey/src/test/java/com/baeldung/jersey/server/rest/FruitResourceIntegrationTest.java b/jersey/src/test/java/com/baeldung/jersey/server/rest/FruitResourceIntegrationTest.java new file mode 100644 index 0000000000..a0b6daed51 --- /dev/null +++ b/jersey/src/test/java/com/baeldung/jersey/server/rest/FruitResourceIntegrationTest.java @@ -0,0 +1,42 @@ +package com.baeldung.jersey.server.rest; + +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.containsString; + +import javax.ws.rs.core.Application; + +import org.glassfish.jersey.test.JerseyTest; +import org.junit.Assert; +import org.junit.Test; + +import com.baeldung.jersey.server.config.ViewApplicationConfig; + +public class FruitResourceIntegrationTest extends JerseyTest { + + @Override + protected Application configure() { + return new ViewApplicationConfig(); + } + + @Test + public void testAllFruit() { + final String response = target("/fruit/all").request() + .get(String.class); + Assert.assertThat(response, allOf(containsString("banana"), containsString("apple"), containsString("kiwi"))); + } + + @Test + public void testIndex() { + final String response = target("/fruit").request() + .get(String.class); + Assert.assertThat(response, containsString("Welcome Fruit Index Page!")); + } + + @Test + public void testErrorTemplate() { + final String response = target("/fruit/orange").request() + .get(String.class); + Assert.assertThat(response, containsString("Error - Fruit not found: orange!")); + } + +} From 0681d23e0e2069227347d69ebb19bd0ba7e67504 Mon Sep 17 00:00:00 2001 From: Jon Cook Date: Sun, 29 Jul 2018 17:34:10 +0200 Subject: [PATCH 132/298] BAEL-1552 - Jersey MVC Support --- .../src/main/java/com/baeldung/jersey/server/model/Fruit.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java b/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java index da4865e9ab..30620e331d 100644 --- a/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java +++ b/jersey/src/main/java/com/baeldung/jersey/server/model/Fruit.java @@ -17,7 +17,4 @@ public class Fruit { public String getColour() { return colour; } - - - } From 441de07ee6af9ed273d9bc22d9331d42bce19c85 Mon Sep 17 00:00:00 2001 From: Saikat <11479802+psysane@users.noreply.github.com> Date: Mon, 6 Aug 2018 11:52:37 +0530 Subject: [PATCH 133/298] [BAEL-1902] Set timezone of a date (#4659) * Convert time in preferred time zone using Java 7, 8 and Joda-time * Update the code as per review comments * Incorporate review comments * Incorporate review changes * Use snippets from unit test only --- .../datetime/UseTimeZoneUnitTest.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 core-java-8/src/test/java/com/baeldung/datetime/UseTimeZoneUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseTimeZoneUnitTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UseTimeZoneUnitTest.java new file mode 100644 index 0000000000..4423ac6ce0 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/datetime/UseTimeZoneUnitTest.java @@ -0,0 +1,72 @@ +package com.baeldung.datetime; + +import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; + +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.junit.Assert; +import org.junit.Test; + +public class UseTimeZoneUnitTest { + + /* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones */ + + String timeZone = "Asia/Singapore"; + + private static final String PATTERN = "E yyyy-MM-dd HH:mm:ss a"; + + @Test + public void givenDateWithoutTimeZone_WhenSetTimeZoneUsingJava7_ThenTimeZoneIsSetSuccessfully() { + Date nowUtc = new Date(); + TimeZone asiaSingapore = TimeZone.getTimeZone(timeZone); + + Calendar nowAsiaSingapore = Calendar.getInstance(asiaSingapore); + nowAsiaSingapore.setTime(nowUtc); + + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(PATTERN); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone(timeZone)); + + System.out.println(String.format("Java7: Time now in '%s' is '%s'", nowAsiaSingapore.getTimeZone() + .getID(), simpleDateFormat.format(nowAsiaSingapore.getTime()))); + + Assert.assertEquals(nowUtc.toInstant().getEpochSecond(), nowAsiaSingapore.toInstant().getEpochSecond()); + Assert.assertEquals(asiaSingapore, nowAsiaSingapore.getTimeZone()); + + } + + @Test + public void givenDateWithoutTimeZone_WhenSetTimeZoneUsingJava8_ThenTimeZoneIsSetSuccessfully() { + Instant nowUtc = Instant.now(); + ZoneId asiaSingapore = ZoneId.of(timeZone); + + ZonedDateTime nowAsiaSingapore = ZonedDateTime.ofInstant(nowUtc, asiaSingapore); + + System.out.println(String.format("Java8: Time now in '%s' is '%s'", nowAsiaSingapore.getZone(), + nowAsiaSingapore.format(DateTimeFormatter.ofPattern(PATTERN)))); + + Assert.assertEquals(nowUtc.getEpochSecond(), nowAsiaSingapore.toEpochSecond()); + Assert.assertEquals(asiaSingapore, nowAsiaSingapore.getZone()); + } + + @Test + public void givenDateWithoutTimeZone_WhenSetTimeZoneUsingJodaTime_ThenTimeZoneIsSetSuccessfully() { + org.joda.time.Instant nowUtc = org.joda.time.Instant.now(); + DateTimeZone asiaSingapore = DateTimeZone.forID(timeZone); + + DateTime nowAsiaSingapore = nowUtc.toDateTime(asiaSingapore); + + System.out.println(String.format("Joda-time: Time now in '%s' is '%s'", nowAsiaSingapore.getZone(), + nowAsiaSingapore.toString(PATTERN))); + + Assert.assertEquals(nowUtc.toInstant().getMillis(), nowAsiaSingapore.toInstant().getMillis()); + Assert.assertEquals(asiaSingapore, nowAsiaSingapore.getZone()); + } + +} From 943df6917e853edc99bd3993103d687a3ddc8602 Mon Sep 17 00:00:00 2001 From: Rokon Uddin Ahmed Date: Mon, 6 Aug 2018 18:04:56 +0600 Subject: [PATCH 134/298] BAEL-7708 04.08.2016 (#4893) * Update README.md * Update README.md * Update README.md * Update README.MD * Create README.md * Update README.md * Update README.md * Update README.md * Create 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 * Create README.md * Create README.md * Update README.md * Update README.md * Update README.MD * Update README.md * Update README.md --- algorithms/README.md | 1 + core-java-collections/README.md | 2 ++ core-java/README.md | 2 +- google-web-toolkit/README.md | 1 + jnosql/README.md | 2 +- libraries/README.md | 2 ++ spring-5-reactive/README.md | 2 +- spring-mvc-java/README.md | 1 + spring-rest-template/README.md | 2 -- 9 files changed, 10 insertions(+), 5 deletions(-) diff --git a/algorithms/README.md b/algorithms/README.md index 14ec7294e7..47ddd7028a 100644 --- a/algorithms/README.md +++ b/algorithms/README.md @@ -23,3 +23,4 @@ - [Converting Between Roman and Arabic Numerals in Java](http://www.baeldung.com/java-convert-roman-arabic) - [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) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index ea721ee402..8f5dd137ed 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -31,6 +31,8 @@ - [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys) - [Getting the Size of an Iterable in Java](http://www.baeldung.com/java-iterable-size) - [Iterating Backward Through a List](http://www.baeldung.com/java-list-iterate-backwards) +- [How to Filter a Collection in Java](http://www.baeldung.com/java-collection-filtering) +- [Add Multiple Items to an Java ArrayList](http://www.baeldung.com/java-add-items-array-list) - [Remove the First Element from a List](http://www.baeldung.com/java-remove-first-element-from-list) - [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map) - [Initializing HashSet at the Time of Construction](http://www.baeldung.com/java-initialize-hashset) diff --git a/core-java/README.md b/core-java/README.md index 77a7a63dab..f05b2625e8 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -168,6 +168,6 @@ - [Encrypting and Decrypting Files in Java](http://www.baeldung.com/java-cipher-input-output-stream) - [How to Get the Size of an Object in Java](http://www.baeldung.com/java-size-of-object) - [Exception Handling in Java](http://www.baeldung.com/java-exceptions) -- [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) - [Guide to Java Instrumentation](http://www.baeldung.com/java-instrumentation) - [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) +- [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) diff --git a/google-web-toolkit/README.md b/google-web-toolkit/README.md index 3526fe9962..65264375bc 100644 --- a/google-web-toolkit/README.md +++ b/google-web-toolkit/README.md @@ -1,2 +1,3 @@ ### Relevant Articles: - [Introduction to GWT](http://www.baeldung.com/gwt) +- [Quick Use of FilenameFilter](http://www.baeldung.com/java-filename-filter) diff --git a/jnosql/README.md b/jnosql/README.md index 6777ecc88c..d580cbc920 100644 --- a/jnosql/README.md +++ b/jnosql/README.md @@ -1,2 +1,2 @@ -### Relevant Articles: +### Relevant Articles: - [A Guide to Eclipse JNoSQL](http://www.baeldung.com/eclipse-jnosql) diff --git a/libraries/README.md b/libraries/README.md index 3d06442bae..aed808420e 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -86,6 +86,8 @@ - [Convert String to Date in Java](http://www.baeldung.com/java-string-to-date) - [Histograms with Apache Commons Frequency](http://www.baeldung.com/apache-commons-frequency) - [Guide to Resilience4j](http://www.baeldung.com/resilience4j) +- [Parsing YAML with SnakeYAML](http://www.baeldung.com/java-snake-yaml) +- [Guide to JMapper](http://www.baeldung.com/jmapper) The libraries module contains examples related to small libraries that are relatively easy to use and does not require any separate module of its own. diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md index 94a891e717..0a7fe7a47e 100644 --- a/spring-5-reactive/README.md +++ b/spring-5-reactive/README.md @@ -13,6 +13,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Reactive WebSockets with Spring 5](http://www.baeldung.com/spring-5-reactive-websockets) - [Spring Webflux Filters](http://www.baeldung.com/spring-webflux-filters) - [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) - [Guide to Spring 5 WebFlux](http://www.baeldung.com/spring-webflux) -- [Spring Webflux and CORS](http://www.baeldung.com/spring-webflux-cors) diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index 6b05ef569c..c4a0e3579c 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -34,3 +34,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Core Annotations](http://www.baeldung.com/spring-core-annotations) - [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) +- [Display RSS Feed with Spring MVC](http://www.baeldung.com/spring-mvc-rss-feed) diff --git a/spring-rest-template/README.md b/spring-rest-template/README.md index dd03317f72..d69d5c01c7 100644 --- a/spring-rest-template/README.md +++ b/spring-rest-template/README.md @@ -4,6 +4,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: -================================ - - [Uploading MultipartFile with Spring RestTemplate](http://www.baeldung.com/spring-rest-template-multipart-upload) From b7355cbab0ffb30287ca3ec2674ef19c9a9fd0e7 Mon Sep 17 00:00:00 2001 From: Carlo Corti Date: Mon, 6 Aug 2018 23:38:54 +0200 Subject: [PATCH 135/298] BAEL-1843 - JUnit4 -> JUnit5 migration guide (#4816) * Added code for the migration from JUnit 4 to JUnit 5 * Add example for Rule migration support * Add fix to access modifiers to test methods * Remove wrong header * Add junit5-migration module and its code snippets * Add module configuration to pom * Remove test classes that were added for the migration from JUnit 4 to JUnit 5 article (moved under correct module) --- pom.xml | 1 + testing-modules/junit-5/pom.xml | 6 ++ .../java/com/baeldung/AssertionUnitTest.java | 4 + .../java/com/baeldung/NestedUnitTest.java | 6 +- .../junit5}/AssumptionUnitTest.java | 12 +-- testing-modules/junit5-migration/README.md | 3 + testing-modules/junit5-migration/pom.xml | 90 +++++++++++++++++++ .../junit4/AnnotationTestExampleUnitTest.java | 22 +++++ .../baeldung/junit4/AssertionUnitTest.java | 36 ++++++++ .../com/baeldung/junit4/AssumeUnitTest.java | 23 +++++ .../junit4/ExceptionAssertionUnitTest.java | 24 +++++ .../baeldung/junit4/RuleExampleUnitTest.java | 16 ++++ .../junit4/TestAnnotationsUnitTest.java | 34 +++++++ .../baeldung/junit4/TraceUnitTestRule.java | 35 ++++++++ .../junit4/categories/Annotations.java | 5 ++ .../junit4/categories/JUnit4UnitTest.java | 5 ++ .../junit5/AnnotationTestExampleUnitTest.java | 28 ++++++ .../baeldung/junit5/AssertionUnitTest.java | 40 +++++++++ .../baeldung/junit5/AssumptionUnitTest.java | 27 ++++++ .../junit5/ConditionalExecutionUnitTest.java | 69 ++++++++++++++ .../com/baeldung/junit5/NestedUnitTest.java | 77 ++++++++++++++++ .../baeldung/junit5/RuleExampleUnitTest.java | 17 ++++ .../junit5/RuleMigrationSupportUnitTest.java | 27 ++++++ .../junit5/TestAnnotationsUnitTest.java | 39 ++++++++ .../baeldung/junit5/TraceUnitExtension.java | 19 ++++ 25 files changed, 656 insertions(+), 9 deletions(-) rename testing-modules/junit-5/src/test/java/com/baeldung/{ => migration/junit5}/AssumptionUnitTest.java (69%) create mode 100644 testing-modules/junit5-migration/README.md create mode 100644 testing-modules/junit5-migration/pom.xml create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AnnotationTestExampleUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AssertionUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AssumeUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/ExceptionAssertionUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/RuleExampleUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/TestAnnotationsUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/TraceUnitTestRule.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/categories/Annotations.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/categories/JUnit4UnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AnnotationTestExampleUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AssertionUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AssumptionUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/ConditionalExecutionUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/NestedUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleExampleUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleMigrationSupportUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/TestAnnotationsUnitTest.java create mode 100644 testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/TraceUnitExtension.java diff --git a/pom.xml b/pom.xml index 34b55fd1f4..e120620c30 100644 --- a/pom.xml +++ b/pom.xml @@ -905,6 +905,7 @@ json jsoup testing-modules/junit-5 + testing-modules/junit5-migration jws libraries-data linkrest diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index 2ef290a7c1..f9ea34ca72 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -33,6 +33,12 @@ ${junit.vintage.version} test
+ + org.junit.jupiter + junit-jupiter-migrationsupport + ${junit.vintage.version} + test + org.apache.logging.log4j log4j-core diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/AssertionUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/AssertionUnitTest.java index 79ba882205..31b6e14d6c 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/AssertionUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/AssertionUnitTest.java @@ -11,14 +11,17 @@ import java.util.Optional; import java.util.function.BooleanSupplier; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; /** * Unit test that demonstrate the different assertions available within JUnit 4 */ +@DisplayName("Test case for assertions") public class AssertionUnitTest { @Test + @DisplayName("Arrays should be equals") public void whenAssertingArraysEquality_thenEqual() { char[] expected = {'J', 'u', 'p', 'i', 't', 'e', 'r'}; char[] actual = "Jupiter".toCharArray(); @@ -27,6 +30,7 @@ public class AssertionUnitTest { } @Test + @DisplayName("The area of two polygons should be equal") public void whenAssertingEquality_thenEqual() { float square = 2 * 2; float rectangle = 2 * 2; diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/NestedUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/NestedUnitTest.java index 7586a2f51a..299cac2480 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/NestedUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/NestedUnitTest.java @@ -10,13 +10,13 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; public class NestedUnitTest { + Stack stack; - boolean isRun = false; @Test @DisplayName("is instantiated with new Stack()") void isInstantiatedWithNew() { - new Stack(); + new Stack<>(); } @Nested @@ -25,7 +25,7 @@ public class NestedUnitTest { @BeforeEach void init() { - stack = new Stack(); + stack = new Stack<>(); } @Test diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/AssumptionUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/migration/junit5/AssumptionUnitTest.java similarity index 69% rename from testing-modules/junit-5/src/test/java/com/baeldung/AssumptionUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/migration/junit5/AssumptionUnitTest.java index 7d67d93486..80201a3f44 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/AssumptionUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/migration/junit5/AssumptionUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.migration.junit5; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assumptions.assumeFalse; @@ -10,19 +10,19 @@ import org.junit.jupiter.api.Test; public class AssumptionUnitTest { @Test - void trueAssumption() { - assumeTrue(5 > 1); + public void trueAssumption() { + assumeTrue(5 > 1, () -> "5 is greater the 1"); assertEquals(5 + 2, 7); } @Test - void falseAssumption() { - assumeFalse(5 < 1); + public void falseAssumption() { + assumeFalse(5 < 1, () -> "5 is less then 1"); assertEquals(5 + 2, 7); } @Test - void assumptionThat() { + public void assumptionThat() { String someString = "Just a string"; assumingThat(someString.equals("Just a string"), () -> assertEquals(2 + 2, 4)); } diff --git a/testing-modules/junit5-migration/README.md b/testing-modules/junit5-migration/README.md new file mode 100644 index 0000000000..5fe7fc1f16 --- /dev/null +++ b/testing-modules/junit5-migration/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: +- [JUnit4 -> JUnit5 migration guide](http://www.baeldung.com/junit4-junit5-migration-guide) + diff --git a/testing-modules/junit5-migration/pom.xml b/testing-modules/junit5-migration/pom.xml new file mode 100644 index 0000000000..ae46b479bb --- /dev/null +++ b/testing-modules/junit5-migration/pom.xml @@ -0,0 +1,90 @@ + + + + 4.0.0 + + junit5-migration + 1.0-SNAPSHOT + junit5-migration + JUnit 4 -> JUnit 5 migration + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + + + + + org.junit.platform + junit-platform-engine + ${junit.platform.version} + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + org.junit.vintage + junit-vintage-engine + ${junit.vintage.version} + test + + + org.junit.jupiter + junit-jupiter-migrationsupport + ${junit.vintage.version} + test + + + + + + + src/test/resources + true + + + + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + org.junit.platform + junit-platform-surefire-provider + ${junit.platform.version} + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + + java + + + + + com.baeldung.TestLauncher + + + + + + + 5.1.0 + 1.1.0 + 5.2.0 + 2.19.1 + 1.6.0 + + + diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AnnotationTestExampleUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AnnotationTestExampleUnitTest.java new file mode 100644 index 0000000000..a5f5c19c65 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AnnotationTestExampleUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.junit4; + +import com.baeldung.junit4.categories.Annotations; +import com.baeldung.junit4.categories.JUnit4UnitTest; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +@Category(value = { Annotations.class, JUnit4UnitTest.class }) +public class AnnotationTestExampleUnitTest { + @Test(expected = Exception.class) + public void shouldRaiseAnException() throws Exception { + throw new Exception("This is my expected exception"); + } + + @Test(timeout = 1) + @Ignore + public void shouldFailBecauseTimeout() throws InterruptedException { + Thread.sleep(10); + } + +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AssertionUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AssertionUnitTest.java new file mode 100644 index 0000000000..8979c9ecbc --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AssertionUnitTest.java @@ -0,0 +1,36 @@ +package com.baeldung.junit4; + +import org.junit.Assert; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; + +import static org.hamcrest.CoreMatchers.hasItems; +import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; + +@DisplayName("Test case for assertions") +public class AssertionUnitTest { + + @Test + @DisplayName("Arrays should be equals") + public void whenAssertingArraysEquality_thenEqual() { + char[] expected = {'J', 'u', 'p', 'i', 't', 'e', 'r'}; + char[] actual = "Jupiter".toCharArray(); + + assertArrayEquals("Arrays should be equal", expected, actual); + } + + @Test + public void givenMultipleAssertion_whenAssertingAll_thenOK() { + assertEquals("4 is 2 times 2", 4, 2 * 2); + assertEquals("java", "JAVA".toLowerCase()); + assertEquals("null is equal to null", null, null); + } + + @Test + public void testAssertThatHasItems() { + assertThat(Arrays.asList("Java", "Kotlin", "Scala"), hasItems("Java", "Kotlin")); + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AssumeUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AssumeUnitTest.java new file mode 100644 index 0000000000..f7730a3dd8 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/AssumeUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.junit4; + + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assume.assumeFalse; +import static org.junit.Assume.assumeTrue; + +public class AssumeUnitTest { + + @Test + public void trueAssumption() { + assumeTrue("5 is greater the 1", 5 > 1); + assertEquals(5 + 2, 7); + } + + @Test + public void falseAssumption() { + assumeFalse("5 is less then 1", 5 < 1); + assertEquals(5 + 2, 7); + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/ExceptionAssertionUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/ExceptionAssertionUnitTest.java new file mode 100644 index 0000000000..38e7f640a2 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/ExceptionAssertionUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.junit4; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +public class ExceptionAssertionUnitTest { + + @Rule + public ExpectedException exceptionRule = ExpectedException.none(); + + @Test(expected = NullPointerException.class) + public void whenExceptionThrown_thenExpectationSatisfied() { + String test = null; + test.length(); + } + + @Test + public void whenExceptionThrown_thenRuleIsApplied() { + exceptionRule.expect(NumberFormatException.class); + exceptionRule.expectMessage("For input string"); + Integer.parseInt("1a"); + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/RuleExampleUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/RuleExampleUnitTest.java new file mode 100644 index 0000000000..35f96b4f6a --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/RuleExampleUnitTest.java @@ -0,0 +1,16 @@ +package com.baeldung.junit4; + +import org.junit.Rule; +import org.junit.Test; + +public class RuleExampleUnitTest { + + @Rule + public final TraceUnitTestRule traceRuleTests = new TraceUnitTestRule(); + + @Test + public void whenTracingTests() { + System.out.println("This is my test"); + /*...*/ + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/TestAnnotationsUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/TestAnnotationsUnitTest.java new file mode 100644 index 0000000000..89c33cafe6 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/TestAnnotationsUnitTest.java @@ -0,0 +1,34 @@ +package com.baeldung.junit4; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; + +import java.util.logging.Logger; + +public class TestAnnotationsUnitTest { + + private static final Logger log = Logger.getLogger(TestAnnotationsUnitTest.class.getName()); + + @BeforeClass + static void setup() { + log.info("@BeforeAll - executes once before all test methods in this class"); + } + + @Before + void init() { + log.info("@BeforeEach - executes before each test method in this class"); + } + + @After + void tearDown() { + log.info("@AfterEach - executed after each test method."); + } + + @AfterClass + static void done() { + log.info("@AfterAll - executed after all test methods."); + } + +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/TraceUnitTestRule.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/TraceUnitTestRule.java new file mode 100644 index 0000000000..9f4811da3d --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/TraceUnitTestRule.java @@ -0,0 +1,35 @@ +package com.baeldung.junit4; + +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.MultipleFailureException; +import org.junit.runners.model.Statement; + +import java.util.ArrayList; +import java.util.List; + +public class TraceUnitTestRule implements TestRule { + + @Override + public Statement apply(Statement base, Description description) { + + return new Statement() { + @Override + public void evaluate() throws Throwable { + List errors = new ArrayList(); + + System.out.println("Starting test ... " + description.getMethodName()); + try { + base.evaluate(); + } catch (Throwable e) { + errors.add(e); + } finally { + System.out.println("... test finished. " + description.getMethodName()); + } + + MultipleFailureException.assertEmpty(errors); + } + }; + } + +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/categories/Annotations.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/categories/Annotations.java new file mode 100644 index 0000000000..22214d95b6 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/categories/Annotations.java @@ -0,0 +1,5 @@ +package com.baeldung.junit4.categories; + +public interface Annotations { + +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/categories/JUnit4UnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/categories/JUnit4UnitTest.java new file mode 100644 index 0000000000..a7474d5f24 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit4/categories/JUnit4UnitTest.java @@ -0,0 +1,5 @@ +package com.baeldung.junit4.categories; + +public interface JUnit4UnitTest { + +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AnnotationTestExampleUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AnnotationTestExampleUnitTest.java new file mode 100644 index 0000000000..16de0be9d8 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AnnotationTestExampleUnitTest.java @@ -0,0 +1,28 @@ +package com.baeldung.junit5; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.junit.platform.runner.JUnitPlatform; +import org.junit.runner.RunWith; + +import java.time.Duration; + +@Tag("annotations") +@Tag("junit5") +@RunWith(JUnitPlatform.class) +public class AnnotationTestExampleUnitTest { + @Test + public void shouldRaiseAnException() throws Exception { + Assertions.assertThrows(Exception.class, () -> { + throw new Exception("This is my expected exception"); + }); + } + + @Test + @Disabled + public void shouldFailBecauseTimeout() throws InterruptedException { + Assertions.assertTimeout(Duration.ofMillis(1), () -> Thread.sleep(10)); + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AssertionUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AssertionUnitTest.java new file mode 100644 index 0000000000..d1d08c6e62 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AssertionUnitTest.java @@ -0,0 +1,40 @@ +package com.baeldung.junit5; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@DisplayName("Test case for assertions") +public class AssertionUnitTest { + + @Test + @DisplayName("Arrays should be equals") + public void whenAssertingArraysEquality_thenEqual() { + char[] expected = {'J', 'u', 'p', 'i', 't', 'e', 'r'}; + char[] actual = "Jupiter".toCharArray(); + + assertArrayEquals(expected, actual, "Arrays should be equal"); + } + + @Test + @DisplayName("The area of two polygons should be equal") + public void whenAssertingEquality_thenEqual() { + float square = 2 * 2; + float rectangle = 2 * 2; + + assertEquals(square, rectangle); + } + + @Test + public void givenMultipleAssertion_whenAssertingAll_thenOK() { + assertAll( + "heading", + () -> assertEquals(4, 2 * 2, "4 is 2 times 2"), + () -> assertEquals("java", "JAVA".toLowerCase()), + () -> assertEquals(null, null, "null is equal to null") + ); + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AssumptionUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AssumptionUnitTest.java new file mode 100644 index 0000000000..4f3d827403 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/AssumptionUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.junit5; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assumptions.*; + +public class AssumptionUnitTest { + + @Test + public void trueAssumption() { + assumeTrue(5 > 1, () -> "5 is greater the 1"); + assertEquals(5 + 2, 7); + } + + @Test + public void falseAssumption() { + assumeFalse(5 < 1, () -> "5 is less then 1"); + assertEquals(5 + 2, 7); + } + + @Test + public void assumptionThat() { + String someString = "Just a string"; + assumingThat(someString.equals("Just a string"), () -> assertEquals(2 + 2, 4)); + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/ConditionalExecutionUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/ConditionalExecutionUnitTest.java new file mode 100644 index 0000000000..7f76e237f1 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/ConditionalExecutionUnitTest.java @@ -0,0 +1,69 @@ +package com.baeldung.junit5; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.*; + +import static org.junit.jupiter.api.Assertions.*; + +public class ConditionalExecutionUnitTest { + + @Test + @EnabledOnOs({OS.MAC}) + void whenOperatingSystemIsMac_thenTestIsEnabled() { + assertEquals(5 + 2, 7); + } + + @Test + @DisabledOnOs({OS.WINDOWS}) + void whenOperatingSystemIsWindows_thenTestIsDisabled() { + assertEquals(5 + 2, 7); + } + + @Test + @EnabledOnJre({JRE.JAVA_8}) + void whenRunningTestsOnJRE8_thenTestIsEnabled() { + assertTrue(5 > 4, "5 is greater the 4"); + assertTrue(null == null, "null is equal to null"); + } + + @Test + @DisabledOnJre({JRE.JAVA_10}) + void whenRunningTestsOnJRE10_thenTestIsDisabled() { + assertTrue(5 > 4, "5 is greater the 4"); + assertTrue(null == null, "null is equal to null"); + } + + @Test + @EnabledIfSystemProperty(named = "os.arch", matches = ".*64.*") + public void whenRunningTestsOn64BitArchitectures_thenTestIsDisabled() { + Integer value = 5; // result of an algorithm + + assertNotEquals(0, value, "The result cannot be 0"); + } + + @Test + @DisabledIfSystemProperty(named = "ci-server", matches = "true") + public void whenRunningTestsOnCIServer_thenTestIsDisabled() { + Integer value = 5; // result of an algorithm + + assertNotEquals(0, value, "The result cannot be 0"); + } + + @Test + @EnabledIfEnvironmentVariable(named = "ENV", matches = "staging-server") + public void whenRunningTestsStagingServer_thenTestIsEnabled() { + char[] expected = {'J', 'u', 'p', 'i', 't', 'e', 'r'}; + char[] actual = "Jupiter".toCharArray(); + + assertArrayEquals(expected, actual, "Arrays should be equal"); + } + + @Test + @DisabledIfEnvironmentVariable(named = "ENV", matches = ".*development.*") + public void whenRunningTestsDevelopmentEnvironment_thenTestIsDisabled() { + char[] expected = {'J', 'u', 'p', 'i', 't', 'e', 'r'}; + char[] actual = "Jupiter".toCharArray(); + + assertArrayEquals(expected, actual, "Arrays should be equal"); + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/NestedUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/NestedUnitTest.java new file mode 100644 index 0000000000..9eeff471ba --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/NestedUnitTest.java @@ -0,0 +1,77 @@ +package com.baeldung.junit5; + +import org.junit.jupiter.api.*; + +import java.util.EmptyStackException; +import java.util.Stack; + +public class NestedUnitTest { + + Stack stack; + + @Test + @DisplayName("is instantiated with new Stack()") + void isInstantiatedWithNew() { + new Stack<>(); + } + + @Nested + @DisplayName("when new") + class WhenNew { + + @BeforeEach + void init() { + stack = new Stack<>(); + } + + @Test + @DisplayName("is empty") + void isEmpty() { + Assertions.assertTrue(stack.isEmpty()); + } + + @Test + @DisplayName("throws EmptyStackException when popped") + void throwsExceptionWhenPopped() { + Assertions.assertThrows(EmptyStackException.class, () -> stack.pop()); + } + + @Test + @DisplayName("throws EmptyStackException when peeked") + void throwsExceptionWhenPeeked() { + Assertions.assertThrows(EmptyStackException.class, () -> stack.peek()); + } + + @Nested + @DisplayName("after pushing an element") + class AfterPushing { + + String anElement = "an element"; + + @BeforeEach + void init() { + stack.push(anElement); + } + + @Test + @DisplayName("it is no longer empty") + void isEmpty() { + Assertions.assertFalse(stack.isEmpty()); + } + + @Test + @DisplayName("returns the element when popped and is empty") + void returnElementWhenPopped() { + Assertions.assertEquals(anElement, stack.pop()); + Assertions.assertTrue(stack.isEmpty()); + } + + @Test + @DisplayName("returns the element when peeked but remains not empty") + void returnElementWhenPeeked() { + Assertions.assertEquals(anElement, stack.peek()); + Assertions.assertFalse(stack.isEmpty()); + } + } + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleExampleUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleExampleUnitTest.java new file mode 100644 index 0000000000..297d0f1730 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.baeldung.junit5; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.platform.runner.JUnitPlatform; +import org.junit.runner.RunWith; + +@RunWith(JUnitPlatform.class) +@ExtendWith(TraceUnitExtension.class) +public class RuleExampleUnitTest { + + @Test + public void whenTracingTests() { + System.out.println("This is my test"); + /*...*/ + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleMigrationSupportUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleMigrationSupportUnitTest.java new file mode 100644 index 0000000000..bbaa42ec7b --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/RuleMigrationSupportUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.junit5; + +import org.junit.Rule; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.migrationsupport.rules.EnableRuleMigrationSupport; +import org.junit.rules.ExpectedException; + +@EnableRuleMigrationSupport +public class RuleMigrationSupportUnitTest { + + @Rule + public ExpectedException exceptionRule = ExpectedException.none(); + + @Test + public void whenExceptionThrown_thenExpectationSatisfied() { + exceptionRule.expect(NullPointerException.class); + String test = null; + test.length(); + } + + @Test + public void whenExceptionThrown_thenRuleIsApplied() { + exceptionRule.expect(NumberFormatException.class); + exceptionRule.expectMessage("For input string"); + Integer.parseInt("1a"); + } +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/TestAnnotationsUnitTest.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/TestAnnotationsUnitTest.java new file mode 100644 index 0000000000..8daf952747 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/TestAnnotationsUnitTest.java @@ -0,0 +1,39 @@ +package com.baeldung.junit5; + +import org.junit.jupiter.api.*; + +import java.util.logging.Logger; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class TestAnnotationsUnitTest { + + private static final Logger log = Logger.getLogger(TestAnnotationsUnitTest.class.getName()); + + @BeforeAll + static void setup() { + log.info("@BeforeAll - executes once before all test methods in this class"); + } + + @BeforeEach + void init() { + log.info("@BeforeEach - executes before each test method in this class"); + } + + @Test + @Disabled + void disabledTest() { + assertTrue(false); + } + + @AfterEach + void tearDown() { + log.info("@AfterEach - executed after each test method."); + } + + @AfterAll + static void done() { + log.info("@AfterAll - executed after all test methods."); + } + +} diff --git a/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/TraceUnitExtension.java b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/TraceUnitExtension.java new file mode 100644 index 0000000000..bd5ae47d63 --- /dev/null +++ b/testing-modules/junit5-migration/src/test/java/com/baeldung/junit5/TraceUnitExtension.java @@ -0,0 +1,19 @@ +package com.baeldung.junit5; + +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; + +public class TraceUnitExtension implements AfterEachCallback, BeforeEachCallback { + + @Override + public void beforeEach(ExtensionContext context) throws Exception { + System.out.println("Starting test ... " + context.getDisplayName()); + } + + @Override + public void afterEach(ExtensionContext context) throws Exception { + System.out.println("... test finished. " + context.getDisplayName()); + } + +} From af4ddaeb34ab56215c5437fddba22e0c5eb27ef9 Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Mon, 6 Aug 2018 21:20:02 -0400 Subject: [PATCH 136/298] Add files via upload --- jersey-client-rx/pom.xml | 21 +++++ .../samples/jerseyrx/ClientOrchestration.java | 94 +++++++++++-------- .../samples/jerseyrx/EmployeeDTO.java | 21 +++++ .../jerseyrx/ClientOrchestrationTest.java | 67 +++++++++++++ 4 files changed, 162 insertions(+), 41 deletions(-) create mode 100644 jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java create mode 100644 jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java diff --git a/jersey-client-rx/pom.xml b/jersey-client-rx/pom.xml index cc5f28c938..fb7494fab1 100644 --- a/jersey-client-rx/pom.xml +++ b/jersey-client-rx/pom.xml @@ -26,6 +26,27 @@ jersey-rx-client-rxjava2 2.27 + + com.github.tomakehurst + wiremock + 1.58 + test + + + org.junit.vintage + junit-vintage-engine + 5.2.0 + + + org.glassfish.jersey.media + jersey-media-json-jackson + 2.22 + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + 2.4.1 + UTF-8 diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java index 2b5c6bf965..5c145ca5d9 100644 --- a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java +++ b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java @@ -11,12 +11,12 @@ import java.util.logging.Level; import org.glassfish.jersey.client.rx.rxjava.RxObservableInvokerProvider; import org.glassfish.jersey.client.rx.rxjava.RxObservableInvoker; import java.util.logging.Logger; -import java.util.stream.Collectors; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.InvocationCallback; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; import org.glassfish.jersey.client.rx.rxjava2.RxFlowableInvoker; import org.glassfish.jersey.client.rx.rxjava2.RxFlowableInvokerProvider; import rx.Observable; @@ -28,7 +28,7 @@ import rx.Observable; public class ClientOrchestration { Client client = ClientBuilder.newClient(); - WebTarget userIdService = client.target("http://localhost:8080/serviceA/id?limit=10"); + WebTarget userIdService = client.target("http://localhost:8080/serviceA/id"); WebTarget nameService = client.target("http://localhost:8080/serviceA/{empId}/name"); WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/hash"); @@ -46,30 +46,33 @@ public class ClientOrchestration { public void callBackOrchestrate() { logger.info("Orchestrating with the pyramid of doom"); - userIdService.request() + userIdService.request().accept(MediaType.APPLICATION_JSON) .async() - .get(new InvocationCallback>() { + .get(new InvocationCallback() { @Override - public void completed(List empIds) { + public void completed(EmployeeDTO empIdList) { + logger.info("[InvocationCallback] Got all the IDs " + empIdList.getEmpIds()); + List empIds = empIdList.getEmpIds(); CountDownLatch completionTracker = new CountDownLatch(empIds.size()); //used to keep track of the progress of the subsequent calls empIds.forEach((id) -> { //for each employee ID, get the name nameService.resolveTemplate("empId", id).request() .async() .get(new InvocationCallback() { + @Override public void completed(String response) { completionTracker.countDown(); - hashService.request().async().get(new InvocationCallback() { + hashService.resolveTemplate("comboIDandName", response + id).request().async().get(new InvocationCallback() { @Override public void completed(String response) { - logger.log(Level.INFO, "The hash output {0}", response); + logger.log(Level.INFO, "[InvocationCallback] The hash output {0}", response); } @Override public void failed(Throwable throwable) { completionTracker.countDown(); - logger.log(Level.WARNING, "An error has occurred in the hashing request step {0}", throwable.getMessage()); + logger.log(Level.WARNING, "[InvocationCallback] An error has occurred in the hashing request step {0}", throwable.getMessage()); } }); } @@ -77,14 +80,14 @@ public class ClientOrchestration { @Override public void failed(Throwable throwable) { completionTracker.countDown(); - logger.log(Level.WARNING, "An error has occurred in the username request step {0}", throwable.getMessage()); + logger.log(Level.WARNING, "[InvocationCallback] An error has occurred in the username request step {0}", throwable.getMessage()); } }); }); try { if (!completionTracker.await(10, TimeUnit.SECONDS)) { //wait for inner requests to complete in 10 seconds - logger.warning("Some requests didn't complete within the timeout"); + logger.warning("[InvocationCallback] Some requests didn't complete within the timeout"); } } catch (InterruptedException ex) { Logger.getLogger(ClientOrchestration.class.getName()).log(Level.SEVERE, null, ex); @@ -94,24 +97,25 @@ public class ClientOrchestration { @Override public void failed(Throwable throwable) { - //implement callback + logger.warning("Couldn't get the list of IDs"); } }); } public void rxOrchestrate() { logger.info("Orchestrating with a CompletionStage"); - CompletionStage> userIdStage = userIdService.request() + CompletionStage userIdStage = userIdService.request().accept(MediaType.APPLICATION_JSON) .rx() - .get(new GenericType>() { + .get(new GenericType() { }) .exceptionally((Throwable throwable) -> { - logger.warning("An error has occurred"); + logger.warning("[CompletionStage] An error has occurred"); return null; }); - userIdStage.thenAcceptAsync(listOfIds -> { - listOfIds.stream().forEach((Long id) -> { + userIdStage.thenAcceptAsync(empIdDto -> { + logger.info("[CompletionStage] Got all the IDs " + empIdDto.getEmpIds()); + empIdDto.getEmpIds().stream().forEach((Long id) -> { CompletableFuture completable = nameService.resolveTemplate("empId", id) .request() .rx() @@ -124,9 +128,9 @@ public class ClientOrchestration { .rx() .get(String.class) .toCompletableFuture() - .thenAcceptAsync(hashValue -> logger.log(Level.INFO, "The hash output {0}", hashValue)) + .thenAcceptAsync(hashValue -> logger.log(Level.INFO, "[CompletionFuture] The hash output {0}", hashValue)) .exceptionally((Throwable throwable) -> { - logger.log(Level.WARNING, "Hash computation failed for {0}", id); + logger.log(Level.WARNING, "[CompletionStage] Hash computation failed for {0}", id); return null; }); @@ -140,53 +144,61 @@ public class ClientOrchestration { public void observableJavaOrchestrate() { logger.info("Orchestrating with Observables"); - Observable> userIdObservable = userIdService.register(RxObservableInvokerProvider.class).request() + Observable userIdObservable = userIdService.register(RxObservableInvokerProvider.class).request() + .accept(MediaType.APPLICATION_JSON) .rx(RxObservableInvoker.class) - .get(new GenericType>() { + .get(new GenericType() { }); - userIdObservable.subscribe((List listOfIds) -> { - Observable.from(listOfIds).map(id - -> nameService.resolveTemplate("empId", id) + userIdObservable.subscribe((EmployeeDTO empIdList) -> { + logger.info("[Observable] Got all the IDs " + empIdList.getEmpIds()); + Observable.from(empIdList.getEmpIds()).subscribe(id + -> nameService.register(RxObservableInvokerProvider.class) + .resolveTemplate("empId", id) .request() .rx(RxObservableInvoker.class) .get(String.class) .asObservable() //gotten the name for the given empId - .doOnError(throwable -> logger.log(Level.WARNING, "An error has occurred in the username request step {0}", throwable.getMessage())) - .subscribe(userName -> hashService.resolveTemplate("comboIDandName", userName + id) + .doOnError(throwable -> logger.log(Level.WARNING, " [Observable] An error has occurred in the username request step {0}", throwable.getMessage())) + .subscribe(userName -> hashService + .register(RxObservableInvokerProvider.class) + .resolveTemplate("comboIDandName", userName + id) .request() .rx(RxObservableInvoker.class) .get(String.class) .asObservable() //gotten the hash value for empId+username - .doOnError(throwable -> logger.log(Level.WARNING, "An error has occurred in the hashing request step {0}", throwable.getMessage())) - .subscribe(hashValue -> logger.log(Level.INFO, "The hash output {0}", hashValue)))); + .doOnError(throwable -> logger.log(Level.WARNING, " [Observable]An error has occurred in the hashing request step {0}", throwable.getMessage())) + .subscribe(hashValue -> logger.log(Level.INFO, "[Observable] The hash output {0}", hashValue)))); }); } + public void flowableJavaOrchestrate() { logger.info("Orchestrating with Flowable"); - Flowable> userIdObservable = userIdService.register(RxFlowableInvokerProvider.class).request() + Flowable userIdObservable = userIdService.register(RxFlowableInvokerProvider.class) + .request() .rx(RxFlowableInvoker.class) - .get(new GenericType>() { + .get(new GenericType() { }); - Disposable subscribe = userIdObservable.subscribe((List listOfIds) -> { + Disposable subscribe = userIdObservable.subscribe((EmployeeDTO dto) -> { + List listOfIds = dto.getEmpIds(); Observable.from(listOfIds).map(id - -> nameService.resolveTemplate("empId", id) + -> nameService.register(RxFlowableInvokerProvider.class) + .resolveTemplate("empId", id) .request() - .rx(RxObservableInvoker.class) - .get(String.class) - .asObservable() //gotten the name for the given empId - .doOnError(throwable -> logger.log(Level.WARNING, "An error has occurred in the username request step {0}", throwable.getMessage())) - .subscribe(userName -> hashService.resolveTemplate("comboIDandName", userName + id) + .rx(RxFlowableInvoker.class) + .get(String.class) //gotten the name for the given empId + .doOnError(throwable -> logger.log(Level.WARNING, "[Flowable] An error has occurred in the username request step {0}", throwable.getMessage())) + .subscribe(userName -> hashService.register(RxFlowableInvokerProvider.class) + .resolveTemplate("comboIDandName", userName + id) .request() - .rx(RxObservableInvoker.class) - .get(String.class) - .asObservable() //gotten the hash value for empId+username - .doOnError(throwable -> logger.warning("An error has occurred in the hashing request step " + throwable.getMessage())) - .subscribe(hashValue -> logger.log(Level.INFO, "The hash output {0}", hashValue)))); + .rx(RxFlowableInvoker.class) + .get(String.class) //gotten the hash value for empId+username + .doOnError(throwable -> logger.warning(" [Flowable] An error has occurred in the hashing request step " + throwable.getMessage())) + .subscribe(hashValue -> logger.log(Level.INFO, "[Flowable] The hash output {0}", hashValue)))); }); } diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java new file mode 100644 index 0000000000..ab3cfb54a2 --- /dev/null +++ b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java @@ -0,0 +1,21 @@ +package com.baeldung.samples.jerseyrx; + +import java.util.List; + +/** + * + * @author SIGINT-X + */ +public class EmployeeDTO { + + private List empIds; + + public List getEmpIds() { + return empIds; + } + + public void setEmpIds(List empIds) { + this.empIds = empIds; + } + +} diff --git a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java new file mode 100644 index 0000000000..4286e192c0 --- /dev/null +++ b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java @@ -0,0 +1,67 @@ +package com.baeldung.samples.jerseyrx; + +import com.github.tomakehurst.wiremock.WireMockServer; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.configureFor; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * + * @author baeldung + */ +public class ClientOrchestrationTest { + + ClientOrchestration orchestrator = new ClientOrchestration(); + + String jsonIdList = "{\"empIds\":[1,2,3,4,5,6]}"; + + String[] nameList = new String[]{"n/a", "Thor", "Hulk", "BlackWidow", "BlackPanther", "TheTick", "Hawkeye"}; + + String[] hashResultList = new String[]{"roht1", "kluh2", "WodiwKcalb3", "RehtnapKclab4", "kciteht5", "eyekwah6"}; + + WireMockServer wireMockServer = new WireMockServer(); + + @Before + public void setup() { + wireMockServer.start(); + configureFor("localhost", 8080); + stubFor(get(urlEqualTo("/serviceA/id")).willReturn(aResponse().withBody(jsonIdList).withHeader("Content-Type", "application/json"))); + + stubFor(get(urlEqualTo("/serviceA/1/name")).willReturn(aResponse().withBody(nameList[1]))); + stubFor(get(urlEqualTo("/serviceA/2/name")).willReturn(aResponse().withBody(nameList[2]))); + stubFor(get(urlEqualTo("/serviceA/3/name")).willReturn(aResponse().withBody(nameList[3]))); + stubFor(get(urlEqualTo("/serviceA/4/name")).willReturn(aResponse().withBody(nameList[4]))); + stubFor(get(urlEqualTo("/serviceA/5/name")).willReturn(aResponse().withBody(nameList[5]))); + stubFor(get(urlEqualTo("/serviceA/6/name")).willReturn(aResponse().withBody(nameList[6]))); + + stubFor(get(urlEqualTo("/serviceA/Thor1/hash")).willReturn(aResponse().withBody(hashResultList[0]))); + stubFor(get(urlEqualTo("/serviceA/Hulk2/hash")).willReturn(aResponse().withBody(hashResultList[1]))); + stubFor(get(urlEqualTo("/serviceA/BlackWidow3/hash")).willReturn(aResponse().withBody(hashResultList[2]))); + stubFor(get(urlEqualTo("/serviceA/BlackPanther4/hash")).willReturn(aResponse().withBody(hashResultList[3]))); + stubFor(get(urlEqualTo("/serviceA/TheTick5/hash")).willReturn(aResponse().withBody(hashResultList[4]))); + stubFor(get(urlEqualTo("/serviceA/Hawkeye6/hash")).willReturn(aResponse().withBody(hashResultList[5]))); + + } + + @Test + public void hits() { + + orchestrator.callBackOrchestrate(); + orchestrator.rxOrchestrate(); + orchestrator.observableJavaOrchestrate(); + orchestrator.flowableJavaOrchestrate(); + + } + + @After + public void tearDown() { + + } + +} From ac9ef8d6d0bad031f9ccebf0c765bcddd204d84a Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Tue, 7 Aug 2018 00:16:23 -0400 Subject: [PATCH 137/298] Add files via upload --- .../samples/jerseyrx/ClientOrchestration.java | 33 +++++++++++++++---- .../jerseyrx/ClientOrchestrationTest.java | 32 +++++++++--------- 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java index 5c145ca5d9..6e184876cb 100644 --- a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java +++ b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java @@ -2,6 +2,7 @@ package com.baeldung.samples.jerseyrx; import io.reactivex.Flowable; import io.reactivex.disposables.Disposable; +import java.util.LinkedList; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; @@ -31,6 +32,7 @@ public class ClientOrchestration { WebTarget userIdService = client.target("http://localhost:8080/serviceA/id"); WebTarget nameService = client.target("http://localhost:8080/serviceA/{empId}/name"); WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/hash"); + LinkedList failures = new LinkedList<>(); Logger logger = Logger.getLogger("ClientOrchestrator"); @@ -72,6 +74,7 @@ public class ClientOrchestration { @Override public void failed(Throwable throwable) { completionTracker.countDown(); + failures.add(throwable); logger.log(Level.WARNING, "[InvocationCallback] An error has occurred in the hashing request step {0}", throwable.getMessage()); } }); @@ -80,6 +83,7 @@ public class ClientOrchestration { @Override public void failed(Throwable throwable) { completionTracker.countDown(); + failures.add(throwable); logger.log(Level.WARNING, "[InvocationCallback] An error has occurred in the username request step {0}", throwable.getMessage()); } }); @@ -90,6 +94,7 @@ public class ClientOrchestration { logger.warning("[InvocationCallback] Some requests didn't complete within the timeout"); } } catch (InterruptedException ex) { + failures.add(ex); Logger.getLogger(ClientOrchestration.class.getName()).log(Level.SEVERE, null, ex); } @@ -97,6 +102,7 @@ public class ClientOrchestration { @Override public void failed(Throwable throwable) { + failures.add(throwable); logger.warning("Couldn't get the list of IDs"); } }); @@ -108,7 +114,8 @@ public class ClientOrchestration { .rx() .get(new GenericType() { }) - .exceptionally((Throwable throwable) -> { + .exceptionally((throwable) -> { + failures.add(throwable); logger.warning("[CompletionStage] An error has occurred"); return null; }); @@ -129,7 +136,8 @@ public class ClientOrchestration { .get(String.class) .toCompletableFuture() .thenAcceptAsync(hashValue -> logger.log(Level.INFO, "[CompletionFuture] The hash output {0}", hashValue)) - .exceptionally((Throwable throwable) -> { + .exceptionally((throwable) -> { + failures.add(throwable); logger.log(Level.WARNING, "[CompletionStage] Hash computation failed for {0}", id); return null; }); @@ -159,7 +167,10 @@ public class ClientOrchestration { .rx(RxObservableInvoker.class) .get(String.class) .asObservable() //gotten the name for the given empId - .doOnError(throwable -> logger.log(Level.WARNING, " [Observable] An error has occurred in the username request step {0}", throwable.getMessage())) + .doOnError((throwable) -> { + failures.add(throwable); + logger.log(Level.WARNING, " [Observable] An error has occurred in the username request step {0}", throwable.getMessage()); + }) .subscribe(userName -> hashService .register(RxObservableInvokerProvider.class) .resolveTemplate("comboIDandName", userName + id) @@ -167,13 +178,15 @@ public class ClientOrchestration { .rx(RxObservableInvoker.class) .get(String.class) .asObservable() //gotten the hash value for empId+username - .doOnError(throwable -> logger.log(Level.WARNING, " [Observable]An error has occurred in the hashing request step {0}", throwable.getMessage())) + .doOnError((throwable) -> { + failures.add(throwable); + logger.log(Level.WARNING, " [Observable]An error has occurred in the hashing request step {0}", throwable.getMessage()); + }) .subscribe(hashValue -> logger.log(Level.INFO, "[Observable] The hash output {0}", hashValue)))); }); } - public void flowableJavaOrchestrate() { logger.info("Orchestrating with Flowable"); @@ -191,13 +204,19 @@ public class ClientOrchestration { .request() .rx(RxFlowableInvoker.class) .get(String.class) //gotten the name for the given empId - .doOnError(throwable -> logger.log(Level.WARNING, "[Flowable] An error has occurred in the username request step {0}", throwable.getMessage())) + .doOnError((throwable) -> { + failures.add(throwable); + logger.log(Level.WARNING, "[Flowable] An error has occurred in the username request step {0}", throwable.getMessage()); + }) .subscribe(userName -> hashService.register(RxFlowableInvokerProvider.class) .resolveTemplate("comboIDandName", userName + id) .request() .rx(RxFlowableInvoker.class) .get(String.class) //gotten the hash value for empId+username - .doOnError(throwable -> logger.warning(" [Flowable] An error has occurred in the hashing request step " + throwable.getMessage())) + .doOnError((throwable) -> { + failures.add(throwable); + logger.warning(" [Flowable] An error has occurred in the hashing request step " + throwable.getMessage()); + }) .subscribe(hashValue -> logger.log(Level.INFO, "[Flowable] The hash output {0}", hashValue)))); }); diff --git a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java index 4286e192c0..2158f29a61 100644 --- a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java +++ b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java @@ -7,6 +7,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import junit.framework.Assert; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -16,52 +17,53 @@ import org.junit.Test; * @author baeldung */ public class ClientOrchestrationTest { - + ClientOrchestration orchestrator = new ClientOrchestration(); - + String jsonIdList = "{\"empIds\":[1,2,3,4,5,6]}"; - + String[] nameList = new String[]{"n/a", "Thor", "Hulk", "BlackWidow", "BlackPanther", "TheTick", "Hawkeye"}; - + String[] hashResultList = new String[]{"roht1", "kluh2", "WodiwKcalb3", "RehtnapKclab4", "kciteht5", "eyekwah6"}; - + WireMockServer wireMockServer = new WireMockServer(); - + @Before public void setup() { wireMockServer.start(); configureFor("localhost", 8080); stubFor(get(urlEqualTo("/serviceA/id")).willReturn(aResponse().withBody(jsonIdList).withHeader("Content-Type", "application/json"))); - + stubFor(get(urlEqualTo("/serviceA/1/name")).willReturn(aResponse().withBody(nameList[1]))); stubFor(get(urlEqualTo("/serviceA/2/name")).willReturn(aResponse().withBody(nameList[2]))); stubFor(get(urlEqualTo("/serviceA/3/name")).willReturn(aResponse().withBody(nameList[3]))); stubFor(get(urlEqualTo("/serviceA/4/name")).willReturn(aResponse().withBody(nameList[4]))); stubFor(get(urlEqualTo("/serviceA/5/name")).willReturn(aResponse().withBody(nameList[5]))); stubFor(get(urlEqualTo("/serviceA/6/name")).willReturn(aResponse().withBody(nameList[6]))); - + stubFor(get(urlEqualTo("/serviceA/Thor1/hash")).willReturn(aResponse().withBody(hashResultList[0]))); stubFor(get(urlEqualTo("/serviceA/Hulk2/hash")).willReturn(aResponse().withBody(hashResultList[1]))); stubFor(get(urlEqualTo("/serviceA/BlackWidow3/hash")).willReturn(aResponse().withBody(hashResultList[2]))); stubFor(get(urlEqualTo("/serviceA/BlackPanther4/hash")).willReturn(aResponse().withBody(hashResultList[3]))); stubFor(get(urlEqualTo("/serviceA/TheTick5/hash")).willReturn(aResponse().withBody(hashResultList[4]))); stubFor(get(urlEqualTo("/serviceA/Hawkeye6/hash")).willReturn(aResponse().withBody(hashResultList[5]))); - + } - + @Test public void hits() { - + orchestrator.callBackOrchestrate(); orchestrator.rxOrchestrate(); orchestrator.observableJavaOrchestrate(); orchestrator.flowableJavaOrchestrate(); - + + Assert.assertTrue(orchestrator.failures.isEmpty()); } - + @After public void tearDown() { - + } - + } From 2b53d299854bbe70c518e84041b456966cd7400d Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Tue, 7 Aug 2018 00:17:36 -0400 Subject: [PATCH 138/298] Update EmployeeDTO.java --- .../main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java index ab3cfb54a2..a161448bb7 100644 --- a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java +++ b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java @@ -4,7 +4,7 @@ import java.util.List; /** * - * @author SIGINT-X + * @author baeldung */ public class EmployeeDTO { From 43f4ef8e3c8dea7780eccab965e43282ed5a4e3d Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Tue, 3 Jul 2018 22:55:47 +0400 Subject: [PATCH 139/298] A simple Real Time streaming example with Spring Webflux. 1. Added an API to generate a real time stream returning numbers. 2. Added Test case to consume that API with a webTestClient. 3. Added a client to consume that API, over the network. --- .../pom.xml | 70 +++++++++++++++++ .../java/com/springwebflux/sample/Client.java | 29 +++++++ .../src/main/resources/application.properties | 1 + springflux-5-reactive-ranjeetkaur/pom.xml | 76 +++++++++++++++++++ .../springwebflux/controller/Controller.java | 28 +++++++ .../com/springwebflux/sample/Application.java | 17 +++++ .../src/main/resources/application.properties | 1 + .../sample/ApplicationTests.java | 36 +++++++++ 8 files changed, 258 insertions(+) create mode 100644 springflux-5-reactive-client-ranjeetkaur/pom.xml create mode 100644 springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java create mode 100644 springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties create mode 100644 springflux-5-reactive-ranjeetkaur/pom.xml create mode 100644 springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java create mode 100644 springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java create mode 100644 springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties create mode 100644 springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java diff --git a/springflux-5-reactive-client-ranjeetkaur/pom.xml b/springflux-5-reactive-client-ranjeetkaur/pom.xml new file mode 100644 index 0000000000..bb832ae055 --- /dev/null +++ b/springflux-5-reactive-client-ranjeetkaur/pom.xml @@ -0,0 +1,70 @@ + + + 4.0.0 + + com.springboot + sample + 0.0.1-SNAPSHOT + jar + + client + SpringFlux Sample Client + + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-webflux + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + --spring.profiles.active=dev + + + + + + + + + spring-releases + https://repo.spring.io/libs-release + + + + + spring-releases + https://repo.spring.io/libs-release + + + + diff --git a/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java b/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java new file mode 100644 index 0000000000..5846969803 --- /dev/null +++ b/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java @@ -0,0 +1,29 @@ +package com.springwebflux.sample; + +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.web.reactive.function.client.WebClient; + +/** + * @author ranjeetkaur + * + */ +@SpringBootApplication(scanBasePackages = "com.springwebflux.*") +@EnableAsync +public class Client { + + public static void main(String[] args) throws InterruptedException { + + WebClient webClient = WebClient.builder() + .baseUrl("http://localhost:8090") + .build(); + + webClient.get() + .uri("/v1/dice") + .retrieve() + .bodyToFlux(Integer.class) + .log(); + + Thread.sleep(10000); + } +} \ No newline at end of file diff --git a/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties b/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties new file mode 100644 index 0000000000..f667a68bc2 --- /dev/null +++ b/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port =8091 \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/pom.xml b/springflux-5-reactive-ranjeetkaur/pom.xml new file mode 100644 index 0000000000..3fe4156360 --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + + com.springboot + sample + 0.0.1-SNAPSHOT + jar + + webflux-server + SpringFlux Sample Server + + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-webflux + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + --spring.profiles.active=dev + + + + + + + + + spring-releases + https://repo.spring.io/libs-release + + + + + spring-releases + https://repo.spring.io/libs-release + + + + diff --git a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java new file mode 100644 index 0000000000..fa3070640e --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java @@ -0,0 +1,28 @@ +package com.springwebflux.controller; + +import java.time.Duration; +import java.util.Random; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import reactor.core.publisher.Flux; + +/** + * @author ranjeetkaur + * + */ +@RestController +@RequestMapping(value = "/v1") +public class Controller { + + private static Random random = new Random(); + + @GetMapping("/dice") + public Flux rollDice() { + return Flux.interval(Duration.ofSeconds(1)) + .map(pulse -> random.nextInt(5) + 1); + } + +} diff --git a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java new file mode 100644 index 0000000000..1641885f41 --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java @@ -0,0 +1,17 @@ +package com.springwebflux.sample; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author ranjeetkaur + * + */ +@SpringBootApplication(scanBasePackages = "com.springwebflux.*") +public class Application { + + public static void main(String[] args) { + + SpringApplication.run(Application.class, args); + } +} \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties b/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties new file mode 100644 index 0000000000..91f7491179 --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port = 8090 \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java b/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java new file mode 100644 index 0000000000..ce09d9ae37 --- /dev/null +++ b/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java @@ -0,0 +1,36 @@ +package com.springwebflux.sample; + +import java.time.Duration; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class ApplicationTests { + + @Autowired + private WebTestClient webTestClient; + + @Before + private void setUp() { + webTestClient = webTestClient.mutate() + .responseTimeout(Duration.ofMillis(10000)) + .build(); + } + + @Test + public void rollDice() throws InterruptedException { + webTestClient.get() + .uri("/v1/dice") + .exchange() + .expectStatus() + .isOk() + .expectBodyList(Integer.class); + } +} \ No newline at end of file From c9e901abbea965dd94113e2dc110652830da65f6 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Mon, 30 Jul 2018 23:48:50 +0400 Subject: [PATCH 140/298] Examples for Reading a file into an arraylist. 1. Using FileReader 2. Using BufferedReader 3. Using Scanner(String and int) 4. Using Files.readAllLines --- .../fileparser/BufferedReaderExample.java | 34 +++++++++++++++++ .../fileparser/FileReaderExample.java | 37 +++++++++++++++++++ .../fileparser/FilesReadLineExample.java | 28 ++++++++++++++ .../fileparser/ScannerIntExample.java | 34 +++++++++++++++++ .../fileparser/ScannerStringExample.java | 34 +++++++++++++++++ file-parser/src/resources/num.txt | 2 + file-parser/src/resources/txt.txt | 2 + 7 files changed, 171 insertions(+) create mode 100644 file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java create mode 100644 file-parser/src/com/baeldung/fileparser/FileReaderExample.java create mode 100644 file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java create mode 100644 file-parser/src/com/baeldung/fileparser/ScannerIntExample.java create mode 100644 file-parser/src/com/baeldung/fileparser/ScannerStringExample.java create mode 100644 file-parser/src/resources/num.txt create mode 100644 file-parser/src/resources/txt.txt diff --git a/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java b/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java new file mode 100644 index 0000000000..a139ed80ab --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java @@ -0,0 +1,34 @@ +package com.baeldung.fileparser; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; + +public class BufferedReaderExample { + + private static final String FILENAME = "src/resources/txt.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (BufferedReader br = new BufferedReader(new FileReader(filename))) { + + while (br.ready()) { + result.add(br.readLine()); + } + return result; + } + + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/FileReaderExample.java b/file-parser/src/com/baeldung/fileparser/FileReaderExample.java new file mode 100644 index 0000000000..1ab98973c7 --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/FileReaderExample.java @@ -0,0 +1,37 @@ +package com.baeldung.fileparser; + +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; + +public class FileReaderExample { + + private static final String FILENAME = "src/resources/txt.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (FileReader f = new FileReader(filename)) { + + while (f.ready()) { + char c = (char) f.read(); + + if (c != ' ' && c != '\t' && c != '\n') { + result.add(c); + } + } + return result; + } + + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java b/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java new file mode 100644 index 0000000000..7f94525c22 --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java @@ -0,0 +1,28 @@ +package com.baeldung.fileparser; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +public class FilesReadLineExample { + + private static final String FILENAME = "src/resources/txt.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + List result = Files.readAllLines(Paths.get(filename)); + + return (ArrayList) result; + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java b/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java new file mode 100644 index 0000000000..aab7455c30 --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java @@ -0,0 +1,34 @@ +package com.baeldung.fileparser; + +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Scanner; + +public class ScannerIntExample { + + private static final String FILENAME = "src/resources/num.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (Scanner s = new Scanner(new FileReader(filename))) { + + while (s.hasNext()) { + result.add(s.nextInt()); + } + return result; + } + + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java b/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java new file mode 100644 index 0000000000..fc18b53609 --- /dev/null +++ b/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java @@ -0,0 +1,34 @@ +package com.baeldung.fileparser; + +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Scanner; + +public class ScannerStringExample { + + private static final String FILENAME = "src/resources/txt.txt"; + + public static void main(String[] args) { + try { + System.out.println(generateArrayListFromFile(FILENAME)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (Scanner s = new Scanner(new FileReader(filename))) { + + while (s.hasNext()) { + result.add(s.nextLine()); + } + return result; + } + + } + +} diff --git a/file-parser/src/resources/num.txt b/file-parser/src/resources/num.txt new file mode 100644 index 0000000000..7787faa3c1 --- /dev/null +++ b/file-parser/src/resources/num.txt @@ -0,0 +1,2 @@ +111 +222 \ No newline at end of file diff --git a/file-parser/src/resources/txt.txt b/file-parser/src/resources/txt.txt new file mode 100644 index 0000000000..75cb50aafa --- /dev/null +++ b/file-parser/src/resources/txt.txt @@ -0,0 +1,2 @@ +Hello +World \ No newline at end of file From c0fb463b89cb9839a66247b73ca766356c1a82f4 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Wed, 1 Aug 2018 10:12:20 +0400 Subject: [PATCH 141/298] Revert "A simple Real Time streaming example with Spring Webflux." This reverts commit b7d4a00dacdcddc877e1726832c4aeec378b6ed8. --- .../pom.xml | 70 ----------------- .../java/com/springwebflux/sample/Client.java | 29 ------- .../src/main/resources/application.properties | 1 - springflux-5-reactive-ranjeetkaur/pom.xml | 76 ------------------- .../springwebflux/controller/Controller.java | 28 ------- .../com/springwebflux/sample/Application.java | 17 ----- .../src/main/resources/application.properties | 1 - .../sample/ApplicationTests.java | 36 --------- 8 files changed, 258 deletions(-) delete mode 100644 springflux-5-reactive-client-ranjeetkaur/pom.xml delete mode 100644 springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java delete mode 100644 springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties delete mode 100644 springflux-5-reactive-ranjeetkaur/pom.xml delete mode 100644 springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java delete mode 100644 springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java delete mode 100644 springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties delete mode 100644 springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java diff --git a/springflux-5-reactive-client-ranjeetkaur/pom.xml b/springflux-5-reactive-client-ranjeetkaur/pom.xml deleted file mode 100644 index bb832ae055..0000000000 --- a/springflux-5-reactive-client-ranjeetkaur/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - 4.0.0 - - com.springboot - sample - 0.0.1-SNAPSHOT - jar - - client - SpringFlux Sample Client - - - org.springframework.boot - spring-boot-starter-parent - 2.0.3.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-webflux - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - --spring.profiles.active=dev - - - - - - - - - spring-releases - https://repo.spring.io/libs-release - - - - - spring-releases - https://repo.spring.io/libs-release - - - - diff --git a/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java b/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java deleted file mode 100644 index 5846969803..0000000000 --- a/springflux-5-reactive-client-ranjeetkaur/src/main/java/com/springwebflux/sample/Client.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.springwebflux.sample; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.web.reactive.function.client.WebClient; - -/** - * @author ranjeetkaur - * - */ -@SpringBootApplication(scanBasePackages = "com.springwebflux.*") -@EnableAsync -public class Client { - - public static void main(String[] args) throws InterruptedException { - - WebClient webClient = WebClient.builder() - .baseUrl("http://localhost:8090") - .build(); - - webClient.get() - .uri("/v1/dice") - .retrieve() - .bodyToFlux(Integer.class) - .log(); - - Thread.sleep(10000); - } -} \ No newline at end of file diff --git a/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties b/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties deleted file mode 100644 index f667a68bc2..0000000000 --- a/springflux-5-reactive-client-ranjeetkaur/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -server.port =8091 \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/pom.xml b/springflux-5-reactive-ranjeetkaur/pom.xml deleted file mode 100644 index 3fe4156360..0000000000 --- a/springflux-5-reactive-ranjeetkaur/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - 4.0.0 - - com.springboot - sample - 0.0.1-SNAPSHOT - jar - - webflux-server - SpringFlux Sample Server - - - org.springframework.boot - spring-boot-starter-parent - 2.0.3.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-webflux - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - repackage - - - - - - --spring.profiles.active=dev - - - - - - - - - spring-releases - https://repo.spring.io/libs-release - - - - - spring-releases - https://repo.spring.io/libs-release - - - - diff --git a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java deleted file mode 100644 index fa3070640e..0000000000 --- a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/controller/Controller.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.springwebflux.controller; - -import java.time.Duration; -import java.util.Random; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import reactor.core.publisher.Flux; - -/** - * @author ranjeetkaur - * - */ -@RestController -@RequestMapping(value = "/v1") -public class Controller { - - private static Random random = new Random(); - - @GetMapping("/dice") - public Flux rollDice() { - return Flux.interval(Duration.ofSeconds(1)) - .map(pulse -> random.nextInt(5) + 1); - } - -} diff --git a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java b/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java deleted file mode 100644 index 1641885f41..0000000000 --- a/springflux-5-reactive-ranjeetkaur/src/main/java/com/springwebflux/sample/Application.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.springwebflux.sample; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * @author ranjeetkaur - * - */ -@SpringBootApplication(scanBasePackages = "com.springwebflux.*") -public class Application { - - public static void main(String[] args) { - - SpringApplication.run(Application.class, args); - } -} \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties b/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties deleted file mode 100644 index 91f7491179..0000000000 --- a/springflux-5-reactive-ranjeetkaur/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -server.port = 8090 \ No newline at end of file diff --git a/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java b/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java deleted file mode 100644 index ce09d9ae37..0000000000 --- a/springflux-5-reactive-ranjeetkaur/src/test/java/com/springwebflux/sample/ApplicationTests.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.springwebflux.sample; - -import java.time.Duration; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.reactive.server.WebTestClient; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -public class ApplicationTests { - - @Autowired - private WebTestClient webTestClient; - - @Before - private void setUp() { - webTestClient = webTestClient.mutate() - .responseTimeout(Duration.ofMillis(10000)) - .build(); - } - - @Test - public void rollDice() throws InterruptedException { - webTestClient.get() - .uri("/v1/dice") - .exchange() - .expectStatus() - .isOk() - .expectBodyList(Integer.class); - } -} \ No newline at end of file From 840b0e1f9c7a58f281ba9fd7069ea97312982979 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Sat, 4 Aug 2018 16:45:02 +0400 Subject: [PATCH 142/298] Moving file parser inside the core-java module. Adding Test cases for reading files. --- .../fileparser/BufferedReaderExample.java | 12 +----- .../baeldung/fileparser/FileConstants.java | 8 ++++ .../fileparser/FileReaderExample.java | 31 ++++++++++++++++ .../fileparser/FilesReadLinesExample.java | 18 +++++++++ .../fileparser/ScannerIntExample.java | 12 +----- .../fileparser/ScannerStringExample.java | 12 +----- .../fileparser/BufferedReaderUnitTest.java | 19 ++++++++++ .../fileparser/FileReaderUnitTest.java | 19 ++++++++++ .../fileparser/FilesReadAllLinesUnitTest.java | 19 ++++++++++ .../fileparser/ScannerIntUnitTest.java | 19 ++++++++++ .../fileparser/ScannerStringUnitTest.java | 19 ++++++++++ .../src/test/resources/sampleNumberFile.txt | 2 + .../src/test/resources/sampleTextFile.txt | 2 + .../fileparser/FileReaderExample.java | 37 ------------------- .../fileparser/FilesReadLineExample.java | 28 -------------- 15 files changed, 159 insertions(+), 98 deletions(-) rename {file-parser/src => core-java/src/main/java}/com/baeldung/fileparser/BufferedReaderExample.java (54%) create mode 100644 core-java/src/main/java/com/baeldung/fileparser/FileConstants.java create mode 100644 core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java create mode 100644 core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java rename {file-parser/src => core-java/src/main/java}/com/baeldung/fileparser/ScannerIntExample.java (53%) rename {file-parser/src => core-java/src/main/java}/com/baeldung/fileparser/ScannerStringExample.java (54%) create mode 100644 core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java create mode 100644 core-java/src/test/resources/sampleNumberFile.txt create mode 100644 core-java/src/test/resources/sampleTextFile.txt delete mode 100644 file-parser/src/com/baeldung/fileparser/FileReaderExample.java delete mode 100644 file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java diff --git a/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java b/core-java/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java similarity index 54% rename from file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java rename to core-java/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java index a139ed80ab..45ff486a79 100644 --- a/file-parser/src/com/baeldung/fileparser/BufferedReaderExample.java +++ b/core-java/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java @@ -7,18 +7,8 @@ import java.util.ArrayList; public class BufferedReaderExample { - private static final String FILENAME = "src/resources/txt.txt"; + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { - ArrayList result = new ArrayList<>(); try (BufferedReader br = new BufferedReader(new FileReader(filename))) { diff --git a/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java b/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java new file mode 100644 index 0000000000..1d3cce79f2 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java @@ -0,0 +1,8 @@ +package com.baeldung.fileparser; + +public class FileConstants { + + protected static final String TEXT_FILENAME = "src/main/resources/sampleTextFile.txt"; + + protected static final String NNUMBER_FILENAME = "src/main/resources/sampleNumberFile.txt"; +} diff --git a/core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java b/core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java new file mode 100644 index 0000000000..f9dd2a9ec5 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java @@ -0,0 +1,31 @@ +package com.baeldung.fileparser; + +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; + +public class FileReaderExample { + + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { + + ArrayList result = new ArrayList<>(); + + try (FileReader f = new FileReader(filename)) { + StringBuffer sb = new StringBuffer(); + while (f.ready()) { + char c = (char) f.read(); + if (c == '\n') { + result.add(sb.toString()); + sb = new StringBuffer(); + } else { + sb.append(c); + } + } + if (sb.length() > 0) { + result.add(sb.toString()); + } + } + + return result; + } +} diff --git a/core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java b/core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java new file mode 100644 index 0000000000..8e74f7d386 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java @@ -0,0 +1,18 @@ +package com.baeldung.fileparser; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +public class FilesReadLinesExample { + + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { + + List result = Files.readAllLines(Paths.get(filename)); + + return (ArrayList) result; + } + +} diff --git a/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java b/core-java/src/main/java/com/baeldung/fileparser/ScannerIntExample.java similarity index 53% rename from file-parser/src/com/baeldung/fileparser/ScannerIntExample.java rename to core-java/src/main/java/com/baeldung/fileparser/ScannerIntExample.java index aab7455c30..25d17af4ea 100644 --- a/file-parser/src/com/baeldung/fileparser/ScannerIntExample.java +++ b/core-java/src/main/java/com/baeldung/fileparser/ScannerIntExample.java @@ -7,17 +7,7 @@ import java.util.Scanner; public class ScannerIntExample { - private static final String FILENAME = "src/resources/num.txt"; - - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { ArrayList result = new ArrayList<>(); diff --git a/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java b/core-java/src/main/java/com/baeldung/fileparser/ScannerStringExample.java similarity index 54% rename from file-parser/src/com/baeldung/fileparser/ScannerStringExample.java rename to core-java/src/main/java/com/baeldung/fileparser/ScannerStringExample.java index fc18b53609..ec213c9490 100644 --- a/file-parser/src/com/baeldung/fileparser/ScannerStringExample.java +++ b/core-java/src/main/java/com/baeldung/fileparser/ScannerStringExample.java @@ -7,17 +7,7 @@ import java.util.Scanner; public class ScannerStringExample { - private static final String FILENAME = "src/resources/txt.txt"; - - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { + protected static ArrayList generateArrayListFromFile(String filename) throws IOException { ArrayList result = new ArrayList<>(); diff --git a/core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java new file mode 100644 index 0000000000..78f900d796 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class BufferedReaderUnitTest { + + protected static final String TEXT_FILENAME = "src/test/resources/sampleTextFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetArrayList() throws IOException { + List lines = BufferedReaderExample.generateArrayListFromFile(TEXT_FILENAME); + assertTrue("File does not has 2 lines", lines.size() == 2); + } +} diff --git a/core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java new file mode 100644 index 0000000000..a38e58d348 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class FileReaderUnitTest { + + protected static final String TEXT_FILENAME = "src/test/resources/sampleTextFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetArrayList() throws IOException { + List lines = FileReaderExample.generateArrayListFromFile(TEXT_FILENAME); + assertTrue("File does not has 2 lines", lines.size() == 2); + } +} diff --git a/core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java new file mode 100644 index 0000000000..c0b742fd47 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class FilesReadAllLinesUnitTest { + + protected static final String TEXT_FILENAME = "src/test/resources/sampleTextFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetArrayList() throws IOException { + List lines = FilesReadLinesExample.generateArrayListFromFile(TEXT_FILENAME); + assertTrue("File does not has 2 lines", lines.size() == 2); + } +} diff --git a/core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java new file mode 100644 index 0000000000..0a398ba7c6 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class ScannerIntUnitTest { + + protected static final String NUMBER_FILENAME = "src/test/resources/sampleNumberFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetIntArrayList() throws IOException { + List numbers = ScannerIntExample.generateArrayListFromFile(NUMBER_FILENAME); + assertTrue("File does not has 2 lines", numbers.size() == 2); + } +} diff --git a/core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java b/core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java new file mode 100644 index 0000000000..8f9b0a56c0 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.fileparser; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.List; + +import org.junit.Test; + +public class ScannerStringUnitTest { + + protected static final String TEXT_FILENAME = "src/test/resources/sampleTextFile.txt"; + + @Test + public void whenParsingExistingTextFile_thenGetArrayList() throws IOException { + List lines = ScannerStringExample.generateArrayListFromFile(TEXT_FILENAME); + assertTrue("File does not has 2 lines", lines.size() == 2); + } +} diff --git a/core-java/src/test/resources/sampleNumberFile.txt b/core-java/src/test/resources/sampleNumberFile.txt new file mode 100644 index 0000000000..7787faa3c1 --- /dev/null +++ b/core-java/src/test/resources/sampleNumberFile.txt @@ -0,0 +1,2 @@ +111 +222 \ No newline at end of file diff --git a/core-java/src/test/resources/sampleTextFile.txt b/core-java/src/test/resources/sampleTextFile.txt new file mode 100644 index 0000000000..75cb50aafa --- /dev/null +++ b/core-java/src/test/resources/sampleTextFile.txt @@ -0,0 +1,2 @@ +Hello +World \ No newline at end of file diff --git a/file-parser/src/com/baeldung/fileparser/FileReaderExample.java b/file-parser/src/com/baeldung/fileparser/FileReaderExample.java deleted file mode 100644 index 1ab98973c7..0000000000 --- a/file-parser/src/com/baeldung/fileparser/FileReaderExample.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.fileparser; - -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; - -public class FileReaderExample { - - private static final String FILENAME = "src/resources/txt.txt"; - - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { - - ArrayList result = new ArrayList<>(); - - try (FileReader f = new FileReader(filename)) { - - while (f.ready()) { - char c = (char) f.read(); - - if (c != ' ' && c != '\t' && c != '\n') { - result.add(c); - } - } - return result; - } - - } - -} diff --git a/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java b/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java deleted file mode 100644 index 7f94525c22..0000000000 --- a/file-parser/src/com/baeldung/fileparser/FilesReadLineExample.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.fileparser; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; - -public class FilesReadLineExample { - - private static final String FILENAME = "src/resources/txt.txt"; - - public static void main(String[] args) { - try { - System.out.println(generateArrayListFromFile(FILENAME)); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ArrayList generateArrayListFromFile(String filename) throws IOException { - - List result = Files.readAllLines(Paths.get(filename)); - - return (ArrayList) result; - } - -} From bf0c538bc9bfa99094a01131c39ab919b8fb4088 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Sat, 4 Aug 2018 16:52:27 +0400 Subject: [PATCH 143/298] Removing unused file. --- .../main/java/com/baeldung/fileparser/FileConstants.java | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 core-java/src/main/java/com/baeldung/fileparser/FileConstants.java diff --git a/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java b/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java deleted file mode 100644 index 1d3cce79f2..0000000000 --- a/core-java/src/main/java/com/baeldung/fileparser/FileConstants.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.fileparser; - -public class FileConstants { - - protected static final String TEXT_FILENAME = "src/main/resources/sampleTextFile.txt"; - - protected static final String NNUMBER_FILENAME = "src/main/resources/sampleNumberFile.txt"; -} From a17637b88ab6b694d32f62bab62f524183ddfe90 Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Sat, 4 Aug 2018 16:53:38 +0400 Subject: [PATCH 144/298] Removing unused files. --- file-parser/src/resources/num.txt | 2 -- file-parser/src/resources/txt.txt | 2 -- 2 files changed, 4 deletions(-) delete mode 100644 file-parser/src/resources/num.txt delete mode 100644 file-parser/src/resources/txt.txt diff --git a/file-parser/src/resources/num.txt b/file-parser/src/resources/num.txt deleted file mode 100644 index 7787faa3c1..0000000000 --- a/file-parser/src/resources/num.txt +++ /dev/null @@ -1,2 +0,0 @@ -111 -222 \ No newline at end of file diff --git a/file-parser/src/resources/txt.txt b/file-parser/src/resources/txt.txt deleted file mode 100644 index 75cb50aafa..0000000000 --- a/file-parser/src/resources/txt.txt +++ /dev/null @@ -1,2 +0,0 @@ -Hello -World \ No newline at end of file From 0be91964dfda73817a65d747e1d885cc838d4be1 Mon Sep 17 00:00:00 2001 From: Shreyash Date: Tue, 7 Aug 2018 13:14:21 +0530 Subject: [PATCH 145/298] BAEL-1164 hzaelcast Jet. --- hazelcast/pom.xml | 20 +++----- .../baeldung/hazelcast/jet/WordCounter.java | 51 +++++++++++++++++++ .../hazelcast/jet/WordCounterUnitTest.java | 21 ++++++++ 3 files changed, 80 insertions(+), 12 deletions(-) create mode 100644 hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java create mode 100644 hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml index cc366cd0a6..705792ad05 100644 --- a/hazelcast/pom.xml +++ b/hazelcast/pom.xml @@ -13,16 +13,12 @@ - - com.hazelcast - hazelcast - ${hazelcast.version} - - - com.hazelcast - hazelcast-client - ${hazelcast.version} - + + + com.hazelcast.jet + hazelcast-jet + ${hazelcast.jet.version} + @@ -36,8 +32,8 @@ - - 3.8.4 + + 0.6 \ No newline at end of file diff --git a/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java b/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java new file mode 100644 index 0000000000..971986bcae --- /dev/null +++ b/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java @@ -0,0 +1,51 @@ +package com.baeldung.hazelcast.jet; + +import java.util.List; +import java.util.Map; + +import static com.hazelcast.jet.Traversers.traverseArray; +import static com.hazelcast.jet.aggregate.AggregateOperations.counting; +import static com.hazelcast.jet.function.DistributedFunctions.wholeItem; + +import com.hazelcast.jet.Jet; +import com.hazelcast.jet.JetInstance; +import com.hazelcast.jet.pipeline.Pipeline; +import com.hazelcast.jet.pipeline.Sinks; +import com.hazelcast.jet.pipeline.Sources; + +public class WordCounter { + + private static final String LIST_NAME = "textList"; + + private static final String MAP_NAME = "countMap"; + + private Pipeline createPipeLine() { + Pipeline p = Pipeline.create(); + p.drawFrom(Sources. list(LIST_NAME)) + .flatMap(word -> traverseArray(word.toLowerCase() + .split("\\W+"))) + .filter(word -> !word.isEmpty()) + .groupingKey(wholeItem()) + .aggregate(counting()) + .drainTo(Sinks.map(MAP_NAME)); + return p; + } + + public Long countWord(List sentences, String word) { + long count = 0; + JetInstance jet = Jet.newJetInstance(); + try { + List textList = jet.getList(LIST_NAME); + textList.addAll(sentences); + Pipeline p = createPipeLine(); + jet.newJob(p) + .join(); + Map counts = jet.getMap(MAP_NAME); + count = counts.get(word); + } finally { + Jet.shutdownAll(); + } + return count; + } + +} diff --git a/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java b/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java new file mode 100644 index 0000000000..95596b3860 --- /dev/null +++ b/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java @@ -0,0 +1,21 @@ +package com.baeldung.hazelcast.jet; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class WordCounterUnitTest { + + @Test + public void whenGivenSentencesAndWord_ThenReturnCountOfWord() { + List sentences = new ArrayList<>(); + sentences.add("The first second was alright, but the second second was tough."); + WordCounter wordCounter = new WordCounter(); + long countSecond = wordCounter.countWord(sentences, "second"); + assertTrue(countSecond == 3); + } + +} From ddc106ccd9931c778304b63d2622498312b373d3 Mon Sep 17 00:00:00 2001 From: Predrag Maric Date: Tue, 7 Aug 2018 14:42:57 +0200 Subject: [PATCH 146/298] BAEL-1852 moved the code into junit-5 module (#4915) * BAEL-1852 moved the code into junit-5 module * BAEL-1852 removed junit-abstract module from parent-modules --- pom.xml | 3 - testing-modules/junit-5/pom.xml | 21 ++++++- .../abstractmethod/AbstractMethodCalling.java | 2 +- .../indepedentmethod/AbstractIndependent.java | 2 +- .../indepedentmethod/ConcreteImpl.java | 2 +- .../AbstractInstanceFields.java | 2 +- .../privatemethod/AbstractPrivateMethods.java | 2 +- .../AbstractMethodCallingUnitTest.java | 2 +- .../AbstractIndependentUnitTest.java | 2 +- .../AbstractInstanceFieldsUnitTest.java | 2 +- .../AbstractPrivateMethodsUnitTest.java | 6 +- testing-modules/junit-abstract/pom.xml | 62 ------------------- .../src/main/resources/logback.xml | 13 ---- 13 files changed, 31 insertions(+), 90 deletions(-) rename testing-modules/{junit-abstract/src/main/java/org/baeldung/testing => junit-5/src/main/java/com/baeldung}/abstractclass/abstractmethod/AbstractMethodCalling.java (83%) rename testing-modules/{junit-abstract/src/main/java/org/baeldung/testing => junit-5/src/main/java/com/baeldung}/abstractclass/indepedentmethod/AbstractIndependent.java (76%) rename testing-modules/{junit-abstract/src/main/java/org/baeldung/testing => junit-5/src/main/java/com/baeldung}/abstractclass/indepedentmethod/ConcreteImpl.java (68%) rename testing-modules/{junit-abstract/src/main/java/org/baeldung/testing => junit-5/src/main/java/com/baeldung}/abstractclass/instancefields/AbstractInstanceFields.java (87%) rename testing-modules/{junit-abstract/src/main/java/org/baeldung/testing => junit-5/src/main/java/com/baeldung}/abstractclass/privatemethod/AbstractPrivateMethods.java (84%) rename testing-modules/{junit-abstract/src/test/java/org/baeldung/testing => junit-5/src/test/java/com/baeldung}/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java (94%) rename testing-modules/{junit-abstract/src/test/java/org/baeldung/testing => junit-5/src/test/java/com/baeldung}/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java (91%) rename testing-modules/{junit-abstract/src/test/java/org/baeldung/testing => junit-5/src/test/java/com/baeldung}/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java (95%) rename testing-modules/{junit-abstract/src/test/java/org/baeldung/testing => junit-5/src/test/java/com/baeldung}/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java (95%) delete mode 100644 testing-modules/junit-abstract/pom.xml delete mode 100644 testing-modules/junit-abstract/src/main/resources/logback.xml diff --git a/pom.xml b/pom.xml index e120620c30..a9aaff3e22 100644 --- a/pom.xml +++ b/pom.xml @@ -551,7 +551,6 @@ apache-meecrowave spring-reactive-kotlin jnosql - testing-modules/junit-abstract sse-jaxrs spring-boot-angular-ecommerce @@ -673,7 +672,6 @@ spring-amqp-simple spring-apache-camel spring-batch - testing-modules/junit-abstract jmh @@ -1080,7 +1078,6 @@ antlr maven-archetype apache-meecrowave - testing-modules/junit-abstract spring-hibernate4 xml diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index f9ea34ca72..c60cc00c2c 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -60,6 +60,24 @@ spring-context ${spring.version} + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + junit + junit + + + + + org.powermock + powermock-api-mockito2 + ${powermock.version} + test + @@ -105,7 +123,8 @@ 5.2.0 2.8.2 1.4.196 - 2.11.0 + 2.8.9 + 1.7.4 2.19.1 1.6.0 5.0.1.RELEASE diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCalling.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/abstractmethod/AbstractMethodCalling.java similarity index 83% rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCalling.java rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/abstractmethod/AbstractMethodCalling.java index b0709bf6bf..e55c6b98e2 100644 --- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCalling.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/abstractmethod/AbstractMethodCalling.java @@ -1,7 +1,7 @@ /** * */ -package org.baeldung.testing.abstractclass.abstractmethod; +package com.baeldung.abstractclass.abstractmethod; /** * When method calls abstract method. diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependent.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/AbstractIndependent.java similarity index 76% rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependent.java rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/AbstractIndependent.java index 7456a51c43..4dce2665d5 100644 --- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependent.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/AbstractIndependent.java @@ -1,4 +1,4 @@ -package org.baeldung.testing.abstractclass.indepedentmethod; +package com.baeldung.abstractclass.indepedentmethod; /** * Test Independent Method diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/ConcreteImpl.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/ConcreteImpl.java similarity index 68% rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/ConcreteImpl.java rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/ConcreteImpl.java index f568ad4eec..6e71b88946 100644 --- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/indepedentmethod/ConcreteImpl.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/indepedentmethod/ConcreteImpl.java @@ -1,4 +1,4 @@ -package org.baeldung.testing.abstractclass.indepedentmethod; +package com.baeldung.abstractclass.indepedentmethod; public class ConcreteImpl extends AbstractIndependent { diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFields.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/instancefields/AbstractInstanceFields.java similarity index 87% rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFields.java rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/instancefields/AbstractInstanceFields.java index 3761eb8c3b..262f72e393 100644 --- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFields.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/instancefields/AbstractInstanceFields.java @@ -1,4 +1,4 @@ -package org.baeldung.testing.abstractclass.instancefields; +package com.baeldung.abstractclass.instancefields; /** * Test Independent Method diff --git a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethods.java b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/privatemethod/AbstractPrivateMethods.java similarity index 84% rename from testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethods.java rename to testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/privatemethod/AbstractPrivateMethods.java index 98a9bcaa07..fe7fb25931 100644 --- a/testing-modules/junit-abstract/src/main/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethods.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/abstractclass/privatemethod/AbstractPrivateMethods.java @@ -1,4 +1,4 @@ -package org.baeldung.testing.abstractclass.privatemethod; +package com.baeldung.abstractclass.privatemethod; import java.time.LocalDateTime; diff --git a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java similarity index 94% rename from testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java index e02915db51..7ebd866f3d 100644 --- a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/abstractmethod/AbstractMethodCallingUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.testing.abstractclass.abstractmethod; +package com.baeldung.abstractclass.abstractmethod; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; diff --git a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java similarity index 91% rename from testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java index 80e42af756..db9811e6c1 100644 --- a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/indepedentmethod/AbstractIndependentUnitTest.java @@ -1,7 +1,7 @@ /** * */ -package org.baeldung.testing.abstractclass.indepedentmethod; +package com.baeldung.abstractclass.indepedentmethod; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java similarity index 95% rename from testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java index ce2577521b..5187ce00ab 100644 --- a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/instancefields/AbstractInstanceFieldsUnitTest.java @@ -1,4 +1,4 @@ -package org.baeldung.testing.abstractclass.instancefields; +package com.baeldung.abstractclass.instancefields; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java similarity index 95% rename from testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java index 7220d9cc47..9ce7ff8706 100644 --- a/testing-modules/junit-abstract/src/test/java/org/baeldung/testing/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/abstractclass/privatemethod/AbstractPrivateMethodsUnitTest.java @@ -1,9 +1,7 @@ /** * */ -package org.baeldung.testing.abstractclass.privatemethod; - -import java.time.LocalDateTime; +package com.baeldung.abstractclass.privatemethod; import org.junit.Test; import org.junit.jupiter.api.Assertions; @@ -12,6 +10,8 @@ import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import java.time.LocalDateTime; + /** * Providing custom values for private methods using powermock * diff --git a/testing-modules/junit-abstract/pom.xml b/testing-modules/junit-abstract/pom.xml deleted file mode 100644 index 106ed8e3a4..0000000000 --- a/testing-modules/junit-abstract/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - 4.0.0 - - junit-abstract - 1.0-SNAPSHOT - jar - - abstractclasses - http://maven.apache.org - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../../ - - - - UTF-8 - 1.7.4 - 1.8 - 5.1.0 - 1.1.0 - 5.2.0 - - - - - org.powermock - powermock-module-junit4 - ${powermock.version} - test - - - junit - junit - - - - - org.powermock - powermock-api-mockito2 - ${powermock.version} - test - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 - - - junit-abstract - - - - - diff --git a/testing-modules/junit-abstract/src/main/resources/logback.xml b/testing-modules/junit-abstract/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/testing-modules/junit-abstract/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file From e730b0d8f8c4f682dfac2fd720d2e4aa3ad999e7 Mon Sep 17 00:00:00 2001 From: Predrag Maric Date: Tue, 7 Aug 2018 18:50:33 +0200 Subject: [PATCH 147/298] BAEL 1861 (#4913) * BAEL-1861 Replaced real tests with demo test "placeholders" * BAEL-1861 Moved code from new module into existing ones * BAEL-1861 Renamed main() classes to not violate PMD rules --- .../baeldung/runfromjava/FirstUnitTest.java | 24 +++++++++ .../runfromjava/RunJUnit5TestsFromJava.java} | 8 +-- .../baeldung/runfromjava/SecondUnitTest.java | 18 +++++++ testing-modules/runjunitfromjava/pom.xml | 54 ------------------- .../junit/runfromjava/listnode/ListNode.java | 41 -------------- .../runfromjava/listnode/MergeLists.java | 22 -------- .../listnode/RemovedNthElement.java | 26 --------- .../runfromjava/listnode/RotateList.java | 30 ----------- .../junit/runfromjava/listnode/SwapNodes.java | 33 ------------ .../baeldung/runfromjava/FirstUnitTest.java | 24 +++++++++ .../baeldung}/runfromjava/MyTestSuite.java | 2 +- .../runfromjava/RunJUnit4TestsFromJava.java} | 4 +- .../baeldung/runfromjava/SecondUnitTest.java | 18 +++++++ 13 files changed, 91 insertions(+), 213 deletions(-) create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/FirstUnitTest.java rename testing-modules/{runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java => junit-5/src/test/java/com/baeldung/runfromjava/RunJUnit5TestsFromJava.java} (90%) create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/SecondUnitTest.java delete mode 100644 testing-modules/runjunitfromjava/pom.xml delete mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/ListNode.java delete mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/MergeLists.java delete mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RemovedNthElement.java delete mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RotateList.java delete mode 100644 testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/SwapNodes.java create mode 100644 testing-modules/testing/src/test/java/com/baeldung/runfromjava/FirstUnitTest.java rename testing-modules/{runjunitfromjava/src/test/java/com/baeldung/junit4 => testing/src/test/java/com/baeldung}/runfromjava/MyTestSuite.java (81%) rename testing-modules/{runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java => testing/src/test/java/com/baeldung/runfromjava/RunJUnit4TestsFromJava.java} (97%) create mode 100644 testing-modules/testing/src/test/java/com/baeldung/runfromjava/SecondUnitTest.java diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/FirstUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/FirstUnitTest.java new file mode 100644 index 0000000000..835132240e --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/FirstUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.runfromjava; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +class FirstUnitTest { + + @Test + void whenThis_thenThat() { + assertTrue(true); + } + + @Test + void whenSomething_thenSomething() { + assertTrue(true); + } + + @Test + void whenSomethingElse_thenSomethingElse() { + assertTrue(true); + } + +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java b/testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/RunJUnit5TestsFromJava.java similarity index 90% rename from testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java rename to testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/RunJUnit5TestsFromJava.java index 8a8f3aae17..309c1bc8c9 100644 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit5/runfromjava/RunJUnit5Tests.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/RunJUnit5TestsFromJava.java @@ -1,4 +1,4 @@ -package com.baeldung.junit5.runfromjava; +package com.baeldung.runfromjava; import org.junit.platform.launcher.Launcher; import org.junit.platform.launcher.LauncherDiscoveryRequest; @@ -14,7 +14,7 @@ import static org.junit.platform.engine.discovery.ClassNameFilter.includeClassNa import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage; -public class RunJUnit5Tests { +public class RunJUnit5TestsFromJava { SummaryGeneratingListener listener = new SummaryGeneratingListener(); public void runOne() { @@ -32,7 +32,7 @@ public class RunJUnit5Tests { public void runAll() { LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder .request() - .selectors(selectPackage("com.baeldung.junit5.runfromjava")) + .selectors(selectPackage("com.baeldung.runfromjava")) .filters(includeClassNamePatterns(".*Test")) .build(); Launcher launcher = LauncherFactory.create(); @@ -45,7 +45,7 @@ public class RunJUnit5Tests { } public static void main(String[] args) { - RunJUnit5Tests runner = new RunJUnit5Tests(); + RunJUnit5TestsFromJava runner = new RunJUnit5TestsFromJava(); runner.runAll(); TestExecutionSummary summary = runner.listener.getSummary(); diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/SecondUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/SecondUnitTest.java new file mode 100644 index 0000000000..b6a387d852 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/runfromjava/SecondUnitTest.java @@ -0,0 +1,18 @@ +package com.baeldung.runfromjava; + +import org.junit.jupiter.api.RepeatedTest; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +class SecondUnitTest { + + @RepeatedTest(10) + void whenSomething_thenSomething() { + assertTrue(true); + } + + @RepeatedTest(5) + void whenSomethingElse_thenSomethingElse() { + assertTrue(true); + } +} diff --git a/testing-modules/runjunitfromjava/pom.xml b/testing-modules/runjunitfromjava/pom.xml deleted file mode 100644 index 8ad3e7ed00..0000000000 --- a/testing-modules/runjunitfromjava/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - - com.baeldung.junit - applicationtesting - 0.0.1-SNAPSHOT - jar - - applicationtesting - http://maven.apache.org - - - UTF-8 - 1.8 - 5.2.0 - 1.2.0 - 4.12 - 3.7.0 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - - - - - - - - org.junit.jupiter - junit-jupiter-engine - ${junit-jupiter.version} - - - org.junit.platform - junit-platform-launcher - ${junit-launcher.version} - - - junit - junit - ${junit4.version} - - - - diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/ListNode.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/ListNode.java deleted file mode 100644 index 31cbda15d3..0000000000 --- a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/ListNode.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.junit.runfromjava.listnode; - -public class ListNode { - private int value; - private ListNode next; - - public ListNode(int v) { - value = v; - } - - public ListNode(int v, ListNode next) { - value = v; - this.next = next; - } - - public int getValue() { - return value; - } - - public ListNode getNext() { - return next; - } - - public void setNext(ListNode next) { - this.next = next; - } - - public String toString() { - String result = ""; - ListNode tmp = this; - - while (tmp.next != null) { - result += tmp.value + "->"; - tmp = tmp.next; - } - - result += tmp.value; - - return result.toString(); - } -} diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/MergeLists.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/MergeLists.java deleted file mode 100644 index f2a24487c8..0000000000 --- a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/MergeLists.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.junit.runfromjava.listnode; - -public class MergeLists { - - public ListNode merge(ListNode list1, ListNode list2) { - - if (list1 == null) { - return list2; - } - if (list2 == null) { - return list1; - } - - if (list1.getValue() <= list2.getValue()) { - list1.setNext(merge(list1.getNext(), list2)); - return list1; - } else { - list2.setNext(merge(list2.getNext(), list1)); - return list2; - } - } -} \ No newline at end of file diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RemovedNthElement.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RemovedNthElement.java deleted file mode 100644 index 22357aaeee..0000000000 --- a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RemovedNthElement.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.junit.runfromjava.listnode; - -public class RemovedNthElement { - public ListNode removeNthFromEnd(ListNode head, int n) { - - ListNode start = new ListNode(0); - start.setNext(head); - - ListNode fast = start; - ListNode slow = start; - - for (int i = 0; i < n + 1 && fast != null; i++) { - fast = fast.getNext(); - } - - while (fast != null) { - fast = fast.getNext(); - slow = slow.getNext(); - } - - slow.setNext(slow.getNext() - .getNext()); - - return start.getNext(); - } -} diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RotateList.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RotateList.java deleted file mode 100644 index 52167cbacc..0000000000 --- a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/RotateList.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.junit.runfromjava.listnode; - -public class RotateList { - public ListNode rotateRight(ListNode list, int n) { - - if (list == null || list.getNext() == null) { - return list; - } - - ListNode tmpList = new ListNode(0); - tmpList.setNext(list); - ListNode fast = tmpList; - ListNode slow = tmpList; - - int listLength; - for (listLength = 0; fast.getNext() != null; listLength++) { - fast = fast.getNext(); - } - - for (int j = listLength - n % listLength; j > 0; j--) { - slow = slow.getNext(); - } - - fast.setNext(tmpList.getNext()); - tmpList.setNext(slow.getNext()); - slow.setNext(null); - - return tmpList.getNext(); - } -} diff --git a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/SwapNodes.java b/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/SwapNodes.java deleted file mode 100644 index 076fed0d5e..0000000000 --- a/testing-modules/runjunitfromjava/src/main/java/com/baeldung/junit/runfromjava/listnode/SwapNodes.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.junit.runfromjava.listnode; - -public class SwapNodes { - public ListNode swapPairs(ListNode listHead) { - - ListNode result = new ListNode(0); - result.setNext(listHead); - - ListNode current = result; - - while (current.getNext() != null && current - .getNext() - .getNext() != null) { - - ListNode first = current.getNext(); - ListNode second = current - .getNext() - .getNext(); - - first.setNext(second.getNext()); - current.setNext(second); - current - .getNext() - .setNext(first); - - current = current - .getNext() - .getNext(); - } - - return result.getNext(); - } -} diff --git a/testing-modules/testing/src/test/java/com/baeldung/runfromjava/FirstUnitTest.java b/testing-modules/testing/src/test/java/com/baeldung/runfromjava/FirstUnitTest.java new file mode 100644 index 0000000000..0e08c43021 --- /dev/null +++ b/testing-modules/testing/src/test/java/com/baeldung/runfromjava/FirstUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.runfromjava; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +public class FirstUnitTest { + + @Test + public void whenThis_thenThat() { + assertTrue(true); + } + + @Test + public void whenSomething_thenSomething() { + assertTrue(true); + } + + @Test + public void whenSomethingElse_thenSomethingElse() { + assertTrue(true); + } + +} diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java b/testing-modules/testing/src/test/java/com/baeldung/runfromjava/MyTestSuite.java similarity index 81% rename from testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java rename to testing-modules/testing/src/test/java/com/baeldung/runfromjava/MyTestSuite.java index 4739b47b88..2413fb1ddf 100644 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/MyTestSuite.java +++ b/testing-modules/testing/src/test/java/com/baeldung/runfromjava/MyTestSuite.java @@ -1,4 +1,4 @@ -package com.baeldung.junit4.runfromjava; +package com.baeldung.runfromjava; import org.junit.runner.RunWith; import org.junit.runners.Suite; diff --git a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java b/testing-modules/testing/src/test/java/com/baeldung/runfromjava/RunJUnit4TestsFromJava.java similarity index 97% rename from testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java rename to testing-modules/testing/src/test/java/com/baeldung/runfromjava/RunJUnit4TestsFromJava.java index 69b821032a..b44b66440a 100644 --- a/testing-modules/runjunitfromjava/src/test/java/com/baeldung/junit4/runfromjava/RunJUnit4Tests.java +++ b/testing-modules/testing/src/test/java/com/baeldung/runfromjava/RunJUnit4TestsFromJava.java @@ -1,4 +1,4 @@ -package com.baeldung.junit4.runfromjava; +package com.baeldung.runfromjava; import junit.extensions.ActiveTestSuite; import junit.extensions.RepeatedTest; @@ -10,7 +10,7 @@ import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; -public class RunJUnit4Tests { +public class RunJUnit4TestsFromJava { public static void runOne() { JUnitCore junit = new JUnitCore(); diff --git a/testing-modules/testing/src/test/java/com/baeldung/runfromjava/SecondUnitTest.java b/testing-modules/testing/src/test/java/com/baeldung/runfromjava/SecondUnitTest.java new file mode 100644 index 0000000000..aa5883562e --- /dev/null +++ b/testing-modules/testing/src/test/java/com/baeldung/runfromjava/SecondUnitTest.java @@ -0,0 +1,18 @@ +package com.baeldung.runfromjava; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +public class SecondUnitTest { + + @Test + public void whenSomething_thenSomething() { + assertTrue(true); + } + + @Test + public void whensomethingElse_thenSomethingElse() { + assertTrue(true); + } +} From 80fba1ab3eb224ff3291bde4b071f1e5d5511090 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 8 Aug 2018 14:49:38 +0300 Subject: [PATCH 148/298] Update README.md --- spring-5/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-5/README.md b/spring-5/README.md index 47bae09862..baf03fb3b3 100644 --- a/spring-5/README.md +++ b/spring-5/README.md @@ -12,4 +12,3 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Introduction to Spring REST Docs](http://www.baeldung.com/spring-rest-docs) - [Spring ResponseStatusException](http://www.baeldung.com/spring-response-status-exception) - [Spring Assert Statements](http://www.baeldung.com/spring-assert) -- [Spring Security 5 – OAuth2 Login](http://www.baeldung.com/spring-security-5-oauth2-login) From 8c874c0f7d5c1b017eb6eaf354cf40a95aca0ad6 Mon Sep 17 00:00:00 2001 From: Kirti Deo Date: Thu, 9 Aug 2018 09:39:01 +0530 Subject: [PATCH 149/298] BAEL:2024 : Deleting files committed by mistake. --- spring-webflux/.gitignore | 25 -- spring-webflux/.mvn/wrapper/maven-wrapper.jar | Bin 47610 -> 0 bytes .../.mvn/wrapper/maven-wrapper.properties | 1 - spring-webflux/mvnw | 225 ------------------ spring-webflux/mvnw.cmd | 143 ----------- spring-webflux/pom.xml | 55 ----- .../client/SpringWebfluxClientApp.java | 36 --- .../example/springwebflux/events/Train.java | 30 --- .../server/SpringWebfluxServerApp.java | 38 --- .../src/main/resources/application.properties | 0 .../SpringWebfluxApplicationTests.java | 16 -- .../server/SpringWebfluxServerAppTest.java | 31 --- 12 files changed, 600 deletions(-) delete mode 100644 spring-webflux/.gitignore delete mode 100644 spring-webflux/.mvn/wrapper/maven-wrapper.jar delete mode 100644 spring-webflux/.mvn/wrapper/maven-wrapper.properties delete mode 100644 spring-webflux/mvnw delete mode 100644 spring-webflux/mvnw.cmd delete mode 100644 spring-webflux/pom.xml delete mode 100644 spring-webflux/src/main/java/com/example/springwebflux/client/SpringWebfluxClientApp.java delete mode 100644 spring-webflux/src/main/java/com/example/springwebflux/events/Train.java delete mode 100644 spring-webflux/src/main/java/com/example/springwebflux/server/SpringWebfluxServerApp.java delete mode 100644 spring-webflux/src/main/resources/application.properties delete mode 100644 spring-webflux/src/test/java/com/example/springwebflux/SpringWebfluxApplicationTests.java delete mode 100644 spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java diff --git a/spring-webflux/.gitignore b/spring-webflux/.gitignore deleted file mode 100644 index 82eca336e3..0000000000 --- a/spring-webflux/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/spring-webflux/.mvn/wrapper/maven-wrapper.jar b/spring-webflux/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9b4d95453115d0c26488d6a78694e0bc6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 47610 zcmbTd1CXW7vMxN+wr$(CZCk5to71*!+jjS~ZJX1!ds=tCefGhB{(HVS`>u$J^~PFn zW>r>YRc2N`sUQsug7OUl0^-}ZZ-jr^e|{kUJj#ly2+~T*iO~apQ;-J#>z!{v|9nH? zexD9D~4A70;F%I|$?{aX9)~)7!NMGs_XtoO(D2z3Q#5Lmj zOYWk1b{iMmsdX30UFmYyZk1gWICVeOtk^$+{3U2(8gx?WA2F!EfBPf&|1?AJ|5Z>M zfUAk^zcf#n|9^4|J34286~NKrUt&c5cZ~iqE?PH7fW5tm3-qG$) z56%`QPSn!0RMV3)jjXfG^UQ}*^yBojH!}58lPlDclX5iUhf*|DV=~e*bl;(l$Wn@r zPE*iH(NK!e9KQcU$rRM}aJc?-&H1PO&vOs*=U+QVvwuk-=zr1x>;XpRCjSyC;{TWQ z|824V8t*^*{x=5yn^pP#-?k<5|7|4y&Pd44&e_TN&sxg@ENqpX0glclj&w%W04Jwp zwJ}#@ag^@h5VV4H5U@i7V#A*a;4bzM-y_rd{0WG#jRFPJU}(#&o8vo@uM+B+$>Tiq zei^5$wg8CVf{+_#Vh`yPx-6TmB~zT_nocS_Rb6&EYp*KjbN#-aP<~3j=NVuR)S1wm zdy3AWx2r9uww3eNJxT>{tdmY4#pLw`*`_fIwSu;yzFYP)=W6iawn`s*omzNbR?E&LyC17rFcjWp!M~p?;{v!78DTxtF85BK4dT< zA5p)Z%6O}mP?<%Z{>nZmbVEbomm zLgy;;N&!y>Dma2sqmbvz&KY-j&s~dd#mWGlNF%7}vS7yt>Dm{P=X zG>Pyv2D!ba0CcTI*G6-v?!0}`EWm1d?K)DgZIQk9eucI&lBtR))NxqVz)+hBR1b|7 zgv&^46cI?mgCvp>lY9W(nJT#^<*kY3o#Php1RZLY@ffmLLq3A!Yd}O~n@BhXVp`<5 zJx`BjR%Svv)Sih_8TFg-9F-Gg3^kQrpDGej@uT5%y_9NSsk5SW>7{>&11u(JZHsZO zZweI|!&qHl0;7qxijraQo=oV^Pi~bNlzx;~b2+hXreonWGD%C$fyHs+8d1kKN>TgB z{Mu?~E{=l1osx|_8P*yC>81_GB7>NS7UA+x2k_c*cU-$gQjR{+IU)z069Ic$<)ci< zb?+V#^-MK!0s~wRP|grx?P^8EZ(9Jt0iA{`uVS6fNo>b@as5_-?e766V}&)8ZOEVtKB z*HtHAqat+2lbJbEI#fl~`XKNIF&J?PHKq)A!z(#j%)Uby=5d!bQP)-Mr!0#J=FV%@9G#Cby%r#(S=23H#9d)5Ndy>pIXJ%si!D=m*-QQZ(O9~#Jhx#AS3 z&Vs+*E5>d+{ib4>FEd#L15-ovl*zV%SYSWF>Z}j!vGn=g%w0~3XvAK&$Dl@t5hiUa#mT(4s9-JF1l zPi5d2YmuFJ4S(O>g~H)5l_`%h3qm?+8MmhXA>GRN}7GX;$4(!WTkYZB=TA^8ZFh^d9_@x$fK4qenP!zzaqQ1^(GQ- zjC$P$B5o{q&-H8UH_$orJTv0}#|9ja(vW9gA%l|@alYk+Uth1ey*ax8wmV7U?^Z9? zsQMrEzP8|_s0=bii4wDWa7te&Vmh9T>fcUXJS|dD3Y$A`s-7kY!+idEa`zB) zaW*%xb+#}9INSa62(M1kwL=m_3E2T|l5Sm9QmON8ewxr#QR`;vOGCgyMsA8$O(;=U z#sEw)37duzeM#9_7l!ly#5c+Mu3{;<9%O{e z`+0*{COEF^py;f6)y6NX)gycj`uU9pdZMum9h(bS!zu1gDXdmF4{Og{u;d(Dr~Co1 z1tm@i#5?>oL}-weK1zJRlLv*+M?l=eI~Sp9vg{R6csq=3tYSB2pqB8 z=#p`us7r|uH=cZnGj|juceAu8J#vb+&UFLFmGn~9O|TNeGH>sboBl%JI9v(@^|45? zLvr2ha)NWP4yxV8K%dU(Ae=zl)qdGyz={$my;Vs6?4?2*1?&u!OFyFbAquv6@1e)~&Rp#Ww9O88!mrze((=@F?&BPl_u9gK4VlHo@4gLK_pGtEA(gO4YpIIWTrFN zqVi%Q{adXq^Ez~dZ0VUC>DW`pGtpTY<9tMd;}WZUhT1iy+S^TfHCWXGuDwAv1Ik85 zh3!tSlWU3*aLtmdf?g(#WnLvVCXW$>gnT_{(%VilR=#2VKh~S}+Po#ha9C*<-l~Fx z$EK{1SO8np&{JC)7hdM8O+C( zF^s3HskJz@p3ot`SPKA92PG!PmC2d|9xA!CZxR!rK9-QYYBGAM-Gj zCqzBaIjtOZ6gu+lA%**RI7to$x^s8xIx}VF96=<29CjWtsl;tmNbuHgrCyB^VzEIB zt@sqnl8Vg`pnMppL6vbjNNKc?BrH<)fxiZ|WrYW%cnz-FMENGzMI+)@l7dit?oP|Wu zg-oLcv~79=fdqEM!zK%lI=R7S!Do!HBaD+*h^ULWVB}4jr^e5oUqY`zA&NUvzseI% z+XCvzS+n|m7WJoyjXXk(PE8;i^r$#Pq|NFd!{g~m2OecA1&>$7SYFw z;}Q{`F3LCE34Z>5;5dDtz&2Z&w|B9fwvU<@S<BBo(L4SbDV#X3%uS+<2q7iH+0baiGzlVP5n0fBDP z7kx+7|Cws+?T|cw-pt~SIa7BRDI_ATZ9^aQS^1I?WfnfEHZ*sGlT#Wk9djDL?dWLA zk%(B?<8L?iV*1m803UW|*sU$raq<(!N!CrQ&y7?7_g zF2!aAfw5cWqO}AX)+v)5_GvQ$1W8MV8bTMr3P{^!96Q4*YhS}9ne|+3GxDJmZEo zqh;%RqD5&32iTh7kT>EEo_%`8BeK&)$eXQ-o+pFIP!?lee z&kos;Q)_afg1H&{X|FTQ0V z@yxv4KGGN)X|n|J+(P6Q`wmGB;J}bBY{+LKVDN9#+_w9s$>*$z)mVQDOTe#JG)Zz9*<$LGBZ-umW@5k5b zbIHp=SJ13oX%IU>2@oqcN?)?0AFN#ovwS^|hpf5EGk0#N<)uC{F}GG}%;clhikp2* zu6ra2gL@2foI>7sL`(x5Q)@K2$nG$S?g`+JK(Q0hNjw9>kDM|Gpjmy=Sw5&{x5$&b zE%T6x(9i|z4?fMDhb%$*CIe2LvVjuHca`MiMcC|+IU51XfLx(BMMdLBq_ z65RKiOC$0w-t)Cyz0i-HEZpkfr$>LK%s5kga^FIY_|fadzu*r^$MkNMc!wMAz3b4P+Z3s(z^(%(04}dU>ef$Xmof(A|XXLbR z2`&3VeR1&jjKTut_i?rR_47Z`|1#$NE$&x#;NQM|hxDZ>biQ*+lg5E62o65ILRnOOOcz%Q;X$MJ?G5dYmk$oL_bONX4 zT^0yom^=NsRO^c$l02#s0T^dAAS&yYiA=;rLx;{ro6w08EeTdVF@j^}Bl;o=`L%h! zMKIUv(!a+>G^L3{z7^v3W$FUUHA+-AMv~<}e?2?VG|!itU~T>HcOKaqknSog zE}yY1^VrdNna1B6qA`s?grI>Y4W%)N;~*MH35iKGAp*gtkg=FE*mFDr5n2vbhwE|4 zZ!_Ss*NMZdOKsMRT=uU{bHGY%Gi=K{OD(YPa@i}RCc+mExn zQogd@w%>14cfQrB@d5G#>Lz1wEg?jJ0|(RwBzD74Eij@%3lyoBXVJpB{q0vHFmE7^ zc91!c%pt&uLa|(NyGF2_L6T{!xih@hpK;7B&bJ#oZM0`{T6D9)J2IXxP?DODPdc+T zC>+Zq8O%DXd5Gog2(s$BDE3suv=~s__JQnX@uGt+1r!vPd^MM}=0((G+QopU?VWgR zqj8EF0?sC`&&Nv-m-nagB}UhXPJUBn-UaDW9;(IX#)uc zL*h%hG>ry@a|U=^=7%k%V{n=eJ%Nl0Oqs!h^>_PgNbD>m;+b)XAk+4Cp=qYxTKDv& zq1soWt*hFf%X8}MpQZL-Lg7jc0?CcWuvAOE(i^j1Km^m8tav)lMx1GF{?J#*xwms2 z3N_KN-31f;@JcW(fTA`J5l$&Q8x{gb=9frpE8K0*0Rm;yzHnDY0J{EvLRF0 zRo6ca)gfv6C)@D#1I|tgL~uHJNA-{hwJQXS?Kw=8LU1J$)nQ-&Jhwxpe+%WeL@j0q z?)92i;tvzRki1P2#poL;YI?9DjGM4qvfpsHZQkJ{J^GNQCEgUn&Sg=966 zq?$JeQT+vq%zuq%%7JiQq(U!;Bsu% zzW%~rSk1e+_t89wUQOW<8%i|5_uSlI7BcpAO20?%EhjF%s%EE8aY15u(IC za2lfHgwc;nYnES7SD&Lf5IyZvj_gCpk47H}e05)rRbfh(K$!jv69r5oI| z?){!<{InPJF6m|KOe5R6++UPlf(KUeb+*gTPCvE6! z(wMCuOX{|-p(b~)zmNcTO%FA z$-6}lkc*MKjIJ(Fyj^jkrjVPS);3Qyq~;O$p+XT+m~0$HsjB@}3}r*h(8wGbH9ktQ zbaiiMSJf`6esxC3`u@nNqvxP1nBwerm|KN)aBzu$8v_liZ0(G8}*jB zv<8J%^S2E_cu+Wp1;gT66rI$>EwubN4I(Lo$t8kzF@?r0xu8JX`tUCpaZi(Q0~_^K zs6pBkie9~06l>(Jpy*d&;ZH{HJ^Ww6>Hs!DEcD{AO42KX(rTaj)0ox`;>}SRrt)N5 zX)8L4Fg)Y6EX?He?I`oHeQiGJRmWOAboAC4Jaf;FXzspuG{+3!lUW8?IY>3%)O546 z5}G94dk)Y>d_%DcszEgADP z8%?i~Ak~GQ!s(A4eVwxPxYy3|I~3I=7jf`yCDEk_W@yfaKjGmPdM}($H#8xGbi3l3 z5#?bjI$=*qS~odY6IqL-Q{=gdr2B5FVq7!lX}#Lw**Pyk!`PHN7M3Lp2c=T4l}?kn zVNWyrIb(k&`CckYH;dcAY7-kZ^47EPY6{K(&jBj1Jm>t$FD=u9U z#LI%MnI3wPice+0WeS5FDi<>~6&jlqx=)@n=g5TZVYdL@2BW3w{Q%MkE%sx}=1ihvj(HDjpx!*qqta?R?| zZ(Ju_SsUPK(ZK*&EdAE(Fj%eABf2+T>*fZ6;TBP%$xr(qv;}N@%vd5iGbzOgyMCk* z3X|-CcAz%}GQHalIwd<-FXzA3btVs-_;!9v7QP)V$ruRAURJhMlw7IO@SNM~UD)2= zv}eqKB^kiB))Yhh%v}$ubb#HBQHg3JMpgNF+pN*QbIx(Rx1ofpVIL5Y{)0y&bMO(@ zyK1vv{8CJQidtiI?rgYVynw{knuc!EoQ5-eete(AmM`32lI7{#eS#!otMBRl21|g^SVHWljl8jU?GU@#pYMIqrt3mF|SSYI&I+Vz|%xuXv8;pHg zlzFl!CZ>X%V#KWL3+-743fzYJY)FkKz>GJ<#uKB)6O8NbufCW%8&bQ^=8fHYfE(lY z1Fl@4l%|iaTqu=g7tTVk)wxjosZf2tZ2`8xs9a$b1X29h!9QP#WaP#~hRNL>=IZO@SX4uYQR_c0pSt89qQR@8gJhL*iXBTSBDtlsiNvc_ewvY-cm%bd&sJTnd@hE zwBGvqGW$X^oD~%`b@yeLW%An*as@4QzwdrpKY9-E%5PLqvO6B+bf>ph+TWiPD?8Ju z-V}p@%LcX{e)?*0o~#!S%XU<+9j>3{1gfU=%sHXhukgH+9z!)AOH_A{H3M}wmfmU8 z&9jjfwT-@iRwCbIEwNP4zQHvX3v-d*y87LoudeB9Jh5+mf9Mnj@*ZCpwpQ*2Z9kBWdL19Od7q|Hdbwv+zP*FuY zQc4CJ6}NIz7W+&BrB5V%{4Ty$#gf#V<%|igk)b@OV`0@<)cj(tl8~lLtt^c^l4{qP z=+n&U0LtyRpmg(_8Qo|3aXCW77i#f{VB?JO3nG!IpQ0Y~m!jBRchn`u>HfQuJwNll zVAMY5XHOX8T?hO@7Vp3b$H)uEOy{AMdsymZ=q)bJ%n&1;>4%GAjnju}Osg@ac*O?$ zpu9dxg-*L(%G^LSMhdnu=K)6ySa|}fPA@*Saj}Z>2Dlk~3%K(Py3yDG7wKij!7zVp zUZ@h$V0wJ|BvKc#AMLqMleA*+$rN%#d95$I;;Iy4PO6Cih{Usrvwt2P0lh!XUx~PGNySbq#P%`8 zb~INQw3Woiu#ONp_p!vp3vDl^#ItB06tRXw88L}lJV)EruM*!ZROYtrJHj!X@K$zJ zp?Tb=Dj_x1^)&>e@yn{^$B93%dFk~$Q|0^$=qT~WaEU-|YZZzi`=>oTodWz>#%%Xk z(GpkgQEJAibV%jL#dU)#87T0HOATp~V<(hV+CcO?GWZ_tOVjaCN13VQbCQo=Dt9cG znSF9X-~WMYDd66Rg8Ktop~CyS7@Pj@Vr<#Ja4zcq1}FIoW$@3mfd;rY_Ak^gzwqqD z^4<_kC2Eyd#=i8_-iZ&g_e#$P`;4v zduoZTdyRyEZ-5WOJwG-bfw*;7L7VXUZ8aIA{S3~?()Yly@ga|-v%?@2vQ;v&BVZlo7 z49aIo^>Cv=gp)o?3qOraF_HFQ$lO9vHVJHSqq4bNNL5j%YH*ok`>ah?-yjdEqtWPo z+8i0$RW|$z)pA_vvR%IVz4r$bG2kSVM&Z;@U*{Lug-ShiC+IScOl?O&8aFYXjs!(O z^xTJ|QgnnC2!|xtW*UOI#vInXJE!ZpDob9x`$ox|(r#A<5nqbnE)i<6#(=p?C~P-7 zBJN5xp$$)g^l};@EmMIe;PnE=vmPsTRMaMK;K`YTPGP0na6iGBR8bF%;crF3>ZPoLrlQytOQrfTAhp;g){Mr$zce#CA`sg^R1AT@tki!m1V zel8#WUNZfj(Fa#lT*nT>^pY*K7LxDql_!IUB@!u?F&(tfPspwuNRvGdC@z&Jg0(-N z(oBb3QX4em;U=P5G?Y~uIw@E7vUxBF-Ti*ccU05WZ7`m=#4?_38~VZvK2{MW*3I#fXoFG3?%B;ki#l%i#$G_bwYQR-4w>y;2` zMPWDvmL6|DP1GVXY)x+z8(hqaV5RloGn$l&imhzZEZP6v^d4qAgbQ~bHZEewbU~Z2 zGt?j~7`0?3DgK+)tAiA8rEst>p#;)W=V+8m+%}E$p-x#)mZa#{c^3pgZ9Cg}R@XB) zy_l7jHpy(u;fb+!EkZs6@Z?uEK+$x3Ehc8%~#4V?0AG0l(vy{8u@Md5r!O+5t zsa{*GBn?~+l4>rChlbuT9xzEx2yO_g!ARJO&;rZcfjzxpA0Chj!9rI_ZD!j` z6P@MWdDv&;-X5X8o2+9t%0f1vJk3R~7g8qL%-MY9+NCvQb)%(uPK4;>y4tozQ2Dl* zEoR_1#S~oFrd9s%NOkoS8$>EQV|uE<9U*1uqAYWCZigiGlMK~vSUU}f5M9o{<*WW? z$kP)2nG$My*fUNX3SE!g7^r#zTT^mVa#A*5sBP8kz4se+o3y}`EIa)6)VpKmto6Ew z1J-r2$%PM4XUaASlgVNv{BBeL{CqJfFO|+QpkvsvVBdCA7|vlwzf1p$Vq50$Vy*O+ z5Eb85s^J2MMVj53l4_?&Wpd1?faYE-X1ml-FNO-|a;ZRM*Vp!(ods{DY6~yRq%{*< zgq5#k|KJ70q47aO1o{*gKrMHt)6+m(qJi#(rAUw0Uy8~z8IX)>9&PTxhLzh#Oh*vZ zPd1b$Z&R{yc&TF^x?iQCw#tV}la&8^W)B*QZ${19LlRYgu#nF7Zj`~CtO^0S#xp+r zLYwM~si$I>+L}5gLGhN=dyAKO)KqPNXUOeFm#o+3 z&#!bD%aTBT@&;CD_5MMC&_Yi+d@nfuxWSKnYh0%~{EU`K&DLx}ZNI2osu#(gOF2}2 zZG#DdQ|k0vXj|PxxXg-MYSi9gI|hxI%iP)YF2$o< zeiC8qgODpT?j!l*pj_G(zXY2Kevy~q=C-SyPV$~s#f-PW2>yL}7V+0Iu^wH;AiI$W zcZDeX<2q%!-;Ah!x_Ld;bR@`bR4<`FTXYD(%@CI#biP z5BvN;=%AmP;G0>TpInP3gjTJanln8R9CNYJ#ziKhj(+V33zZorYh0QR{=jpSSVnSt zGt9Y7Bnb#Ke$slZGDKti&^XHptgL7 zkS)+b>fuz)B8Lwv&JV*};WcE2XRS63@Vv8V5vXeNsX5JB?e|7dy$DR9*J#J= zpKL@U)Kx?Y3C?A3oNyJ5S*L+_pG4+X*-P!Er~=Tq7=?t&wwky3=!x!~wkV$Ufm(N| z1HY?`Ik8?>%rf$6&0pxq8bQl16Jk*pwP`qs~x~Trcstqe-^hztuXOG zrYfI7ZKvK$eHWi9d{C${HirZ6JU_B`f$v@SJhq?mPpC-viPMpAVwE;v|G|rqJrE5p zRVf904-q{rjQ=P*MVKXIj7PSUEzu_jFvTksQ+BsRlArK&A*=>wZPK3T{Ki-=&WWX= z7x3VMFaCV5;Z=X&(s&M^6K=+t^W=1>_FFrIjwjQtlA|-wuN7&^v1ymny{51gZf4-V zU8|NSQuz!t<`JE%Qbs||u-6T*b*>%VZRWsLPk&umJ@?Noo5#{z$8Q0oTIv00`2A`# zrWm^tAp}17z72^NDu^95q1K)6Yl`Wvi-EZA+*i&8%HeLi*^9f$W;f1VF^Y*W;$3dk|eLMVb_H{;0f*w!SZMoon+#=CStnG-7ZU8V>Iy( zmk;42e941mi7!e>J0~5`=NMs5g)WrdUo^7sqtEvwz8>H$qk=nj(pMvAb4&hxobPA~p&-L5a_pTs&-0XCm zKXZ8BkkriiwE)L2CN$O-`#b15yhuQO7f_WdmmG<-lKeTBq_LojE&)|sqf;dt;llff znf|C$@+knhV_QYVxjq*>y@pDK|DuZg^L{eIgMZnyTEoe3hCgVMd|u)>9knXeBsbP_$(guzw>eV{?5l$ z063cqIysrx82-s6k;vE?0jxzV{@`jY3|*Wp?EdNUMl0#cBP$~CHqv$~sB5%50`m(( zSfD%qnxbGNM2MCwB+KA?F>u__Ti>vD%k0#C*Unf?d)bBG6-PYM!!q;_?YWptPiHo} z8q3M~_y9M6&&0#&uatQD6?dODSU)%_rHen`ANb z{*-xROTC1f9d!8`LsF&3jf{OE8~#;>BxHnOmR}D80c2Eh zd867kq@O$I#zEm!CCZJw8S`mCx}HrCl_Rh4Hsk{Cb_vJ4VA3GK+icku z%lgw)Y@$A0kzEV^#=Zj8i6jPk&Mt_bKDD!jqY3&W(*IPbzYu$@x$|3*aP{$bz-~xE^AOxtbyWvzwaCOHv6+99llI&xT_8)qX3u|y|0rDV z(Hu*#5#cN0mw4OSdY$g_xHo-zyZ-8WW&4r%qW(=5N>0O-t{k;#G9X81F~ynLV__Kz zbW1MA>Pjg0;3V?iV+-zQsll_0jimGuD|0GNW^av|4yes(PkR1bGZwO6xvgCy}ThR7?d&$N`kA3N!Xn5uSKKCT-`{lE1ZYYy?GzL}WF+mh|sgT6K2Z*c9YB zFSpGRNgYvk&#<2@G(vUM5GB|g?gk~-w+I4C{vGu{`%fiNuZIeu@V1qt`-x$E?OR;zu866Y@2^et5GTNCpX#3D=|jD5>lT^vD$ zr}{lRL#Lh4g45Yj43Vs7rxUb*kWC?bpKE1@75OJQ=XahF z5(C0DyF;at%HtwMTyL!*vq6CLGBi^Ey}Mx39TC2$a)UmekKDs&!h>4Hp2TmSUi!xo zWYGmyG)`$|PeDuEL3C6coVtit>%peYQ6S1F4AcA*F`OA;qM+1U6UaAI(0VbW#!q9* zz82f@(t35JH!N|P4_#WKK6Rc6H&5blD6XA&qXahn{AP=oKncRgH!&=b6WDz?eexo* z9pzh}_aBc_R&dZ+OLk+2mK-5UhF`>}{KN7nOxb{-1 zd`S-o1wgCh7k0u%QY&zoZH}!<;~!)3KTs-KYRg}MKP3Vl%p$e6*MOXLKhy)<1F5L* z+!IH!RHQKdpbT8@NA+BFd=!T==lzMU95xIyJ13Z6zysYQ1&zzH!$BNU(GUm1QKqm< zTo#f%;gJ@*o;{#swM4lKC(QQ<%@;7FBskc7$5}W9Bi=0heaVvuvz$Ml$TR8@}qVn>72?6W1VAc{Mt}M zkyTBhk|?V}z`z$;hFRu8Vq;IvnChm+no@^y9C1uugsSU`0`46G#kSN9>l_ozgzyqc zZnEVj_a-?v@?JmH1&c=~>-v^*zmt`_@3J^eF4e))l>}t2u4L`rueBR=jY9gZM;`nV z>z(i<0eedu2|u-*#`SH9lRJ7hhDI=unc z?g^30aePzkL`~hdH*V7IkDGnmHzVr%Q{d7sfb7(|)F}ijXMa7qg!3eHex)_-$X;~* z>Zd8WcNqR>!`m#~Xp;r4cjvfR{i04$&f1)7sgen9i>Y|3)DCt^f)`uq@!(SG?w|tdSLS+<;ID74 zTq8FJYHJHrhSwvKL|O1ZnSbG-=l6Eg-Suv60Xc;*bq~g+LYk*Q&e)tR_h3!(y)O}$ zLi*i5ec^uHkd)fz2KWiR;{RosL%peU`TxM7w*M9m#rAiG`M)FTB>=X@|A`7x)zn5- z$MB5>0qbweFB249EI@!zL~I7JSTZbzjSMMJ=!DrzgCS!+FeaLvx~jZXwR`BFxZ~+A z=!Pifk?+2awS3DVi32fgZRaqXZq2^->izZpIa1sEog@01#TuEzq%*v359787rZoC( z9%`mDR^Hdxb%XzUt&cJN3>Cl{wmv{@(h>R38qri1jLKds0d|I?%Mmhu2pLy=< zOkKo4UdS`E9Y~z3z{5_K+j~i7Ou}q0?Qv4YebBya1%VkkWzR%+oB!c?9(Ydaka32! zTEv*zgrNWs`|~Q{h?O|8s0Clv{Kg0$&U}?VFLkGg_y=0Qx#=P${6SNQFp!tDsTAPV z0Ra{(2I7LAoynS0GgeQ6_)?rYhUy}AE^$gwmg?i!x#<9eP=0N=>ZgB#LV9|aH8q#B za|O-vu(GR|$6Ty!mKtIfqWRS-RO4M0wwcSr9*)2A5`ZyAq1`;6Yo)PmDLstI zL2%^$1ikF}0w^)h&000z8Uc7bKN6^q3NBfZETM+CmMTMU`2f^a#BqoYm>bNXDxQ z`3s6f6zi5sj70>rMV-Mp$}lP|jm6Zxg}Sa*$gNGH)c-upqOC7vdwhw}e?`MEMdyaC zP-`+83ke+stJPTsknz0~Hr8ea+iL>2CxK-%tt&NIO-BvVt0+&zsr9xbguP-{3uW#$ z<&0$qcOgS{J|qTnP;&!vWtyvEIi!+IpD2G%Zs>;k#+d|wbodASsmHX_F#z?^$)zN5 zpQSLH`x4qglYj*{_=8p>!q39x(y`B2s$&MFQ>lNXuhth=8}R}Ck;1}MI2joNIz1h| zjlW@TIPxM_7 zKBG{Thg9AP%B2^OFC~3LG$3odFn_mr-w2v**>Ub7da@>xY&kTq;IGPK5;^_bY5BP~ z2fiPzvC&osO@RL)io905e4pY3Yq2%j&)cfqk|($w`l`7Pb@407?5%zIS9rDgVFfx! zo89sD58PGBa$S$Lt?@8-AzR)V{@Q#COHi-EKAa5v!WJtJSa3-Wo`#TR%I#UUb=>j2 z7o-PYd_OrbZ~3K`pn*aw2)XKfuZnUr(9*J<%z@WgC?fexFu%UY!Yxi6-63kAk7nsM zlrr5RjxV45AM~MPIJQqKpl6QmABgL~E+pMswV+Knrn!0T)Ojw{<(yD8{S|$(#Z!xX zpH9_Q>5MoBKjG%zzD*b6-v>z&GK8Dfh-0oW4tr(AwFsR(PHw_F^k((%TdkglzWR`iWX>hT1rSX;F90?IN4&}YIMR^XF-CEM(o(W@P#n?HF z!Ey(gDD_0vl+{DDDhPsxspBcks^JCEJ$X74}9MsLt=S?s3)m zQ0cSrmU*<u;KMgi1(@Ip7nX@4Zq>yz;E<(M8-d0ksf0a2Ig8w2N-T69?f}j}ufew}LYD zxr7FF3R7yV0Gu^%pXS^49){xT(nPupa(8aB1>tfKUxn{6m@m1lD>AYVP=<)fI_1Hp zIXJW9gqOV;iY$C&d=8V)JJIv9B;Cyp7cE}gOoz47P)h)Y?HIE73gOHmotX1WKFOvk z5(t$Wh^13vl;+pnYvJGDz&_0Hd3Z4;Iwa-i3p|*RN7n?VJ(whUPdW>Z-;6)Re8n2# z-mvf6o!?>6wheB9q}v~&dvd0V`8x&pQkUuK_D?Hw^j;RM-bi_`5eQE5AOIzG0y`Hr zceFx7x-<*yfAk|XDgPyOkJ?){VGnT`7$LeSO!n|o=;?W4SaGHt4ngsy@=h-_(^qX)(0u=Duy02~Fr}XWzKB5nkU$y`$67%d^(`GrAYwJ? zN75&RKTlGC%FP27M06zzm}Y6l2(iE*T6kdZPzneMK9~m)s7J^#Q=B(Okqm1xB7wy< zNC>)8Tr$IG3Q7?bxF%$vO1Y^Qhy>ZUwUmIW5J4=ZxC|U)R+zg4OD$pnQ{cD`lp+MM zS3RitxImPC0)C|_d18Shpt$RL5iIK~H z)F39SLwX^vpz;Dcl0*WK*$h%t0FVt`Wkn<=rQ6@wht+6|3?Yh*EUe+3ISF zbbV(J6NNG?VNIXC)AE#(m$5Q?&@mjIzw_9V!g0#+F?)2LW2+_rf>O&`o;DA!O39Rg ziOyYKXbDK!{#+cj_j{g;|IF`G77qoNBMl8r@EIUBf+7M|eND2#Y#-x=N_k3a52*fi zp-8K}C~U4$$76)@;@M@6ZF*IftXfwyZ0V+6QESKslI-u!+R+?PV=#65d04(UI%}`r z{q6{Q#z~xOh}J=@ZN<07>bOdbSI(Tfcu|gZ?{YVVcOPTTVV52>&GrxwumlIek}OL? zeGFo#sd|C_=JV#Cu^l9$fSlH*?X|e?MdAj8Uw^@Dh6+eJa?A?2Z#)K zvr7I|GqB~N_NU~GZ?o1A+fc@%HlF$71Bz{jOC{B*x=?TsmF0DbFiNcnIuRENZA43a zfFR89OAhqSn|1~L4sA9nVHsFV4xdIY_Ix>v0|gdP(tJ^7ifMR_2i4McL#;94*tSY) zbwcRqCo$AnpV)qGHZ~Iw_2Q1uDS2XvFff#5BXjO!w&1C^$Pv^HwXT~vN0l}QsTFOz zp|y%Om9}{#!%cPR8d8sc4Y@BM+smy{aU#SHY>>2oh1pK+%DhPqc2)`!?wF{8(K$=~ z<4Sq&*`ThyQETvmt^NaN{Ef2FQ)*)|ywK%o-@1Q9PQ_)$nJqzHjxk4}L zJRnK{sYP4Wy(5Xiw*@M^=SUS9iCbSS(P{bKcfQ(vU?F~)j{~tD>z2I#!`eFrSHf;v zquo)*?AW$#+qP}n$%<{;wr$()*yw5N`8_rOTs^kOqyY;dIjsdw*6k_mL}v2V9C_*sK<_L8 za<3)C%4nRybn^plZ(y?erFuRVE9g%mzsJzEi5CTx?wwx@dpDFSOAubRa_#m+=AzZ~ z^0W#O2zIvWEkxf^QF660(Gy8eyS`R$N#K)`J732O1rK4YHBmh|7zZ`!+_91uj&3d} zKUqDuDQ8YCmvx-Jv*$H%{MrhM zw`g@pJYDvZp6`2zsZ(dm)<*5p3nup(AE6}i#Oh=;dhOA=V7E}98CO<1Lp3*+&0^`P zs}2;DZ15cuT($%cwznqmtTvCvzazAVu5Ub5YVn#Oo1X|&MsVvz8c5iwRi43-d3T%tMhcK#ke{i-MYad@M~0B_p`Iq){RLadp-6!peP^OYHTq~^vM zqTr5=CMAw|k3QxxiH;`*;@GOl(PXrt(y@7xo$)a3Fq4_xRM_3+44!#E zO-YL^m*@}MVI$5PM|N8Z2kt-smM>Jj@Dkg5%`lYidMIbt4v=Miqj4-sEE z)1*5VCqF1I{KZVw`U0Wa!+)|uiOM|=gM65??+k|{E6%76MqT>T+;z{*&^5Q9ikL2D zN2}U$UY)=rIyUnWo=yQ@55#sCZeAC}cQA(tg5ZhqLtu*z>4}mbfoZ>JOj-|a2fR$L zQ(7N$spJL_BHb6Bf%ieO10~pQX%@^WKmQOQNOUe4h|M}XOTRL`^QVpN$MjJ7t+UdP zDdzcK3e7_fdv)PPR>O|-`kVC1_O08_WGcQXj*W5d?}3yE?-fZ_@mE-zcq6^Mn49!; zDDcus*@4dFIyZ%_d3*MO=kk3$MQ^?zaDR1-o<<7T=;`8 zz2(w>U9IQ+pZ<*B;4dE@LnlF7YwNG>la#rQ@mC4u@@0_pf40+<&t)+9(YOgCP9(aJ z5v7SRi(y4;fWR)oHRxf2|Va=?P zXq&7GtTYd+3U{Wm5?#e7gDwz#OFbvHL4Jq{BGhNYzh|U!1$_WEJef&NKDD9)*$d+e ztXF1-rvO5OBm{g9Mo8x?^YB;J|G*~3m@2y%Fyx6eb*O^lW- z`JUL?!exvd&SL_w89KoQxw5ZZ}7$FD4s>z`!3R}6vcFf0lWNYjH$#P z<)0DiPN%ASTkjWqlBB;8?RX+X+y>z*$H@l%_-0-}UJ>9l$`=+*lIln9lMi%Q7CK-3 z;bsfk5N?k~;PrMo)_!+-PO&)y-pbaIjn;oSYMM2dWJMX6tsA5>3QNGQII^3->manx z(J+2-G~b34{1^sgxplkf>?@Me476Wwog~$mri{^`b3K0p+sxG4oKSwG zbl!m9DE87k>gd9WK#bURBx%`(=$J!4d*;!0&q;LW82;wX{}KbPAZtt86v(tum_1hN z0{g%T0|c(PaSb+NAF^JX;-?=e$Lm4PAi|v%(9uXMU>IbAlv*f{Ye3USUIkK`^A=Vn zd))fSFUex3D@nsdx6-@cfO1%yfr4+0B!uZ)cHCJdZNcsl%q9;#%k@1jh9TGHRnH2(ef0~sB(`82IC_71#zbg=NL$r=_9UD-~ z8c54_zA@jEhkJpL?U`$p&|XF}OpRvr`~}+^BYBtiFB1!;FX;a3=7jkFSET)41C@V` zxhfS)O-$jRJ|R}CL{=N{{^0~c8WuLOC?`>JKmFGi?dlfss4Y^AAtV#FoLvWoHsEeg zAAOc+PXl@WoSOOu_6Tz~K=>OK@KL#^re(1oPrhcen@+#ouGG|g(;A5(SVuE~rp$?# zR$o(46m}O~QtU{!N-s}RfYh+?*m9v#w@;=DEXI;!CEf0bHEgI<~T7&VnIvtG%o=s@3c zG1AT(J>!bph%Z1^xT_aO>@%jWnTW=8Z^2k0?aJ(8R5VA}H+mDh>$b9ua{)I5X9$%b z&O%F;3AIW&9j3=Q1#8uL%4_2mc3xX2AdzYJi%#Q#PEY3lk<#u=Pc?EJ7qt4WZX)bH481F8hwMr^9C^N8KUiWIgcVa=V` z4_7By=0Fkq>M6N?Bis+nc$YOqN4Qs@KDdQCy0TTi;SQ7^#<wi9E4T)##ZVvS(SK4#6j^QjHIUh<0_ZD2Yl+t?Z2;4zA zvI<(>jLvJae#sIA`qHl0lnkcU$>Rrkcnp{E;VZwW`cucIIWi{hftjEx-7>xXWRsa4VH(CCyuleyG8a+wOY8l*y>n@ zxZb}o=p9lR)9N^FKfkvPH-t2{qDE=hG8Z!`JO>6aJ^hKJVyIV&qGo*YSpoU(d)&OE ziv2#o`&W>(IK~sH{_5aPL;qcn{2%Gae+r5G4yMl5U)EB>ZidEo|F@f)70WN%Pxo`= zQ+U-W9}iLlF=`VeGD0*EpI!(lVJHy(%9yFZkS_GMSF?J*$bq+2vW37rwn;9?9%g(Jhwc<`lHvf6@SfnQaA&aF=los z0>hw9*P}3mWaZ|N5+NXIqz#8EtCtYf-szHPI`%!HhjmeCnZCim3$IX?5Il%muqrPr zyUS#WRB(?RNxImUZHdS&sF8%5wkd0RIb*O#0HH zeH~m^Rxe1;4d(~&pWGyPBxAr}E(wVwlmCs*uyeB2mcsCT%kwX|8&Pygda=T}x{%^7 z)5lE5jl0|DKd|4N*_!(ZLrDL5Lp&WjO7B($n9!_R3H(B$7*D zLV}bNCevduAk2pJfxjpEUCw;q$yK=X-gH^$2f}NQyl(9ymTq>xq!x0a7-EitRR3OY zOYS2Qh?{_J_zKEI!g0gz1B=_K4TABrliLu6nr-`w~g2#zb zh7qeBbkWznjeGKNgUS8^^w)uLv*jd8eH~cG-wMN+{*42Z{m(E{)>K7O{rLflN(vC~ zRcceKP!kd)80=8ttH@14>_q|L&x0K^N0Ty{9~+c>m0S<$R@e11>wu&=*Uc^^`dE9RnW+)N$re2(N@%&3A?!JdI?Vx;X=8&1+=;krE8o%t z32Gi2=|qi=F?kmSo19LqgEPC5kGeJ5+<3TpUXV3Yik_6(^;SJw=Cz`dq(LN)F9G<$ za-aTiEiE}H(a>WITnJ+qG$3eCqrKgXFRiIv=@1C4zGNV!+ z{{7_AulEPXdR+~$sJ+yHA73j_w^4>UHZFnK$xsp}YtpklHa57+9!NfhOuU7m4@WQp z5_qb`)p|6atW#^b;KIj?8mWxF(!eN<#8h=Ohzw&bagGAS4;O^;d-~#Ct0*gpp_4&( ztwlS2Jf#9i>=e5+X8QSy**-JE&6{$GlkjNzNJY;K5&h|iDT-6%4@g;*JK&oA8auCovoA0+S(t~|vpG$yI+;aKSa{{Y(Tnm{ zzWuo^wgB?@?S9oKub=|NZNEDc;5v@IL*DBqaMkgn@z+IeaE^&%fZ0ZGLFYEubRxP0WG`S| zRCRXWt+ArtBMCRqB725odpDu(qdG;jez|6*MZE_Ml<4ehK_$06#r3*=zC9q}YtZ*S zBEb2?=5|Tt;&QV^qXpaf?<;2>07JVaR^L9-|MG6y=U9k{8-^iS4-l_D(;~l=zLoq% zVw05cIVj1qTLpYcQH0wS1yQ47L4OoP;otb02V!HGZhPnzw`@TRACZZ_pfB#ez4wObPJYcc%W>L8Z*`$ZPypyFuHJRW>NAha3z?^PfHsbP*-XPPq|`h} zljm&0NB7EFFgWo%0qK`TAhp220MRLHof1zNXAP6At4n#(ts2F+B`SaIKOHzEBmCJ3 z$7Z&kYcKWH&T!=#s5C8C_UMQ4F^CFeacQ{e0bG?p5J~*mOvg>zy_C{A4sbf!JT+JK z>9kMi=5@{1To&ILA)1wwVpOJ&%@yfuRwC9cD2`0CmsURi5pr2nYb6oBY&EmL9Gd@i zj{F}h!T*#a<@6mKzogszCSUCq5pxGeCq-w2|M>ZzLft79&A-&!AH~#ER1?Z=ZavC0 z)V05~!^Nl{E5wrkBLnrxLoO|AG&hoOa6AV2{KWL#X*UItj_W`}DEbIUxa;huN0S#` zUtXHi+cPyg-=Gad`2Aw-HWO*;`_&j9B3GHLy(f^@Do@Wu*5{FANC+>M*e6(YAz4k^ zcb_n4oJgrykBM1T!VN(2`&(rNBh+UcE}oL@A~Fj}xf0|qtJK?WzUk{t=M15p!)i7k zM!`qg^o;xR*VM49 zcY_1Yv0?~;V7`h7c&Rj;yapzw2+H%~-AhagWAfI0U`2d7$SXt=@8SEV_hpyni~8B| zmy7w?04R$7leh>WYSu8)oxD`88>7l=AWWJmm9iWfRO z!Aa*kd7^Z-3sEIny|bs9?8<1f)B$Xboi69*|j5E?lMH6PhhFTepWbjvh*7 zJEKyr89j`X>+v6k1O$NS-`gI;mQ(}DQdT*FCIIppRtRJd2|J?qHPGQut66-~F>RWs=TMIYl6K=k7`n1c%*gtLMgJM2|D;Hc|HNidlC>-nKm5q2 zBXyM)6euzXE&_r%C06K*fES5`6h-_u>4PZs^`^{bxR?=s!7Ld0`}aJ?Z6)7x1^ zt3Yi`DVtZ*({C;&E-sJ1W@dK29of-B1lIm)MV4F?HkZ_3t|LrpIuG~IZdWO@(2S6& zB2jA7qiiGi%HO2fU5|yY#aC<57DNc7T%q9L>B_Qh@v#)x(?}*zr1f4C4p8>~v2JFR z8=g|BIpG$W)QEc#GV1A}_(>v&=KTqZbfm)rqdM>}3n%;mv2z*|8%@%u)nQWi>X=%m?>Thn;V**6wQEj#$rU&_?y|xoCLe4=2`e&7P16L7LluN^#&f1#Gsf<{` z>33Bc8LbllJfhhAR?d7*ej*Rty)DHwVG)3$&{XFKdG?O-C=-L9DG$*)_*hQicm`!o zib(R-F%e@mD*&V`$#MCK=$95r$}E<4%o6EHLxM0&K$=;Z#6Ag0Tcl9i+g`$Pcz&tP zgds)TewipwlXh0T)!e~d+ES8zuwFIChK+c4;{!RC4P(|E4$^#0V*HhXG80C;ZD-no z!u+uQ;GCpm^iAW&odDVeo+LJU6qc$4+CJ6b6T&Y^K3(O_bN{@A{&*c6>f6y@EJ+34 zscmnr_m{V`e8HdZ>xs*=g6DK)q2H5Xew?8h;k{)KBl;fO@c_1uRV>l#Xr+^vzgsub zMUo8k!cQ>m1BnO>TQ<)|oBHVATk|}^c&`sg>V5)u-}xK*TOg%E__w<*=|;?? z!WptKGk*fFIEE-G&d8-jh%~oau#B1T9hDK;1a*op&z+MxJbO!Bz8~+V&p-f8KYw!B zIC4g_&BzWI98tBn?!7pt4|{3tm@l+K-O>Jq08C6x(uA)nuJ22n`meK;#J`UK0b>(e z2jhQ{rY;qcOyNJR9qioLiRT51gfXchi2#J*wD3g+AeK>lm_<>4jHCC>*)lfiQzGtl zPjhB%U5c@-(o}k!hiTtqIJQXHiBc8W8yVkYFSuV_I(oJ|U2@*IxKB1*8gJCSs|PS+EIlo~NEbD+RJ^T1 z@{_k(?!kjYU~8W&!;k1=Q+R-PDVW#EYa(xBJ2s8GKOk#QR92^EQ_p-?j2lBlArQgT z0RzL+zbx-Y>6^EYF-3F8`Z*qwIi_-B5ntw#~M}Q)kE% z@aDhS7%)rc#~=3b3TW~c_O8u!RnVEE10YdEBa!5@&)?!J0B{!Sg}Qh$2`7bZR_atZ zV0Nl8TBf4BfJ*2p_Xw+h;rK@{unC5$0%X}1U?=9!fc2j_qu13bL+5_?jg+f$u%)ZbkVg2a`{ZwQCdJhq%STYsK*R*aQKU z=lOv?*JBD5wQvdQIObh!v>HG3T&>vIWiT?@cp$SwbDoV(?STo3x^DR4Yq=9@L5NnN z_C?fdf!HDWyv(?Uw={r`jtv_67bQ5WLFEsf@p!P3pKvnKh_D}X@WTX^xml)D^Sj8Er?RRo2GLWxu`-Bsc ztZ*OU?k$jdB|C6uJtJ#yFm{8!oAQj<0X}2I(9uuw#fiv5bdF$ZBOl@h<#V401H;_` zu5-9V`$k1Mk44+9|F}wIIjra8>7jLUQF|q zIi8JCWez)_hj3aHBMn6(scZd9q#I<3MZzv}Yjc^t_gtGunP?|mAs+s!nGtNlDQ?ZO zgtG2b3s#J8Wh#0z1E|n_(y*F5-s7_LM0Rj3atDhs4HqmZc|?8LDFFu}YWZ}^8D`Yi z`AgJWbQ)dK(Qn?%Z=YDi#f%pLZu_kRnLrC2Qu|V>iD=z=8Y%}YY=g8bb~&dj;h7(T zPhji+7=m2hP~Xw`%Ma7o#?jo#+{IY&YkSeg^os)9>3?ZB z|Bt1-;uj0%|M_9k;#6c+)a)0oA}8+=h^#A_o=QR@jX^|y`YIR9V8ppGX>)FS%X>eB zD&v$!{eebt&-}u8z2t`KZLno>+UPceqXzuZe2u zHYz7U9}_Sw2da@ugQjBJCp(MNp~mVSk>b9nN*8UE`)88xXr88KXWmTa;FKKrd{Zy> zqL}@fo*7-ImF(Ad!5W7Z#;QLsABck0s8aWQohc@PmX3TK#f$`734%ifVd{M!J1;%A z)qjpf=kxPgv5NpUuUyc=C%MzLufCgTEFXQawxJo)rv4xG&{TKfV;V#ggkxefi`{sS zX+NQ8yc>qcdU zUuLM~0x32S& z|NdQ-wE6O{{U-(dCn@}Ty2i=)pJeb-?bP+BGRkLHp&;`Vup!}`pJdth`04rFPy;$a zkU=wWy;P$BMzf+0DM(IbYh`Dk*60l?3LAU;z3I^tHbXtB5H$Op=VEPL8!mydG>$T@S9;?^}mmDK)+x*TCN_Z`%SG{Hv0;P*>(P@^xe2%mUldaqF9$ zG+Oq<5)pQ+V4%%R>bK|~veGY4T&ALmnT@W*I)aT~2(zk>&L9PVG9&;LdC%xAUA`gC4KOGLHiqxbxMTA^!+T*7G;rF z;7ZNc3t&xd!^{e|E(7-FHu@!VrWQ8CB=pP;#jG#yi6(!BfCV(rrY~7D)0vCp_Ra@9 zSuu)to5ArdCAYX}MU&4u6}*{oe=Ipe09Z7|z41Y&lh`olz{lmO>wZpnwx+x4!~7@37|N~@wr=Tqf*+}4H{7GE*BvptMyhTAwu?VYEaj~BiJm7 zQw98FiwJTx0`qY8Y+268mkV#!grHt3S_69w?1TRi-P^2iNv=ajmQIkoX7OkY=Cpvk zs;-Gv?R(YEAb(%@0tNz)_r8bwE zPh75RwYWr?wPZ0rkG<5WwX|fjqCBP4^etDs4{ZF9+|c#@Y60nB)I_U5Z$FYe=SLXI zn}7T@%LLA>*fWf9X?vSD3tpXSEk%H{*`ZmRik>=se}`HWHKL|HHiXovNzTS~-4e?1 zgVLCWv@)(($B*C3rGn`N#nzUyVrSw>OiD;4`i15QHhdicm}A(CP)UO>PO(3!(=v-x zrsKIUCbJMb>=IB}20b{69IdU(vQ%Ti0Zm?VLQoL++HK(G%^P{wuH;|@Cn7Ncybw%D zDhWh??1)6j5j7RbEy-{rVefvMhV|Su8n9`m>4LU^TanMzUIy>S&UbSKJW56C(K5NX z*Ypzh@KaMD=ank_G}Di5SaDTz3@Ze;5$pkK$7Pz?SBj&njRD4so5e0Msp_p}|D8aq zDvU@2s@T_?)?f5XEWS3j_%6%AK-4aXU5!Xzk{fL%mI~AYWP?q}8X}}ZV3ZzKLFvmm zOHWR3OY0l)pZ#y@qGPkjS~mGj&J8uJnU<~+n?qrBTsf>8jN~i17c~Ry=4wM6YrgqZ@h`8`?iL&$8#fYrt7MinX)gEl7Sh_TS zOW{AyVh%SzW|QYBJo8iEVrA!yL(Lm&j6GB0|c?~N{~?Qyj^qjbs>E~lpWo!q!lNwfr(DPZVe zaazh2J{{o=*AQ|Wxz*!pBwYx_9+G$12{5G3V!0F=yB=tPa zEgh47ryFGZc;E%A{m4lJoik6@^k%E0{99pIL1gE;NqT!1dl5UV>RkEWtP)3f_5hG6 zs%M}qX?DNaI+4HN*-wn`HOjlEz0}K{o0fG~_%%c8sDq)6Z2)6msormgjhmtdzv;Hy{BwHXKp&3Bf9paw+J4r-E zBoWmEr6%r3t?F`38eCyr+)`In1&qS9`gcQ|rHBP`LlCl=_x?ck0lISju@hW*d~EQ) zU2sgl#~^(ye%SeZR%gZ=&?1ZxeU1v@44;`}yi^j0*Efg1lIFcC*xEj}Y~k|(I&}7z zXXi2xe>mc_cC`K=v8&-5p%=m=z47Z6HQUzNi5=oCeJ$-Bo#B0=i}CemYbux7I~B*e z3hSneMn$KHNXf4;wr5fkuA+)IzWs8gJ%$o0Q^vfnXQLnABJW;NRN(83Dcbu9dLnvo z6mweq2@yPK%0|R9vT)B$&|S!QO6f(~J^Z+b`G(j1;HKOq_fG$-36zvBI$`hvA94i( zGPGVo&Y%nRsodWyzn0bD0VZlG?=0M23Mc2V1_7>R^3`|z_5B;}JnIp0FI}9XNKJ^o z7xYKOFdYxX?UW~4PC!hVz86aP+dsOkBA(sz3J+6$KL`SU4tRwWnnCQN z&+C92x#?WNBaxf?Q^Q}@QD5rC=@aj8SIg;(QG06k^C5bZFwmiAyFl|qPX^@e2*J%m z1Fu_Jk5oZEB&%YN54Y8;?#l#GYHr->Q>-?72QSIc+Gx^C%;!$ezH>t<=o$&#w*Y_Y7=|PH*+o57yb>b&zpTUQv)0raRzrkL=hA-Z(10vNYDiT487% zzp2zr4ujA#rQ;Hxh7moX(VldzylrhKvPnl9Fb?LCt#|==!=?2aiZ`$Wx*^Lv@5r_ySpQ_vQ{h2_>I`Wd|GjXY?!>=X8v}wmTc+Nqi-?ln zQa28}pDfvjpheaM2>AYDC2x`+&QYH(jGqHDYLi}w55O5^e9s=Ui^hQ~xG*&TU8I}Y zeH~7!$!=a+1_RZe{6G$BICI6R2PKE{gYW8_ss!VY*4uXw8`?o>p=fC>n&DGzxJ$&w zoIxdMA4I503p(>m9*FnFeEJQ5Nd^WK*>I_79(IA)e#hr2qZ8Y!RMcbS}R z(2;{C#FXUv_o-0C=w18S!7fh!MXAN-iF!Oq4^n#Q{ktGsqj0nd~}H&v#Brb}6cd=q75>E;O8p?6a;CR4FiN zxyB?rmw)!Kxrh&7DbPei$lj)r+fDY&=qH+ zKX`VtQ=2fc?BwarW+heGX&C!Qk;F;mEuPC*8 z0Tv0h2v&J#wCU_0q-Wq9SHLOvx@F!QQQN+qN^-r-OgGRYhpu%J-L~SiU7o@0&q6t( zxtimUlrTO)Zk6SnXsm8l$`GW-ZHKNo1a}<%U4Ng z(k8=jTPjoZZ%$(tdr@17t|MV8uhdF4s|HbPO)SF`++T%r=cNRx&$BkW7|$)u%Anm; zGOv)GmwW*J5DzeI8Vk_HZ4v?Mmz$vpL#M%+vyeiW;BK6w|_S0 z{pqGZxI%-~r~b@=F#^|^+pwQE*qc8+b7!b}A$8OjqA%6=i?yI;3BcDP1xU_UVYa?^ z3o-aYI`X%p!w>>cRe_3rtp}@f1d&AQZ_2eeB;1_+9(`jpC22z+w%(kh6G3}Rz&~U_ z5_LxI)7~`nP=ZdVO&`rUP8`b-t^Vqi;Yt~Ckxauk>cj@W0v=E}$00?Jq(sxBcQHKc z(W}uAA*+e%Q)ybLANOe7gb4w^eX#gI%i56{GJz6NVMA{tQ! z3-}Mdjxfy6C#;%_-{5h|d0xP0YQ!qQ^uV*Y&_F9pP!A;qx#0w*)&xPF0?%{;8t+uWA#vrZ|CBD0wz@?M=ge(^#$y< zIEBv1wmL`NKAe&)7@UC9H^t0E0$}Odd>u4cQGdKdlfCn0`goK~uQ0xrP*{VJ*TjR; za16!CM>-msM@KcxU|HsEGgn{v>uy1R?slG}XL5)*rLTNHdYowI*;qe~TZH z|1Ez0TXrc@khWdmgZJKV6+aJVlFsv5z~PhdC>=^tL5BC|3tyMuXSdsEC3L0qw60S>ecX zi&`-rZ=GqxfrH{+JvkuOY?{d?;HZmv z2@4+ep(g+yG6W%NrdJe2%miVnb8nX{yXK>?5DC#GA6IIXU-`!?8+xm(8r)Vi;=?g! zmOK)$jQv~nakv-|`0=Z`-Ir1%2q8~>T7-k=DyG^Rjk7|!y(QO&)cBEKdBrv~E$7_y z&?K!6DP;Qr_0fbbj86^W(4M{lqGx6Mb;`H;>IDqqGG@3I+oZg_)nb=k|ItMkuX2Y@ zYzDmMV~3{y43}y%IT+)nBCIzi^Cr1gEfyrjrQ7gXAmE$4Hj(&CuyWXjDrkV~uP>9T zCX5cXn!1oEjO!P#71iyGh#q+8qrD8)h#wE#x;bz+a^sQyAntO(UhxFVUqR^dux8 zOsN=Nzw5imC7U~@t^#gLo}j#vge3C6o(%0V5<0d~1qlxe4%yD~{EDGzZ40)ZIXytB zg3^NFa(98n#OwV!DJqgy;xitYp)Q(W$(J0<0Xr5DHFYO$zuUkC(4}Zv2uB`O@_TR7 zG3Ehp!K;YLl%2&*oz3`{p|hj`Bzd(@BMVVA2ruucGsD0mj`^a1Qw3WsT7_z)c_<&j zvy(u5yod#@5~XT5KRPqKKp*2Q`rN!6gd#Wdh9;806oaWGi6~pB78)SYEhIYZDo*^} z-93olUg^Vh29G^}wQ8p(BK0(<7R6(8><}Bia@h%62o%ONE`~PiaIdfy!HGUm0GZdJ z&^aK^@JP|8YL`L(zI6Y#c%Q{6*APf`DU#$22PjfSP@T4xKHW~A(vL$pvf+~p{QLdx^j4sUA;?IZ zVWID3OA_VkZ_3?~Yy1yn?4Ev^r}1~c!n9;Z7pRn*D$^J%4QyWNvPkKF5{{bMBefvT zFZu|hco!0Me-__dyLe6S!}>m?I-x%1{Zr3_Qi!(T@)hh%zBE1my2AWl^XY#v%TSX3 z;?rn8Chf+?>SQ|v8gl$*f5dpix{i;?651ezum2tQCU`9sKxuZG2A9o(M~}G`*q2m#iW# z?0fJS+j_XxOk1fb+Nx6$rZqhg!x}eO!3nMy6a@4doqY&?(c`8$^B?0InG4T&{mu*3 zpcYaf)z__Dgr%+6UFYYXSu(oRrPYGviL~FKc{0X%tnt+9slAC|W0F8l^(@8qDXks~ zOZgs?O-6e-12Q>w5d?|E$P&oyah^mqd(Cu#uNtjCpp&F}G&biuW49LGkFCDEYe0S* zo-W_}-yR$%Z^03i8{&R&oU1BbY9$ER3RR5LjocL5er=CclJwCH>M6ge$R*Wi zd3zUoE*~?a1owq&DiT2#_Q)~tr$;Q=BJrMHrG@j3^J=#U3 zmd)ubgUu(9g(qmjx~7+!$9^%~fpi9$*n=+HfX&<>a}qkD;Ky@piqolGdF>VEX?(!DuO z{=7v}0Y|$@o3c`s^K3&3uMD0T1NMMrgwn$+g{=Tr&IHH@S`Aj4zn z{Mpln$!B->uUYTFe+75e!ee*euX`W%xA&g!-%s-YJ-sJP*(~t=44RSN6K5u7}a9;40`KN#fg#N>-s?YE6*qS9zkP2*=!a%O&aJ4>)JR>{O6n)(@ z$2mBny!kLLgnPgrX&!fTVnSXLEY}ZR{fLL4Jw;uI;)DhJJ<;%5&X%lg5)mYwwyHK=W zS`3yPe&Ncy_OA!;HvQV1TI3}7jib>EhqT!PZIoDg_Wm4OraFX|nGmCsXj|{&g!(_; z;(_uG68gxxy{T#wPPuETHggw6G8nCyc`=x89;arkuB%&7rbL&VzCm|jQFg8me78tu z2l-K|IsFgX@am)(c=1IWYX5fhCjIZ&9MBs9(Qg*`U5T`@H2xqzQxj`1bK#2gmDn2=yI!n0*6A2{JuA3~uX7 zsXocdxHHMV^?dsW+s}S8j8Mq!pjB8=NytY%-MEgx+HnavDcotwYmA{J%RzlLhZ{?t-W6 zr-JA(qw%OVMtv?N?75aid-cY`ZJLFT`fh-fZ0()^P(3wyQ`wDHG$9cUmEr^~!;iGV z#ukG&nXeLHarXD$=({)#Es!?%=2*`or!FE4N6XWEo>>`}ocE?kmQb+2JP;-))sn0V zoC6&be>gf!XD#yJO`FCF(Ts|~ zUbO#y44!V-U|&SEr1#r^_fJ1Ql3isjfCVAfvNga7OBJG^YAP`r8d{))?5D{xm+FB~ z*>D&s+(Z(o*)gx|EpJAYlnk@A&=zpkYvak{W~Y}~8M_p7Uu1bY#7m{Mq-#4-xw3lH z{(8=+O+WrU)^C(;qRm%NiKnO+<0W6EF|>n#fw%OKxr!@d%dWHOmv~#M2{eIlxaRW% z;k6v=< zZ{5W}@ik?!__~T?0QX0xX^^}Isw8Ey-yXCwQkS!)xT-ZdV6A`#HdMECf78X){%6)7 znLSKwqK}!hdkVk2QjAZ?j%&Id%WY~^<$ntL2p8J;eq$VCp%Cg{)oW&%Z3vp6ihm9D zIlPC#zVE^>62fNwZqsk)mt+E#rrU@%4vWtkYK)Qv$a*}$T2ZJCtTFI`tuLb*7j`!^eR`?d9h2TjF-h2Yr+ z){T|kWBNyrA5vpZE{Ez_)pG7Zf%QXqW)R@(<_0oOP?cwg&gib`IjKTzN_R*5A)G>_ z1r#qXr5i)U$$wv(kXfodOg=h$UZk78c@50K^wOMcKCx26s{q}vdOioj1n!&if0FRY zSi@$}gn4KW;2<;+lY?&>M6GNrRtfUTEIzqih@yLMQA2(17m3)hLTa@zlj=oHqaCG5 zYg71D3e}v36DjH++<*=MXgd2q&dP^6f&^KctfDe(SQrvy5JXC@BG#|N_^XbfxhcV) z>KV$aMxcL*ISc0|0;+<2ix7U7xq8m48=~j!a`g?SzE5}(Y;hxqEHJg_+qB99$}py7 z*ZPXL?FKLA>0uVicvq3okpoLZE#OG@fv^+k0{35pf`XdVT)1< z#mV4mcikkivZcE(=0rgfv&#+yZJrAOX&VDL(}Zx8@&$yi4Y1kmEK&uL<}ZqWr05mr zcSwaqH=squnLs+UCn@yp#WNQuIv$~B*sN_NAACD>N3k_$E(j~}Uvqda!_ zZcu7UrsR_q-P2YTrg|lijt8kyqL>T@ab#-a7i>%#*eoxFfgx(FoPa(y1nDI{z#Pz^ zfF~)6RBc?#ivEF<@XVD*#9r^r-;*<^(tE%UtWw^oom83;$5d{UoUbmAP(3Z)14YTK zMXQ#mz9yw>*8D^82vL^|%lyo|ZiQPd&{<*wCZI%up=wadl~C~cRJ!=Hjc&F)FNlnd zgNI|iSIMyqh=qV(z+HbldU4}!sqMs1R?t*RV!S*WW>qW_GF4NJ&vb-{2sJjiTIpL; z{bC@V&EhO|>GuDv7`%$kO<-P@^VI+y zl0tXGm|eISy)fiY3m8_Yaz>`Q=B(Yi8EH71{wfM*8ziS3BIju?26ujw==Xh4x5rH71h?Z859IWq(i#9 zLt0wt?(QBsL(q4yCv&g4t0jJvu^@FtJJk`8YXb{{(OdTS%rGxnPR)xY#6=?AWjD5M2n z5GZ@@ulO|JN34J-2y*-Nh@6|?RkFHwSj$e}p}mbc3Y}*el{O31RU0Z_E48@5O~5n;kDJy}a$x&Lc;27DTvAd@s^9>IA@$q{m6K?eZqOJGKpgCT!Zhld>#d^DAK+MDP}|3h zZ{i!ENw;mW62Pq^|FY#w?@8U6Nvjgi(sKW}&uvgjz0YIS>%Sxk1`5 z`qk`C2*bWd|0I4L=_~s(^2F$Bv7OTjo*G+gBD=Rq-~$7t{Bo|mmck(d6ywQ*UbIjkS>qtkH~Zs(sq zEYNB4xxdYmy+G=${gOjGGfSQQLi1D*{&en*3{wyd7U3M)y^FX(+d)eFi?9oMy@64c zwL?!q#*eJ$eayb4lc!B$W%M4B$4dH>9eFXwjfk5U@}6vXOWDiiLMYP3^VYlG$yDjaC({9tyL4NxPb{x=ADdJ7Bl5EHzU6h-Cbke zwi+34LGVF=G%>d5Q7C>n!)%!LT`UZ0v^YN1WrcjC(pS!&vek-SK#kj^EL9!l?TvY% zOkz%!#5Cf^2JFrvNeU5ZL1_aI(M~e4?~kId$T!A@Z$?f40q#~5HuElkRMQV+6r0>J zK9y=%I^m-_xwRNyO<2Zq-0W6!frE$jT$C3Qi3d>0911QPc`Ky6`~Y<)?mMy*u`nz8 z={b()Z;8DqbWJ?MdOsaF6Zn)$d>DQpRHM~bD3cq=Rw_fzWpiwtJFY`BF}hTFCeh+C zs-4A}MCP}`EInNzh3hRoZ6L1a`J7}T&wh9#HItmHBCRwefpQ97*u{--QH=5>MSZud zv_%DacJS+lsxlJ0q=40vs-8P$Q$_Pt)JM=)|1dcFO&JWY8KwhiP$a&Ua*Z z$BTW#lu4QZna#vZECq#Q?Up_(@`0#(@~0?mG{qA#^rZDq^&6T=pbGL8nU?BY-TwKE zPmMqhP_w?q1B~|43T5=Hl(Bi-+{yY;Acv4i9u}oWC+@^i*}l}=dg`Y~E%dTn;rqj5 z&3pLFHjC62jcxW_a@Jj2Ce%eToCB!6OV*6I0!XF9Hq7orpm-RpizSSHx890&_kCQ% z$cKVw-`WnDvv5Lq?L!qGDcUPtgmotX=C`~Smjg&oM5V?}gAzL%WkRwLmNZyrCbKwC zcsUD3O0ruLr%s`B5W)IYjzLTXcAqinas75T_j&1_m!m!^ORvk6_bYvK||DIVE@IUjWQ z0dQ(H9=a-c`@{Q=uj?JC8g`r$a>)gR#=2%vuea5B_BAp;*QX&I;N?>jHYFR=q?8sq zatBJBYX`tr1BQxIgACJ==*ivk$UjW^Maod6-=SzI3MMUbCqu!3wVHt!Be?M@)2aK+$Rv(?iH18-}e+rDznPRv< zi!{-5NNHE)eqVEeYl>F5S{6w^8L$0p7l|M;(^c+Ei|{V7!!8;xiDx@QK4Pl8Iel7N z*9%$ISyQPK_+5tc2c9jhX%sfIOCZf-E%K9X7Z6N0Nvp!~v(KAZvWnaHK^SQSragIF zVIC_7tGTXeU(TRqj?owTmj{SXNtf7;9evoBURMB5R`8R1$@$}FCS%ugA{4igxOhRi z*q_y$&&!mHF1$S}2279&m0^nFxDV#WvV&?Pphq(craPjcBtveg0Nqdm9tXL4lN{t= z?BLepVnp$U5KskjvVX-GjEf=M3mOTZb|Z$Hp*yytey0C^{cH*v>gqF&-j?gcEj4)l)cdGBmB(^HrSe_)qzf z+TZ^Yo4|GWz=Oi3m`r(hV`iZHb_mu63g(JXPMW4p9JhL_(tg+XQnmR0&52UUA|nZI zvjwOx(fNtZ`8!#|4$7GoJPQ`;T?hKOi`^`kFOyX;C4KfC(U-(CX?Qh2!RTe!4raMP zjLaC7qL_tJ?^0!T9ibZe!m-x!u7o%2dHK{uYZ~#+vERAv-G-MQeYQ*~DILuFpu02u z(Qc)=bHqb4{fs+hdKa5etlX z3EW#vlbEZmWT>X{3WbgW)8~u=8IGuRc<=?KoDXg5V`jf%i^Ai`Cd9=&FH6d|N9uJl z>QhxtW_{}H10BF}GQNitk~V=GnB%NI1Xv-6-OeaI&Amg0s{4i4;HhP$6oc(L-}yHt zej63({`5VLSoIef7D3Z9BA5x<9$^x?PhV=6A@Nu=QiJo@*o?M@*6-UA@EdV@bQCR< z9>{N%eK;Y#U-@XDBBCT^j=?<|y|lsAWrXsf`t%4VT{)63oxQe^u_5NuOq{rsrRd}Z zOx&OldRtR4leEX#r$9`gPJtbHccH!JgZK&3x`tJ<_{kv)E?$LhZ?brv`Cc}X%cWC7<@6yqM2O&m(rB`1v-TiqcQmA5n$rbGJ4zs({=R-I%6}*^UQ)wi9WuzW%Ri%&5 zTdd%>+GvADk+4q#3s5qne99`MC)X_#=p1!d?(mcKDW=Efc31Jso)9M49O0OMeP&7~ zIm!vorpxBSbvSiczr^?WP&e&-!3GLxCIaR5?PGeLgwYT;lYu9UE8SwmXR(D?A^s`7 z^F4di(+oHh%$DZjj7F3_-Y9}k^uCKeSC?Jd7h>RZIDZ{wcbh|9w4)p$dmv7|gX1n& zkrYjSso~;~qMMzZUQ5AC+GUvuj@y{4E&&v(+OE-rS^J7iE~Yz1 zCQ9hAI&0X2_H8CKZMqo00MsxtwjvM{`AdSaZ8#Y?5zPI;a+0`JF52!uVwr@5Ufctm zm;5G%gI&utfGa~fv6!jHh9d1r3TYD zEOlrbyFnDl5J%sEO>HErK~WWE6I$_eXp!dbphDf zc;~oWDQylVa=y?q;c>SKzvZ~R(ZE2csFwf@10@zaZxFAYWaV9TFMh(QuqxNhPUav~ zzCkoe8-lM{?vh}kdM6EMCH(eLK3Rt{HsEJ+4fve=xAVq(cUc9fO9g1%zI+QfFOb@0 zePFU(&?Np9w3&xs)ZwPnQniC0%xs8(Hyx{7*Ot51*`9&2^h7@!nmzuF`3pl8ep#Ls z<)nk7ts}`9tGgaVJWC-3w;B~$juY6m+7XgfzjR4I=oV}E9LRGf4@cI>d3z%CYyURI z7lRn11g!D34zI6|26>?CELeIh?cEv_GCCMd5&g<=9-)pe8iXINQ}4IljYsQyfRz|( z<%w=HN4ZOQKJ9e7DOUhjA7A%-xcR%2`@1?U&u}rvqNc_8l9dUT_S`4TKJ;yezIdp} z?qDAfx6IHQ7YlO;EAP%d4U2O7jU`Uh(um!J`hJ_3&mmQez8AqWLQEftYJuMdCj27t zoV#b!c0d8al0j1yveY6)U#kPCh%OfL>P=%WE^LQew^k-QqZ{rjX6PqOd2K7>1^VUB z`&H@+vW=wH0UY>88nXCH@RKCY&?bR%8-53b{;@>|;uzDd5f`Z% zaSC<8OLh|b@ZnBET?My38fV9~ku2cPfcWZl7nW|pkQKfFlp@xRt+K0Tj@gdvVAQXP z?i45RNE4W#Kf0%Pp2=?hESkG}EK557cwn0r1{uWeG53_tb!9bg&R8R_d4s5N0poc- zr>1g0W~1oha&#@_irbqnL)jJ@Z=y7J3fCQ@qlr{6(%rSs2rpkS1QIU^tieJ-xq%nd ze-C=#{@E+Kzb&SJ2KM~9q^4Yk^jyXa#{;P)y`YsFvfzX?%V~r6GciP4eX~$vk{-C? zeipAYsMSp`Z~&-Jc*dt}m-A_w&cnb#~sIdbU{uCayd>nWKDxQ9!%R zTrgS~+>TqXgrN~e2&eeWdPhuHP2*#K1=f^B@UGZBjFq- z;mtKYyul9ZNuq89XEoeSg7^qld5^R}FHpbyRyk1pRPMDO$_Kqi*sp1hk&UpUKc!V! zJZpCQc!)@X+%qOQMP)CU@Qe|=IG@|DZ~o#j>TBFQxH>8rJ#0y`XO9ukvc)kJ6LY3$ zY}{(tri#32!LjVY^exC3Ky)i$NY6v^*>X5y8F65pYYjt^T^X<=zm=)Cr=>dcId>?I zR^0I?)=)|}ak7wG)&Ar#A&60BRp}&NWFPy7zt)yl3aObS?sB8fxfU9ayR{$#%S<#3 zrsbmi#bDSP)@w%iYS%&wyyIB??LJ0Q%aD^!XXYk3)tQt~x_YU?y4KVKl{MJ)KSz&f zV;tJ1smY(dLM6zZXVAWND3L|(W=q~HjA6OkjQ+kx-EuqtaaQQPaa=2_wwuW@G*1>e z_TqB;+1@yuHg}YYpEJL&Sw~jD3Xeb(Wo(-nz6`#gbP7?agYT>j_R%+^h{1>7W&cP{s8epLY9Ky6mU*u*!QBn zI7T~WL-_qj+~Hdpr}qtfjZmD;eI%H0SP~~ifqoD59-q)R9_Z zKr6OeoZT!Za#k5yo&CCmzLbGP*6ggJ@2QPhIY^aMXjVjQ@D+-E#qmAjuL{o@NCUDF zFy)B~$j`rK7Iz$L>_Jl~O?IJu2P3 zlHQ@${Jgcvp`PKu7p;6Fr=4y1?8nJ;=~jls^gx4&_O4+)C-OGc5)L0+R!&uI&qQID zhV&ZQ@+2={Z|2F%WoOu9Ljt}|0r;!e zCBx(uAViqOffibUBOVEH_IlV=57ZQSQ~Te5(wmsO+o_CCNAgCJzZ3ly84J34_Zf#SwQ9q8i41 zE>u$JuO$kQq*W6MDo$Eu?3jJAFUt&>Qy#K{lT-Vx z6=kceU^v`;vBRoFxQED5TL+=>QJ!iaxV^Z2r#%CaaEWgbs1ysT$&~sem&74AEC!;< zcGDH;CENBJ&hfI!@G5ezCK!sXzdB@m#a(q8KeX;U=yl6AujNz z{}huJlo1yL$DlAsi{12aS?CJ*{xuIIV4wf-V6E?L4E!5BWMQ0Zh4uel*xZJ}QQuPE z-u#DdD6hH6`;nVJ>O}8iuWxH>Z2vc>a;iFbm)nrbj$ps$6aa4TjfVZVZr7dK+E_E# z+S`ErJDM9i{HX815lax33Wl(;H~m|sF28cs+hB$%2pjyXgubo5p_%ay3!*?212bxX z@1{$rzY6~DK*{`5@oRm0>(9INQX61!{Ip#NymIM*g~u=D)UFH!NcfQ(AsZXVOPv5) zX?=4bI9>9;>HvTACiBNDt)x;_}tsJousTuWrG- zDUSM9|4|IRSy@PhdB$sAk4b;vRr>Nt@t3OB<#_*dl_7P>FGcFF3-DA?KBW00A<;2=*&`^P8}cEZW!GSO9(+{;-V@ zd%%C8KEDYD$pC#x%zb4bfVJ|kgWcG0-UNZT9@2=R|Wz+H2iJ2A29LV z#Dye7Qn~^KUqOIS)8EGZC9w+k*Sq|}?ze$| zKpJrq7cvL=dV^7%ejE4Cn@aE>Q}b^ELnd#EUUf703IedX{*S;n6P|BELgooxW`$lE z2;lhae}w#VCPR>N+{A=T+qyn;-Jk!Dn2`C1H{l?&Wv&mW{)_(?+|T+JGMPf)s$;=d z5J27Mw}F4!tB`@`mkAnI1_G4%{WjW<(=~4PFy#B)>ubz@;O|2J^F9yq(EB<9e9})4 z{&vv)&j^s`f|tKquM7lG$@pD_AFY;q=hx31Z;lY;$;aa>NbnT| kh{^d0>dn0}#6IV5TMroUdkH8gdhnkj_&0LYo6ArC2O!h?t^fc4 diff --git a/spring-webflux/.mvn/wrapper/maven-wrapper.properties b/spring-webflux/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index b573bb50d5..0000000000 --- a/spring-webflux/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip diff --git a/spring-webflux/mvnw b/spring-webflux/mvnw deleted file mode 100644 index 5bf251c077..0000000000 --- a/spring-webflux/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/spring-webflux/mvnw.cmd b/spring-webflux/mvnw.cmd deleted file mode 100644 index 019bd74d76..0000000000 --- a/spring-webflux/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/spring-webflux/pom.xml b/spring-webflux/pom.xml deleted file mode 100644 index fca75456f5..0000000000 --- a/spring-webflux/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - 4.0.0 - - com.example - spring-webflux - 0.0.1-SNAPSHOT - jar - - spring-webflux - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.3.RELEASE - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-webflux - - - - org.springframework.boot - spring-boot-starter-test - test - - - io.projectreactor - reactor-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/spring-webflux/src/main/java/com/example/springwebflux/client/SpringWebfluxClientApp.java b/spring-webflux/src/main/java/com/example/springwebflux/client/SpringWebfluxClientApp.java deleted file mode 100644 index 6546c53120..0000000000 --- a/spring-webflux/src/main/java/com/example/springwebflux/client/SpringWebfluxClientApp.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.example.springwebflux.client; - -import java.util.Collections; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.http.MediaType; -import org.springframework.web.reactive.function.client.WebClient; - -import com.example.springwebflux.events.Train; - -import reactor.core.Disposable; - -@SpringBootApplication -public class SpringWebfluxClientApp { - - @Bean - WebClient client() { - return WebClient.create("http://localhost:8080"); - } - - @Bean - Disposable demoClient(WebClient client) { - return client().get().uri("/trainschedule").accept(MediaType.TEXT_EVENT_STREAM).exchange() - .flatMapMany(response -> response.bodyToFlux(Train.class)).subscribe(System.out::println); - } - - public static void main(String[] args) { - SpringApplication app = new SpringApplication(SpringWebfluxClientApp.class); - app.setDefaultProperties(Collections.singletonMap("server.port", "7777")); - app.run(args); - - } - -} diff --git a/spring-webflux/src/main/java/com/example/springwebflux/events/Train.java b/spring-webflux/src/main/java/com/example/springwebflux/events/Train.java deleted file mode 100644 index 5d077550b1..0000000000 --- a/spring-webflux/src/main/java/com/example/springwebflux/events/Train.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.example.springwebflux.events; - -import java.util.Date; - -public class Train { - private String trainName; - private Date trainTime; - - public Train(String trainName, Date trainTime) { - this.trainName = trainName; - this.trainTime = trainTime; - } - - public String getTrainName() { - return trainName; - } - - public void setTrainName(String trainName) { - this.trainName = trainName; - } - - public Date getTrainTime() { - return trainTime; - } - - public void setTrainTime(Date trainTime) { - this.trainTime = trainTime; - } - -} diff --git a/spring-webflux/src/main/java/com/example/springwebflux/server/SpringWebfluxServerApp.java b/spring-webflux/src/main/java/com/example/springwebflux/server/SpringWebfluxServerApp.java deleted file mode 100644 index 562a8bd011..0000000000 --- a/spring-webflux/src/main/java/com/example/springwebflux/server/SpringWebfluxServerApp.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.example.springwebflux.server; - -import java.time.Duration; -import java.util.Date; -import java.util.stream.Stream; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RestController; - -import com.example.springwebflux.events.Train; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -@SpringBootApplication -@RestController -public class SpringWebfluxServerApp { - - @GetMapping("/trainschedule/{trainName}") - Mono getTrainSchByName(@PathVariable String trainName) { - return Mono.just(new Train(trainName, new Date())); - } - - @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE, value = "/trainschedule") - Flux getTrainSch() { - Flux trainFlux = Flux.fromStream(Stream.generate(() -> new Train("Heartbeat: ", new Date()))); - Flux durationFlux = Flux.interval(Duration.ofSeconds(1)); - return Flux.zip(trainFlux, durationFlux).map(t -> t.getT1()); - } - - public static void main(String[] args) { - SpringApplication.run(SpringWebfluxServerApp.class, args); - } -} diff --git a/spring-webflux/src/main/resources/application.properties b/spring-webflux/src/main/resources/application.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-webflux/src/test/java/com/example/springwebflux/SpringWebfluxApplicationTests.java b/spring-webflux/src/test/java/com/example/springwebflux/SpringWebfluxApplicationTests.java deleted file mode 100644 index 28934514e4..0000000000 --- a/spring-webflux/src/test/java/com/example/springwebflux/SpringWebfluxApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example.springwebflux; - -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 SpringWebfluxApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java b/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java deleted file mode 100644 index 1d12aedff4..0000000000 --- a/spring-webflux/src/test/java/com/example/springwebflux/server/SpringWebfluxServerAppTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.example.springwebflux.server; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.reactive.server.WebTestClient; - -@SpringBootTest -@RunWith(SpringRunner.class) -public class SpringWebfluxServerAppTest { - - private WebTestClient webTestClient; - - @Before - public void before() { - this.webTestClient = WebTestClient.bindToServer().baseUrl("http://localhost:8080").build(); - } - - @Test - public void whenGetTrainSchByNameIsCalled_ThenReturnScheduleForTheTrain() { - this.webTestClient.get() - .uri("/trainschedule/Heartbeat:") - .accept(MediaType.APPLICATION_JSON_UTF8) - .exchange() - .expectStatus().isOk(); - } - -} From fb0a6ab53977d540297bbe2cde1c2dbcb72e725f Mon Sep 17 00:00:00 2001 From: DOHA Date: Thu, 9 Aug 2018 15:37:13 +0300 Subject: [PATCH 150/298] upgrade and cleanup spring-thymeleaf --- spring-thymeleaf/pom.xml | 100 +++++++----------- .../thymeleaf/config/WebMVCConfig.java | 21 ++-- .../thymeleaf/config/WebMVCSecurity.java | 2 +- .../controller/FragmentsIntegrationTest.java | 27 +++-- 4 files changed, 64 insertions(+), 86 deletions(-) diff --git a/spring-thymeleaf/pom.xml b/spring-thymeleaf/pom.xml index c023dcdb5f..0926728aba 100644 --- a/spring-thymeleaf/pom.xml +++ b/spring-thymeleaf/pom.xml @@ -1,5 +1,5 @@ + 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-thymeleaf @@ -8,8 +8,9 @@ com.baeldung - parent-modules - 1.0.0-SNAPSHOT + parent-spring-5 + 0.0.1-SNAPSHOT + ../parent-spring-5 @@ -17,7 +18,7 @@ org.springframework spring-context - ${org.springframework-version} + ${spring.version} @@ -29,19 +30,38 @@ org.springframework spring-webmvc - ${org.springframework-version} + ${spring.version} + + + org.springframework.data + spring-data-commons + ${spring-data.version} + + + + javax.validation + validation-api + ${javax.validation-version} + + + org.hibernate.validator + hibernate-validator + ${hibernate-validator.version} + + org.springframework.security spring-security-web - ${springframework-security.version} + ${spring-security.version} org.springframework.security spring-security-config - ${springframework-security.version} + ${spring-security.version} + org.thymeleaf @@ -50,10 +70,9 @@ org.thymeleaf - thymeleaf-spring4 + thymeleaf-spring5 ${org.thymeleaf-version} - nz.net.ultraq.thymeleaf thymeleaf-layout-dialect @@ -64,60 +83,29 @@ thymeleaf-extras-java8time ${org.thymeleaf.extras-version} + javax.servlet javax.servlet-api - ${javax.servlet-version} + ${javax.servlet-api.version} provided - - - javax.validation - validation-api - ${javax.validation-version} - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - + org.springframework spring-test - ${org.springframework-version} + ${spring.version} test - org.springframework.security spring-security-test - ${springframework-security.version} + ${spring-security.version} test - - - - - - org.springframework.data - spring-data-commons - ${springFramework-data.version} - @@ -131,7 +119,7 @@ false - + org.codehaus.cargo cargo-maven2-plugin @@ -151,7 +139,7 @@ - + org.apache.tomcat.maven tomcat7-maven-plugin @@ -176,22 +164,14 @@ - - 4.3.4.RELEASE - 4.2.0.RELEASE - 2.0.7.RELEASE - 3.1.0 - + 2.0.9.RELEASE 3.0.9.RELEASE - 3.0.0.RELEASE - 2.1.2 - - 1.1.0.Final - 5.3.3.Final - 5.2.5.Final + 3.0.1.RELEASE + 2.3.0 + 2.0.1.Final + 6.0.11.Final - 2.6 1.6.1 2.2 diff --git a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCConfig.java b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCConfig.java index 2e76877199..34a59ea391 100644 --- a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCConfig.java +++ b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCConfig.java @@ -2,6 +2,9 @@ package com.baeldung.thymeleaf.config; import java.util.Locale; +import nz.net.ultraq.thymeleaf.LayoutDialect; +import nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy; + import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Bean; @@ -15,23 +18,20 @@ import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; import org.springframework.web.servlet.i18n.SessionLocaleResolver; -import org.thymeleaf.TemplateEngine; import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect; -import org.thymeleaf.spring4.SpringTemplateEngine; -import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; -import org.thymeleaf.spring4.view.ThymeleafViewResolver; +import org.thymeleaf.spring5.ISpringTemplateEngine; +import org.thymeleaf.spring5.SpringTemplateEngine; +import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; +import org.thymeleaf.spring5.view.ThymeleafViewResolver; import org.thymeleaf.templatemode.TemplateMode; import org.thymeleaf.templateresolver.ITemplateResolver; import com.baeldung.thymeleaf.formatter.NameFormatter; import com.baeldung.thymeleaf.utils.ArrayUtil; -import nz.net.ultraq.thymeleaf.LayoutDialect; -import nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy; - @Configuration @EnableWebMvc @ComponentScan({ "com.baeldung.thymeleaf" }) @@ -39,10 +39,11 @@ import nz.net.ultraq.thymeleaf.decorators.strategies.GroupingStrategy; * Java configuration file that is used for Spring MVC and Thymeleaf * configurations */ -public class WebMVCConfig extends WebMvcConfigurerAdapter implements ApplicationContextAware { +public class WebMVCConfig implements WebMvcConfigurer, ApplicationContextAware { private ApplicationContext applicationContext; + @Override public void setApplicationContext(ApplicationContext applicationContext) { this.applicationContext = applicationContext; } @@ -77,7 +78,7 @@ public class WebMVCConfig extends WebMvcConfigurerAdapter implements Application return resolver; } - private TemplateEngine templateEngine(ITemplateResolver templateResolver) { + private ISpringTemplateEngine templateEngine(ITemplateResolver templateResolver) { SpringTemplateEngine engine = new SpringTemplateEngine(); engine.addDialect(new LayoutDialect(new GroupingStrategy())); engine.addDialect(new Java8TimeDialect()); diff --git a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCSecurity.java b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCSecurity.java index 46bff38a3f..ea51ca3cd9 100644 --- a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCSecurity.java +++ b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/config/WebMVCSecurity.java @@ -27,7 +27,7 @@ public class WebMVCSecurity extends WebSecurityConfigurerAdapter { @Override protected void configure(final AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication().withUser("user1").password("user1Pass").authorities("ROLE_USER"); + auth.inMemoryAuthentication().withUser("user1").password("{noop}user1Pass").authorities("ROLE_USER"); } @Override diff --git a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/FragmentsIntegrationTest.java b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/FragmentsIntegrationTest.java index 5bc45d0004..c6158b76b1 100644 --- a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/FragmentsIntegrationTest.java +++ b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/FragmentsIntegrationTest.java @@ -1,10 +1,22 @@ package com.baeldung.thymeleaf.controller; +import static org.hamcrest.Matchers.containsString; +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import javax.servlet.Filter; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockHttpSession; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.RequestPostProcessor; import org.springframework.test.web.servlet.setup.MockMvcBuilders; @@ -15,21 +27,6 @@ import com.baeldung.thymeleaf.config.WebApp; import com.baeldung.thymeleaf.config.WebMVCConfig; import com.baeldung.thymeleaf.config.WebMVCSecurity; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import javax.servlet.Filter; - -import static org.hamcrest.Matchers.containsString; - @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class }) From e7485a181318f1cc0f2a54bdb4fe0d437594207f Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 9 Aug 2018 21:43:44 +0530 Subject: [PATCH 151/298] Task/bael 8020 (#4919) * BAEL-8020 Fix surefire configs of spring-5 projects -Removed surefire configurations from spring-5 projects * BAEL-8020 Fix surefire configs of spring-5 projects -Fixed surefire and junit configuration of spring-5-** projects -Fixed mavensurefire plugin to execute JUnit5 tests BAEL-8125 * BAEL-8020 Fix sure fire configs in spring5 project -Fixed dependency for junit-5 * BAEL-8020 Fix sure fire configs in spring5 project -Fixed dependency for junit5-migration * BAEL-8020 Fix surefire configs -Updated maven war plugin to 3.0.0 * BAEL-8020 Fix surefire configs -Upgraded surefire custom logger api version to 2.21.0 for all child projects * BAEL-8020 -Deleted empty test SpringBootMvcApplicationTests.java in spring-boot-mvc. -Renamed SpringBootMvcApplicationTests.java correct in spring-boot-vue * BAEL-8020 Fix surfire configs -Added junit vintage dependency to run junit4 tests --- core-java-sun/pom.xml | 2 +- core-java/pom.xml | 2 +- java-numbers/pom.xml | 2 +- jee-7/pom.xml | 2 +- mustache/pom.xml | 2 +- parent-boot-2/pom.xml | 107 ++++-------------- pom.xml | 45 +++++++- spring-5-mvc/pom.xml | 18 --- spring-5-reactive-client/pom.xml | 61 +--------- spring-5-reactive/pom.xml | 55 --------- spring-5-security/pom.xml | 16 --- ...nMemoryAuthControllerIntegrationTest.java} | 2 +- spring-5/pom.xml | 55 --------- .../SpringBootMvcApplicationTests.java | 16 --- ... => SpringBootMvcApplicationUnitTest.java} | 2 +- spring-boot/pom.xml | 1 + .../spring-cloud-connectors-heroku/pom.xml | 2 +- spring-reactive-kotlin/pom.xml | 3 - spring-rest-embedded-tomcat/pom.xml | 1 - testing-modules/junit-5/pom.xml | 6 +- testing-modules/junit5-migration/pom.xml | 6 +- testing-modules/test-containers/pom.xml | 2 +- 22 files changed, 83 insertions(+), 325 deletions(-) rename spring-5-security/src/test/java/com/baeldung/inmemory/{InMemoryAuthControllerTest.java => InMemoryAuthControllerIntegrationTest.java} (97%) delete mode 100644 spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java rename spring-boot-vue/src/test/java/com/baeldung/springbootmvc/{SpringBootMvcApplicationTests.java => SpringBootMvcApplicationUnitTest.java} (96%) diff --git a/core-java-sun/pom.xml b/core-java-sun/pom.xml index f489f3b030..7292335232 100644 --- a/core-java-sun/pom.xml +++ b/core-java-sun/pom.xml @@ -303,7 +303,7 @@ 1.7.0 - 2.19.1 + 2.21.0 1.8.0 3.0.2 diff --git a/core-java/pom.xml b/core-java/pom.xml index b83cb478d4..3f44851f97 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -530,7 +530,7 @@ 3.10.0 - 2.19.1 + 2.21.0 4.3.4.RELEASE 1.5.8.RELEASE diff --git a/java-numbers/pom.xml b/java-numbers/pom.xml index a9fb556517..bf4d3e8792 100644 --- a/java-numbers/pom.xml +++ b/java-numbers/pom.xml @@ -156,7 +156,7 @@ 1.19 1.19 - 2.19.1 + 2.21.0 3.0.0-M1 3.0.2 diff --git a/jee-7/pom.xml b/jee-7/pom.xml index d0246f650a..fbf102185d 100644 --- a/jee-7/pom.xml +++ b/jee-7/pom.xml @@ -418,7 +418,7 @@ 1.0.0.Final 2.6 4.2.3.RELEASE - 2.17 + 2.21.0 1.1.2 2.4 2.2.14 diff --git a/mustache/pom.xml b/mustache/pom.xml index 6012c9a15a..d385246182 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -153,7 +153,7 @@ 3.7.0 - 2.19.1 + 2.21.0 0.8 3.3.7 1.8 diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index ab6162a5a5..2fc46e4c28 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -8,18 +8,27 @@ Parent for all Spring Boot 2 modules - org.springframework.boot - spring-boot-starter-parent - 2.0.1.RELEASE - + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-dependencies + 2.0.1.RELEASE + pom + import + + + io.rest-assured rest-assured - ${rest-assured.version} - + org.springframework.boot spring-boot-starter-test @@ -27,79 +36,16 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - 3 - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LongRunningUnitTest.java - **/*ManualTest.java - **/*LiveTest.java - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${maven.compiler.source} - ${maven.compiler.target} - - - - - + + + + org.springframework.boot + spring-boot-maven-plugin + 2.0.1.RELEASE + + + - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - **/*LiveTest.java - **/AutoconfigurationTest.java - **/*UnitTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - */EthControllerTestOne.java - **/*EntryPointsTest.java - - - - - - - json - - - - - - thin-jar @@ -122,13 +68,8 @@ - UTF-8 - UTF-8 - 1.8 3.1.0 - 1.8 - 1.8 1.0.11.RELEASE diff --git a/pom.xml b/pom.xml index a9aaff3e22..978e27f055 100644 --- a/pom.xml +++ b/pom.xml @@ -43,9 +43,15 @@ org.junit.jupiter junit-jupiter-engine - ${junit.jupiter.version} + ${junit-jupiter.version} test + + org.junit.jupiter + junit-jupiter-api + ${junit-jupiter.version} + test + org.hamcrest hamcrest-core @@ -70,6 +76,14 @@ ${mockito.version} test + + org.apache.maven.surefire + surefire-logger-api + ${maven-surefire-plugin.version} + + test + true + @@ -98,6 +112,23 @@ **/*LiveTest.java + + + org.junit.platform + junit-platform-surefire-provider + ${junit-platform.version} + + + org.junit.jupiter + junit-jupiter-engine + ${junit-jupiter.version} + + + org.junit.vintage + junit-vintage-engine + ${junit-jupiter.version} + + org.apache.maven.plugins @@ -187,6 +218,10 @@ + + maven-war-plugin + ${maven-war-plugin.version} + @@ -406,6 +441,7 @@ spring-4 spring-5 spring-5-reactive + spring-5-reactive-client spring-5-mvc spring-5-security spring-activiti @@ -663,6 +699,7 @@ spring-4 spring-5 spring-5-reactive + spring-5-reactive-client spring-5-mvc spring-5-security spring-activiti @@ -942,6 +979,7 @@ spark-java spring-4 spring-5-reactive + spring-5-reactive-client spring-5-mvc spring-5-security spring-activiti @@ -1220,7 +1258,7 @@ 2.19.1 2.5 1.4 - 2.6 + 3.0.0 3.1.0 1.2 2.3.1 @@ -1228,7 +1266,8 @@ 1.2 2.5.0 1.3 - 5.0.2 + 1.2.0 + 5.2.0 0.3.1 2.5.1 0.0.1 diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml index 0408550c79..2d28eb741e 100644 --- a/spring-5-mvc/pom.xml +++ b/spring-5-mvc/pom.xml @@ -82,11 +82,6 @@ spring-boot-starter-test test - - junit - junit - test - com.jayway.restassured rest-assured @@ -137,19 +132,6 @@ - - org.apache.maven.plugins - maven-surefire-plugin - - - false - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index 9388ee83c1..f60832d545 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -11,8 +11,8 @@ spring 5 sample project about new features - parent-boot-2 com.baeldung + parent-boot-2 0.0.1-SNAPSHOT ../parent-boot-2 @@ -43,20 +43,6 @@ javax.json.bind javax.json.bind-api - - - - - - - - - - - - - - org.apache.geronimo.specs geronimo-json_1.1_spec @@ -102,28 +88,6 @@ 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 - - org.projectlombok lombok @@ -145,22 +109,6 @@ JAR - - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - @@ -186,13 +134,6 @@ - UTF-8 - UTF-8 - 1.8 - 1.0.0 - 5.0.0 - 2.20 - 5.0.2.RELEASE 1.0.1.RELEASE 1.1.3 1.0 diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml index acc82be0d1..f89fd45581 100644 --- a/spring-5-reactive/pom.xml +++ b/spring-5-reactive/pom.xml @@ -43,20 +43,6 @@ org.springframework.boot spring-boot-starter-actuator - - - - - - - - - - - - - - org.projectlombok lombok @@ -100,28 +86,6 @@ ${commons-collections4.version} 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 - org.apache.commons commons-lang3 @@ -159,29 +123,10 @@ JAR - - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - - 1.0.0 - 5.0.2 - 2.20 1.0.1.RELEASE 2.1.12 1.1.3 diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index 7024e6f873..ebcd6556a4 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -76,22 +76,6 @@ JAR - - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - diff --git a/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java b/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerIntegrationTest.java similarity index 97% rename from spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java rename to spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerIntegrationTest.java index 7a8ea7b248..9d08cb7cfa 100644 --- a/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerTest.java +++ b/spring-5-security/src/test/java/com/baeldung/inmemory/InMemoryAuthControllerIntegrationTest.java @@ -14,7 +14,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = InMemoryAuthApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class InMemoryAuthControllerTest { +public class InMemoryAuthControllerIntegrationTest { @Autowired private TestRestTemplate template; diff --git a/spring-5/pom.xml b/spring-5/pom.xml index e37833ff94..9f60b8a364 100644 --- a/spring-5/pom.xml +++ b/spring-5/pom.xml @@ -41,18 +41,6 @@ javax.json.bind javax.json.bind-api - - - - - - - - - - - - org.apache.geronimo.specs geronimo-json_1.1_spec @@ -85,45 +73,21 @@ org.springframework spring-test - - org.springframework.boot - spring-boot-starter-test - test - org.springframework.security spring-security-test test - org.apache.commons commons-collections4 ${commons-collections4.version} 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 - org.springframework.restdocs @@ -147,22 +111,6 @@ JAR - - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - org.asciidoctor asciidoctor-maven-plugin @@ -190,9 +138,6 @@ - 1.0.0 - 5.0.2.RELEASE - 1.0.1.RELEASE 1.0 1.5.6 4.1 diff --git a/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java b/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java deleted file mode 100644 index 1add635ed8..0000000000 --- a/spring-boot-mvc/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.springbootmvc; - -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 SpringBootMvcApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java b/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationUnitTest.java similarity index 96% rename from spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java rename to spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationUnitTest.java index 6364351eb3..567b239ed2 100644 --- a/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationTests.java +++ b/spring-boot-vue/src/test/java/com/baeldung/springbootmvc/SpringBootMvcApplicationUnitTest.java @@ -16,7 +16,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc -public class SpringBootMvcApplicationTests { +public class SpringBootMvcApplicationUnitTest { @Autowired private MockMvc mockMvc; diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index ef30600d45..c0e386a679 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -222,6 +222,7 @@ 3.6.0 3.2.0 18.0 + 1.2.0 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml index 875aa5ceaa..f25c190d56 100644 --- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml +++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml @@ -79,7 +79,7 @@ Brixton.SR7 - 2.19.1 + 2.21.0 9.4-1201-jdbc4 diff --git a/spring-reactive-kotlin/pom.xml b/spring-reactive-kotlin/pom.xml index 8eafe9f217..f2f0dc58ec 100644 --- a/spring-reactive-kotlin/pom.xml +++ b/spring-reactive-kotlin/pom.xml @@ -19,9 +19,6 @@ - UTF-8 - UTF-8 - 1.8 1.2.41 diff --git a/spring-rest-embedded-tomcat/pom.xml b/spring-rest-embedded-tomcat/pom.xml index edccbb17d5..1a1adce6db 100644 --- a/spring-rest-embedded-tomcat/pom.xml +++ b/spring-rest-embedded-tomcat/pom.xml @@ -85,7 +85,6 @@ - 2.19.1 2.9.2 1.8 1.8 diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index c60cc00c2c..93365264ac 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -118,14 +118,14 @@ - 5.1.0 - 1.1.0 + 5.2.0 + 1.2.0 5.2.0 2.8.2 1.4.196 2.8.9 1.7.4 - 2.19.1 + 2.21.0 1.6.0 5.0.1.RELEASE diff --git a/testing-modules/junit5-migration/pom.xml b/testing-modules/junit5-migration/pom.xml index ae46b479bb..9d9d418774 100644 --- a/testing-modules/junit5-migration/pom.xml +++ b/testing-modules/junit5-migration/pom.xml @@ -80,10 +80,10 @@ - 5.1.0 - 1.1.0 + 5.2.0 + 1.2.0 5.2.0 - 2.19.1 + 2.21.0 1.6.0 diff --git a/testing-modules/test-containers/pom.xml b/testing-modules/test-containers/pom.xml index 2a8f434040..0ace187555 100644 --- a/testing-modules/test-containers/pom.xml +++ b/testing-modules/test-containers/pom.xml @@ -109,7 +109,7 @@ 1.7.2 42.2.2 3.12.0 - 2.19.1 + 2.21.0 From e80c93b72badd46e9f1ce8870d494ca7eb1beba1 Mon Sep 17 00:00:00 2001 From: Adrian Precub Date: Fri, 10 Aug 2018 07:40:47 +0300 Subject: [PATCH 152/298] BAEL-2039: chaos monkey for spring boot (#4889) --- spring-boot/pom.xml | 7 +++++ .../chaosmonkey/SpringBootChaosMonkeyApp.java | 15 +++++++++ .../controller/PermissionsController.java | 25 +++++++++++++++ .../service/PermissionsService.java | 17 ++++++++++ .../src/main/resources/application.properties | 31 +++++++++++++++++++ 5 files changed, 95 insertions(+) create mode 100644 spring-boot/src/main/java/com/baeldung/chaosmonkey/SpringBootChaosMonkeyApp.java create mode 100644 spring-boot/src/main/java/com/baeldung/chaosmonkey/controller/PermissionsController.java create mode 100644 spring-boot/src/main/java/com/baeldung/chaosmonkey/service/PermissionsService.java diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index c0e386a679..3a43dbd828 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -149,6 +149,12 @@ rome ${rome.version} + + + de.codecentric + chaos-monkey-spring-boot + ${chaos.monkey.version} + @@ -219,6 +225,7 @@ 8.5.11 2.4.1.Final 1.9.0 + 2.0.0 3.6.0 3.2.0 18.0 diff --git a/spring-boot/src/main/java/com/baeldung/chaosmonkey/SpringBootChaosMonkeyApp.java b/spring-boot/src/main/java/com/baeldung/chaosmonkey/SpringBootChaosMonkeyApp.java new file mode 100644 index 0000000000..16a0aea13b --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/chaosmonkey/SpringBootChaosMonkeyApp.java @@ -0,0 +1,15 @@ +package com.baeldung.chaosmonkey; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * Created by adi on 8/2/18. + */ +@SpringBootApplication(scanBasePackages = { "com.baeldung.chaosmonkey" }) +public class SpringBootChaosMonkeyApp { + + public static void main(String[] args) { + SpringApplication.run(SpringBootChaosMonkeyApp.class, args); + } +} diff --git a/spring-boot/src/main/java/com/baeldung/chaosmonkey/controller/PermissionsController.java b/spring-boot/src/main/java/com/baeldung/chaosmonkey/controller/PermissionsController.java new file mode 100644 index 0000000000..6ceb117f4e --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/chaosmonkey/controller/PermissionsController.java @@ -0,0 +1,25 @@ +package com.baeldung.chaosmonkey.controller; + +import com.baeldung.chaosmonkey.service.PermissionsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * Created by adi on 8/2/18. + */ +@RestController +@RequestMapping("/permissions") +public class PermissionsController { + + @Autowired private PermissionsService permissionsService; + + @GetMapping + public List getAllPermissions() { + return permissionsService.getAllPermissions(); + } + +} diff --git a/spring-boot/src/main/java/com/baeldung/chaosmonkey/service/PermissionsService.java b/spring-boot/src/main/java/com/baeldung/chaosmonkey/service/PermissionsService.java new file mode 100644 index 0000000000..435e262901 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/chaosmonkey/service/PermissionsService.java @@ -0,0 +1,17 @@ +package com.baeldung.chaosmonkey.service; + +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; + +/** + * Created by adi on 8/2/18. + */ +@Service +public class PermissionsService { + + public List getAllPermissions() { + return Arrays.asList("CREATE", "READ", "UPDATE", "DELETE"); + } +} diff --git a/spring-boot/src/main/resources/application.properties b/spring-boot/src/main/resources/application.properties index 8c02e528ab..629e880940 100644 --- a/spring-boot/src/main/resources/application.properties +++ b/spring-boot/src/main/resources/application.properties @@ -43,3 +43,34 @@ servlet.mapping=/dispatcherExampleURL #spring.banner.image.invert= //TODO contactInfoType=email + +#chaos monkey for spring boot props +management.endpoint.chaosmonkey.enabled=true +management.endpoint.chaosmonkeyjmx.enabled=true + +spring.profiles.active=chaos-monkey +#Determine whether should execute or not +chaos.monkey.enabled=true +#How many requests are to be attacked. 1: attack each request; 5: each 5th request is attacked +chaos.monkey.assaults.level=1 +#Minimum latency in ms added to the request +chaos.monkey.assaults.latencyRangeStart=3000 +#Maximum latency in ms added to the request +chaos.monkey.assaults.latencyRangeEnd=15000 +#Latency assault active +chaos.monkey.assaults.latencyActive=true +#Exception assault active +chaos.monkey.assaults.exceptionsActive=false +#AppKiller assault active +chaos.monkey.assaults.killApplicationActive=false +#Controller watcher active +chaos.monkey.watcher.controller=false +#RestController watcher active +chaos.monkey.watcher.restController=false +#Service watcher active +chaos.monkey.watcher.service=true +#Repository watcher active +chaos.monkey.watcher.repository=false +#Component watcher active +chaos.monkey.watcher.component=false + From 52e055e770341f98e62563fc84311b2660cfaa37 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Fri, 10 Aug 2018 10:16:38 +0530 Subject: [PATCH 153/298] BAEL-8141 Can we remove some of the Spring milestone/snapshot repos from modules? (#4941) BAEL-8141 --- .../spring-data-dynamodb/pom.xml | 34 ------------------- spring-5-mvc/pom.xml | 24 +------------ spring-5-reactive-client/pom.xml | 21 ------------ spring-5-security/pom.xml | 21 ------------ spring-cloud/spring-cloud-gateway/pom.xml | 23 ++----------- .../spring-cloud-ribbon-client/pom.xml | 19 ----------- spring-security-openid/pom.xml | 21 ------------ 7 files changed, 3 insertions(+), 160 deletions(-) diff --git a/persistence-modules/spring-data-dynamodb/pom.xml b/persistence-modules/spring-data-dynamodb/pom.xml index 9f2b63c17c..e5bd78d208 100644 --- a/persistence-modules/spring-data-dynamodb/pom.xml +++ b/persistence-modules/spring-data-dynamodb/pom.xml @@ -177,46 +177,12 @@ - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - dynamodb-local DynamoDB Local Release Repository ${dynamodblocal.repository.url} - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml index 2d28eb741e..f5346a0fa0 100644 --- a/spring-5-mvc/pom.xml +++ b/spring-5-mvc/pom.xml @@ -134,31 +134,9 @@ - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - + 2.9.0 1.1.2 - diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index f60832d545..f2f7dd1729 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -112,27 +112,6 @@ - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - 1.0.1.RELEASE 1.1.3 diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index ebcd6556a4..1435019c24 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -79,25 +79,4 @@ - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - \ No newline at end of file diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml index db57373b6f..8babbff274 100644 --- a/spring-cloud/spring-cloud-gateway/pom.xml +++ b/spring-cloud/spring-cloud-gateway/pom.xml @@ -28,7 +28,7 @@ org.springframework.cloud - spring-cloud-starter-gateway + spring-cloud-starter org.springframework.boot @@ -54,27 +54,8 @@ - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - 2.0.0.RC2 + 2.0.1.RELEASE 6.0.2.Final diff --git a/spring-cloud/spring-cloud-ribbon-client/pom.xml b/spring-cloud/spring-cloud-ribbon-client/pom.xml index eb8398848c..fd69dbe043 100644 --- a/spring-cloud/spring-cloud-ribbon-client/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-client/pom.xml @@ -38,25 +38,6 @@ - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - Brixton.SR7 diff --git a/spring-security-openid/pom.xml b/spring-security-openid/pom.xml index 9c498f3700..a2c0b6b119 100644 --- a/spring-security-openid/pom.xml +++ b/spring-security-openid/pom.xml @@ -51,27 +51,6 @@ - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - 2.2.1.RELEASE 1.0.9.RELEASE From 711a352d7fab7ebc57884e57902b20727b303ff6 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Fri, 10 Aug 2018 09:31:34 +0200 Subject: [PATCH 154/298] merge --- .../java/com/baeldung/reactive/util/CpuUtils.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 spring-5-reactive/src/main/java/com/baeldung/reactive/util/CpuUtils.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/util/CpuUtils.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/util/CpuUtils.java new file mode 100644 index 0000000000..8d16434920 --- /dev/null +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/util/CpuUtils.java @@ -0,0 +1,15 @@ +package com.baeldung.reactive.util; + +import com.sun.management.OperatingSystemMXBean; + +import java.lang.management.ManagementFactory; + +public class CpuUtils { + + private static OperatingSystemMXBean operatingSystemMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); + + static Double getUsage() { + return (operatingSystemMXBean.getSystemCpuLoad() / operatingSystemMXBean.getAvailableProcessors()) * 100; + } + +} From 9ea9b7ae72243a02f9d59adc8c398a37ba77d24b Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Fri, 10 Aug 2018 10:05:51 +0200 Subject: [PATCH 155/298] BAEL-2056 --- .../java/collections/CollectionsEmpty.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 core-java-collections/src/test/java/org/baeldung/java/collections/CollectionsEmpty.java diff --git a/core-java-collections/src/test/java/org/baeldung/java/collections/CollectionsEmpty.java b/core-java-collections/src/test/java/org/baeldung/java/collections/CollectionsEmpty.java new file mode 100644 index 0000000000..09ecebe47b --- /dev/null +++ b/core-java-collections/src/test/java/org/baeldung/java/collections/CollectionsEmpty.java @@ -0,0 +1,26 @@ +package org.baeldung.java.collections; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.junit.Assert; +import org.junit.Test; + +class CollectionsEmpty { + + @Test + public void givenArrayList_whenAddingElement_addsNewElement() { + ArrayList mutableList = new ArrayList<>(); + mutableList.add("test"); + + Assert.assertEquals(mutableList.size(), 1); + Assert.assertEquals(mutableList.get(0), "test"); + } + + @Test(expected = UnsupportedOperationException.class) + public void givenCollectionsEmptyList_whenAddingElement_throwsUnsupportedOperationException() { + List immutableList = Collections.emptyList(); + immutableList.add("test"); + } + +} From 2a3c5b8eac0337782fcf7636fe6167cffd58605e Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Fri, 10 Aug 2018 13:55:58 +0200 Subject: [PATCH 156/298] BAEL-2056 (#4945) --- .../baeldung/collection/CollectionsEmpty.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 core-java-collections/src/test/java/com/baeldung/collection/CollectionsEmpty.java diff --git a/core-java-collections/src/test/java/com/baeldung/collection/CollectionsEmpty.java b/core-java-collections/src/test/java/com/baeldung/collection/CollectionsEmpty.java new file mode 100644 index 0000000000..86a262107d --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/collection/CollectionsEmpty.java @@ -0,0 +1,26 @@ +package com.baeldung.collection; + +import java.util.List; +import java.util.ArrayList; +import java.util.Collections; +import org.junit.Assert; +import org.junit.Test; + +public class CollectionsEmpty { + + @Test + public void givenArrayList_whenAddingElement_addsNewElement() { + ArrayList mutableList = new ArrayList<>(); + mutableList.add("test"); + + Assert.assertEquals(mutableList.size(), 1); + Assert.assertEquals(mutableList.get(0), "test"); + } + + @Test(expected = UnsupportedOperationException.class) + public void givenCollectionsEmptyList_whenAddingElement_throwsUnsupportedOperationException() { + List immutableList = Collections.emptyList(); + immutableList.add("test"); + } + +} \ No newline at end of file From 2b229332b966a006d0f2edb3b7d165a0510a08ff Mon Sep 17 00:00:00 2001 From: k0l0ssus Date: Fri, 10 Aug 2018 08:24:46 -0400 Subject: [PATCH 157/298] Add files via upload --- jersey-client-rx/pom.xml | 2 +- .../samples/jerseyrx/ClientOrchestration.java | 82 +++++++++---------- .../samples/jerseyrx/EmployeeDTO.java | 33 ++++++++ .../jerseyrx/ClientOrchestrationTest.java | 63 ++++++++------ 4 files changed, 107 insertions(+), 73 deletions(-) diff --git a/jersey-client-rx/pom.xml b/jersey-client-rx/pom.xml index fb7494fab1..4e35be31b4 100644 --- a/jersey-client-rx/pom.xml +++ b/jersey-client-rx/pom.xml @@ -40,7 +40,7 @@ org.glassfish.jersey.media jersey-media-json-jackson - 2.22 + 2.25 com.fasterxml.jackson.jaxrs diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java index 6e184876cb..f2687c8c8d 100644 --- a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java +++ b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java @@ -1,7 +1,6 @@ package com.baeldung.samples.jerseyrx; import io.reactivex.Flowable; -import io.reactivex.disposables.Disposable; import java.util.LinkedList; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -27,28 +26,22 @@ import rx.Observable; * @author baeldung */ public class ClientOrchestration { - + Client client = ClientBuilder.newClient(); + WebTarget userIdService = client.target("http://localhost:8080/serviceA/id"); WebTarget nameService = client.target("http://localhost:8080/serviceA/{empId}/name"); WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/hash"); + + LinkedList failures = new LinkedList<>(); - + Logger logger = Logger.getLogger("ClientOrchestrator"); - - public static void main(String[] args) { - ClientOrchestration orchestrator = new ClientOrchestration(); - - orchestrator.callBackOrchestrate(); - orchestrator.rxOrchestrate(); - orchestrator.observableJavaOrchestrate(); - orchestrator.flowableJavaOrchestrate(); - - } - + public void callBackOrchestrate() { logger.info("Orchestrating with the pyramid of doom"); - userIdService.request().accept(MediaType.APPLICATION_JSON) + userIdService.request() + .accept(MediaType.APPLICATION_JSON) .async() .get(new InvocationCallback() { @Override @@ -61,7 +54,7 @@ public class ClientOrchestration { nameService.resolveTemplate("empId", id).request() .async() .get(new InvocationCallback() { - + @Override public void completed(String response) { completionTracker.countDown(); @@ -70,7 +63,7 @@ public class ClientOrchestration { public void completed(String response) { logger.log(Level.INFO, "[InvocationCallback] The hash output {0}", response); } - + @Override public void failed(Throwable throwable) { completionTracker.countDown(); @@ -79,7 +72,7 @@ public class ClientOrchestration { } }); } - + @Override public void failed(Throwable throwable) { completionTracker.countDown(); @@ -88,7 +81,7 @@ public class ClientOrchestration { } }); }); - + try { if (!completionTracker.await(10, TimeUnit.SECONDS)) { //wait for inner requests to complete in 10 seconds logger.warning("[InvocationCallback] Some requests didn't complete within the timeout"); @@ -97,9 +90,9 @@ public class ClientOrchestration { failures.add(ex); Logger.getLogger(ClientOrchestration.class.getName()).log(Level.SEVERE, null, ex); } - + } - + @Override public void failed(Throwable throwable) { failures.add(throwable); @@ -107,7 +100,7 @@ public class ClientOrchestration { } }); } - + public void rxOrchestrate() { logger.info("Orchestrating with a CompletionStage"); CompletionStage userIdStage = userIdService.request().accept(MediaType.APPLICATION_JSON) @@ -119,7 +112,7 @@ public class ClientOrchestration { logger.warning("[CompletionStage] An error has occurred"); return null; }); - + userIdStage.thenAcceptAsync(empIdDto -> { logger.info("[CompletionStage] Got all the IDs " + empIdDto.getEmpIds()); empIdDto.getEmpIds().stream().forEach((Long id) -> { @@ -128,7 +121,7 @@ public class ClientOrchestration { .rx() .get(String.class) .toCompletableFuture(); - + completable.thenAccept((String userName) -> { hashService.resolveTemplate("comboIDandName", userName + id) .request() @@ -141,24 +134,24 @@ public class ClientOrchestration { logger.log(Level.WARNING, "[CompletionStage] Hash computation failed for {0}", id); return null; }); - + }); - + }); }); - + } - + public void observableJavaOrchestrate() { - + logger.info("Orchestrating with Observables"); - Observable userIdObservable = userIdService.register(RxObservableInvokerProvider.class).request() + Observable observableUserIdService = userIdService.register(RxObservableInvokerProvider.class).request() .accept(MediaType.APPLICATION_JSON) .rx(RxObservableInvoker.class) .get(new GenericType() { - }); - - userIdObservable.subscribe((EmployeeDTO empIdList) -> { + }).asObservable(); + + observableUserIdService.subscribe((EmployeeDTO empIdList) -> { logger.info("[Observable] Got all the IDs " + empIdList.getEmpIds()); Observable.from(empIdList.getEmpIds()).subscribe(id -> nameService.register(RxObservableInvokerProvider.class) @@ -171,8 +164,7 @@ public class ClientOrchestration { failures.add(throwable); logger.log(Level.WARNING, " [Observable] An error has occurred in the username request step {0}", throwable.getMessage()); }) - .subscribe(userName -> hashService - .register(RxObservableInvokerProvider.class) + .subscribe(userName -> hashService.register(RxObservableInvokerProvider.class) .resolveTemplate("comboIDandName", userName + id) .request() .rx(RxObservableInvoker.class) @@ -184,21 +176,21 @@ public class ClientOrchestration { }) .subscribe(hashValue -> logger.log(Level.INFO, "[Observable] The hash output {0}", hashValue)))); }); - + } - + public void flowableJavaOrchestrate() { - - logger.info("Orchestrating with Flowable"); - Flowable userIdObservable = userIdService.register(RxFlowableInvokerProvider.class) + + Flowable userIdFlowable = userIdService.register(RxFlowableInvokerProvider.class) .request() .rx(RxFlowableInvoker.class) .get(new GenericType() { }); - - Disposable subscribe = userIdObservable.subscribe((EmployeeDTO dto) -> { + + userIdFlowable.subscribe((EmployeeDTO dto) -> { + logger.info("Orchestrating with Flowable"); List listOfIds = dto.getEmpIds(); - Observable.from(listOfIds).map(id + Flowable.just(listOfIds).subscribe(id -> nameService.register(RxFlowableInvokerProvider.class) .resolveTemplate("empId", id) .request() @@ -219,7 +211,7 @@ public class ClientOrchestration { }) .subscribe(hashValue -> logger.log(Level.INFO, "[Flowable] The hash output {0}", hashValue)))); }); - + } - + } diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java index a161448bb7..3a818f979e 100644 --- a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java +++ b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java @@ -1,6 +1,7 @@ package com.baeldung.samples.jerseyrx; import java.util.List; +import java.util.Objects; /** * @@ -18,4 +19,36 @@ public class EmployeeDTO { this.empIds = empIds; } + @Override + public int hashCode() { + int hash = 5; + hash = 59 * hash + Objects.hashCode(this.empIds); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final EmployeeDTO other = (EmployeeDTO) obj; + if (!Objects.equals(this.empIds, other.empIds)) { + return false; + } + return true; + } + + @Override + public String toString() { + return "EmployeeDTO{" + "empIds=" + empIds + '}'; + } + + + } diff --git a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java index 2158f29a61..6df0e1c110 100644 --- a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java +++ b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java @@ -1,15 +1,18 @@ package com.baeldung.samples.jerseyrx; -import com.github.tomakehurst.wiremock.WireMockServer; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.configureFor; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import junit.framework.Assert; -import org.junit.After; +import com.github.tomakehurst.wiremock.junit.WireMockRule; +import java.util.LinkedList; +import java.util.logging.Logger; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; +import static junit.framework.Assert.assertTrue; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; /** @@ -17,53 +20,59 @@ import org.junit.Test; * @author baeldung */ public class ClientOrchestrationTest { - + + Client client = ClientBuilder.newClient(); + + WebTarget userIdService = client.target("http://localhost:8080/serviceA/id"); + WebTarget nameService = client.target("http://localhost:8080/serviceA/{empId}/name"); + WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/hash"); + + LinkedList failures = new LinkedList<>(); + + Logger logger = Logger.getLogger("ClientOrchestrator"); + ClientOrchestration orchestrator = new ClientOrchestration(); - + String jsonIdList = "{\"empIds\":[1,2,3,4,5,6]}"; - + String[] nameList = new String[]{"n/a", "Thor", "Hulk", "BlackWidow", "BlackPanther", "TheTick", "Hawkeye"}; - + String[] hashResultList = new String[]{"roht1", "kluh2", "WodiwKcalb3", "RehtnapKclab4", "kciteht5", "eyekwah6"}; - - WireMockServer wireMockServer = new WireMockServer(); - + + @Rule + public WireMockRule wireMockServer = new WireMockRule(); + @Before public void setup() { - wireMockServer.start(); - configureFor("localhost", 8080); + stubFor(get(urlEqualTo("/serviceA/id")).willReturn(aResponse().withBody(jsonIdList).withHeader("Content-Type", "application/json"))); - + stubFor(get(urlEqualTo("/serviceA/1/name")).willReturn(aResponse().withBody(nameList[1]))); stubFor(get(urlEqualTo("/serviceA/2/name")).willReturn(aResponse().withBody(nameList[2]))); stubFor(get(urlEqualTo("/serviceA/3/name")).willReturn(aResponse().withBody(nameList[3]))); stubFor(get(urlEqualTo("/serviceA/4/name")).willReturn(aResponse().withBody(nameList[4]))); stubFor(get(urlEqualTo("/serviceA/5/name")).willReturn(aResponse().withBody(nameList[5]))); stubFor(get(urlEqualTo("/serviceA/6/name")).willReturn(aResponse().withBody(nameList[6]))); - + stubFor(get(urlEqualTo("/serviceA/Thor1/hash")).willReturn(aResponse().withBody(hashResultList[0]))); stubFor(get(urlEqualTo("/serviceA/Hulk2/hash")).willReturn(aResponse().withBody(hashResultList[1]))); stubFor(get(urlEqualTo("/serviceA/BlackWidow3/hash")).willReturn(aResponse().withBody(hashResultList[2]))); stubFor(get(urlEqualTo("/serviceA/BlackPanther4/hash")).willReturn(aResponse().withBody(hashResultList[3]))); stubFor(get(urlEqualTo("/serviceA/TheTick5/hash")).willReturn(aResponse().withBody(hashResultList[4]))); stubFor(get(urlEqualTo("/serviceA/Hawkeye6/hash")).willReturn(aResponse().withBody(hashResultList[5]))); - + } - + @Test public void hits() { - + orchestrator.callBackOrchestrate(); orchestrator.rxOrchestrate(); orchestrator.observableJavaOrchestrate(); orchestrator.flowableJavaOrchestrate(); - - Assert.assertTrue(orchestrator.failures.isEmpty()); + + assertTrue(orchestrator.failures.isEmpty()); } - - @After - public void tearDown() { - - } - + + } From dccf0c3b0bbc77536666ecba3554d7c29ca1ecee Mon Sep 17 00:00:00 2001 From: mherbaghinyan Date: Fri, 10 Aug 2018 17:50:13 +0400 Subject: [PATCH 158/298] bring back dependencies --- .../performance/CollectionsBenchmark.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java index 64cff16cd7..ff1e8d7953 100644 --- a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java +++ b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java @@ -1,6 +1,9 @@ package com.baeldung.performance; 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.HashSet; @@ -15,14 +18,14 @@ public class CollectionsBenchmark { private Set employeeSet = new HashSet<>(); private List employeeList = new ArrayList<>(); - private final long m_count = 16; + private long iterations = 10000; private Employee employee = new Employee(100L, "Harry"); - @Setup(Level.Invocation) + @Setup(Level.Trial) public void setUp() { - for (long ii = 0; ii < m_count; ii++) { + for (long ii = 0; ii < iterations; ii++) { employeeSet.add(new Employee(ii, "John")); employeeList.add(new Employee(ii, "John")); @@ -35,19 +38,26 @@ public class CollectionsBenchmark { @Benchmark @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.MINUTES) + @OutputTimeUnit(TimeUnit.NANOSECONDS) + @Warmup(iterations = 1) public boolean testArrayList(MyState state) { return state.employeeList.contains(state.employee); } @Benchmark @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.MINUTES) + @OutputTimeUnit(TimeUnit.NANOSECONDS) + @Warmup(iterations = 1) public boolean testHashSet(MyState state) { return state.employeeSet.contains(state.employee); } public static void main(String[] args) throws Exception { - org.openjdk.jmh.Main.main(args); + Options options = new OptionsBuilder() + .include(CollectionsBenchmark.class.getSimpleName()).threads(1) + .forks(1).shouldFailOnError(true) + .shouldDoGC(true) + .jvmArgs("-server").build(); + new Runner(options).run(); } } From 570e33dc1af438c6d2ee8054b7e2d4c8a62d3016 Mon Sep 17 00:00:00 2001 From: eelhazati Date: Thu, 9 Aug 2018 21:48:09 +0100 Subject: [PATCH 159/298] move sse-jaxrs module under apache-cxf module. --- apache-cxf/pom.xml | 3 +- apache-cxf/sse-jaxrs/pom.xml | 21 ++++ apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml | 62 +++++++++ .../sse/jaxrs/client/SseClientApp.java | 48 +++++++ .../jaxrs/client/SseClientBroadcastApp.java | 52 ++++++++ .../src/main/resources/logback.xml | 13 ++ apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml | 85 +++++++++++++ .../com/baeldung/sse/jaxrs/AppConfig.java | 8 ++ .../com/baeldung/sse/jaxrs/SseResource.java | 119 ++++++++++++++++++ .../java/com/baeldung/sse/jaxrs/Stock.java | 50 ++++++++ .../com/baeldung/sse/jaxrs/StockService.java | 78 ++++++++++++ .../src/main/liberty/config/server.xml | 7 ++ .../src/main/resources/META-INF/beans.xml | 6 + .../src/main/resources/logback.xml | 13 ++ .../src/main/webapp/WEB-INF/web.xml | 11 ++ .../src/main/webapp/index.html | 1 + .../src/main/webapp/sse-broadcast.html | 38 ++++++ .../sse-jaxrs-server/src/main/webapp/sse.html | 38 ++++++ core-kotlin/src/test/resources/Kotlin.out | 2 + pom.xml | 1 - 20 files changed, 654 insertions(+), 2 deletions(-) create mode 100644 apache-cxf/sse-jaxrs/pom.xml create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html create mode 100644 apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html create mode 100644 core-kotlin/src/test/resources/Kotlin.out diff --git a/apache-cxf/pom.xml b/apache-cxf/pom.xml index 53d9d4054c..8918fd4450 100644 --- a/apache-cxf/pom.xml +++ b/apache-cxf/pom.xml @@ -1,5 +1,5 @@ + 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 apache-cxf @@ -17,6 +17,7 @@ cxf-spring cxf-jaxrs-implementation cxf-aegis + sse-jaxrs diff --git a/apache-cxf/sse-jaxrs/pom.xml b/apache-cxf/sse-jaxrs/pom.xml new file mode 100644 index 0000000000..d4b6c19d03 --- /dev/null +++ b/apache-cxf/sse-jaxrs/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + sse-jaxrs + pom + + + com.baeldung + apache-cxf + 0.0.1-SNAPSHOT + + + + sse-jaxrs-server + sse-jaxrs-client + + + diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml new file mode 100644 index 0000000000..0f5406fbc7 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-client/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + + com.baeldung + sse-jaxrs + 0.0.1-SNAPSHOT + + + sse-jaxrs-client + + + 3.2.0 + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + singleEvent + + java + + + com.baeldung.sse.jaxrs.client.SseClientApp + + + + broadcast + + java + + + com.baeldung.sse.jaxrs.client.SseClientBroadcastApp + + + + + + + + + + org.apache.cxf + cxf-rt-rs-client + ${cxf-version} + + + org.apache.cxf + cxf-rt-rs-sse + ${cxf-version} + + + + diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java b/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java new file mode 100644 index 0000000000..5d42b3a243 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientApp.java @@ -0,0 +1,48 @@ +package com.baeldung.sse.jaxrs.client; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.sse.InboundSseEvent; +import javax.ws.rs.sse.SseEventSource; +import java.util.function.Consumer; + +public class SseClientApp { + + private static final String url = "http://127.0.0.1:9080/sse-jaxrs-server/sse/stock/prices"; + + public static void main(String... args) throws Exception { + + Client client = ClientBuilder.newClient(); + WebTarget target = client.target(url); + try (SseEventSource eventSource = SseEventSource.target(target).build()) { + + eventSource.register(onEvent, onError, onComplete); + eventSource.open(); + + //Consuming events for one hour + Thread.sleep(60 * 60 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + client.close(); + System.out.println("End"); + } + + // A new event is received + private static Consumer onEvent = (inboundSseEvent) -> { + String data = inboundSseEvent.readData(); + System.out.println(data); + }; + + //Error + private static Consumer onError = (throwable) -> { + throwable.printStackTrace(); + }; + + //Connection close and there is nothing to receive + private static Runnable onComplete = () -> { + System.out.println("Done!"); + }; + +} diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java b/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java new file mode 100644 index 0000000000..9afc187a6d --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/java/com/baeldung/sse/jaxrs/client/SseClientBroadcastApp.java @@ -0,0 +1,52 @@ +package com.baeldung.sse.jaxrs.client; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.sse.InboundSseEvent; +import javax.ws.rs.sse.SseEventSource; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; + +public class SseClientBroadcastApp { + + private static final String subscribeUrl = "http://localhost:9080/sse-jaxrs-server/sse/stock/subscribe"; + + + public static void main(String... args) throws Exception { + + Client client = ClientBuilder.newClient(); + WebTarget target = client.target(subscribeUrl); + try (final SseEventSource eventSource = SseEventSource.target(target) + .reconnectingEvery(5, TimeUnit.SECONDS) + .build()) { + eventSource.register(onEvent, onError, onComplete); + eventSource.open(); + System.out.println("Wainting for incoming event ..."); + + //Consuming events for one hour + Thread.sleep(60 * 60 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + client.close(); + System.out.println("End"); + } + + // A new event is received + private static Consumer onEvent = (inboundSseEvent) -> { + String data = inboundSseEvent.readData(); + System.out.println(data); + }; + + //Error + private static Consumer onError = (throwable) -> { + throwable.printStackTrace(); + }; + + //Connection close and there is nothing to receive + private static Runnable onComplete = () -> { + System.out.println("Done!"); + }; + +} diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-client/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml new file mode 100644 index 0000000000..46572a2b75 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + + com.baeldung + sse-jaxrs + 0.0.1-SNAPSHOT + + + sse-jaxrs-server + war + + + 2.4.2 + false + 18.0.0.2 + + + + ${artifactId} + + + net.wasdev.wlp.maven.plugins + liberty-maven-plugin + ${liberty-maven-plugin.version} + + + io.openliberty + openliberty-webProfile8 + ${openliberty-version} + zip + + project + true + src/main/liberty/config/server.xml + + + + install-server + prepare-package + + install-server + create-server + install-feature + + + + install-apps + package + + install-apps + + + + + + + + + + + javax.ws.rs + javax.ws.rs-api + 2.1 + provided + + + javax.enterprise + cdi-api + 2.0 + provided + + + javax.json.bind + javax.json.bind-api + 1.0 + provided + + + + + diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java new file mode 100644 index 0000000000..058d19f045 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/AppConfig.java @@ -0,0 +1,8 @@ +package com.baeldung.sse.jaxrs; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +@ApplicationPath("sse") +public class AppConfig extends Application { +} diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java new file mode 100644 index 0000000000..1f60168a1b --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/SseResource.java @@ -0,0 +1,119 @@ +package com.baeldung.sse.jaxrs; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.sse.OutboundSseEvent; +import javax.ws.rs.sse.Sse; +import javax.ws.rs.sse.SseBroadcaster; +import javax.ws.rs.sse.SseEventSink; + +@ApplicationScoped +@Path("stock") +public class SseResource { + + @Inject + private StockService stockService; + + private Sse sse; + private SseBroadcaster sseBroadcaster; + private OutboundSseEvent.Builder eventBuilder; + + @Context + public void setSse(Sse sse) { + this.sse = sse; + this.eventBuilder = sse.newEventBuilder(); + this.sseBroadcaster = sse.newBroadcaster(); + } + + @GET + @Path("prices") + @Produces("text/event-stream") + public void getStockPrices(@Context SseEventSink sseEventSink, + @HeaderParam(HttpHeaders.LAST_EVENT_ID_HEADER) @DefaultValue("-1") int lastReceivedId) { + + int lastEventId = 1; + if (lastReceivedId != -1) { + lastEventId = ++lastReceivedId; + } + boolean running = true; + while (running) { + Stock stock = stockService.getNextTransaction(lastEventId); + if (stock != null) { + OutboundSseEvent sseEvent = this.eventBuilder + .name("stock") + .id(String.valueOf(lastEventId)) + .mediaType(MediaType.APPLICATION_JSON_TYPE) + .data(Stock.class, stock) + .reconnectDelay(3000) + .comment("price change") + .build(); + sseEventSink.send(sseEvent); + lastEventId++; + } + //Simulate connection close + if (lastEventId % 5 == 0) { + sseEventSink.close(); + break; + } + + try { + //Wait 5 seconds + Thread.sleep(5 * 1000); + } catch (InterruptedException ex) { + // ... + } + //Simulatae a while boucle break + running = lastEventId <= 2000; + } + sseEventSink.close(); + } + + @GET + @Path("subscribe") + @Produces(MediaType.SERVER_SENT_EVENTS) + public void listen(@Context SseEventSink sseEventSink) { + sseEventSink.send(sse.newEvent("Welcome !")); + this.sseBroadcaster.register(sseEventSink); + sseEventSink.send(sse.newEvent("You are registred !")); + } + + @GET + @Path("publish") + public void broadcast() { + Runnable r = new Runnable() { + @Override + public void run() { + int lastEventId = 0; + boolean running = true; + while (running) { + lastEventId++; + Stock stock = stockService.getNextTransaction(lastEventId); + if (stock != null) { + OutboundSseEvent sseEvent = eventBuilder + .name("stock") + .id(String.valueOf(lastEventId)) + .mediaType(MediaType.APPLICATION_JSON_TYPE) + .data(Stock.class, stock) + .reconnectDelay(3000) + .comment("price change") + .build(); + sseBroadcaster.broadcast(sseEvent); + } + try { + //Wait 5 seconds + Thread.currentThread().sleep(5 * 1000); + } catch (InterruptedException ex) { + // ... + } + //Simulatae a while boucle break + running = lastEventId <= 2000; + } + } + }; + new Thread(r).start(); + } +} diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java new file mode 100644 index 0000000000..a186b32771 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/Stock.java @@ -0,0 +1,50 @@ +package com.baeldung.sse.jaxrs; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +public class Stock { + private Integer id; + private String name; + private BigDecimal price; + LocalDateTime dateTime; + + public Stock(Integer id, String name, BigDecimal price, LocalDateTime dateTime) { + this.id = id; + this.name = name; + this.price = price; + this.dateTime = dateTime; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public LocalDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(LocalDateTime dateTime) { + this.dateTime = dateTime; + } +} diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java new file mode 100644 index 0000000000..15818ead5d --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/java/com/baeldung/sse/jaxrs/StockService.java @@ -0,0 +1,78 @@ +package com.baeldung.sse.jaxrs; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.context.Initialized; +import javax.enterprise.event.Event; +import javax.enterprise.event.Observes; +import javax.inject.Inject; +import javax.inject.Named; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import java.util.concurrent.atomic.AtomicInteger; + +@ApplicationScoped +@Named +public class StockService { + + private static final BigDecimal UP = BigDecimal.valueOf(1.05f); + private static final BigDecimal DOWN = BigDecimal.valueOf(0.95f); + + List stockNames = Arrays.asList("GOOG", "IBM", "MS", "GOOG", "YAHO"); + List stocksDB = new ArrayList<>(); + private AtomicInteger counter = new AtomicInteger(0); + + public void init(@Observes @Initialized(ApplicationScoped.class) Object init) { + //Open price + System.out.println("@Start Init ..."); + stockNames.forEach(stockName -> { + stocksDB.add(new Stock(counter.incrementAndGet(), stockName, generateOpenPrice(), LocalDateTime.now())); + }); + + Runnable runnable = new Runnable() { + @Override + public void run() { + //Simulate Change price and put every x seconds + while (true) { + int indx = new Random().nextInt(stockNames.size()); + String stockName = stockNames.get(indx); + BigDecimal price = getLastPrice(stockName); + BigDecimal newprice = changePrice(price); + Stock stock = new Stock(counter.incrementAndGet(), stockName, newprice, LocalDateTime.now()); + stocksDB.add(stock); + + int r = new Random().nextInt(30); + try { + Thread.currentThread().sleep(r*1000); + } catch (InterruptedException ex) { + // ... + } + } + } + }; + new Thread(runnable).start(); + System.out.println("@End Init ..."); + } + + public Stock getNextTransaction(Integer lastEventId) { + return stocksDB.stream().filter(s -> s.getId().equals(lastEventId)).findFirst().orElse(null); + } + + BigDecimal generateOpenPrice() { + float min = 70; + float max = 120; + return BigDecimal.valueOf(min + new Random().nextFloat() * (max - min)).setScale(4,RoundingMode.CEILING); + } + + BigDecimal changePrice(BigDecimal price) { + return Math.random() >= 0.5 ? price.multiply(UP).setScale(4,RoundingMode.CEILING) : price.multiply(DOWN).setScale(4,RoundingMode.CEILING); + } + + private BigDecimal getLastPrice(String stockName) { + return stocksDB.stream().filter(stock -> stock.getName().equals(stockName)).findFirst().get().getPrice(); + } +} diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml new file mode 100644 index 0000000000..9bf66d7795 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/liberty/config/server.xml @@ -0,0 +1,7 @@ + + + jaxrs-2.1 + cdi-2.0 + + + diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000..4f0b3cdeeb --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..b4b8121fdd --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,11 @@ + + + Hello Servlet + + + index.html + + + diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html new file mode 100644 index 0000000000..9015a7a32c --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/index.html @@ -0,0 +1 @@ +index diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html new file mode 100644 index 0000000000..5a46e2a5d3 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse-broadcast.html @@ -0,0 +1,38 @@ + + + + Server-Sent Event Broadcasting + + +

Stock prices :

+
+
    +
+
+ + + \ No newline at end of file diff --git a/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html new file mode 100644 index 0000000000..8fddae4717 --- /dev/null +++ b/apache-cxf/sse-jaxrs/sse-jaxrs-server/src/main/webapp/sse.html @@ -0,0 +1,38 @@ + + + + Server-Sent Event + + +

Stock prices :

+
+
    +
+
+ + + \ No newline at end of file diff --git a/core-kotlin/src/test/resources/Kotlin.out b/core-kotlin/src/test/resources/Kotlin.out new file mode 100644 index 0000000000..63d15d2528 --- /dev/null +++ b/core-kotlin/src/test/resources/Kotlin.out @@ -0,0 +1,2 @@ +Kotlin +Concise, Safe, Interoperable, Tool-friendly \ No newline at end of file diff --git a/pom.xml b/pom.xml index 978e27f055..db3bef7fda 100644 --- a/pom.xml +++ b/pom.xml @@ -587,7 +587,6 @@ apache-meecrowave spring-reactive-kotlin jnosql - sse-jaxrs spring-boot-angular-ecommerce From 4cd349f5337fd2b3d5d845a6c55c3bd37363e749 Mon Sep 17 00:00:00 2001 From: Kacper Date: Fri, 10 Aug 2018 21:10:15 +0200 Subject: [PATCH 160/298] Kotlin constructors (#4933) --- .../main/java/com/baeldung/constructor/Car.kt | 17 ++++++++++++ .../java/com/baeldung/constructor/Employee.kt | 3 +++ .../java/com/baeldung/constructor/Person.java | 19 ++++++++++++++ .../kotlin/com/baeldung/constructor/Person.kt | 26 +++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 core-kotlin/src/main/java/com/baeldung/constructor/Car.kt create mode 100644 core-kotlin/src/main/java/com/baeldung/constructor/Employee.kt create mode 100644 core-kotlin/src/main/java/com/baeldung/constructor/Person.java create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/constructor/Person.kt diff --git a/core-kotlin/src/main/java/com/baeldung/constructor/Car.kt b/core-kotlin/src/main/java/com/baeldung/constructor/Car.kt new file mode 100644 index 0000000000..72b8d330e8 --- /dev/null +++ b/core-kotlin/src/main/java/com/baeldung/constructor/Car.kt @@ -0,0 +1,17 @@ +package com.baeldung.constructor + +class Car { + val id: String + val type: String + + constructor(id: String, type: String) { + this.id = id + this.type = type + } + +} + +fun main(args: Array) { + val car = Car("1", "sport") + val s= Car("2", "suv") +} \ No newline at end of file diff --git a/core-kotlin/src/main/java/com/baeldung/constructor/Employee.kt b/core-kotlin/src/main/java/com/baeldung/constructor/Employee.kt new file mode 100644 index 0000000000..4483bfcf08 --- /dev/null +++ b/core-kotlin/src/main/java/com/baeldung/constructor/Employee.kt @@ -0,0 +1,3 @@ +package com.baeldung.constructor + +class Employee(name: String, val salary: Int): Person(name) \ No newline at end of file diff --git a/core-kotlin/src/main/java/com/baeldung/constructor/Person.java b/core-kotlin/src/main/java/com/baeldung/constructor/Person.java new file mode 100644 index 0000000000..57911b24ee --- /dev/null +++ b/core-kotlin/src/main/java/com/baeldung/constructor/Person.java @@ -0,0 +1,19 @@ +package com.baeldung.constructor; + +class PersonJava { + final String name; + final String surname; + final Integer age; + + public PersonJava(String name, String surname) { + this.name = name; + this.surname = surname; + this.age = null; + } + + public PersonJava(String name, String surname, Integer age) { + this.name = name; + this.surname = surname; + this.age = age; + } +} diff --git a/core-kotlin/src/main/kotlin/com/baeldung/constructor/Person.kt b/core-kotlin/src/main/kotlin/com/baeldung/constructor/Person.kt new file mode 100644 index 0000000000..3779d74541 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/constructor/Person.kt @@ -0,0 +1,26 @@ +package com.baeldung.constructor + +open class Person( + val name: String, + val age: Int? = null +) { + val upperCaseName: String = name.toUpperCase() + + init { + println("Hello, I'm $name") + + if (age != null && age < 0) { + throw IllegalArgumentException("Age cannot be less than zero!") + } + } + + init { + println("upperCaseName is $upperCaseName") + } + +} + +fun main(args: Array) { + val person = Person("John") + val personWithAge = Person("John", 22) +} \ No newline at end of file From d3a02b789ebaf0aa1375a97175c5e23921fe70fa Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 11 Aug 2018 00:31:45 +0200 Subject: [PATCH 161/298] BAEL-1997 state design pattern in Java (#4827) * BAEL-1997 state design pattern in Java * BAEL-1997 different example code * BAEL-1997 add additional method to the states * BAEL-1997 clean up in ReceivedState --- .../com/baeldung/state/DeliveredState.java | 25 ++++++++++++++ .../java/com/baeldung/state/OrderedState.java | 24 ++++++++++++++ .../main/java/com/baeldung/state/Package.java | 26 +++++++++++++++ .../java/com/baeldung/state/PackageState.java | 10 ++++++ .../com/baeldung/state/ReceivedState.java | 24 ++++++++++++++ .../java/com/baeldung/state/StateDemo.java | 19 +++++++++++ .../baeldung/state/StatePatternUnitTest.java | 33 +++++++++++++++++++ 7 files changed, 161 insertions(+) create mode 100644 patterns/design-patterns/src/main/java/com/baeldung/state/DeliveredState.java create mode 100644 patterns/design-patterns/src/main/java/com/baeldung/state/OrderedState.java create mode 100644 patterns/design-patterns/src/main/java/com/baeldung/state/Package.java create mode 100644 patterns/design-patterns/src/main/java/com/baeldung/state/PackageState.java create mode 100644 patterns/design-patterns/src/main/java/com/baeldung/state/ReceivedState.java create mode 100644 patterns/design-patterns/src/main/java/com/baeldung/state/StateDemo.java create mode 100644 patterns/design-patterns/src/test/java/com/baeldung/state/StatePatternUnitTest.java diff --git a/patterns/design-patterns/src/main/java/com/baeldung/state/DeliveredState.java b/patterns/design-patterns/src/main/java/com/baeldung/state/DeliveredState.java new file mode 100644 index 0000000000..9f5e4d8fc4 --- /dev/null +++ b/patterns/design-patterns/src/main/java/com/baeldung/state/DeliveredState.java @@ -0,0 +1,25 @@ +package com.baeldung.state; + +public class DeliveredState implements PackageState { + + @Override + public void next(Package pkg) { + pkg.setState(new ReceivedState()); + } + + @Override + public void prev(Package pkg) { + pkg.setState(new OrderedState()); + } + + @Override + public void printStatus() { + System.out.println("Package delivered to post office, not received yet."); + } + + @Override + public String toString() { + return "DeliveredState{}"; + } + +} \ No newline at end of file diff --git a/patterns/design-patterns/src/main/java/com/baeldung/state/OrderedState.java b/patterns/design-patterns/src/main/java/com/baeldung/state/OrderedState.java new file mode 100644 index 0000000000..0642c4c73c --- /dev/null +++ b/patterns/design-patterns/src/main/java/com/baeldung/state/OrderedState.java @@ -0,0 +1,24 @@ +package com.baeldung.state; + +public class OrderedState implements PackageState { + + @Override + public void next(Package pkg) { + pkg.setState(new DeliveredState()); + } + + @Override + public void prev(Package pkg) { + System.out.println("The package is in it's root state."); + } + + @Override + public void printStatus() { + System.out.println("Package ordered, not delivered to the office yet."); + } + + @Override + public String toString() { + return "OrderedState{}"; + } +} \ No newline at end of file diff --git a/patterns/design-patterns/src/main/java/com/baeldung/state/Package.java b/patterns/design-patterns/src/main/java/com/baeldung/state/Package.java new file mode 100644 index 0000000000..f3dfbb3fa7 --- /dev/null +++ b/patterns/design-patterns/src/main/java/com/baeldung/state/Package.java @@ -0,0 +1,26 @@ +package com.baeldung.state; + +public class Package { + + private PackageState state = new OrderedState(); + + public PackageState getState() { + return state; + } + + public void setState(PackageState state) { + this.state = state; + } + + public void previousState() { + state.prev(this); + } + + public void nextState() { + state.next(this); + } + + public void printStatus() { + state.printStatus(); + } +} diff --git a/patterns/design-patterns/src/main/java/com/baeldung/state/PackageState.java b/patterns/design-patterns/src/main/java/com/baeldung/state/PackageState.java new file mode 100644 index 0000000000..d6656c78ac --- /dev/null +++ b/patterns/design-patterns/src/main/java/com/baeldung/state/PackageState.java @@ -0,0 +1,10 @@ +package com.baeldung.state; + +public interface PackageState { + + void next(Package pkg); + + void prev(Package pkg); + + void printStatus(); +} \ No newline at end of file diff --git a/patterns/design-patterns/src/main/java/com/baeldung/state/ReceivedState.java b/patterns/design-patterns/src/main/java/com/baeldung/state/ReceivedState.java new file mode 100644 index 0000000000..84136fa48e --- /dev/null +++ b/patterns/design-patterns/src/main/java/com/baeldung/state/ReceivedState.java @@ -0,0 +1,24 @@ +package com.baeldung.state; + +public class ReceivedState implements PackageState { + + @Override + public void next(Package pkg) { + System.out.println("This package is already received by a client."); + } + + @Override + public void prev(Package pkg) { + pkg.setState(new DeliveredState()); + } + + @Override + public void printStatus() { + System.out.println("Package was received by client."); + } + + @Override + public String toString() { + return "ReceivedState{}"; + } +} \ No newline at end of file diff --git a/patterns/design-patterns/src/main/java/com/baeldung/state/StateDemo.java b/patterns/design-patterns/src/main/java/com/baeldung/state/StateDemo.java new file mode 100644 index 0000000000..1a63ea3ddf --- /dev/null +++ b/patterns/design-patterns/src/main/java/com/baeldung/state/StateDemo.java @@ -0,0 +1,19 @@ +package com.baeldung.state; + +public class StateDemo { + + public static void main(String[] args) { + + Package pkg = new Package(); + pkg.printStatus(); + + pkg.nextState(); + pkg.printStatus(); + + pkg.nextState(); + pkg.printStatus(); + + pkg.nextState(); + pkg.printStatus(); + } +} diff --git a/patterns/design-patterns/src/test/java/com/baeldung/state/StatePatternUnitTest.java b/patterns/design-patterns/src/test/java/com/baeldung/state/StatePatternUnitTest.java new file mode 100644 index 0000000000..731974f92b --- /dev/null +++ b/patterns/design-patterns/src/test/java/com/baeldung/state/StatePatternUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.state; + +import com.baeldung.state.Package; + +import static org.junit.Assert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + +import org.junit.Test; + +public class StatePatternUnitTest { + + @Test + public void givenNewPackage_whenPackageReceived_thenStateReceived() { + Package pkg = new Package(); + + assertThat(pkg.getState(), instanceOf(OrderedState.class)); + pkg.nextState(); + + assertThat(pkg.getState(), instanceOf(DeliveredState.class)); + pkg.nextState(); + + assertThat(pkg.getState(), instanceOf(ReceivedState.class)); + } + + @Test + public void givenDeliveredPackage_whenPrevState_thenStateOrdered() { + Package pkg = new Package(); + pkg.setState(new DeliveredState()); + pkg.previousState(); + + assertThat(pkg.getState(), instanceOf(OrderedState.class)); + } +} From 5b9df5d901bc8768fcdcea181c3eec5e25680c9e Mon Sep 17 00:00:00 2001 From: Mher Baghinyan Date: Sat, 11 Aug 2018 17:52:08 +0400 Subject: [PATCH 162/298] Update CollectionsBenchmark.java --- .../java/com/baeldung/performance/CollectionsBenchmark.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java index ff1e8d7953..e5b7787438 100644 --- a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java +++ b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java @@ -28,10 +28,10 @@ public class CollectionsBenchmark { for (long ii = 0; ii < iterations; ii++) { employeeSet.add(new Employee(ii, "John")); employeeList.add(new Employee(ii, "John")); - - employeeList.add(employee); - employeeSet.add(employee); } + + employeeList.add(employee); + employeeSet.add(employee); } } From 224dce952b93153bb8c96eb0c2d0a2b4885e2b69 Mon Sep 17 00:00:00 2001 From: Mher Baghinyan Date: Sat, 11 Aug 2018 18:06:21 +0400 Subject: [PATCH 163/298] Update CollectionsBenchmark.java --- .../java/com/baeldung/performance/CollectionsBenchmark.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java index e5b7787438..6d36789c2b 100644 --- a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java +++ b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java @@ -25,9 +25,9 @@ public class CollectionsBenchmark { @Setup(Level.Trial) public void setUp() { - for (long ii = 0; ii < iterations; ii++) { - employeeSet.add(new Employee(ii, "John")); - employeeList.add(new Employee(ii, "John")); + for (long i = 0; i < iterations; i++) { + employeeSet.add(new Employee(i, "John")); + employeeList.add(new Employee(i, "John")); } employeeList.add(employee); From b23980ae2cdd4c4df61767de65798ca38fb5c424 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:06:49 +0530 Subject: [PATCH 164/298] BAEL-1857 Updated to parent pom.xml --- testing-modules/parallel-tests-junit/pom.xml | 60 ++++---------------- 1 file changed, 11 insertions(+), 49 deletions(-) diff --git a/testing-modules/parallel-tests-junit/pom.xml b/testing-modules/parallel-tests-junit/pom.xml index 1a42437b1b..3fd4e695e5 100644 --- a/testing-modules/parallel-tests-junit/pom.xml +++ b/testing-modules/parallel-tests-junit/pom.xml @@ -1,50 +1,12 @@ - - 4.0.0 - - com.baeldung - parallel-tests-junit - 0.0.1-SNAPSHOT - jar - - parallel-tests-junit - http://maven.apache.org - - - UTF-8 - - - - - junit - junit - 4.12 - test - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 - - all - 10 - 2 - 2 - 6 - 3.5 - 5 - true - - FunctionTestSuite.class - - - - - - - + + + 4.0.0 + com.baeldung + parallel-tests-junit + 0.0.1-SNAPSHOT + pom + + math-test-functions + string-test-functions + From 87e6645b1ce67db4e01077eca021c0a4195caef0 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:07:58 +0530 Subject: [PATCH 165/298] BAEL-1857 Delete FunctionTestSuite.java --- .../src/test/java/com/baeldung/FunctionTestSuite.java | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java diff --git a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java deleted file mode 100644 index c7f4050b18..0000000000 --- a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/FunctionTestSuite.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@RunWith(Suite.class) -@SuiteClasses({StringFunctionTest.class, MathFunctionTest.class}) -public class FunctionTestSuite { - -} From 24ba05ce0df372e92e574c6629ce007289179fab Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:08:43 +0530 Subject: [PATCH 166/298] BAEL-1857 Delete MathFunctionTest.java --- .../java/com/baeldung/MathFunctionTest.java | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 testing-modules/parallel-tests-junit/src/test/java/com/baeldung/MathFunctionTest.java diff --git a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/MathFunctionTest.java b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/MathFunctionTest.java deleted file mode 100644 index 9a609c3e93..0000000000 --- a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/MathFunctionTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class MathFunctionTest { - - @Test - public void test_addingIntegers_returnsSum() throws InterruptedException { - assertEquals(22, Math.addExact(10, 12)); - - } - - @Test - public void test_multiplyingIntegers_returnsProduct() { - assertEquals(120, Math.multiplyExact(10, 12)); - } - - @Test - public void test_subtractingIntegers_returnsDifference() { - assertEquals(2, Math.subtractExact(12, 10)); - } - - @Test - public void test_minimumInteger() { - assertEquals(10, Math.min(10, 12)); - } -} From d78acb07a1e8d7afd034ad08dfb8d6b14e543c09 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:09:16 +0530 Subject: [PATCH 167/298] BAEL-1857 Delete StringFunctionTest.java --- .../java/com/baeldung/StringFunctionTest.java | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 testing-modules/parallel-tests-junit/src/test/java/com/baeldung/StringFunctionTest.java diff --git a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/StringFunctionTest.java b/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/StringFunctionTest.java deleted file mode 100644 index 9adfea8ff0..0000000000 --- a/testing-modules/parallel-tests-junit/src/test/java/com/baeldung/StringFunctionTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class StringFunctionTest { - - @Test - public void test_upperCase() { - assertEquals("TESTCASE", "testCase".toUpperCase()); - } - - @Test - public void test_indexOf() { - assertEquals(1, "testCase".indexOf("e")); - } -} From 2f4a12066236d0b826c3bf1dba05c259f67eee7d Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:10:18 +0530 Subject: [PATCH 168/298] BAEL-1857 --- .../math-test-functions/pom.xml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 testing-modules/parallel-tests-junit/math-test-functions/pom.xml diff --git a/testing-modules/parallel-tests-junit/math-test-functions/pom.xml b/testing-modules/parallel-tests-junit/math-test-functions/pom.xml new file mode 100644 index 0000000000..18d2b562f3 --- /dev/null +++ b/testing-modules/parallel-tests-junit/math-test-functions/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + com.baeldung + parallel-tests-junit + 0.0.1-SNAPSHOT + + math-test-functions + math-test-functions + http://maven.apache.org + + UTF-8 + + + + junit + junit + 4.12 + test + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.0 + + all + 10 + 2 + 2 + 6 + 3.5 + 5 + true + + FunctionTestSuite.class + + + + + + From 876ffa765c258cb9fad6ea9701db5119da82402b Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:13:04 +0530 Subject: [PATCH 169/298] BAEL-1857 --- .../src/test/java/com/baeldung/FunctionTestSuite.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/FunctionTestSuite.java diff --git a/testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/FunctionTestSuite.java b/testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/FunctionTestSuite.java new file mode 100644 index 0000000000..4fe551b365 --- /dev/null +++ b/testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/FunctionTestSuite.java @@ -0,0 +1,11 @@ +package com.baeldung; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ ComparisonFunctionTest.class, ArithmeticFunctionTest.class }) +public class FunctionTestSuite { + +} From 9379e84ac8bbfa75ff4ccfcea3b44026884e0ae9 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:13:55 +0530 Subject: [PATCH 170/298] BAEL-1857 --- .../com/baeldung/ComparisonFunctionTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/ComparisonFunctionTest.java diff --git a/testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/ComparisonFunctionTest.java b/testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/ComparisonFunctionTest.java new file mode 100644 index 0000000000..4f72c87279 --- /dev/null +++ b/testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/ComparisonFunctionTest.java @@ -0,0 +1,19 @@ +package com.baeldung; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class ComparisonFunctionTest { + + @Test + public void test_findMax() { + assertEquals(20, Math.max(10, 20)); + } + + @Test + public void test_findMin() { + assertEquals(10, Math.min(10, 20)); + } + +} From 8e507cae4bd3b962cb7367285ccbb398c182fe0f Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:14:41 +0530 Subject: [PATCH 171/298] BAEL-1857 --- .../com/baeldung/ArithmeticFunctionTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/ArithmeticFunctionTest.java diff --git a/testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/ArithmeticFunctionTest.java b/testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/ArithmeticFunctionTest.java new file mode 100644 index 0000000000..df0aa695fc --- /dev/null +++ b/testing-modules/parallel-tests-junit/math-test-functions/src/test/java/com/baeldung/ArithmeticFunctionTest.java @@ -0,0 +1,28 @@ +package com.baeldung; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class ArithmeticFunctionTest { + + @Test + public void test_addingIntegers_returnsSum() { + assertEquals(22, Math.addExact(10, 12)); + } + + @Test + public void test_multiplyingIntegers_returnsProduct() { + assertEquals(120, Math.multiplyExact(10, 12)); + } + + @Test + public void test_subtractingIntegers_returnsDifference() { + assertEquals(2, Math.subtractExact(12, 10)); + } + + @Test + public void test_minimumInteger() { + assertEquals(10, Math.min(10, 12)); + } +} From 7ed89c7bc8d2be5165ff38eb324443c5388e2572 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:16:11 +0530 Subject: [PATCH 172/298] BAEL-1857 --- .../parallel-tests-junit/string-test-functions/pom.xml | 1 + 1 file changed, 1 insertion(+) create mode 100644 testing-modules/parallel-tests-junit/string-test-functions/pom.xml diff --git a/testing-modules/parallel-tests-junit/string-test-functions/pom.xml b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml @@ -0,0 +1 @@ + From ec084c3b651f98abfd221088c807a164c7b71348 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:17:11 +0530 Subject: [PATCH 173/298] BAEL-1857 --- .../string-test-functions/pom.xml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/testing-modules/parallel-tests-junit/string-test-functions/pom.xml b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml index 8b13789179..af61cfce8e 100644 --- a/testing-modules/parallel-tests-junit/string-test-functions/pom.xml +++ b/testing-modules/parallel-tests-junit/string-test-functions/pom.xml @@ -1 +1,41 @@ + + + 4.0.0 + + com.baeldung + parallel-tests-junit + 0.0.1-SNAPSHOT + + string-test-functions + string-test-functions + http://maven.apache.org + + UTF-8 + + + + junit + junit + 4.12 + test + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.0 + + all + true + 2 + + + + + From b3579151a91b765ce51bd720c01c5ea2ec54b9b0 Mon Sep 17 00:00:00 2001 From: josephine-barboza Date: Sat, 11 Aug 2018 14:18:30 +0530 Subject: [PATCH 174/298] BAEL-1857 --- .../java/com/baeldung/StringFunctionTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 testing-modules/parallel-tests-junit/string-test-functions/src/test/java/com/baeldung/StringFunctionTest.java diff --git a/testing-modules/parallel-tests-junit/string-test-functions/src/test/java/com/baeldung/StringFunctionTest.java b/testing-modules/parallel-tests-junit/string-test-functions/src/test/java/com/baeldung/StringFunctionTest.java new file mode 100644 index 0000000000..7f2bc5e5e7 --- /dev/null +++ b/testing-modules/parallel-tests-junit/string-test-functions/src/test/java/com/baeldung/StringFunctionTest.java @@ -0,0 +1,18 @@ +package com.baeldung; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class StringFunctionTest { + + @Test + public void test_upperCase() { + assertEquals("TESTCASE", "testCase".toUpperCase()); + } + + @Test + public void test_indexOf() { + assertEquals(1, "testCase".indexOf("e")); + } +} From 43bfb9722ff5ef948fd60609e2b97c19385f894a Mon Sep 17 00:00:00 2001 From: RanjeetKaur17 Date: Sun, 12 Aug 2018 00:07:20 +0400 Subject: [PATCH 175/298] Moving File Parser Samples to core-java-io --- .../main/java/com/baeldung/fileparser/BufferedReaderExample.java | 0 .../src/main/java/com/baeldung/fileparser/FileReaderExample.java | 0 .../main/java/com/baeldung/fileparser/FilesReadLinesExample.java | 0 .../src/main/java/com/baeldung/fileparser/ScannerIntExample.java | 0 .../main/java/com/baeldung/fileparser/ScannerStringExample.java | 0 .../test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java | 0 .../src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java | 0 .../java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java | 0 .../src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java | 0 .../test/java/com/baeldung/fileparser/ScannerStringUnitTest.java | 0 .../src/test/resources/sampleNumberFile.txt | 0 {core-java => core-java-io}/src/test/resources/sampleTextFile.txt | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {core-java => core-java-io}/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java (100%) rename {core-java => core-java-io}/src/main/java/com/baeldung/fileparser/FileReaderExample.java (100%) rename {core-java => core-java-io}/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java (100%) rename {core-java => core-java-io}/src/main/java/com/baeldung/fileparser/ScannerIntExample.java (100%) rename {core-java => core-java-io}/src/main/java/com/baeldung/fileparser/ScannerStringExample.java (100%) rename {core-java => core-java-io}/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java (100%) rename {core-java => core-java-io}/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java (100%) rename {core-java => core-java-io}/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java (100%) rename {core-java => core-java-io}/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java (100%) rename {core-java => core-java-io}/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java (100%) rename {core-java => core-java-io}/src/test/resources/sampleNumberFile.txt (100%) rename {core-java => core-java-io}/src/test/resources/sampleTextFile.txt (100%) diff --git a/core-java/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java b/core-java-io/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java rename to core-java-io/src/main/java/com/baeldung/fileparser/BufferedReaderExample.java diff --git a/core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java b/core-java-io/src/main/java/com/baeldung/fileparser/FileReaderExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/fileparser/FileReaderExample.java rename to core-java-io/src/main/java/com/baeldung/fileparser/FileReaderExample.java diff --git a/core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java b/core-java-io/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java rename to core-java-io/src/main/java/com/baeldung/fileparser/FilesReadLinesExample.java diff --git a/core-java/src/main/java/com/baeldung/fileparser/ScannerIntExample.java b/core-java-io/src/main/java/com/baeldung/fileparser/ScannerIntExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/fileparser/ScannerIntExample.java rename to core-java-io/src/main/java/com/baeldung/fileparser/ScannerIntExample.java diff --git a/core-java/src/main/java/com/baeldung/fileparser/ScannerStringExample.java b/core-java-io/src/main/java/com/baeldung/fileparser/ScannerStringExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/fileparser/ScannerStringExample.java rename to core-java-io/src/main/java/com/baeldung/fileparser/ScannerStringExample.java diff --git a/core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java b/core-java-io/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java rename to core-java-io/src/test/java/com/baeldung/fileparser/BufferedReaderUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java b/core-java-io/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java rename to core-java-io/src/test/java/com/baeldung/fileparser/FileReaderUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java b/core-java-io/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java rename to core-java-io/src/test/java/com/baeldung/fileparser/FilesReadAllLinesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java b/core-java-io/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java rename to core-java-io/src/test/java/com/baeldung/fileparser/ScannerIntUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java b/core-java-io/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java rename to core-java-io/src/test/java/com/baeldung/fileparser/ScannerStringUnitTest.java diff --git a/core-java/src/test/resources/sampleNumberFile.txt b/core-java-io/src/test/resources/sampleNumberFile.txt similarity index 100% rename from core-java/src/test/resources/sampleNumberFile.txt rename to core-java-io/src/test/resources/sampleNumberFile.txt diff --git a/core-java/src/test/resources/sampleTextFile.txt b/core-java-io/src/test/resources/sampleTextFile.txt similarity index 100% rename from core-java/src/test/resources/sampleTextFile.txt rename to core-java-io/src/test/resources/sampleTextFile.txt From 15c728736dcac355918360a1369ca082d6bf3d9d Mon Sep 17 00:00:00 2001 From: Marcos Lopez Gonzalez Date: Sat, 11 Aug 2018 22:13:43 +0200 Subject: [PATCH 176/298] builder helper maven plugin --- maven/pom.xml | 19 +++++++++++++++++++ .../com/baeldung/maven/plugins/Foo.java | 10 ++++++++++ .../maven/plugins/MultipleSrcFolders.java | 9 +++++++++ 3 files changed, 38 insertions(+) create mode 100644 maven/src/main/another-src/com/baeldung/maven/plugins/Foo.java create mode 100644 maven/src/main/java/com/baeldung/maven/plugins/MultipleSrcFolders.java diff --git a/maven/pom.xml b/maven/pom.xml index a409432f8b..4f91e8717c 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -94,6 +94,24 @@ + + org.codehaus.mojo + build-helper-maven-plugin + ${maven.build.helper.version} + + + generate-sources + + add-source + + + + src/main/another-src + + + + +
@@ -102,6 +120,7 @@ 2.21.0 1.1 3.0.0 + 3.0.0 Baeldung
diff --git a/maven/src/main/another-src/com/baeldung/maven/plugins/Foo.java b/maven/src/main/another-src/com/baeldung/maven/plugins/Foo.java new file mode 100644 index 0000000000..f8a6fe9853 --- /dev/null +++ b/maven/src/main/another-src/com/baeldung/maven/plugins/Foo.java @@ -0,0 +1,10 @@ +package com.baeldung.maven.plugins; + +public class Foo { + + public static String foo() { + return "foo"; + } + +} + diff --git a/maven/src/main/java/com/baeldung/maven/plugins/MultipleSrcFolders.java b/maven/src/main/java/com/baeldung/maven/plugins/MultipleSrcFolders.java new file mode 100644 index 0000000000..d403918dd3 --- /dev/null +++ b/maven/src/main/java/com/baeldung/maven/plugins/MultipleSrcFolders.java @@ -0,0 +1,9 @@ +package com.baeldung.maven.plugins; + +public class MultipleSrcFolders { + + public static void callFoo() { + Foo.foo(); + } + +} From 99676b1a9ee000ce41b7de864a924290761414ec Mon Sep 17 00:00:00 2001 From: yuugen Date: Sun, 12 Aug 2018 04:32:05 +0530 Subject: [PATCH 177/298] Bael 2019 static vs dynamic binding (#4807) * adding the required classes for binding example * completed test class for AnimalActivityUnitTest static functions * changes to example so that they don't seem to be a replica of https://stackoverflow.com/questions/19017258/static-vs-dynamic-binding-in-java * refactoring and removing unnecessary file * revert changes to RegexUnitTest --- .../java/com/baeldung/binding/Animal.java | 23 +++++ .../com/baeldung/binding/AnimalActivity.java | 43 +++++++++ .../main/java/com/baeldung/binding/Cat.java | 18 ++++ .../binding/AnimalActivityUnitTest.java | 95 +++++++++++++++++++ .../com/baeldung/binding/AnimalUnitTest.java | 86 +++++++++++++++++ .../com/baeldung/binding/CatUnitTest.java | 62 ++++++++++++ 6 files changed, 327 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/binding/Animal.java create mode 100644 core-java/src/main/java/com/baeldung/binding/AnimalActivity.java create mode 100644 core-java/src/main/java/com/baeldung/binding/Cat.java create mode 100644 core-java/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/binding/CatUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/binding/Animal.java b/core-java/src/main/java/com/baeldung/binding/Animal.java new file mode 100644 index 0000000000..12eaa2a7a3 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/binding/Animal.java @@ -0,0 +1,23 @@ +package com.baeldung.binding; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by madhumita.g on 25-07-2018. + */ +public class Animal { + + final static Logger logger = LoggerFactory.getLogger(Animal.class); + + public void makeNoise() { + logger.info("generic animal noise"); + } + + public void makeNoise(Integer repetitions) { + while(repetitions != 0) { + logger.info("generic animal noise countdown " + repetitions); + repetitions -= 1; + } + } +} diff --git a/core-java/src/main/java/com/baeldung/binding/AnimalActivity.java b/core-java/src/main/java/com/baeldung/binding/AnimalActivity.java new file mode 100644 index 0000000000..1bd36123e3 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/binding/AnimalActivity.java @@ -0,0 +1,43 @@ +package com.baeldung.binding; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by madhumita.g on 25-07-2018. + */ +public class AnimalActivity { + + final static Logger logger = LoggerFactory.getLogger(AnimalActivity.class); + + + public static void sleep(Animal animal) { + logger.info("Animal is sleeping"); + } + + public static void sleep(Cat cat) { + logger.info("Cat is sleeping"); + } + + public static void main(String[] args) { + + Animal animal = new Animal(); + + //calling methods of animal object + animal.makeNoise(); + + animal.makeNoise(3); + + + //assigning a dog object to reference of type Animal + Animal catAnimal = new Cat(); + + catAnimal.makeNoise(); + + // calling static function + AnimalActivity.sleep(catAnimal); + + return; + + } +} diff --git a/core-java/src/main/java/com/baeldung/binding/Cat.java b/core-java/src/main/java/com/baeldung/binding/Cat.java new file mode 100644 index 0000000000..bbe740e412 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/binding/Cat.java @@ -0,0 +1,18 @@ +package com.baeldung.binding; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Created by madhumita.g on 25-07-2018. + */ +public class Cat extends Animal { + + final static Logger logger = LoggerFactory.getLogger(Cat.class); + + public void makeNoise() { + + logger.info("meow"); + } + +} diff --git a/core-java/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java b/core-java/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java new file mode 100644 index 0000000000..41c67ff389 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/binding/AnimalActivityUnitTest.java @@ -0,0 +1,95 @@ +package com.baeldung.binding; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.spi.LoggingEvent; +import ch.qos.logback.core.Appender; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.slf4j.LoggerFactory; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.verify; + +/** + *https://gist.github.com/bloodredsun/a041de13e57bf3c6c040 + */ +@RunWith(MockitoJUnitRunner.class) + +public class AnimalActivityUnitTest { + + @Mock + private Appender mockAppender; + @Captor + private ArgumentCaptor captorLoggingEvent; + + @Before + public void setup() { + final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + logger.addAppender(mockAppender); + } + + @After + public void teardown() { + final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + logger.detachAppender(mockAppender); + } + + @Test + public void givenAnimalReference__whenRefersAnimalObject_shouldCallFunctionWithAnimalParam() { + + Animal animal = new Animal(); + + AnimalActivity.sleep(animal); + + verify(mockAppender).doAppend(captorLoggingEvent.capture()); + + final LoggingEvent loggingEvent = captorLoggingEvent.getValue(); + + assertThat(loggingEvent.getLevel(), is(Level.INFO)); + + assertThat(loggingEvent.getFormattedMessage(), + is("Animal is sleeping")); + } + + @Test + public void givenDogReference__whenRefersCatObject_shouldCallFunctionWithAnimalParam() { + + Cat cat = new Cat(); + + AnimalActivity.sleep(cat); + + verify(mockAppender).doAppend(captorLoggingEvent.capture()); + + final LoggingEvent loggingEvent = captorLoggingEvent.getValue(); + + assertThat(loggingEvent.getLevel(), is(Level.INFO)); + + assertThat(loggingEvent.getFormattedMessage(), + is("Cat is sleeping")); + } + + @Test + public void givenAnimaReference__whenRefersDogObject_shouldCallFunctionWithAnimalParam() { + + Animal cat = new Cat(); + + AnimalActivity.sleep(cat); + + verify(mockAppender).doAppend(captorLoggingEvent.capture()); + + final LoggingEvent loggingEvent = captorLoggingEvent.getValue(); + + assertThat(loggingEvent.getLevel(), is(Level.INFO)); + + assertThat(loggingEvent.getFormattedMessage(), + is("Animal is sleeping")); + } +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java b/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java new file mode 100644 index 0000000000..238990f2b4 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java @@ -0,0 +1,86 @@ +package com.baeldung.binding; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.spi.LoggingEvent; +import ch.qos.logback.core.Appender; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.slf4j.LoggerFactory; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.verify; + +/** + * Created by madhumita.g on 01-08-2018. + */ + +@RunWith(MockitoJUnitRunner.class) +public class AnimalUnitTest { + @Mock + private Appender mockAppender; + @Captor + private ArgumentCaptor captorLoggingEvent; + + @Before + public void setup() { + final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + logger.addAppender(mockAppender); + } + + @After + public void teardown() { + final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + logger.detachAppender(mockAppender); + } + + @Test + public void whenCalledWithoutParameters_shouldCallFunctionMakeNoiseWithoutParameters() { + + Animal animal = new Animal(); + + animal.makeNoise(); + + verify(mockAppender).doAppend(captorLoggingEvent.capture()); + + final LoggingEvent loggingEvent = captorLoggingEvent.getValue(); + + assertThat(loggingEvent.getLevel(), is(Level.INFO)); + + assertThat(loggingEvent.getFormattedMessage(), + is("generic animal noise")); + } + + @Test + public void whenCalledWithParameters_shouldCallFunctionMakeNoiseWithParameters() { + + Animal animal = new Animal(); + + int testValue = 3; + animal.makeNoise(testValue); + + verify(mockAppender).doAppend(captorLoggingEvent.capture()); + + final LoggingEvent loggingEvent = captorLoggingEvent.getValue(); + + while (testValue != 0) { + assertThat(loggingEvent.getLevel(), is(Level.INFO)); + + assertThat(loggingEvent.getFormattedMessage(), + is("generic animal noise countdown 3\n" + + "generic animal noise countdown 2\n" + + "generic animal noise countdown 1\n")); + + testValue-=1; + + } + } + +} diff --git a/core-java/src/test/java/com/baeldung/binding/CatUnitTest.java b/core-java/src/test/java/com/baeldung/binding/CatUnitTest.java new file mode 100644 index 0000000000..76ccfb7719 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/binding/CatUnitTest.java @@ -0,0 +1,62 @@ +package com.baeldung.binding; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.spi.LoggingEvent; +import ch.qos.logback.core.Appender; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.slf4j.LoggerFactory; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.verify; + +/** + * Created by madhumita.g on 01-08-2018. + */ +@RunWith(MockitoJUnitRunner.class) +public class CatUnitTest { + + @Mock + private Appender mockAppender; + + @Captor + private ArgumentCaptor captorLoggingEvent; + + @Before + public void setup() { + final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + logger.addAppender(mockAppender); + } + + @After + public void teardown() { + final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); + logger.detachAppender(mockAppender); + } + + @Test + public void makeNoiseTest() { + + Cat cat = new Cat(); + + cat.makeNoise(); + + verify(mockAppender).doAppend(captorLoggingEvent.capture()); + + final LoggingEvent loggingEvent = captorLoggingEvent.getValue(); + + assertThat(loggingEvent.getLevel(), is(Level.INFO)); + + assertThat(loggingEvent.getFormattedMessage(), + is("meow")); + + } +} From 534d5749ccaff172e5890627f4329f480031cc72 Mon Sep 17 00:00:00 2001 From: Dhrubajyoti Bhattacharjee Date: Sun, 12 Aug 2018 10:49:43 +0530 Subject: [PATCH 178/298] BAEL-1983 Initialize hashmap (#4949) * BAEL-1983 Initialize hashmap * BAEL-1983 Initialize hashmap --- .../guava/GuavaMapInitializeUnitTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 guava/src/test/java/org/baeldung/guava/GuavaMapInitializeUnitTest.java diff --git a/guava/src/test/java/org/baeldung/guava/GuavaMapInitializeUnitTest.java b/guava/src/test/java/org/baeldung/guava/GuavaMapInitializeUnitTest.java new file mode 100644 index 0000000000..69a7505316 --- /dev/null +++ b/guava/src/test/java/org/baeldung/guava/GuavaMapInitializeUnitTest.java @@ -0,0 +1,30 @@ +package org.baeldung.guava; + +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.*; + +import java.util.Map; +import org.junit.Test; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; + +public class GuavaMapInitializeUnitTest { + + @Test + public void givenKeyValuesShoudInitializeMap() { + Map articles = ImmutableMap.of("Title", "My New Article", "Title2", "Second Article"); + + assertThat(articles.get("Title"), equalTo("My New Article")); + assertThat(articles.get("Title2"), equalTo("Second Article")); + + } + + + @Test + public void givenKeyValuesShouldCreateMutableMap() { + Map articles = Maps.newHashMap(ImmutableMap.of("Title", "My New Article", "Title2", "Second Article")); + + assertThat(articles.get("Title"), equalTo("My New Article")); + assertThat(articles.get("Title2"), equalTo("Second Article")); + } +} From 8bcc305853240caa87ea7c9a8fe5ba9f931d48f9 Mon Sep 17 00:00:00 2001 From: Mher Baghinyan Date: Mon, 13 Aug 2018 17:12:48 +0400 Subject: [PATCH 179/298] Update CollectionsBenchmark.java --- .../com/baeldung/performance/CollectionsBenchmark.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java index 6d36789c2b..921e1608ea 100644 --- a/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java +++ b/core-java-collections/src/main/java/com/baeldung/performance/CollectionsBenchmark.java @@ -11,6 +11,9 @@ import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Warmup(iterations = 5) public class CollectionsBenchmark { @State(Scope.Thread) @@ -35,19 +38,12 @@ public class CollectionsBenchmark { } } - @Benchmark - @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.NANOSECONDS) - @Warmup(iterations = 1) public boolean testArrayList(MyState state) { return state.employeeList.contains(state.employee); } @Benchmark - @BenchmarkMode(Mode.AverageTime) - @OutputTimeUnit(TimeUnit.NANOSECONDS) - @Warmup(iterations = 1) public boolean testHashSet(MyState state) { return state.employeeSet.contains(state.employee); } From 5eea4fc6a6cc4ace02389e8267c469323eba4246 Mon Sep 17 00:00:00 2001 From: cmlavila Date: Mon, 13 Aug 2018 20:02:06 -0300 Subject: [PATCH 180/298] BAEL-2037 - Code for mini-article (#4923) * BAEL-2037 - Code for mini-article * BAEL-2037 - Fixes after editors review * Fixing dependencies * Change File Reader * Formatting * Fix imports * Rename test class --- json/pom.xml | 14 +++ .../baeldung/jsonpointer/JsonPointerCrud.java | 95 +++++++++++++++++++ .../jsonpointer/JsonPointerCrudUnitTest.java | 59 ++++++++++++ json/src/test/resources/address.json | 4 + json/src/test/resources/books.json | 7 ++ 5 files changed, 179 insertions(+) create mode 100644 json/src/main/java/com/baeldung/jsonpointer/JsonPointerCrud.java create mode 100644 json/src/test/java/com/baeldung/jsonpointer/JsonPointerCrudUnitTest.java create mode 100644 json/src/test/resources/address.json create mode 100644 json/src/test/resources/books.json diff --git a/json/pom.xml b/json/pom.xml index c55e833b40..fa3fcafa65 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -33,6 +33,20 @@ json 20171018 + + + junit + junit + 4.12 + test + + + + org.glassfish + javax.json + 1.1.2 + + diff --git a/json/src/main/java/com/baeldung/jsonpointer/JsonPointerCrud.java b/json/src/main/java/com/baeldung/jsonpointer/JsonPointerCrud.java new file mode 100644 index 0000000000..4398aa7867 --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonpointer/JsonPointerCrud.java @@ -0,0 +1,95 @@ +package com.baeldung.jsonpointer; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; + +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonPointer; +import javax.json.JsonReader; +import javax.json.JsonString; +import javax.json.JsonStructure; + +public class JsonPointerCrud { + + private JsonStructure jsonStructure = null; + + public JsonPointerCrud(String fileName) throws IOException { + + try (JsonReader reader = Json.createReader(Files.newBufferedReader(Paths.get(fileName)))) { + jsonStructure = reader.read(); + } catch (FileNotFoundException e) { + System.out.println("Error to open json file: " + e.getMessage()); + } + + } + + public JsonPointerCrud(InputStream stream) { + + JsonReader reader = Json.createReader(stream); + jsonStructure = reader.read(); + reader.close(); + + } + + public JsonStructure insert(String key, String value) { + + JsonPointer jsonPointer = Json.createPointer("/" + key); + JsonString jsonValue = Json.createValue(value); + jsonStructure = jsonPointer.add(jsonStructure, jsonValue); + + return jsonStructure; + + } + + public JsonStructure update(String key, String newValue) { + + JsonPointer jsonPointer = Json.createPointer("/" + key); + JsonString jsonNewValue = Json.createValue(newValue); + jsonStructure = jsonPointer.replace(jsonStructure, jsonNewValue); + + return jsonStructure; + } + + public JsonStructure delete(String key) { + + JsonPointer jsonPointer = Json.createPointer("/" + key); + jsonPointer.getValue(jsonStructure); + jsonStructure = jsonPointer.remove(jsonStructure); + + return jsonStructure; + + } + + public String fetchValueFromKey(String key) { + JsonPointer jsonPointer = Json.createPointer("/" + key); + JsonString jsonString = (JsonString) jsonPointer.getValue(jsonStructure); + + return jsonString.getString(); + } + + public String fetchListValues(String key) { + JsonPointer jsonPointer = Json.createPointer("/" + key); + JsonObject jsonObject = (JsonObject) jsonPointer.getValue(jsonStructure); + + return jsonObject.toString(); + } + + public String fetchFullJSON() { + JsonPointer jsonPointer = Json.createPointer(""); + JsonObject jsonObject = (JsonObject) jsonPointer.getValue(jsonStructure); + + return jsonObject.toString(); + + } + + public boolean check(String key) { + JsonPointer jsonPointer = Json.createPointer("/" + key); + boolean found = jsonPointer.containsValue(jsonStructure); + + return found; + } +} diff --git a/json/src/test/java/com/baeldung/jsonpointer/JsonPointerCrudUnitTest.java b/json/src/test/java/com/baeldung/jsonpointer/JsonPointerCrudUnitTest.java new file mode 100644 index 0000000000..c1553db325 --- /dev/null +++ b/json/src/test/java/com/baeldung/jsonpointer/JsonPointerCrudUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung.jsonpointer; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class JsonPointerCrudUnitTest { + + @Test + public void testJsonPointerCrudForAddress() { + + JsonPointerCrud jsonPointerCrud = new JsonPointerCrud(JsonPointerCrudUnitTest.class.getResourceAsStream("/address.json")); + + assertFalse(jsonPointerCrud.check("city")); + + // insert a value + jsonPointerCrud.insert("city", "Rio de Janeiro"); + + assertTrue(jsonPointerCrud.check("city")); + + // fetch full json + String fullJSON = jsonPointerCrud.fetchFullJSON(); + + assertTrue(fullJSON.contains("name")); + + assertTrue(fullJSON.contains("city")); + + // fetch value + String cityName = jsonPointerCrud.fetchValueFromKey("city"); + + assertEquals(cityName, "Rio de Janeiro"); + + // update value + jsonPointerCrud.update("city", "Sao Paulo"); + + // fetch value + cityName = jsonPointerCrud.fetchValueFromKey("city"); + + assertEquals(cityName, "Sao Paulo"); + + // delete + jsonPointerCrud.delete("city"); + + assertFalse(jsonPointerCrud.check("city")); + + } + + @Test + public void testJsonPointerCrudForBooks() { + + JsonPointerCrud jsonPointerCrud = new JsonPointerCrud(JsonPointerCrudUnitTest.class.getResourceAsStream("/books.json")); + + // fetch value + String book = jsonPointerCrud.fetchListValues("books/1"); + + assertEquals(book, "{\"title\":\"Title 2\",\"author\":\"John Doe\"}"); + + } +} \ No newline at end of file diff --git a/json/src/test/resources/address.json b/json/src/test/resources/address.json new file mode 100644 index 0000000000..599fcae12b --- /dev/null +++ b/json/src/test/resources/address.json @@ -0,0 +1,4 @@ +{ + "name": "Customer 01", + "street name": "Street 01" +} \ No newline at end of file diff --git a/json/src/test/resources/books.json b/json/src/test/resources/books.json new file mode 100644 index 0000000000..0defc3de98 --- /dev/null +++ b/json/src/test/resources/books.json @@ -0,0 +1,7 @@ +{ + "library": "My Personal Library", + "books": [ + { "title":"Title 1", "author":"Jane Doe" }, + { "title":"Title 2", "author":"John Doe" } + ] +} \ No newline at end of file From 74e3e7ff95078b5e8ed6bac245faf55424b45799 Mon Sep 17 00:00:00 2001 From: Juan Moreno Date: Mon, 13 Aug 2018 20:33:36 -0300 Subject: [PATCH 181/298] Kotlin Nested and Inner Classes Code SampleCode Issue: BAEL-1759 --- core-kotlin/pom.xml | 48 ++++++------ .../kotlin/com/baeldung/nested/Computer.kt | 75 +++++++++++++++++++ .../com/baeldung/nested/ComputerUnitTest.kt | 28 +++++++ 3 files changed, 127 insertions(+), 24 deletions(-) create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/nested/Computer.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/nested/ComputerUnitTest.kt diff --git a/core-kotlin/pom.xml b/core-kotlin/pom.xml index afa7d8a963..a86359c02f 100644 --- a/core-kotlin/pom.xml +++ b/core-kotlin/pom.xml @@ -106,22 +106,22 @@ klaxon ${klaxon.version} - - io.ktor - ktor-server-netty - ${ktor.io.version} - - - io.ktor - ktor-gson - ${ktor.io.version} - - - ch.qos.logback - logback-classic - 1.2.1 - test - + + io.ktor + ktor-server-netty + ${ktor.io.version} + + + io.ktor + ktor-gson + ${ktor.io.version} + + + ch.qos.logback + logback-classic + 1.2.1 + test + @@ -166,13 +166,13 @@ ${java.version} - default-compile none - default-testCompile @@ -224,10 +224,10 @@ UTF-8 - 1.2.51 - 1.2.51 - 1.2.51 - 1.2.51 + 1.2.60 + 1.2.60 + 1.2.60 + 1.2.60 0.22.5 0.9.2 1.5.0 @@ -235,9 +235,9 @@ 3.0.4 0.1.0 3.6.1 - 1.0.0 + 1.1.1 5.2.0 3.10.0 - + \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/nested/Computer.kt b/core-kotlin/src/main/kotlin/com/baeldung/nested/Computer.kt new file mode 100644 index 0000000000..ee01c06646 --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/nested/Computer.kt @@ -0,0 +1,75 @@ +package com.baeldung.nested + +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +class Computer(val model: String) { + + companion object { + const val originCountry = "China" + fun getBuiltDate(): String { + return "2018-05-23" + } + + val log: Logger = LoggerFactory.getLogger(Computer::class.java) + } + + //Nested class + class MotherBoard(val manufacturer: String) { + fun getInfo() = "Made by $manufacturer installed in $originCountry - ${getBuiltDate()}" + } + + //Inner class + inner class HardDisk(val sizeInGb: Int) { + fun getInfo() = "Installed on ${this@Computer} with $sizeInGb GB" + } + + interface Switcher { + fun on(): String + } + + interface Protector { + fun smart() + } + + fun powerOn(): String { + //Local class + var defaultColor = "Blue" + + class Led(val color: String) { + fun blink(): String { + return "blinking $color" + } + + fun changeDefaultPowerOnColor() { + defaultColor = "Violet" + } + } + + val powerLed = Led("Green") + log.debug("defaultColor is $defaultColor") + powerLed.changeDefaultPowerOnColor() + log.debug("defaultColor changed inside Led class to $defaultColor") + //Anonymous object + val powerSwitch = object : Switcher, Protector { + override fun on(): String { + return powerLed.blink() + } + + override fun smart() { + log.debug("Smart protection is implemented") + } + + fun changeDefaultPowerOnColor() { + defaultColor = "Yellow" + } + } + powerSwitch.changeDefaultPowerOnColor() + log.debug("defaultColor changed inside powerSwitch anonymous object to $defaultColor") + return powerSwitch.on() + } + + override fun toString(): String { + return "Computer(model=$model)" + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/nested/ComputerUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/nested/ComputerUnitTest.kt new file mode 100644 index 0000000000..7882d85b3c --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/nested/ComputerUnitTest.kt @@ -0,0 +1,28 @@ +package com.baeldung.nested + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ComputerUnitTest { + + @Test + fun givenComputer_whenPowerOn_thenBlink() { + val computer = Computer("Desktop") + + assertThat(computer.powerOn()).isEqualTo("blinking Green") + } + + @Test + fun givenMotherboard_whenGetInfo_thenGetInstalledAndBuiltDetails() { + val motherBoard = Computer.MotherBoard("MotherBoard Inc.") + + assertThat(motherBoard.getInfo()).isEqualTo("Made by MotherBoard Inc. installed in China - 2018-05-23") + } + + @Test + fun givenHardDisk_whenGetInfo_thenGetComputerModelAndDiskSizeInGb() { + val hardDisk = Computer("Desktop").HardDisk(1000) + + assertThat(hardDisk.getInfo()).isEqualTo("Installed on Computer(model=Desktop) with 1000 GB") + } +} \ No newline at end of file From f2c2287b65bcdedadea7e2d492956b2f8eb88dac Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 14 Aug 2018 08:47:47 +0530 Subject: [PATCH 182/298] BAEL-8143 Update Mockito articles -Upgraded mockito version to 2.21.0 --- aws/pom.xml | 2 +- ethereum/pom.xml | 2 +- javax-servlets/pom.xml | 2 +- pom.xml | 2 +- spring-core/pom.xml | 2 +- spring-mockito/pom.xml | 2 +- testing-modules/mockito-2/pom.xml | 2 +- testing-modules/mocks/mock-comparisons/pom.xml | 2 +- testing-modules/test-containers/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/aws/pom.xml b/aws/pom.xml index 176ecaa40d..26bc0c8037 100644 --- a/aws/pom.xml +++ b/aws/pom.xml @@ -137,7 +137,7 @@ 1.1.0 2.8.0 1.11.290 - 2.8.9 + 2.21.0 3.8.0 1.11.86 https://s3-us-west-2.amazonaws.com/dynamodb-local/release diff --git a/ethereum/pom.xml b/ethereum/pom.xml index f07ed2c6a0..434898635f 100644 --- a/ethereum/pom.xml +++ b/ethereum/pom.xml @@ -213,7 +213,7 @@ 3.3.1 5.0.5.RELEASE 1.5.6.RELEASE - 1.10.19 + 2.21.0 2.5.0 1.3 2.9.3 diff --git a/javax-servlets/pom.xml b/javax-servlets/pom.xml index afee807428..7b4eecd880 100644 --- a/javax-servlets/pom.xml +++ b/javax-servlets/pom.xml @@ -84,7 +84,7 @@ 5.0.5.RELEASE 2.8.2 3.9.1 - 2.18.3 + 2.21.0 1.3.3 2.6 4.0.1 diff --git a/pom.xml b/pom.xml index 978e27f055..98e0066597 100644 --- a/pom.xml +++ b/pom.xml @@ -1239,7 +1239,7 @@ 4.12 1.3 - 2.8.9 + 2.21.0 1.7.21 1.1.7 diff --git a/spring-core/pom.xml b/spring-core/pom.xml index 9e885462f3..708ba7c5a2 100644 --- a/spring-core/pom.xml +++ b/spring-core/pom.xml @@ -90,7 +90,7 @@ - 1.10.19 + 2.21.0 1.4.4.RELEASE 1 20.0 diff --git a/spring-mockito/pom.xml b/spring-mockito/pom.xml index 6aeaa9a1e8..a7a1c834ed 100644 --- a/spring-mockito/pom.xml +++ b/spring-mockito/pom.xml @@ -30,7 +30,7 @@ - 1.10.19 + 2.21.0 diff --git a/testing-modules/mockito-2/pom.xml b/testing-modules/mockito-2/pom.xml index 4b7dc70155..cab4d7977b 100644 --- a/testing-modules/mockito-2/pom.xml +++ b/testing-modules/mockito-2/pom.xml @@ -15,6 +15,6 @@ - 2.8.9 + 2.21.0 diff --git a/testing-modules/mocks/mock-comparisons/pom.xml b/testing-modules/mocks/mock-comparisons/pom.xml index 9424757a7a..df54db0c70 100644 --- a/testing-modules/mocks/mock-comparisons/pom.xml +++ b/testing-modules/mocks/mock-comparisons/pom.xml @@ -46,7 +46,7 @@ - 2.9.0 + 2.21.0 3.5.1 1.34 diff --git a/testing-modules/test-containers/pom.xml b/testing-modules/test-containers/pom.xml index 0ace187555..1f4c483988 100644 --- a/testing-modules/test-containers/pom.xml +++ b/testing-modules/test-containers/pom.xml @@ -104,7 +104,7 @@ 4.12.1 2.8.2 1.4.196 - 2.11.0 + 2.21.0 5.0.1.RELEASE 1.7.2 42.2.2 From 924a3dc9cc73927d2965e1b55fac4dc02f2cbfa0 Mon Sep 17 00:00:00 2001 From: daoire Date: Tue, 14 Aug 2018 07:25:11 +0100 Subject: [PATCH 183/298] Java Faker Tests (#4922) * Java Faker Tests * Rename tests * Rename Test Class * Remove files from sub module --- testing-modules/java-faker/pom.xml | 29 ----- .../test/java/com/baeldung/JavaFakerTest.java | 115 ----------------- testing-modules/testing/pom.xml | 5 + .../baeldung/javafaker/JavaFakerUnitTest.java | 121 ++++++++++++++++++ 4 files changed, 126 insertions(+), 144 deletions(-) delete mode 100644 testing-modules/java-faker/pom.xml delete mode 100644 testing-modules/java-faker/src/test/java/com/baeldung/JavaFakerTest.java create mode 100644 testing-modules/testing/src/test/java/com/baeldung/javafaker/JavaFakerUnitTest.java diff --git a/testing-modules/java-faker/pom.xml b/testing-modules/java-faker/pom.xml deleted file mode 100644 index 4ac5368e24..0000000000 --- a/testing-modules/java-faker/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 4.0.0 - - com.baeldung - java-faker - 1.0-SNAPSHOT - - - - com.github.javafaker - javafaker - 0.15 - - - - - junit - junit - 4.12 - test - - - - - - diff --git a/testing-modules/java-faker/src/test/java/com/baeldung/JavaFakerTest.java b/testing-modules/java-faker/src/test/java/com/baeldung/JavaFakerTest.java deleted file mode 100644 index 8d89fa0ab2..0000000000 --- a/testing-modules/java-faker/src/test/java/com/baeldung/JavaFakerTest.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.baeldung; - -import com.github.javafaker.Faker; -import com.github.javafaker.service.FakeValuesService; -import com.github.javafaker.service.FakerIDN; -import com.github.javafaker.service.LocaleDoesNotExistException; -import com.github.javafaker.service.RandomService; -import javafx.scene.Parent; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import java.util.Locale; -import java.util.Random; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -public class JavaFakerTest { - - private Faker faker; - - @Before - public void setUp() throws Exception { - faker = new Faker(); - } - - @Test - public void givenJavaFaker_whenAddressObjectCalled_checkValidAddressInfoGiven() throws Exception { - - Faker faker = new Faker(); - - String streetName = faker.address().streetName(); - String number = faker.address().buildingNumber(); - String city = faker.address().city(); - String country = faker.address().country(); - - System.out.println(String.format("%s\n%s\n%s\n%s", - number, - streetName, - city, - country)); - - } - - @Test - public void givenJavaFakersWithSameSeed_whenNameCalled_CheckSameName() throws Exception { - - Faker faker1 = new Faker(new Random(24)); - Faker faker2 = new Faker(new Random(24)); - - assertEquals(faker1.name().firstName(), faker2.name().firstName()); - } - - @Test - public void givenJavaFakersWithDifferentLocals_checkZipCodesMatchRegex() throws Exception { - - Faker ukFaker = new Faker(new Locale("en-GB")); - Faker usFaker = new Faker(new Locale("en-US")); - - System.out.println(String.format("American zipcode: %s", usFaker.address().zipCode())); - System.out.println(String.format("British postcode: %s", ukFaker.address().zipCode())); - - Pattern ukPattern = Pattern.compile("([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z]))))\\s?[0-9][A-Za-z]{2})"); - Matcher ukMatcher = ukPattern.matcher(ukFaker.address().zipCode()); - - assertTrue(ukMatcher.find()); - - Matcher usMatcher = Pattern.compile("^\\d{5}(?:[-\\s]\\d{4})?$").matcher(usFaker.address().zipCode()); - - assertTrue(usMatcher.find()); - - } - - @Test - public void givenJavaFakerService_testFakersCreated() throws Exception { - - RandomService randomService = new RandomService(); - - System.out.println(randomService.nextBoolean()); - System.out.println(randomService.nextDouble()); - - Faker faker = new Faker(new Random(randomService.nextLong())); - - System.out.println(faker.address().city()); - - } - - @Test - public void testFakeValuesService() throws Exception { - - FakeValuesService fakeValuesService = new FakeValuesService(new Locale("en-GB"), new RandomService()); - - String email = fakeValuesService.bothify("????##@gmail.com"); - Matcher emailMatcher = Pattern.compile("\\w{4}\\d{2}@gmail.com").matcher(email); - assertTrue(emailMatcher.find()); - - String alphaNumericString = fakeValuesService.regexify("[a-z1-9]{10}"); - Matcher alphaNumericMatcher = Pattern.compile("[a-z1-9]{10}").matcher(alphaNumericString); - assertTrue(alphaNumericMatcher.find()); - - } - - - @Test(expected = LocaleDoesNotExistException.class) - public void givenWrongLocale_whenFakerIsInitialised_testLocaleDoesNotExistExceptionIsThrown() throws Exception { - - Faker wrongLocaleFaker = new Faker(new Locale("en-seaWorld")); - - } -} diff --git a/testing-modules/testing/pom.xml b/testing-modules/testing/pom.xml index 7b2fe76d0f..2e783b2116 100644 --- a/testing-modules/testing/pom.xml +++ b/testing-modules/testing/pom.xml @@ -88,6 +88,11 @@ javalite-common ${javalite.version} + + com.github.javafaker + javafaker + 0.15 + diff --git a/testing-modules/testing/src/test/java/com/baeldung/javafaker/JavaFakerUnitTest.java b/testing-modules/testing/src/test/java/com/baeldung/javafaker/JavaFakerUnitTest.java new file mode 100644 index 0000000000..7a3b9771fb --- /dev/null +++ b/testing-modules/testing/src/test/java/com/baeldung/javafaker/JavaFakerUnitTest.java @@ -0,0 +1,121 @@ +package com.baeldung.javafaker; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Locale; +import java.util.Random; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.junit.Before; +import org.junit.Test; + +import com.github.javafaker.Faker; +import com.github.javafaker.service.FakeValuesService; +import com.github.javafaker.service.LocaleDoesNotExistException; +import com.github.javafaker.service.RandomService; + +public class JavaFakerUnitTest { + + private Faker faker; + + @Before + public void setUp() throws Exception { + faker = new Faker(); + } + + @Test + public void givenJavaFaker_whenAddressObjectCalled_checkValidAddressInfoGiven() throws Exception { + + Faker faker = new Faker(); + + String streetName = faker.address() + .streetName(); + String number = faker.address() + .buildingNumber(); + String city = faker.address() + .city(); + String country = faker.address() + .country(); + + System.out.println(String.format("%s\n%s\n%s\n%s", number, streetName, city, country)); + + } + + @Test + public void givenJavaFakersWithSameSeed_whenNameCalled_CheckSameName() throws Exception { + + Faker faker1 = new Faker(new Random(24)); + Faker faker2 = new Faker(new Random(24)); + + assertEquals(faker1.name() + .firstName(), + faker2.name() + .firstName()); + } + + @Test + public void givenJavaFakersWithDifferentLocals_checkZipCodesMatchRegex() throws Exception { + + Faker ukFaker = new Faker(new Locale("en-GB")); + Faker usFaker = new Faker(new Locale("en-US")); + + System.out.println(String.format("American zipcode: %s", usFaker.address() + .zipCode())); + System.out.println(String.format("British postcode: %s", ukFaker.address() + .zipCode())); + + Pattern ukPattern = Pattern.compile("([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z]))))\\s?[0-9][A-Za-z]{2})"); + Matcher ukMatcher = ukPattern.matcher(ukFaker.address() + .zipCode()); + + assertTrue(ukMatcher.find()); + + Matcher usMatcher = Pattern.compile("^\\d{5}(?:[-\\s]\\d{4})?$") + .matcher(usFaker.address() + .zipCode()); + + assertTrue(usMatcher.find()); + + } + + @Test + public void givenJavaFakerService_testFakersCreated() throws Exception { + + RandomService randomService = new RandomService(); + + System.out.println(randomService.nextBoolean()); + System.out.println(randomService.nextDouble()); + + Faker faker = new Faker(new Random(randomService.nextLong())); + + System.out.println(faker.address() + .city()); + + } + + @Test + public void testFakeValuesService() throws Exception { + + FakeValuesService fakeValuesService = new FakeValuesService(new Locale("en-GB"), new RandomService()); + + String email = fakeValuesService.bothify("????##@gmail.com"); + Matcher emailMatcher = Pattern.compile("\\w{4}\\d{2}@gmail.com") + .matcher(email); + assertTrue(emailMatcher.find()); + + String alphaNumericString = fakeValuesService.regexify("[a-z1-9]{10}"); + Matcher alphaNumericMatcher = Pattern.compile("[a-z1-9]{10}") + .matcher(alphaNumericString); + assertTrue(alphaNumericMatcher.find()); + + } + + @Test(expected = LocaleDoesNotExistException.class) + public void givenWrongLocale_whenFakerIsInitialised_testLocaleDoesNotExistExceptionIsThrown() throws Exception { + + Faker wrongLocaleFaker = new Faker(new Locale("en-seaWorld")); + + } +} \ No newline at end of file From 0b9bb44781f1e79f67646a6e49595459655ef271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Tue, 14 Aug 2018 08:26:57 +0200 Subject: [PATCH 184/298] [BAEL-2020] Differences between final, finally and finalize in Java (#4848) * [BAEL-2020] Examples code * [BAEL-2020] Moving classes into 'keywords' package --- .../keywords/finalize/FinalizeObject.java | 18 ++++++++++++ .../baeldung/keywords/finalkeyword/Child.java | 15 ++++++++++ .../keywords/finalkeyword/GrandChild.java | 5 ++++ .../keywords/finalkeyword/Parent.java | 23 +++++++++++++++ .../finallykeyword/FinallyExample.java | 29 +++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/keywords/finalize/FinalizeObject.java create mode 100644 core-java/src/main/java/com/baeldung/keywords/finalkeyword/Child.java create mode 100644 core-java/src/main/java/com/baeldung/keywords/finalkeyword/GrandChild.java create mode 100644 core-java/src/main/java/com/baeldung/keywords/finalkeyword/Parent.java create mode 100644 core-java/src/main/java/com/baeldung/keywords/finallykeyword/FinallyExample.java diff --git a/core-java/src/main/java/com/baeldung/keywords/finalize/FinalizeObject.java b/core-java/src/main/java/com/baeldung/keywords/finalize/FinalizeObject.java new file mode 100644 index 0000000000..af0449c0da --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keywords/finalize/FinalizeObject.java @@ -0,0 +1,18 @@ +package com.baeldung.keywords.finalize; + +public class FinalizeObject { + + @Override + protected void finalize() throws Throwable { + System.out.println("Execute finalize method"); + super.finalize(); + } + + public static void main(String[] args) throws Exception { + FinalizeObject object = new FinalizeObject(); + object = null; + System.gc(); + Thread.sleep(1000); + } + +} diff --git a/core-java/src/main/java/com/baeldung/keywords/finalkeyword/Child.java b/core-java/src/main/java/com/baeldung/keywords/finalkeyword/Child.java new file mode 100644 index 0000000000..8615c78652 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keywords/finalkeyword/Child.java @@ -0,0 +1,15 @@ +package com.baeldung.keywords.finalkeyword; + +public final class Child extends Parent { + + @Override + void method1(int arg1, final int arg2) { + // OK + } + +/* @Override + void method2() { + // Compilation error + }*/ + +} diff --git a/core-java/src/main/java/com/baeldung/keywords/finalkeyword/GrandChild.java b/core-java/src/main/java/com/baeldung/keywords/finalkeyword/GrandChild.java new file mode 100644 index 0000000000..1530c5037f --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keywords/finalkeyword/GrandChild.java @@ -0,0 +1,5 @@ +package com.baeldung.keywords.finalkeyword; + +/*public class GrandChild extends Child { + // Compilation error +}*/ diff --git a/core-java/src/main/java/com/baeldung/keywords/finalkeyword/Parent.java b/core-java/src/main/java/com/baeldung/keywords/finalkeyword/Parent.java new file mode 100644 index 0000000000..5cd2996e7a --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keywords/finalkeyword/Parent.java @@ -0,0 +1,23 @@ +package com.baeldung.keywords.finalkeyword; + +public class Parent { + + int field1 = 1; + final int field2 = 2; + + Parent() { + field1 = 2; // OK +// field2 = 3; // Compilation error + } + + void method1(int arg1, final int arg2) { + arg1 = 2; // OK +// arg2 = 3; // Compilation error + } + + final void method2() { + final int localVar = 2; // OK +// localVar = 3; // Compilation error + } + +} diff --git a/core-java/src/main/java/com/baeldung/keywords/finallykeyword/FinallyExample.java b/core-java/src/main/java/com/baeldung/keywords/finallykeyword/FinallyExample.java new file mode 100644 index 0000000000..3c0aee3196 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/keywords/finallykeyword/FinallyExample.java @@ -0,0 +1,29 @@ +package com.baeldung.keywords.finallykeyword; + +public class FinallyExample { + + public static void main(String args[]) throws Exception { + try { + System.out.println("Execute try block"); + throw new Exception(); + } catch (Exception e) { + System.out.println("Execute catch block"); + } finally { + System.out.println("Execute finally block"); + } + + try { + System.out.println("Execute try block"); + } finally { + System.out.println("Execute finally block"); + } + + try { + System.out.println("Execute try block"); + throw new Exception(); + } finally { + System.out.println("Execute finally block"); + } + } + +} From ce8d193f47a2c1f3e664898cc1b41eadb653e969 Mon Sep 17 00:00:00 2001 From: Vizsoro Date: Tue, 14 Aug 2018 09:43:43 +0200 Subject: [PATCH 185/298] simplifying exception test (#4962) * simplifying exception test * simplifying subclass initialization --- .../ListInitializationUnitTest.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java b/core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java index bc012dae6b..b484eecef7 100644 --- a/core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java +++ b/core-java/src/test/java/com/baeldung/java/listInitialization/ListInitializationUnitTest.java @@ -9,28 +9,15 @@ import java.util.stream.Stream; import lombok.extern.java.Log; import org.junit.Assert; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; @Log public class ListInitializationUnitTest { - @Rule - public ExpectedException exception = ExpectedException.none(); - @Test public void givenAnonymousInnerClass_thenInitialiseList() { List cities = new ArrayList() { - // Inside declaration of the subclass - - // You can have multiple initializer block { - log.info("Inside the first initializer block."); - } - - { - log.info("Inside the second initializer block."); add("New York"); add("Rio"); add("Tokyo"); @@ -47,11 +34,10 @@ public class ListInitializationUnitTest { Assert.assertTrue(list.contains("foo")); } - @Test + @Test(expected = UnsupportedOperationException.class) public void givenArraysAsList_whenAdd_thenUnsupportedException() { List list = Arrays.asList("foo", "bar"); - exception.expect(UnsupportedOperationException.class); list.add("baz"); } From 856ca42d23e7dd0241a448f4e83c0b12547550bf Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 14 Aug 2018 13:34:45 +0530 Subject: [PATCH 186/298] BAEL-7636 Add the missing plugin versions in the tutorial repo -Added missing plugin versions --- apache-thrift/pom.xml | 2 + core-java-8/pom.xml | 2 + core-java-io/pom.xml | 2 + disruptor/pom.xml | 2 + ethereum/pom.xml | 2 + .../spring-boot-admin-client/pom.xml | 2 + .../spring-boot-admin-server/pom.xml | 2 + spring-boot-persistence/pom.xml | 98 ++++++++++--------- spring-boot-security/pom.xml | 2 + spring-boot/pom.xml | 2 + spring-mvc-java/pom.xml | 2 + spring-reactive-kotlin/pom.xml | 20 ++-- .../spring-swagger-codegen-app/pom.xml | 2 + 13 files changed, 83 insertions(+), 57 deletions(-) diff --git a/apache-thrift/pom.xml b/apache-thrift/pom.xml index 6947cc71bc..b22364cb19 100644 --- a/apache-thrift/pom.xml +++ b/apache-thrift/pom.xml @@ -39,6 +39,7 @@ org.codehaus.mojo build-helper-maven-plugin + ${build-helper-maven-plugin.version} generate-sources @@ -60,6 +61,7 @@ 0.10.0 0.1.11 1.7.12 + 3.0.0 diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml index 7e3b8cb280..ed145af5d2 100644 --- a/core-java-8/pom.xml +++ b/core-java-8/pom.xml @@ -151,6 +151,7 @@ org.springframework.boot spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} @@ -184,6 +185,7 @@ 1.7.0 1.19 1.19 + 2.0.4.RELEASE
\ No newline at end of file diff --git a/core-java-io/pom.xml b/core-java-io/pom.xml index 35bc43921c..bc71fb8838 100644 --- a/core-java-io/pom.xml +++ b/core-java-io/pom.xml @@ -183,6 +183,7 @@ org.springframework.boot spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} @@ -316,6 +317,7 @@ 2.1.0.1 1.19 2.4.5 + 2.0.4.RELEASE
\ No newline at end of file diff --git a/disruptor/pom.xml b/disruptor/pom.xml index 6f3a8d9bfd..d3cef3bd9b 100644 --- a/disruptor/pom.xml +++ b/disruptor/pom.xml @@ -112,6 +112,7 @@ com.jolira onejar-maven-plugin + ${onejar-maven-plugin.version} @@ -138,6 +139,7 @@ 2.4.3 3.0.2 + 1.4.4 \ No newline at end of file diff --git a/ethereum/pom.xml b/ethereum/pom.xml index f07ed2c6a0..837ee2b19c 100644 --- a/ethereum/pom.xml +++ b/ethereum/pom.xml @@ -184,6 +184,7 @@ org.springframework.boot spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} org.apache.maven.plugins @@ -224,6 +225,7 @@ 4.12 1.2.3 1.7.25 + 2.0.4.RELEASE diff --git a/spring-boot-admin/spring-boot-admin-client/pom.xml b/spring-boot-admin/spring-boot-admin-client/pom.xml index fcbbb11cd7..ea03d6ef6d 100644 --- a/spring-boot-admin/spring-boot-admin-client/pom.xml +++ b/spring-boot-admin/spring-boot-admin-client/pom.xml @@ -46,6 +46,7 @@ org.springframework.boot spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} @@ -59,6 +60,7 @@ 1.5.4 + 2.0.4.RELEASE diff --git a/spring-boot-admin/spring-boot-admin-server/pom.xml b/spring-boot-admin/spring-boot-admin-server/pom.xml index 50228034c1..d8e7bb5574 100644 --- a/spring-boot-admin/spring-boot-admin-server/pom.xml +++ b/spring-boot-admin/spring-boot-admin-server/pom.xml @@ -76,6 +76,7 @@ org.springframework.boot spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} @@ -83,6 +84,7 @@ 1.5.4 1.5.4 + 2.0.4.RELEASE diff --git a/spring-boot-persistence/pom.xml b/spring-boot-persistence/pom.xml index 60e6689e31..a16d953581 100644 --- a/spring-boot-persistence/pom.xml +++ b/spring-boot-persistence/pom.xml @@ -1,53 +1,57 @@ - 4.0.0 - com.baeldung - spring-boot-persistence - 0.0.1-SNAPSHOT - jar - spring-boot-persistence - This is a simple Spring Data Repositories test + 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-boot-persistence + 0.0.1-SNAPSHOT + jar + spring-boot-persistence + This is a simple Spring Data Repositories test - - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 - + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.h2database - h2 - - - org.springframework.boot - spring-boot-starter - - + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + + + org.springframework.boot + spring-boot-starter + + - - spring-boot-persistence - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-war-plugin - - - pl.project13.maven - git-commit-id-plugin - - - + + spring-boot-persistence + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-war-plugin + + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + + + + + 2.2.4 + \ No newline at end of file diff --git a/spring-boot-security/pom.xml b/spring-boot-security/pom.xml index 12f51eec94..5283a69c2d 100644 --- a/spring-boot-security/pom.xml +++ b/spring-boot-security/pom.xml @@ -67,12 +67,14 @@ org.springframework.boot spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} 1.5.9.RELEASE + 2.0.4.RELEASE diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index 3a43dbd828..0667a24416 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -176,6 +176,7 @@ pl.project13.maven git-commit-id-plugin + ${git-commit-id-plugin.version} @@ -230,6 +231,7 @@ 3.2.0 18.0 1.2.0 + 2.2.4 \ No newline at end of file diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 068824eba0..83f2556fe0 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -163,6 +163,7 @@ maven-resources-plugin + ${maven-resources-plugin.version} @@ -283,6 +284,7 @@ 2.6 2.7 1.6.1 + 3.1.0 1.8.9 diff --git a/spring-reactive-kotlin/pom.xml b/spring-reactive-kotlin/pom.xml index f2f0dc58ec..2bac2d1961 100644 --- a/spring-reactive-kotlin/pom.xml +++ b/spring-reactive-kotlin/pom.xml @@ -12,15 +12,11 @@ Demo project for Spring Boot - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 - - - - 1.2.41 - + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + @@ -67,6 +63,7 @@ kotlin-maven-plugin org.jetbrains.kotlin + ${kotlin-maven-plugin.version} -Xjsr305=strict @@ -86,5 +83,8 @@ - + + 1.2.41 + 1.2.60 + diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml index ece534dc74..8e8c9f5e09 100644 --- a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml +++ b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml @@ -31,6 +31,7 @@ org.springframework.boot spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} @@ -39,6 +40,7 @@ 1.8 0.0.1-SNAPSHOT 1.5.10.RELEASE + 2.0.4.RELEASE \ No newline at end of file From f996c000c5e04fe31102a2e76a374b4e23a7bb77 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 14 Aug 2018 14:17:35 +0530 Subject: [PATCH 187/298] Update pom.xml --- spring-swagger-codegen/spring-swagger-codegen-app/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml index 8e8c9f5e09..4880eb9453 100644 --- a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml +++ b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml @@ -42,5 +42,4 @@ 1.5.10.RELEASE 2.0.4.RELEASE - - \ No newline at end of file + From f55e3796d98e6e239bf637be7a3561885e3bc1cb Mon Sep 17 00:00:00 2001 From: Felipe Santiago Corro Date: Tue, 14 Aug 2018 07:24:28 -0300 Subject: [PATCH 188/298] optimizing regex expressions (#4961) --- .../optmization/OptimizedMatcher.java | 6 + .../optmization/OptimizedMatcherUnitTest.java | 109 ++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/regexp/datepattern/optmization/OptimizedMatcher.java create mode 100644 core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/optmization/OptimizedMatcher.java b/core-java/src/main/java/com/baeldung/regexp/datepattern/optmization/OptimizedMatcher.java new file mode 100644 index 0000000000..ccae942dcc --- /dev/null +++ b/core-java/src/main/java/com/baeldung/regexp/datepattern/optmization/OptimizedMatcher.java @@ -0,0 +1,6 @@ +package com.baeldung.regexp.datepattern.optmization; + +public class OptimizedMatcher { + + +} diff --git a/core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherUnitTest.java b/core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherUnitTest.java new file mode 100644 index 0000000000..f21a755b01 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/regexp/optmization/OptimizedMatcherUnitTest.java @@ -0,0 +1,109 @@ +package com.baeldung.regexp.optmization; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static org.junit.Assert.assertTrue; + +public class OptimizedMatcherUnitTest { + + private long time; + private long mstimePreCompiled; + private long mstimeNotPreCompiled; + + private String action; + + private List items; + + @Before + public void setup() { + Random random = new Random(); + items = new ArrayList(); + long average = 0; + + for (int i = 0; i < 100000; ++i) { + StringBuilder s = new StringBuilder(); + int characters = random.nextInt(7) + 1; + for (int k = 0; k < characters; ++ k) { + char c = (char)(random.nextInt('Z' - 'A') + 'A'); + int rep = random.nextInt(95) + 5; + for (int j = 0; j < rep; ++ j) + s.append(c); + average += rep; + } + items.add(s.toString()); + } + + average /= 100000; + System.out.println("generated data, average length: " + average); + } + + + @Test + public void givenANotPreCompiledAndAPreCompiledPatternA_whenMatcheItems_thenPreCompiledFasterThanNotPreCompiled() { + + testPatterns("A*"); + assertTrue(mstimePreCompiled < mstimeNotPreCompiled); + } + + @Test + public void givenANotPreCompiledAndAPreCompiledPatternABC_whenMatcheItems_thenPreCompiledFasterThanNotPreCompiled() { + + testPatterns("A*B*C*"); + assertTrue(mstimePreCompiled < mstimeNotPreCompiled); + } + + @Test + public void givenANotPreCompiledAndAPreCompiledPatternECWF_whenMatcheItems_thenPreCompiledFasterThanNotPreCompiled() { + + testPatterns("E*C*W*F*"); + assertTrue(mstimePreCompiled < mstimeNotPreCompiled); + } + + private void testPatterns(String regex) { + time = System.nanoTime(); + int matched = 0; + int unmatched = 0; + + for (String item : this.items) { + if (item.matches(regex)) { + ++matched; + } + else { + ++unmatched; + } + } + + this.action = "uncompiled: regex=" + regex + " matched=" + matched + " unmatched=" + unmatched; + + this.mstimeNotPreCompiled = (System.nanoTime() - time) / 1000000; + System.out.println(this.action + ": " + mstimeNotPreCompiled + "ms"); + + time = System.nanoTime(); + + Matcher matcher = Pattern.compile(regex).matcher(""); + matched = 0; + unmatched = 0; + + for (String item : this.items) { + if (matcher.reset(item).matches()) { + ++matched; + } + else { + ++unmatched; + } + } + + this.action = "compiled: regex=" + regex + " matched=" + matched + " unmatched=" + unmatched; + + this.mstimePreCompiled = (System.nanoTime() - time) / 1000000; + System.out.println(this.action + ": " + mstimePreCompiled + "ms"); + } +} From 623ae0ba7290cf77391cf397957c0fd44960208b Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 14 Aug 2018 21:18:44 +0530 Subject: [PATCH 189/298] BAEL-7636 Add the missing plugin versions in the tutorial repo -Added spring-swagger-codegen projects explicitly in pom.xml --- pom.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index db3bef7fda..0b7e842871 100644 --- a/pom.xml +++ b/pom.xml @@ -434,7 +434,8 @@ testing-modules/rest-testing resteasy rxjava - spring-swagger-codegen + spring-swagger-codegen/spring-swagger-codegen-api-client + spring-swagger-codegen/spring-swagger-codegen-app testing-modules/selenium-junit-testng persistence-modules/solr spark-java @@ -691,7 +692,8 @@ testing-modules/rest-testing resteasy rxjava - spring-swagger-codegen + spring-swagger-codegen/spring-swagger-codegen-api-client + spring-swagger-codegen/spring-swagger-codegen-app testing-modules/selenium-junit-testng persistence-modules/solr spark-java @@ -972,7 +974,8 @@ testing-modules/rest-testing resteasy rxjava - spring-swagger-codegen + spring-swagger-codegen/spring-swagger-codegen-api-client + spring-swagger-codegen/spring-swagger-codegen-app testing-modules/selenium-junit-testng persistence-modules/solr spark-java From 489a26d4296ed3e45f9fd5436ee71da3f8d0d5e2 Mon Sep 17 00:00:00 2001 From: DOHA Date: Tue, 14 Aug 2018 20:52:19 +0300 Subject: [PATCH 190/298] fix eclipse profiles --- eclipse/formatter.xml | 292 ------------------------------------------ 1 file changed, 292 deletions(-) diff --git a/eclipse/formatter.xml b/eclipse/formatter.xml index 808f65cda9..6887946a4c 100644 --- a/eclipse/formatter.xml +++ b/eclipse/formatter.xml @@ -1,297 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 7c940234868c6be44e5a433a12c37d37d3e39fa2 Mon Sep 17 00:00:00 2001 From: Doha2012 Date: Tue, 14 Aug 2018 20:50:33 +0000 Subject: [PATCH 191/298] fix eclipse profiles (#4966) --- eclipse/formatter.xml | 292 ------------------------------------------ 1 file changed, 292 deletions(-) diff --git a/eclipse/formatter.xml b/eclipse/formatter.xml index 808f65cda9..6887946a4c 100644 --- a/eclipse/formatter.xml +++ b/eclipse/formatter.xml @@ -1,297 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 3b64d8ef4ed0cb8201de94a75ba2675ecb93d9b1 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Wed, 15 Aug 2018 14:14:50 +0530 Subject: [PATCH 192/298] BAEL-8219 Fix tests for core-java, maven and core-java-io projects -Test fixes --- .../file/FilenameFilterManualTest.java | 2 +- .../people.json | 0 .../students.json | 0 .../teachers.xml | 0 .../workers.xml | 0 .../exceptionhandling/Exceptions.java | 16 +- .../com/baeldung/binding/AnimalUnitTest.java | 17 +- maven/pom.xml | 266 ++++++++++-------- 8 files changed, 158 insertions(+), 143 deletions(-) rename core-java-io/src/test/resources/{testFolder => fileNameFilterManualTestFolder}/people.json (100%) rename core-java-io/src/test/resources/{testFolder => fileNameFilterManualTestFolder}/students.json (100%) rename core-java-io/src/test/resources/{testFolder => fileNameFilterManualTestFolder}/teachers.xml (100%) rename core-java-io/src/test/resources/{testFolder => fileNameFilterManualTestFolder}/workers.xml (100%) diff --git a/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java index 47a7973b34..f9a2ce972d 100644 --- a/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java +++ b/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java @@ -18,7 +18,7 @@ public class FilenameFilterManualTest { @BeforeClass public static void setupClass() { directory = new File(FilenameFilterManualTest.class.getClassLoader() - .getResource("testFolder") + .getResource("fileNameFilterManualTestFolder") .getFile()); } diff --git a/core-java-io/src/test/resources/testFolder/people.json b/core-java-io/src/test/resources/fileNameFilterManualTestFolder/people.json similarity index 100% rename from core-java-io/src/test/resources/testFolder/people.json rename to core-java-io/src/test/resources/fileNameFilterManualTestFolder/people.json diff --git a/core-java-io/src/test/resources/testFolder/students.json b/core-java-io/src/test/resources/fileNameFilterManualTestFolder/students.json similarity index 100% rename from core-java-io/src/test/resources/testFolder/students.json rename to core-java-io/src/test/resources/fileNameFilterManualTestFolder/students.json diff --git a/core-java-io/src/test/resources/testFolder/teachers.xml b/core-java-io/src/test/resources/fileNameFilterManualTestFolder/teachers.xml similarity index 100% rename from core-java-io/src/test/resources/testFolder/teachers.xml rename to core-java-io/src/test/resources/fileNameFilterManualTestFolder/teachers.xml diff --git a/core-java-io/src/test/resources/testFolder/workers.xml b/core-java-io/src/test/resources/fileNameFilterManualTestFolder/workers.xml similarity index 100% rename from core-java-io/src/test/resources/testFolder/workers.xml rename to core-java-io/src/test/resources/fileNameFilterManualTestFolder/workers.xml diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java b/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java index eb8b733f82..48f4b5c02b 100644 --- a/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java +++ b/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java @@ -25,11 +25,7 @@ public class Exceptions { } public List loadAllPlayers(String playersFile) throws IOException{ - try { - throw new IOException(); - } catch(IOException ex) { - throw new IllegalStateException(); - } + throw new IOException(); } public int getPlayerScoreThrows(String playerFile) throws FileNotFoundException { @@ -163,14 +159,8 @@ public class Exceptions { } } - public void throwAsGotoAntiPattern() { - try { - // bunch of code - throw new MyException(); - // second bunch of code - } catch ( MyException e ) { - // third bunch of code - } + public void throwAsGotoAntiPattern() throws MyException { + throw new MyException(); } public int getPlayerScoreSwallowingExceptionAntiPattern(String playerFile) { diff --git a/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java b/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java index 238990f2b4..a34640b58a 100644 --- a/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java +++ b/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java @@ -16,8 +16,11 @@ import org.slf4j.LoggerFactory; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.util.List; + /** * Created by madhumita.g on 01-08-2018. */ @@ -66,20 +69,18 @@ public class AnimalUnitTest { int testValue = 3; animal.makeNoise(testValue); - verify(mockAppender).doAppend(captorLoggingEvent.capture()); + verify(mockAppender,times(3)).doAppend(captorLoggingEvent.capture()); - final LoggingEvent loggingEvent = captorLoggingEvent.getValue(); + final List loggingEvents = captorLoggingEvent.getAllValues(); - while (testValue != 0) { + for(LoggingEvent loggingEvent : loggingEvents) + { assertThat(loggingEvent.getLevel(), is(Level.INFO)); assertThat(loggingEvent.getFormattedMessage(), - is("generic animal noise countdown 3\n" - + "generic animal noise countdown 2\n" - + "generic animal noise countdown 1\n")); - - testValue-=1; + is("generic animal noise countdown "+testValue)); + testValue--; } } diff --git a/maven/pom.xml b/maven/pom.xml index 4f91e8717c..a24b6b16bd 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -1,127 +1,151 @@ - 4.0.0 - com.baeldung - maven - 0.0.1-SNAPSHOT + 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 + maven + 0.0.1-SNAPSHOT - - parent-modules - com.baeldung - 1.0.0-SNAPSHOT - + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + - - - - maven-resources-plugin - ${maven.resources.version} - - output-resources - - - input-resources - - *.png - - true - - - - - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - - -Xlint:unchecked - - - - - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - DataTest.java - - - TestFail.java - DataCheck.java - - true - - - - maven-failsafe-plugin - ${maven.failsafe.version} - - - - integration-test - verify - - - - - - - - - maven-verifier-plugin - ${maven.verifier.version} - - input-resources/verifications.xml - - - - - verify - - - - - - maven-clean-plugin - ${maven.clean.version} - - - - output-resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - ${maven.build.helper.version} - - - generate-sources - - add-source - - - - src/main/another-src - - - - - - - + + + + maven-resources-plugin + ${maven.resources.version} + + output-resources + + + input-resources + + *.png + + true + + + + + + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + -Xlint:unchecked + + + + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + DataTest.java + + + TestFail.java + DataCheck.java + + true + + + + maven-failsafe-plugin + ${maven.failsafe.version} + + + + integration-test + verify + + + + + + + + + maven-verifier-plugin + ${maven.verifier.version} + + input-resources/verifications.xml + + + + + verify + + + + + + maven-clean-plugin + ${maven.clean.version} + + + + output-resources + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${maven.build.helper.version} + + + generate-sources + + add-source + + + + src/main/another-src + + + + + + + - - 3.0.2 - 2.21.0 - 1.1 - 3.0.0 - 3.0.0 - Baeldung - + + + default + + + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + DataTest.java + + + TestFail.java + DataCheck.java + + true + + + + + + + + + 3.0.2 + 2.21.0 + 1.1 + 3.0.0 + 3.0.0 + Baeldung + \ No newline at end of file From a966b54d4284c0e401cea620bab35de84050d9a4 Mon Sep 17 00:00:00 2001 From: Siben Nayak Date: Wed, 15 Aug 2018 14:19:00 +0530 Subject: [PATCH 193/298] [BAEL-2032] Operate on an item in a Stream then remove it (#4955) * [BAEL-2032] Operate on an item in a Stream then remove it * [BAEL-2032] Refactored unit test * [BAEL-2032] Added a new test for filter and used logger --- .../StreamOperateAndRemoveUnitTest.java | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java b/core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java new file mode 100644 index 0000000000..202fe00017 --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java @@ -0,0 +1,78 @@ +package com.baeldung.collection; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class StreamOperateAndRemoveUnitTest { + + private List itemList; + + @Before + public void setup() { + + itemList = new ArrayList<>(); + for (int i = 0; i < 10; i++) { + itemList.add(new Item(i)); + } + } + + @Test + public void givenAListOf10Items_whenFilteredForQualifiedItems_thenFilteredListContains5Items() { + + final List filteredList = itemList.stream().filter(item -> item.isQualified()) + .collect(Collectors.toList()); + + Assert.assertEquals(5, filteredList.size()); + } + + @Test + public void givenAListOf10Items_whenOperateAndRemoveQualifiedItemsUsingRemoveIf_thenListContains5Items() { + + itemList.stream().filter(item -> item.isQualified()).forEach(item -> item.operate()); + itemList.removeIf(item -> item.isQualified()); + + Assert.assertEquals(5, itemList.size()); + } + + @Test + public void givenAListOf10Items_whenOperateAndRemoveQualifiedItemsUsingRemoveAll_thenListContains5Items() { + + final List operatedList = new ArrayList<>(); + itemList.stream().filter(item -> item.isQualified()).forEach(item -> { + item.operate(); + operatedList.add(item); + }); + itemList.removeAll(operatedList); + + Assert.assertEquals(5, itemList.size()); + } + + class Item { + + private final Logger logger = LoggerFactory.getLogger(this.getClass().getName()); + + private final int value; + + public Item(final int value) { + + this.value = value; + } + + public boolean isQualified() { + + return value % 2 == 0; + } + + public void operate() { + + logger.info("Even Number: " + this.value); + } + } +} \ No newline at end of file From 1212404897c751a155a2e975d8b8656e095dd12f Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Wed, 15 Aug 2018 14:14:50 +0530 Subject: [PATCH 194/298] BAEL-8219 Fix tests for core-java, maven and core-java-io projects -Test fixes --- .../file/FilenameFilterManualTest.java | 2 +- .../people.json | 0 .../students.json | 0 .../teachers.xml | 0 .../workers.xml | 0 .../exceptionhandling/Exceptions.java | 16 +- .../com/baeldung/binding/AnimalUnitTest.java | 17 +- maven/pom.xml | 266 ++++++++++-------- 8 files changed, 158 insertions(+), 143 deletions(-) rename core-java-io/src/test/resources/{testFolder => fileNameFilterManualTestFolder}/people.json (100%) rename core-java-io/src/test/resources/{testFolder => fileNameFilterManualTestFolder}/students.json (100%) rename core-java-io/src/test/resources/{testFolder => fileNameFilterManualTestFolder}/teachers.xml (100%) rename core-java-io/src/test/resources/{testFolder => fileNameFilterManualTestFolder}/workers.xml (100%) diff --git a/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java index 47a7973b34..f9a2ce972d 100644 --- a/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java +++ b/core-java-io/src/test/java/com/baeldung/file/FilenameFilterManualTest.java @@ -18,7 +18,7 @@ public class FilenameFilterManualTest { @BeforeClass public static void setupClass() { directory = new File(FilenameFilterManualTest.class.getClassLoader() - .getResource("testFolder") + .getResource("fileNameFilterManualTestFolder") .getFile()); } diff --git a/core-java-io/src/test/resources/testFolder/people.json b/core-java-io/src/test/resources/fileNameFilterManualTestFolder/people.json similarity index 100% rename from core-java-io/src/test/resources/testFolder/people.json rename to core-java-io/src/test/resources/fileNameFilterManualTestFolder/people.json diff --git a/core-java-io/src/test/resources/testFolder/students.json b/core-java-io/src/test/resources/fileNameFilterManualTestFolder/students.json similarity index 100% rename from core-java-io/src/test/resources/testFolder/students.json rename to core-java-io/src/test/resources/fileNameFilterManualTestFolder/students.json diff --git a/core-java-io/src/test/resources/testFolder/teachers.xml b/core-java-io/src/test/resources/fileNameFilterManualTestFolder/teachers.xml similarity index 100% rename from core-java-io/src/test/resources/testFolder/teachers.xml rename to core-java-io/src/test/resources/fileNameFilterManualTestFolder/teachers.xml diff --git a/core-java-io/src/test/resources/testFolder/workers.xml b/core-java-io/src/test/resources/fileNameFilterManualTestFolder/workers.xml similarity index 100% rename from core-java-io/src/test/resources/testFolder/workers.xml rename to core-java-io/src/test/resources/fileNameFilterManualTestFolder/workers.xml diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java b/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java index eb8b733f82..48f4b5c02b 100644 --- a/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java +++ b/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java @@ -25,11 +25,7 @@ public class Exceptions { } public List loadAllPlayers(String playersFile) throws IOException{ - try { - throw new IOException(); - } catch(IOException ex) { - throw new IllegalStateException(); - } + throw new IOException(); } public int getPlayerScoreThrows(String playerFile) throws FileNotFoundException { @@ -163,14 +159,8 @@ public class Exceptions { } } - public void throwAsGotoAntiPattern() { - try { - // bunch of code - throw new MyException(); - // second bunch of code - } catch ( MyException e ) { - // third bunch of code - } + public void throwAsGotoAntiPattern() throws MyException { + throw new MyException(); } public int getPlayerScoreSwallowingExceptionAntiPattern(String playerFile) { diff --git a/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java b/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java index 238990f2b4..a34640b58a 100644 --- a/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java +++ b/core-java/src/test/java/com/baeldung/binding/AnimalUnitTest.java @@ -16,8 +16,11 @@ import org.slf4j.LoggerFactory; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.util.List; + /** * Created by madhumita.g on 01-08-2018. */ @@ -66,20 +69,18 @@ public class AnimalUnitTest { int testValue = 3; animal.makeNoise(testValue); - verify(mockAppender).doAppend(captorLoggingEvent.capture()); + verify(mockAppender,times(3)).doAppend(captorLoggingEvent.capture()); - final LoggingEvent loggingEvent = captorLoggingEvent.getValue(); + final List loggingEvents = captorLoggingEvent.getAllValues(); - while (testValue != 0) { + for(LoggingEvent loggingEvent : loggingEvents) + { assertThat(loggingEvent.getLevel(), is(Level.INFO)); assertThat(loggingEvent.getFormattedMessage(), - is("generic animal noise countdown 3\n" - + "generic animal noise countdown 2\n" - + "generic animal noise countdown 1\n")); - - testValue-=1; + is("generic animal noise countdown "+testValue)); + testValue--; } } diff --git a/maven/pom.xml b/maven/pom.xml index 4f91e8717c..a24b6b16bd 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -1,127 +1,151 @@ - 4.0.0 - com.baeldung - maven - 0.0.1-SNAPSHOT + 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 + maven + 0.0.1-SNAPSHOT - - parent-modules - com.baeldung - 1.0.0-SNAPSHOT - + + parent-modules + com.baeldung + 1.0.0-SNAPSHOT + - - - - maven-resources-plugin - ${maven.resources.version} - - output-resources - - - input-resources - - *.png - - true - - - - - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - - -Xlint:unchecked - - - - - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - DataTest.java - - - TestFail.java - DataCheck.java - - true - - - - maven-failsafe-plugin - ${maven.failsafe.version} - - - - integration-test - verify - - - - - - - - - maven-verifier-plugin - ${maven.verifier.version} - - input-resources/verifications.xml - - - - - verify - - - - - - maven-clean-plugin - ${maven.clean.version} - - - - output-resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - ${maven.build.helper.version} - - - generate-sources - - add-source - - - - src/main/another-src - - - - - - - + + + + maven-resources-plugin + ${maven.resources.version} + + output-resources + + + input-resources + + *.png + + true + + + + + + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + -Xlint:unchecked + + + + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + DataTest.java + + + TestFail.java + DataCheck.java + + true + + + + maven-failsafe-plugin + ${maven.failsafe.version} + + + + integration-test + verify + + + + + + + + + maven-verifier-plugin + ${maven.verifier.version} + + input-resources/verifications.xml + + + + + verify + + + + + + maven-clean-plugin + ${maven.clean.version} + + + + output-resources + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${maven.build.helper.version} + + + generate-sources + + add-source + + + + src/main/another-src + + + + + + + - - 3.0.2 - 2.21.0 - 1.1 - 3.0.0 - 3.0.0 - Baeldung - + + + default + + + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + DataTest.java + + + TestFail.java + DataCheck.java + + true + + + + + + + + + 3.0.2 + 2.21.0 + 1.1 + 3.0.0 + 3.0.0 + Baeldung + \ No newline at end of file From 9a655ae6098532bfa947d392cd3a2bffd8a1e1f6 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Wed, 15 Aug 2018 17:31:45 +0530 Subject: [PATCH 195/298] BAEL-7636 Add the missing plugin versions in the tutorial -Ignoring faulty test causing out of memory exception in travis --- core-java/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java b/core-java/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java index 6aa59e68d0..22fe0f5e57 100644 --- a/core-java/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java +++ b/core-java/src/test/java/com/baeldung/unsafe/UnsafeUnitTest.java @@ -1,6 +1,7 @@ package com.baeldung.unsafe; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import sun.misc.Unsafe; @@ -56,6 +57,7 @@ public class UnsafeUnitTest { } @Test + @Ignore // Uncomment for local public void givenArrayBiggerThatMaxInt_whenAllocateItOffHeapMemory_thenSuccess() throws NoSuchFieldException, IllegalAccessException { //given long SUPER_SIZE = (long) Integer.MAX_VALUE * 2; From 96e1728d7fa39d072f0f05b8e01339da1c34aa1a Mon Sep 17 00:00:00 2001 From: rozagerardo Date: Wed, 15 Aug 2018 09:13:50 -0300 Subject: [PATCH 196/298] geroza/BAEL-395-Archaius_With_Spring_Cloud_Introduction (#4968) * * added examples for archaius introduction, with basic configuration, extra configurations, adn setting up an additional config source * * fixed indentation in XML files --- spring-cloud/pom.xml | 1 + spring-cloud/spring-cloud-archaius/README.md | 14 ++++ .../additional-sources-simple/pom.xml | 24 ++++++ .../AdditionalSourcesSimpleApplication.java | 13 ++++ .../ApplicationPropertiesConfigurations.java | 21 ++++++ .../ConfigPropertiesController.java | 37 ++++++++++ .../src/main/resources/application.properties | 3 + .../src/main/resources/config.properties | 2 + .../main/resources/other-config.properties | 2 + .../ArchaiusAdditionalSourcesLiveTest.java | 54 ++++++++++++++ .../basic-config/pom.xml | 24 ++++++ .../basic/BasicArchaiusApplication.java | 13 ++++ .../ConfigPropertiesController.java | 70 ++++++++++++++++++ .../src/main/resources/application.properties | 3 + .../src/main/resources/config.properties | 4 + .../src/main/resources/other.properties | 2 + ...aiusBasicConfigurationIntegrationTest.java | 45 +++++++++++ .../ArchaiusBasicConfigurationLiveTest.java | 74 +++++++++++++++++++ .../src/test/resources/config.properties | 3 + .../extra-configs/pom.xml | 43 +++++++++++ .../extraconfigs/ExtraConfigsApplication.java | 16 ++++ .../ConfigPropertiesController.java | 60 +++++++++++++++ .../src/main/resources/application.properties | 3 + .../other-config-dir/extra.properties | 2 + .../src/main/resources/other.properties | 2 + .../ArchaiusExtraConfigsLiveTest.java | 54 ++++++++++++++ spring-cloud/spring-cloud-archaius/pom.xml | 64 ++++++++++++++++ 27 files changed, 653 insertions(+) create mode 100644 spring-cloud/spring-cloud-archaius/README.md create mode 100644 spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml create mode 100644 spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/AdditionalSourcesSimpleApplication.java create mode 100644 spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/config/ApplicationPropertiesConfigurations.java create mode 100644 spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/controller/ConfigPropertiesController.java create mode 100644 spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/application.properties create mode 100644 spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/config.properties create mode 100644 spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/other-config.properties create mode 100644 spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/com/baeldung/spring/cloud/archaius/additionalsources/ArchaiusAdditionalSourcesLiveTest.java create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/pom.xml create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/main/java/com/baeldung/spring/cloud/archaius/basic/BasicArchaiusApplication.java create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/main/java/com/baeldung/spring/cloud/archaius/basic/controller/ConfigPropertiesController.java create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/application.properties create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/config.properties create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/other.properties create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/ArchaiusBasicConfigurationIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/ArchaiusBasicConfigurationLiveTest.java create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/test/resources/config.properties create mode 100644 spring-cloud/spring-cloud-archaius/extra-configs/pom.xml create mode 100644 spring-cloud/spring-cloud-archaius/extra-configs/src/main/java/com/baeldung/spring/cloud/archaius/extraconfigs/ExtraConfigsApplication.java create mode 100644 spring-cloud/spring-cloud-archaius/extra-configs/src/main/java/com/baeldung/spring/cloud/archaius/extraconfigs/controllers/ConfigPropertiesController.java create mode 100644 spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/application.properties create mode 100644 spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/other-config-dir/extra.properties create mode 100644 spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/other.properties create mode 100644 spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/com/baeldung/spring/cloud/archaius/extraconfigs/ArchaiusExtraConfigsLiveTest.java create mode 100644 spring-cloud/spring-cloud-archaius/pom.xml diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 373a12da9e..1fdab4213c 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -31,6 +31,7 @@ spring-cloud-zuul-eureka-integration spring-cloud-contract spring-cloud-kubernetes + spring-cloud-archaius diff --git a/spring-cloud/spring-cloud-archaius/README.md b/spring-cloud/spring-cloud-archaius/README.md new file mode 100644 index 0000000000..9de26352e1 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/README.md @@ -0,0 +1,14 @@ +# Spring Cloud Archaius + +#### Basic Config +This service has the basic, out-of-the-box Spring Cloud Netflix Archaius configuration. + +#### Extra Configs +This service customizes some properties supported by Archaius. + +These properties are set up on the main method, since Archaius uses System properties, but they could be added as command line arguments when launching the app. + +#### Additional Sources +In this service we create a new AbstractConfiguration bean, setting up a new Configuration Properties source. + +These properties have precedence over all the other properties in the Archaius Composite Configuration. \ No newline at end of file diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml b/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml new file mode 100644 index 0000000000..1ae6d543fb --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + additional-sources-simple + 1.0.0-SNAPSHOT + jar + additional-sources-simple + + + com.baeldung.spring.cloud + spring-cloud-archaius + 1.0.0-SNAPSHOT + .. + + + + + org.springframework.boot + spring-boot-starter-web + + + diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/AdditionalSourcesSimpleApplication.java b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/AdditionalSourcesSimpleApplication.java new file mode 100644 index 0000000000..e1a1d106cf --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/AdditionalSourcesSimpleApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.spring.cloud.archaius.additionalsources; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class AdditionalSourcesSimpleApplication { + + public static void main(String[] args) { + SpringApplication.run(AdditionalSourcesSimpleApplication.class, args); + } + +} diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/config/ApplicationPropertiesConfigurations.java b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/config/ApplicationPropertiesConfigurations.java new file mode 100644 index 0000000000..f2d8ca2638 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/config/ApplicationPropertiesConfigurations.java @@ -0,0 +1,21 @@ +package com.baeldung.spring.cloud.archaius.additionalsources.config; + +import org.apache.commons.configuration.AbstractConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.netflix.config.DynamicConfiguration; +import com.netflix.config.FixedDelayPollingScheduler; +import com.netflix.config.PolledConfigurationSource; +import com.netflix.config.sources.URLConfigurationSource; + +@Configuration +public class ApplicationPropertiesConfigurations { + + @Bean + public AbstractConfiguration addApplicationPropertiesSource() { + PolledConfigurationSource source = new URLConfigurationSource("classpath:other-config.properties"); + return new DynamicConfiguration(source, new FixedDelayPollingScheduler()); + } + +} diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/controller/ConfigPropertiesController.java b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/controller/ConfigPropertiesController.java new file mode 100644 index 0000000000..304369a036 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/java/com/baeldung/spring/cloud/archaius/additionalsources/controller/ConfigPropertiesController.java @@ -0,0 +1,37 @@ +package com.baeldung.spring.cloud.archaius.additionalsources.controller; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.netflix.config.DynamicPropertyFactory; +import com.netflix.config.DynamicStringProperty; + +@RestController +public class ConfigPropertiesController { + + private DynamicStringProperty propertyOneWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.one", "not found!"); + + private DynamicStringProperty propertyTwoWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.two", "not found!"); + + private DynamicStringProperty propertyThreeWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.three", "not found!"); + + private DynamicStringProperty propertyFourWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.four", "not found!"); + + @GetMapping("/properties-from-dynamic") + public Map getPropertiesFromDynamic() { + Map properties = new HashMap<>(); + properties.put(propertyOneWithDynamic.getName(), propertyOneWithDynamic.get()); + properties.put(propertyTwoWithDynamic.getName(), propertyTwoWithDynamic.get()); + properties.put(propertyThreeWithDynamic.getName(), propertyThreeWithDynamic.get()); + properties.put(propertyFourWithDynamic.getName(), propertyFourWithDynamic.get()); + return properties; + } +} diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/application.properties b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/application.properties new file mode 100644 index 0000000000..bf55e89a27 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8082 +baeldung.archaius.properties.one=one FROM:application.properties +baeldung.archaius.properties.two=two FROM:application.properties diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/config.properties b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/config.properties new file mode 100644 index 0000000000..b104c0c488 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/config.properties @@ -0,0 +1,2 @@ +baeldung.archaius.properties.one=one FROM:config.properties +baeldung.archaius.properties.three=three FROM:config.properties diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/other-config.properties b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/other-config.properties new file mode 100644 index 0000000000..00fe8ff2aa --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/main/resources/other-config.properties @@ -0,0 +1,2 @@ +baeldung.archaius.properties.one=one FROM:other-config.properties +baeldung.archaius.properties.four=four FROM:other-config.properties diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/com/baeldung/spring/cloud/archaius/additionalsources/ArchaiusAdditionalSourcesLiveTest.java b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/com/baeldung/spring/cloud/archaius/additionalsources/ArchaiusAdditionalSourcesLiveTest.java new file mode 100644 index 0000000000..f3a345d869 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/com/baeldung/spring/cloud/archaius/additionalsources/ArchaiusAdditionalSourcesLiveTest.java @@ -0,0 +1,54 @@ +package com.baeldung.spring.cloud.archaius.additionalsources; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpMethod; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class ArchaiusAdditionalSourcesLiveTest { + + private static final String BASE_URL = "http://localhost:8082"; + + private static final String DYNAMIC_PROPERTIES_URL = "/properties-from-dynamic"; + private static final Map EXPECTED_ARCHAIUS_PROPERTIES = createExpectedArchaiusProperties(); + + private static Map createExpectedArchaiusProperties() { + Map map = new HashMap<>(); + map.put("baeldung.archaius.properties.one", "one FROM:other-config.properties"); + map.put("baeldung.archaius.properties.two", "two FROM:application.properties"); + map.put("baeldung.archaius.properties.three", "three FROM:config.properties"); + map.put("baeldung.archaius.properties.four", "four FROM:other-config.properties"); + return map; + } + + @Autowired + ConfigurableApplicationContext context; + + @Autowired + private TestRestTemplate template; + + private Map exchangeAsMap(String uri, ParameterizedTypeReference> responseType) { + return template.exchange(uri, HttpMethod.GET, null, responseType) + .getBody(); + } + + @Test + public void givenNonDefaultConfigurationFilesSetup_whenRequestProperties_thenEndpointRetrievesValuesInFiles() { + Map initialResponse = this.exchangeAsMap(BASE_URL + DYNAMIC_PROPERTIES_URL, new ParameterizedTypeReference>() { + }); + + assertThat(initialResponse).containsAllEntriesOf(EXPECTED_ARCHAIUS_PROPERTIES); + } +} diff --git a/spring-cloud/spring-cloud-archaius/basic-config/pom.xml b/spring-cloud/spring-cloud-archaius/basic-config/pom.xml new file mode 100644 index 0000000000..b5b091712d --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + basic-config + 1.0.0-SNAPSHOT + jar + basic-config + + + com.baeldung.spring.cloud + spring-cloud-archaius + 1.0.0-SNAPSHOT + .. + + + + + org.springframework.boot + spring-boot-starter-web + + + diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/main/java/com/baeldung/spring/cloud/archaius/basic/BasicArchaiusApplication.java b/spring-cloud/spring-cloud-archaius/basic-config/src/main/java/com/baeldung/spring/cloud/archaius/basic/BasicArchaiusApplication.java new file mode 100644 index 0000000000..e6e578eed3 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/main/java/com/baeldung/spring/cloud/archaius/basic/BasicArchaiusApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.spring.cloud.archaius.basic; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class BasicArchaiusApplication { + + public static void main(String[] args) { + SpringApplication.run(BasicArchaiusApplication.class, args); + } + +} diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/main/java/com/baeldung/spring/cloud/archaius/basic/controller/ConfigPropertiesController.java b/spring-cloud/spring-cloud-archaius/basic-config/src/main/java/com/baeldung/spring/cloud/archaius/basic/controller/ConfigPropertiesController.java new file mode 100644 index 0000000000..46b8f345f6 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/main/java/com/baeldung/spring/cloud/archaius/basic/controller/ConfigPropertiesController.java @@ -0,0 +1,70 @@ +package com.baeldung.spring.cloud.archaius.basic.controller; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.netflix.config.DynamicIntProperty; +import com.netflix.config.DynamicPropertyFactory; +import com.netflix.config.DynamicStringProperty; + +@RestController +public class ConfigPropertiesController { + + @Value("${baeldung.archaius.properties.one:not found!}") + private String propertyOneWithValue; + + @Value("${baeldung.archaius.properties.two:not found!}") + private String propertyTwoWithValue; + + @Value("${baeldung.archaius.properties.three:not found!}") + private String propertyThreeWithValue; + + @Value("${baeldung.archaius.properties.four:not found!}") + private String propertyFourWithValue; + + private DynamicStringProperty propertyOneWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.one", "not found!"); + + private DynamicStringProperty propertyTwoWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.two", "not found!"); + + private DynamicStringProperty propertyThreeWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.three", "not found!"); + + private DynamicStringProperty propertyFourWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.four", "not found!"); + + private DynamicIntProperty intPropertyWithDynamic = DynamicPropertyFactory.getInstance() + .getIntProperty("baeldung.archaius.properties.int", 0); + + @GetMapping("/properties-from-value") + public Map getPropertiesFromValue() { + Map properties = new HashMap<>(); + properties.put("baeldung.archaius.properties.one", propertyOneWithValue); + properties.put("baeldung.archaius.properties.two", propertyTwoWithValue); + properties.put("baeldung.archaius.properties.three", propertyThreeWithValue); + properties.put("baeldung.archaius.properties.four", propertyFourWithValue); + return properties; + } + + @GetMapping("/properties-from-dynamic") + public Map getPropertiesFromDynamic() { + Map properties = new HashMap<>(); + properties.put(propertyOneWithDynamic.getName(), propertyOneWithDynamic.get()); + properties.put(propertyTwoWithDynamic.getName(), propertyTwoWithDynamic.get()); + properties.put(propertyThreeWithDynamic.getName(), propertyThreeWithDynamic.get()); + properties.put(propertyFourWithDynamic.getName(), propertyFourWithDynamic.get()); + return properties; + } + + @GetMapping("/int-property") + public Map getIntPropertyFromDynamic() { + Map properties = new HashMap<>(); + properties.put(intPropertyWithDynamic.getName(), intPropertyWithDynamic.get()); + return properties; + } +} diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/application.properties b/spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/application.properties new file mode 100644 index 0000000000..1a35a22197 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8080 +baeldung.archaius.properties.one=one FROM:application.properties +baeldung.archaius.properties.two=two FROM:application.properties \ No newline at end of file diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/config.properties b/spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/config.properties new file mode 100644 index 0000000000..86ae575d20 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/config.properties @@ -0,0 +1,4 @@ +baeldung.archaius.properties.one=one FROM:config.properties +baeldung.archaius.properties.three=three FROM:config.properties + +baeldung.archaius.properties.int=1 diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/other.properties b/spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/other.properties new file mode 100644 index 0000000000..26796b7341 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/main/resources/other.properties @@ -0,0 +1,2 @@ +baeldung.archaius.properties.one=one FROM:other.properties +baeldung.archaius.properties.four=four FROM:other.properties diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/ArchaiusBasicConfigurationIntegrationTest.java b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/ArchaiusBasicConfigurationIntegrationTest.java new file mode 100644 index 0000000000..2948606c0b --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/ArchaiusBasicConfigurationIntegrationTest.java @@ -0,0 +1,45 @@ +package com.baeldung.spring.cloud.archaius.basic; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Collections; + +import org.junit.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.platform.runner.JUnitPlatform; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.util.TestPropertyValues; +import org.springframework.cloud.context.environment.EnvironmentChangeEvent; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +import com.netflix.config.DynamicPropertyFactory; +import com.netflix.config.DynamicStringProperty; + +@RunWith(JUnitPlatform.class) +@ExtendWith(SpringExtension.class) +@SpringBootTest +public class ArchaiusBasicConfigurationIntegrationTest { + + @Autowired + ConfigurableApplicationContext context; + + private DynamicStringProperty testPropertyWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.test.properties.one", "not found!"); + + @Test + public void givenIntialPropertyValue_whenPropertyChanges_thenArchaiusRetrievesNewValue() { + String initialValue = testPropertyWithDynamic.get(); + + TestPropertyValues.of("baeldung.archaius.test.properties.one=new-value") + .applyTo(context); + context.publishEvent(new EnvironmentChangeEvent(Collections.singleton("baeldung.archaius.test.properties.one"))); + String finalValue = testPropertyWithDynamic.get(); + + assertThat(initialValue).isEqualTo("test-one"); + assertThat(finalValue).isEqualTo("new-value"); + } + +} diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/ArchaiusBasicConfigurationLiveTest.java b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/ArchaiusBasicConfigurationLiveTest.java new file mode 100644 index 0000000000..70d43df60d --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/com/baeldung/spring/cloud/archaius/basic/ArchaiusBasicConfigurationLiveTest.java @@ -0,0 +1,74 @@ +package com.baeldung.spring.cloud.archaius.basic; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpMethod; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class ArchaiusBasicConfigurationLiveTest { + + private static final String BASE_URL = "http://localhost:8080"; + + private static final String DYNAMIC_PROPERTIES_URL = "/properties-from-dynamic"; + private static final Map EXPECTED_ARCHAIUS_PROPERTIES = createExpectedArchaiusProperties(); + + private static Map createExpectedArchaiusProperties() { + Map map = new HashMap<>(); + map.put("baeldung.archaius.properties.one", "one FROM:application.properties"); + map.put("baeldung.archaius.properties.two", "two FROM:application.properties"); + map.put("baeldung.archaius.properties.three", "three FROM:config.properties"); + map.put("baeldung.archaius.properties.four", "not found!"); + return map; + } + + private static final String VALUE_PROPERTIES_URL = "/properties-from-value"; + private static final Map EXPECTED_VALUE_PROPERTIES = createExpectedValueProperties(); + + private static Map createExpectedValueProperties() { + Map map = new HashMap<>(); + map.put("baeldung.archaius.properties.one", "one FROM:application.properties"); + map.put("baeldung.archaius.properties.two", "two FROM:application.properties"); + map.put("baeldung.archaius.properties.three", "not found!"); + map.put("baeldung.archaius.properties.four", "not found!"); + return map; + } + + @Autowired + ConfigurableApplicationContext context; + + @Autowired + private TestRestTemplate template; + + private Map exchangeAsMap(String uri, ParameterizedTypeReference> responseType) { + return template.exchange(uri, HttpMethod.GET, null, responseType) + .getBody(); + } + + @Test + public void givenDefaultConfigurationSetup_whenRequestProperties_thenEndpointRetrievesValuesInFiles() { + Map initialResponse = this.exchangeAsMap(BASE_URL + DYNAMIC_PROPERTIES_URL, new ParameterizedTypeReference>() { + }); + + assertThat(initialResponse).containsAllEntriesOf(EXPECTED_ARCHAIUS_PROPERTIES); + } + + @Test + public void givenNonDefaultConfigurationFilesSetup_whenRequestSpringVisibleProperties_thenEndpointDoesntRetrieveArchaiusProperties() { + Map initialResponse = this.exchangeAsMap(BASE_URL + VALUE_PROPERTIES_URL, new ParameterizedTypeReference>() { + }); + + assertThat(initialResponse).containsAllEntriesOf(EXPECTED_VALUE_PROPERTIES); + } +} diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/test/resources/config.properties b/spring-cloud/spring-cloud-archaius/basic-config/src/test/resources/config.properties new file mode 100644 index 0000000000..1ceb5d1161 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/test/resources/config.properties @@ -0,0 +1,3 @@ +baeldung.archaius.test.properties.one=test-one +baeldung.archaius.test.properties.two=test-two +baeldung.archaius.test.properties.int=1 diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml b/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml new file mode 100644 index 0000000000..2f3f2b084a --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/extra-configs/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + extra-configs + 1.0.0-SNAPSHOT + jar + extra-configs + + + com.baeldung.spring.cloud + spring-cloud-archaius + 1.0.0-SNAPSHOT + .. + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.cloud + spring-cloud-starter-netflix-archaius + + + + + + + org.springframework.cloud + spring-cloud-netflix + ${spring-cloud-dependencies.version} + pom + import + + + + + 2.0.1.RELEASE + + diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/src/main/java/com/baeldung/spring/cloud/archaius/extraconfigs/ExtraConfigsApplication.java b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/java/com/baeldung/spring/cloud/archaius/extraconfigs/ExtraConfigsApplication.java new file mode 100644 index 0000000000..4747d875db --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/java/com/baeldung/spring/cloud/archaius/extraconfigs/ExtraConfigsApplication.java @@ -0,0 +1,16 @@ +package com.baeldung.spring.cloud.archaius.extraconfigs; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ExtraConfigsApplication { + + public static void main(String[] args) { + // System properties can be set as command line arguments too + System.setProperty("archaius.configurationSource.additionalUrls", "classpath:other-config-dir/extra.properties"); + System.setProperty("archaius.configurationSource.defaultFileName", "other.properties"); + SpringApplication.run(ExtraConfigsApplication.class, args); + } + +} diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/src/main/java/com/baeldung/spring/cloud/archaius/extraconfigs/controllers/ConfigPropertiesController.java b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/java/com/baeldung/spring/cloud/archaius/extraconfigs/controllers/ConfigPropertiesController.java new file mode 100644 index 0000000000..382c6b3a2c --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/java/com/baeldung/spring/cloud/archaius/extraconfigs/controllers/ConfigPropertiesController.java @@ -0,0 +1,60 @@ +package com.baeldung.spring.cloud.archaius.extraconfigs.controllers; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.netflix.config.DynamicPropertyFactory; +import com.netflix.config.DynamicStringProperty; + +@RestController +public class ConfigPropertiesController { + + @Value("${baeldung.archaius.properties.one:not found!}") + private String propertyOneWithValue; + + @Value("${baeldung.archaius.properties.two:not found!}") + private String propertyTwoWithValue; + + @Value("${baeldung.archaius.properties.three:not found!}") + private String propertyThreeWithValue; + + @Value("${baeldung.archaius.properties.four:not found!}") + private String propertyFourWithValue; + + private DynamicStringProperty propertyOneWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.one", "not found!"); + + private DynamicStringProperty propertyTwoWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.two", "not found!"); + + private DynamicStringProperty propertyThreeWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.three", "not found!"); + + private DynamicStringProperty propertyFourWithDynamic = DynamicPropertyFactory.getInstance() + .getStringProperty("baeldung.archaius.properties.four", "not found!"); + + @GetMapping("/properties-from-value") + public Map getPropertiesFromValue() { + Map properties = new HashMap<>(); + properties.put("baeldung.archaius.properties.one", propertyOneWithValue); + properties.put("baeldung.archaius.properties.two", propertyTwoWithValue); + properties.put("baeldung.archaius.properties.three", propertyThreeWithValue); + properties.put("baeldung.archaius.properties.four", propertyFourWithValue); + return properties; + } + + @GetMapping("/properties-from-dynamic") + public Map getPropertiesFromDynamic() { + Map properties = new HashMap<>(); + properties.put("baeldung.archaius.properties.one", propertyOneWithDynamic.get()); + properties.put("baeldung.archaius.properties.two", propertyTwoWithDynamic.get()); + properties.put("baeldung.archaius.properties.three", propertyThreeWithDynamic.get()); + properties.put("baeldung.archaius.properties.four", propertyFourWithDynamic.get()); + return properties; + } + +} diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/application.properties b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/application.properties new file mode 100644 index 0000000000..1e36b134d4 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8081 +baeldung.archaius.properties.one=one FROM:application.properties +baeldung.archaius.properties.two=two FROM:application.properties diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/other-config-dir/extra.properties b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/other-config-dir/extra.properties new file mode 100644 index 0000000000..ea99914cc1 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/other-config-dir/extra.properties @@ -0,0 +1,2 @@ +baeldung.archaius.properties.one=one FROM:extra.properties +baeldung.archaius.properties.three=three FROM:extra.properties diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/other.properties b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/other.properties new file mode 100644 index 0000000000..26796b7341 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/extra-configs/src/main/resources/other.properties @@ -0,0 +1,2 @@ +baeldung.archaius.properties.one=one FROM:other.properties +baeldung.archaius.properties.four=four FROM:other.properties diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/com/baeldung/spring/cloud/archaius/extraconfigs/ArchaiusExtraConfigsLiveTest.java b/spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/com/baeldung/spring/cloud/archaius/extraconfigs/ArchaiusExtraConfigsLiveTest.java new file mode 100644 index 0000000000..232ca73352 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/com/baeldung/spring/cloud/archaius/extraconfigs/ArchaiusExtraConfigsLiveTest.java @@ -0,0 +1,54 @@ +package com.baeldung.spring.cloud.archaius.extraconfigs; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpMethod; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class ArchaiusExtraConfigsLiveTest { + + private static final String BASE_URL = "http://localhost:8081"; + + private static final String DYNAMIC_PROPERTIES_URL = "/properties-from-dynamic"; + private static final Map EXPECTED_ARCHAIUS_PROPERTIES = createExpectedArchaiusProperties(); + + private static Map createExpectedArchaiusProperties() { + Map map = new HashMap<>(); + map.put("baeldung.archaius.properties.one", "one FROM:application.properties"); + map.put("baeldung.archaius.properties.two", "two FROM:application.properties"); + map.put("baeldung.archaius.properties.three", "three FROM:extra.properties"); + map.put("baeldung.archaius.properties.four", "four FROM:other.properties"); + return map; + } + + @Autowired + ConfigurableApplicationContext context; + + @Autowired + private TestRestTemplate template; + + private Map exchangeAsMap(String uri, ParameterizedTypeReference> responseType) { + return template.exchange(uri, HttpMethod.GET, null, responseType) + .getBody(); + } + + @Test + public void givenNonDefaultConfigurationFilesSetup_whenRequestProperties_thenEndpointRetrievesValuesInFiles() { + Map initialResponse = this.exchangeAsMap(BASE_URL + DYNAMIC_PROPERTIES_URL, new ParameterizedTypeReference>() { + }); + + assertThat(initialResponse).containsAllEntriesOf(EXPECTED_ARCHAIUS_PROPERTIES); + } +} diff --git a/spring-cloud/spring-cloud-archaius/pom.xml b/spring-cloud/spring-cloud-archaius/pom.xml new file mode 100644 index 0000000000..cd102f86cd --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + com.baeldung.spring.cloud + spring-cloud-archaius + 1.0.0-SNAPSHOT + spring-cloud-archaius + Spring Cloud Archaius Pom parent + pom + + + com.baeldung.spring.cloud + spring-cloud + 1.0.0-SNAPSHOT + .. + + + + basic-config + additional-sources-simple + extra-configs + + + + + org.springframework.cloud + spring-cloud-starter-netflix-archaius + + + org.springframework.boot + spring-boot-starter-test + + + org.assertj + assertj-core + test + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + + + + + org.springframework.cloud + spring-cloud-netflix + ${spring-cloud-dependencies.version} + pom + import + + + + + + 2.0.1.RELEASE + 1.2.0 + + From 1e11dea2069fc0776d86a902d9a04f04eb416776 Mon Sep 17 00:00:00 2001 From: DOHA Date: Wed, 15 Aug 2018 16:00:09 +0300 Subject: [PATCH 197/298] move and upgrade hibernate criteria --- .../hibernate/criteria/model/Item.java | 81 +++++ .../criteria/util/HibernateUtil.java | 0 .../criteria/view/ApplicationView.java | 335 ++++++++++++++++++ .../src/main/resources/import.sql | 31 ++ .../HibernateCriteriaIntegrationTest.java | 1 - .../criteria/HibernateCriteriaTestRunner.java | 0 .../criteria/HibernateCriteriaTestSuite.java | 0 .../hibernate/criteria/model/Item.hbm.xml | 0 .../src/test/resources/criteria.cfg.xml | 4 +- .../src/test/resources/import.sql | 21 ++ .../criteria/view/ApplicationView.java | 251 ------------- .../src/main/resources/criteria.cfg.xml | 17 - .../resources/criteria_create_queries.sql | 7 - 13 files changed, 470 insertions(+), 278 deletions(-) create mode 100644 persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/model/Item.java rename {spring-hibernate4 => persistence-modules/spring-hibernate-5}/src/main/java/com/baeldung/hibernate/criteria/util/HibernateUtil.java (100%) create mode 100644 persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/view/ApplicationView.java create mode 100644 persistence-modules/spring-hibernate-5/src/main/resources/import.sql rename {spring-hibernate4 => persistence-modules/spring-hibernate-5}/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java (99%) rename {spring-hibernate4 => persistence-modules/spring-hibernate-5}/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestRunner.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate-5}/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestSuite.java (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate-5}/src/test/resources/com/baeldung/hibernate/criteria/model/Item.hbm.xml (100%) rename {spring-hibernate4 => persistence-modules/spring-hibernate-5}/src/test/resources/criteria.cfg.xml (85%) create mode 100644 persistence-modules/spring-hibernate-5/src/test/resources/import.sql delete mode 100644 spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/view/ApplicationView.java delete mode 100644 spring-hibernate4/src/main/resources/criteria.cfg.xml delete mode 100644 spring-hibernate4/src/main/resources/criteria_create_queries.sql diff --git a/persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/model/Item.java b/persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/model/Item.java new file mode 100644 index 0000000000..957207b7e6 --- /dev/null +++ b/persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/model/Item.java @@ -0,0 +1,81 @@ +package com.baeldung.hibernate.criteria.model; + +import java.io.Serializable; + +public class Item implements Serializable { + + private static final long serialVersionUID = 1L; + private Integer itemId; + private String itemName; + private String itemDescription; + private Integer itemPrice; + + // constructors + public Item() { + + } + + public Item(final Integer itemId, final String itemName, final String itemDescription) { + super(); + this.itemId = itemId; + this.itemName = itemName; + this.itemDescription = itemDescription; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((itemId == null) ? 0 : itemId.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Item other = (Item) obj; + if (itemId == null) { + if (other.itemId != null) + return false; + } else if (!itemId.equals(other.itemId)) + return false; + return true; + } + + public Integer getItemId() { + return itemId; + } + + public void setItemId(final Integer itemId) { + this.itemId = itemId; + } + + public String getItemName() { + return itemName; + } + + public void setItemName(final String itemName) { + this.itemName = itemName; + } + + public String getItemDescription() { + return itemDescription; + } + + public Integer getItemPrice() { + return itemPrice; + } + + public void setItemPrice(final Integer itemPrice) { + this.itemPrice = itemPrice; + } + + public void setItemDescription(final String itemDescription) { + this.itemDescription = itemDescription; + } +} diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/util/HibernateUtil.java b/persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/util/HibernateUtil.java similarity index 100% rename from spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/util/HibernateUtil.java rename to persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/util/HibernateUtil.java diff --git a/persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/view/ApplicationView.java b/persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/view/ApplicationView.java new file mode 100644 index 0000000000..72d4dea377 --- /dev/null +++ b/persistence-modules/spring-hibernate-5/src/main/java/com/baeldung/hibernate/criteria/view/ApplicationView.java @@ -0,0 +1,335 @@ +/** + * ApplicationViewer is the class that starts the application + * First it creates the session object and then creates the + * criteria query. + * + * @author Pritam Banerjee + * @version 1.0 + * @since 07/20/2016 + */ + +package com.baeldung.hibernate.criteria.view; + +import java.util.List; + +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +import org.hibernate.Session; +import org.hibernate.query.Query; + +import com.baeldung.hibernate.criteria.model.Item; +import com.baeldung.hibernate.criteria.util.HibernateUtil; + +public class ApplicationView { + + // default Constructor + public ApplicationView() { + + } + + public boolean checkIfCriteriaTimeLower() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + + // calculate the time taken by criteria + final long startTimeCriteria = System.nanoTime(); + cr.select(root) + .where(cb.like(root.get("itemName"), "%item One%")); + // .add(Restrictions.like("itemName", "%item One%")); + Query query = session.createQuery(cr); + + final List results = query.getResultList(); + final long endTimeCriteria = System.nanoTime(); + final long durationCriteria = (endTimeCriteria - startTimeCriteria) / 1000; + + // calculate the time taken by HQL + final long startTimeHQL = System.nanoTime(); + session.beginTransaction(); + final List items = session.createQuery("FROM Item where itemName like '%item One%'") + .list(); + final long endTimeHQL = System.nanoTime(); + final long durationHQL = (endTimeHQL - startTimeHQL) / 1000; + + if (durationCriteria > durationHQL) { + return false; + } else { + return true; + } + } + + // To get items having price more than 1000 + public String[] greaterThanCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + cr.select(root) + .where(cb.gt(root.get("itemPrice"), 1000)); + // cr.add(Restrictions.gt("itemPrice", 1000)); + Query query = session.createQuery(cr); + final List greaterThanItemsList = query.getResultList(); + final String greaterThanItems[] = new String[greaterThanItemsList.size()]; + for (int i = 0; i < greaterThanItemsList.size(); i++) { + greaterThanItems[i] = greaterThanItemsList.get(i) + .getItemName(); + } + session.close(); + return greaterThanItems; + } + + // To get items having price less than 1000 + public String[] lessThanCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + cr.select(root) + .where(cb.lt(root.get("itemPrice"), 1000)); + // cr.add(Restrictions.lt("itemPrice", 1000)); + Query query = session.createQuery(cr); + final List lessThanItemsList = query.getResultList(); + final String lessThanItems[] = new String[lessThanItemsList.size()]; + for (int i = 0; i < lessThanItemsList.size(); i++) { + lessThanItems[i] = lessThanItemsList.get(i) + .getItemName(); + } + session.close(); + return lessThanItems; + } + + // To get items whose Name start with Chair + public String[] likeCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + cr.select(root) + .where(cb.like(root.get("itemName"), "%chair%")); + // cr.add(Restrictions.like("itemName", "%chair%")); + Query query = session.createQuery(cr); + final List likeItemsList = query.getResultList(); + final String likeItems[] = new String[likeItemsList.size()]; + for (int i = 0; i < likeItemsList.size(); i++) { + likeItems[i] = likeItemsList.get(i) + .getItemName(); + } + session.close(); + return likeItems; + } + + // Case sensitive search + public String[] likeCaseCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + cr.select(root) + .where(cb.like(cb.lower(root.get("itemName")), "%chair%")); + // cr.add(Restrictions.ilike("itemName", "%Chair%")); + Query query = session.createQuery(cr); + final List ilikeItemsList = query.getResultList(); + final String ilikeItems[] = new String[ilikeItemsList.size()]; + for (int i = 0; i < ilikeItemsList.size(); i++) { + ilikeItems[i] = ilikeItemsList.get(i) + .getItemName(); + } + session.close(); + return ilikeItems; + } + + // To get records having itemPrice in between 100 and 200 + public String[] betweenCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + cr.select(root) + .where(cb.between(root.get("itemPrice"), 100, 200)); + // cr.add(Restrictions.between("itemPrice", 100, 200)); + Query query = session.createQuery(cr); + final List betweenItemsList = query.getResultList(); + final String betweenItems[] = new String[betweenItemsList.size()]; + for (int i = 0; i < betweenItemsList.size(); i++) { + betweenItems[i] = betweenItemsList.get(i) + .getItemName(); + } + session.close(); + return betweenItems; + } + + // To check if the given property is null + public String[] nullCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + cr.select(root) + .where(cb.isNull(root.get("itemDescription"))); + // cr.add(Restrictions.isNull("itemDescription")); + Query query = session.createQuery(cr); + final List nullItemsList = query.getResultList(); + final String nullDescItems[] = new String[nullItemsList.size()]; + for (int i = 0; i < nullItemsList.size(); i++) { + nullDescItems[i] = nullItemsList.get(i) + .getItemName(); + } + session.close(); + return nullDescItems; + } + + // To check if the given property is not null + public String[] notNullCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + cr.select(root) + .where(cb.isNotNull(root.get("itemDescription"))); + // cr.add(Restrictions.isNotNull("itemDescription")); + Query query = session.createQuery(cr); + final List notNullItemsList = query.getResultList(); + final String notNullDescItems[] = new String[notNullItemsList.size()]; + for (int i = 0; i < notNullItemsList.size(); i++) { + notNullDescItems[i] = notNullItemsList.get(i) + .getItemName(); + } + session.close(); + return notNullDescItems; + } + + // Adding more than one expression in one cr + public String[] twoCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + Predicate[] predicates = new Predicate[2]; + predicates[0] = cb.isNull(root.get("itemDescription")); + predicates[1] = cb.like(root.get("itemName"), "chair%"); + cr.select(root) + .where(predicates); + // cr.add(Restrictions.isNull("itemDescription")); + // cr.add(Restrictions.like("itemName", "chair%")); + Query query = session.createQuery(cr); + final List notNullItemsList = query.getResultList(); + final String notNullDescItems[] = new String[notNullItemsList.size()]; + for (int i = 0; i < notNullItemsList.size(); i++) { + notNullDescItems[i] = notNullItemsList.get(i) + .getItemName(); + } + session.close(); + return notNullDescItems; + } + + // To get items matching with the above defined conditions joined + // with Logical AND + public String[] andLogicalCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + Predicate greaterThanPrice = cb.gt(root.get("itemPrice"), 1000); + Predicate chairItems = cb.like(root.get("itemName"), "Chair%"); + cr.select(root) + .where(cb.and(greaterThanPrice, chairItems)); + // final Criterion greaterThanPrice = Restrictions.gt("itemPrice", 1000); + // final Criterion chairItems = Restrictions.like("itemName", "Chair%"); + // final LogicalExpression andExample = Restrictions.and(greaterThanPrice, chairItems); + // cr.add(andExample); + Query query = session.createQuery(cr); + final List andItemsList = query.getResultList(); + final String andItems[] = new String[andItemsList.size()]; + for (int i = 0; i < andItemsList.size(); i++) { + andItems[i] = andItemsList.get(i) + .getItemName(); + } + session.close(); + return andItems; + } + + // To get items matching with the above defined conditions joined + // with Logical OR + public String[] orLogicalCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + Predicate greaterThanPrice = cb.gt(root.get("itemPrice"), 1000); + Predicate chairItems = cb.like(root.get("itemName"), "Chair%"); + cr.select(root) + .where(cb.or(greaterThanPrice, chairItems)); + Query query = session.createQuery(cr); + final List orItemsList = query.getResultList(); + final String orItems[] = new String[orItemsList.size()]; + for (int i = 0; i < orItemsList.size(); i++) { + orItems[i] = orItemsList.get(i) + .getItemName(); + } + session.close(); + return orItems; + } + + // Sorting example + public String[] sortingCriteria() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Item.class); + final Root root = cr.from(Item.class); + cr.select(root); + cr.orderBy(cb.asc(root.get("itemName")), cb.desc(root.get("itemPrice"))); + // cr.addOrder(Order.asc("itemName")); + // cr.addOrder(Order.desc("itemPrice")).list(); + Query query = session.createQuery(cr); + final List sortedItemsList = query.getResultList(); + final String sortedItems[] = new String[sortedItemsList.size()]; + for (int i = 0; i < sortedItemsList.size(); i++) { + sortedItems[i] = sortedItemsList.get(i) + .getItemName(); + } + session.close(); + return sortedItems; + } + + // Set projections Row Count + public Long[] projectionRowCount() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Long.class); + final Root root = cr.from(Item.class); + cr.select(cb.count(root)); + Query query = session.createQuery(cr); + final List itemProjected = query.getResultList(); + // session.createCriteria(Item.class).setProjection(Projections.rowCount()).list(); + final Long projectedRowCount[] = new Long[itemProjected.size()]; + for (int i = 0; i < itemProjected.size(); i++) { + projectedRowCount[i] = itemProjected.get(i); + } + session.close(); + return projectedRowCount; + } + + // Set projections average of itemPrice + public Double[] projectionAverage() { + final Session session = HibernateUtil.getHibernateSession(); + final CriteriaBuilder cb = session.getCriteriaBuilder(); + final CriteriaQuery cr = cb.createQuery(Double.class); + final Root root = cr.from(Item.class); + cr.select(cb.avg(root.get("itemPrice"))); + Query query = session.createQuery(cr); + final List avgItemPriceList = query.getResultList(); + // session.createCriteria(Item.class).setProjection(Projections.projectionList().add(Projections.avg("itemPrice"))).list(); + + final Double avgItemPrice[] = new Double[avgItemPriceList.size()]; + for (int i = 0; i < avgItemPriceList.size(); i++) { + avgItemPrice[i] = (Double) avgItemPriceList.get(i); + } + session.close(); + return avgItemPrice; + } + +} diff --git a/persistence-modules/spring-hibernate-5/src/main/resources/import.sql b/persistence-modules/spring-hibernate-5/src/main/resources/import.sql new file mode 100644 index 0000000000..ae008f29bc --- /dev/null +++ b/persistence-modules/spring-hibernate-5/src/main/resources/import.sql @@ -0,0 +1,31 @@ +insert into item (item_id, item_name, item_desc, item_price) +values(1,'item One', 'test 1', 35.12); + +insert into item (item_id, item_name, item_desc, item_price) +values(2,'Pogo stick', 'Pogo stick', 466.12); +insert into item (item_id, item_name, item_desc, item_price) +values(3,'Raft', 'Raft', 345.12); + +insert into item (item_id, item_name, item_desc, item_price) +values(4,'Skate Board', 'Skating', 135.71); + +insert into item (item_id, item_name, item_desc, item_price) +values(5,'Umbrella', 'Umbrella for Rain', 619.25); + +insert into item (item_id, item_name, item_desc, item_price) +values(6,'Glue', 'Glue for home', 432.73); + +insert into item (item_id, item_name, item_desc, item_price) +values(7,'Paint', 'Paint for Room', 1311.40); + +insert into item (item_id, item_name, item_desc, item_price) +values(8,'Red paint', 'Red paint for room', 1135.71); + +insert into item (item_id, item_name, item_desc, item_price) +values(9,'Household Chairs', 'Chairs for house', 25.71); + +insert into item (item_id, item_name, item_desc, item_price) +values(10,'Office Chairs', 'Chairs for office', 395.98); + +insert into item (item_id, item_name, item_desc, item_price) +values(11,'Outdoor Chairs', 'Chairs for outdoor activities', 1234.36); diff --git a/spring-hibernate4/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java similarity index 99% rename from spring-hibernate4/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java rename to persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java index 2275bf14f2..723b097305 100644 --- a/spring-hibernate4/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java +++ b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java @@ -43,7 +43,6 @@ public class HibernateCriteriaIntegrationTest { } session.close(); assertArrayEquals(expectedChairCaseItems, av.likeCaseCriteria()); - } @Test diff --git a/spring-hibernate4/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestRunner.java b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestRunner.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestRunner.java rename to persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestRunner.java diff --git a/spring-hibernate4/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestSuite.java b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestSuite.java similarity index 100% rename from spring-hibernate4/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestSuite.java rename to persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaTestSuite.java diff --git a/spring-hibernate4/src/test/resources/com/baeldung/hibernate/criteria/model/Item.hbm.xml b/persistence-modules/spring-hibernate-5/src/test/resources/com/baeldung/hibernate/criteria/model/Item.hbm.xml similarity index 100% rename from spring-hibernate4/src/test/resources/com/baeldung/hibernate/criteria/model/Item.hbm.xml rename to persistence-modules/spring-hibernate-5/src/test/resources/com/baeldung/hibernate/criteria/model/Item.hbm.xml diff --git a/spring-hibernate4/src/test/resources/criteria.cfg.xml b/persistence-modules/spring-hibernate-5/src/test/resources/criteria.cfg.xml similarity index 85% rename from spring-hibernate4/src/test/resources/criteria.cfg.xml rename to persistence-modules/spring-hibernate-5/src/test/resources/criteria.cfg.xml index 726e9acb3f..bc4fed9680 100644 --- a/spring-hibernate4/src/test/resources/criteria.cfg.xml +++ b/persistence-modules/spring-hibernate-5/src/test/resources/criteria.cfg.xml @@ -10,8 +10,8 @@ sa org.hibernate.dialect.H2Dialect - update - true + create-drop + false \ No newline at end of file diff --git a/persistence-modules/spring-hibernate-5/src/test/resources/import.sql b/persistence-modules/spring-hibernate-5/src/test/resources/import.sql new file mode 100644 index 0000000000..087d62d331 --- /dev/null +++ b/persistence-modules/spring-hibernate-5/src/test/resources/import.sql @@ -0,0 +1,21 @@ +insert into item (item_id, item_name, item_desc, item_price) values(1,'item One', 'test 1', 35.12); + +insert into item (item_id, item_name, item_desc, item_price) values(2,'Pogo stick', 'Pogo stick', 466.12); + +insert into item (item_id, item_name, item_desc, item_price) values(3,'Raft', 'Raft', 345.12); + +insert into item (item_id, item_name, item_desc, item_price) values(4,'Skate Board', 'Skating', 135.71); + +insert into item (item_id, item_name, item_desc, item_price) values(5,'Umbrella', 'Umbrella for Rain', 619.25); + +insert into item (item_id, item_name, item_desc, item_price) values(6,'Glue', 'Glue for home', 432.73); + +insert into item (item_id, item_name, item_desc, item_price) values(7,'Paint', 'Paint for Room', 1311.40); + +insert into item (item_id, item_name, item_desc, item_price) values(8,'Red paint', 'Red paint for room', 1135.71); + +insert into item (item_id, item_name, item_desc, item_price) values(9,'Household Chairs', 'Chairs for house', 25.71); + +insert into item (item_id, item_name, item_desc, item_price) values(10,'Office Chairs', 'Chairs for office', 395.98); + +insert into item (item_id, item_name, item_desc, item_price) values(11,'Outdoor Chairs', 'Chairs for outdoor activities', 1234.36); diff --git a/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/view/ApplicationView.java b/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/view/ApplicationView.java deleted file mode 100644 index 83e3c2f9a5..0000000000 --- a/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/view/ApplicationView.java +++ /dev/null @@ -1,251 +0,0 @@ -/** - * ApplicationViewer is the class that starts the application - * First it creates the session object and then creates the - * criteria query. - * - * @author Pritam Banerjee - * @version 1.0 - * @since 07/20/2016 - */ - -package com.baeldung.hibernate.criteria.view; - -import java.util.List; - -import org.hibernate.Criteria; -import org.hibernate.Session; -import org.hibernate.Transaction; -import org.hibernate.criterion.Criterion; -import org.hibernate.criterion.LogicalExpression; -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Projections; -import org.hibernate.criterion.Restrictions; - -import com.baeldung.hibernate.criteria.model.Item; -import com.baeldung.hibernate.criteria.util.HibernateUtil; - -public class ApplicationView { - - // default Constructor - public ApplicationView() { - - } - - public boolean checkIfCriteriaTimeLower() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - Transaction tx = null; - - // calculate the time taken by criteria - final long startTimeCriteria = System.nanoTime(); - cr.add(Restrictions.like("itemName", "%item One%")); - final List results = cr.list(); - final long endTimeCriteria = System.nanoTime(); - final long durationCriteria = (endTimeCriteria - startTimeCriteria) / 1000; - - // calculate the time taken by HQL - final long startTimeHQL = System.nanoTime(); - tx = session.beginTransaction(); - final List items = session.createQuery("FROM Item where itemName like '%item One%'").list(); - final long endTimeHQL = System.nanoTime(); - final long durationHQL = (endTimeHQL - startTimeHQL) / 1000; - - if (durationCriteria > durationHQL) { - return false; - } else { - return true; - } - } - - // To get items having price more than 1000 - public String[] greaterThanCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - cr.add(Restrictions.gt("itemPrice", 1000)); - final List greaterThanItemsList = cr.list(); - final String greaterThanItems[] = new String[greaterThanItemsList.size()]; - for (int i = 0; i < greaterThanItemsList.size(); i++) { - greaterThanItems[i] = greaterThanItemsList.get(i).getItemName(); - } - session.close(); - return greaterThanItems; - } - - // To get items having price less than 1000 - public String[] lessThanCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - cr.add(Restrictions.lt("itemPrice", 1000)); - final List lessThanItemsList = cr.list(); - final String lessThanItems[] = new String[lessThanItemsList.size()]; - for (int i = 0; i < lessThanItemsList.size(); i++) { - lessThanItems[i] = lessThanItemsList.get(i).getItemName(); - } - session.close(); - return lessThanItems; - } - - // To get items whose Name start with Chair - public String[] likeCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - - final Criteria cr = session.createCriteria(Item.class); - cr.add(Restrictions.like("itemName", "%chair%")); - final List likeItemsList = cr.list(); - final String likeItems[] = new String[likeItemsList.size()]; - for (int i = 0; i < likeItemsList.size(); i++) { - likeItems[i] = likeItemsList.get(i).getItemName(); - } - session.close(); - return likeItems; - } - - // Case sensitive search - public String[] likeCaseCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - cr.add(Restrictions.ilike("itemName", "%Chair%")); - final List ilikeItemsList = cr.list(); - final String ilikeItems[] = new String[ilikeItemsList.size()]; - for (int i = 0; i < ilikeItemsList.size(); i++) { - ilikeItems[i] = ilikeItemsList.get(i).getItemName(); - } - session.close(); - return ilikeItems; - } - - // To get records having itemPrice in between 100 and 200 - public String[] betweenCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - // To get items having price more than 1000 - cr.add(Restrictions.between("itemPrice", 100, 200)); - final List betweenItemsList = cr.list(); - final String betweenItems[] = new String[betweenItemsList.size()]; - for (int i = 0; i < betweenItemsList.size(); i++) { - betweenItems[i] = betweenItemsList.get(i).getItemName(); - } - session.close(); - return betweenItems; - } - - // To check if the given property is null - public String[] nullCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - cr.add(Restrictions.isNull("itemDescription")); - final List nullItemsList = cr.list(); - final String nullDescItems[] = new String[nullItemsList.size()]; - for (int i = 0; i < nullItemsList.size(); i++) { - nullDescItems[i] = nullItemsList.get(i).getItemName(); - } - session.close(); - return nullDescItems; - } - - // To check if the given property is not null - public String[] notNullCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - cr.add(Restrictions.isNotNull("itemDescription")); - final List notNullItemsList = cr.list(); - final String notNullDescItems[] = new String[notNullItemsList.size()]; - for (int i = 0; i < notNullItemsList.size(); i++) { - notNullDescItems[i] = notNullItemsList.get(i).getItemName(); - } - session.close(); - return notNullDescItems; - } - - // Adding more than one expression in one cr - public String[] twoCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - cr.add(Restrictions.isNull("itemDescription")); - cr.add(Restrictions.like("itemName", "chair%")); - final List notNullItemsList = cr.list(); - final String notNullDescItems[] = new String[notNullItemsList.size()]; - for (int i = 0; i < notNullItemsList.size(); i++) { - notNullDescItems[i] = notNullItemsList.get(i).getItemName(); - } - session.close(); - return notNullDescItems; - } - - // To get items matching with the above defined conditions joined - // with Logical AND - public String[] andLogicalCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - final Criterion greaterThanPrice = Restrictions.gt("itemPrice", 1000); - final Criterion chairItems = Restrictions.like("itemName", "Chair%"); - final LogicalExpression andExample = Restrictions.and(greaterThanPrice, chairItems); - cr.add(andExample); - final List andItemsList = cr.list(); - final String andItems[] = new String[andItemsList.size()]; - for (int i = 0; i < andItemsList.size(); i++) { - andItems[i] = andItemsList.get(i).getItemName(); - } - session.close(); - return andItems; - } - - // To get items matching with the above defined conditions joined - // with Logical OR - public String[] orLogicalCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - final Criterion greaterThanPrice = Restrictions.gt("itemPrice", 1000); - final Criterion chairItems = Restrictions.like("itemName", "Chair%"); - final LogicalExpression orExample = Restrictions.or(greaterThanPrice, chairItems); - cr.add(orExample); - final List orItemsList = cr.list(); - final String orItems[] = new String[orItemsList.size()]; - for (int i = 0; i < orItemsList.size(); i++) { - orItems[i] = orItemsList.get(i).getItemName(); - } - session.close(); - return orItems; - } - - // Sorting example - public String[] sortingCriteria() { - final Session session = HibernateUtil.getHibernateSession(); - final Criteria cr = session.createCriteria(Item.class); - cr.addOrder(Order.asc("itemName")); - cr.addOrder(Order.desc("itemPrice")).list(); - final List sortedItemsList = cr.list(); - final String sortedItems[] = new String[sortedItemsList.size()]; - for (int i = 0; i < sortedItemsList.size(); i++) { - sortedItems[i] = sortedItemsList.get(i).getItemName(); - } - session.close(); - return sortedItems; - } - - // Set projections Row Count - public Long[] projectionRowCount() { - final Session session = HibernateUtil.getHibernateSession(); - final List itemProjected = session.createCriteria(Item.class).setProjection(Projections.rowCount()).list(); - final Long projectedRowCount[] = new Long[itemProjected.size()]; - for (int i = 0; i < itemProjected.size(); i++) { - projectedRowCount[i] = itemProjected.get(i); - } - session.close(); - return projectedRowCount; - } - - // Set projections average of itemPrice - public Double[] projectionAverage() { - final Session session = HibernateUtil.getHibernateSession(); - final List avgItemPriceList = session.createCriteria(Item.class).setProjection(Projections.projectionList().add(Projections.avg("itemPrice"))).list(); - - final Double avgItemPrice[] = new Double[avgItemPriceList.size()]; - for (int i = 0; i < avgItemPriceList.size(); i++) { - avgItemPrice[i] = (Double) avgItemPriceList.get(i); - } - session.close(); - return avgItemPrice; - } - -} diff --git a/spring-hibernate4/src/main/resources/criteria.cfg.xml b/spring-hibernate4/src/main/resources/criteria.cfg.xml deleted file mode 100644 index a39a32e151..0000000000 --- a/spring-hibernate4/src/main/resources/criteria.cfg.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - com.mysql.jdbc.Driver - jdbc:mysql://localhost:3306/test - root - iamtheking - org.hibernate.dialect.MySQLDialect - true - - - \ No newline at end of file diff --git a/spring-hibernate4/src/main/resources/criteria_create_queries.sql b/spring-hibernate4/src/main/resources/criteria_create_queries.sql deleted file mode 100644 index 3a627dd38c..0000000000 --- a/spring-hibernate4/src/main/resources/criteria_create_queries.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE `item` ( - `ITEM_ID` int(11) NOT NULL AUTO_INCREMENT, - `ITEM_DESC` varchar(100) DEFAULT NULL, - `ITEM_PRICE` int(11) NOT NULL, - `ITEM_NAME` varchar(255) NOT NULL, - PRIMARY KEY (`ITEM_ID`) -) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=latin1; From 3f2271f51b8a9852c240fafbddaf028c0e76fc08 Mon Sep 17 00:00:00 2001 From: bungrudi <30967151+bungrudi@users.noreply.github.com> Date: Wed, 15 Aug 2018 20:23:19 +0700 Subject: [PATCH 198/298] BAEL-2043: An Intro to Hibernate Entity Lifecycle (#4960) * "An Intro to Hibernate Entity Lifecycle" "An Intro to Hibernate Entity Lifecycle" by Rudi * Revision from Predrag's feedback * Another revision from Predrag's feedback * Another feedback. --- .../lifecycle/DirtyDataInspector.java | 26 +++ .../hibernate/lifecycle/FootballPlayer.java | 35 ++++ .../lifecycle/HibernateLifecycleUtil.java | 96 ++++++++++ .../HibernateInterceptorUnitTest.java | 1 - .../lifecycle/HibernateLifecycleUnitTest.java | 164 ++++++++++++++++++ .../resources/hibernate-lifecycle.properties | 9 + .../src/test/resources/lifecycle-init.sql | 25 +++ 7 files changed, 355 insertions(+), 1 deletion(-) create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/DirtyDataInspector.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/FootballPlayer.java create mode 100644 hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUtil.java create mode 100644 hibernate5/src/test/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUnitTest.java create mode 100644 hibernate5/src/test/resources/hibernate-lifecycle.properties create mode 100644 hibernate5/src/test/resources/lifecycle-init.sql diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/DirtyDataInspector.java b/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/DirtyDataInspector.java new file mode 100644 index 0000000000..4e00be2b5c --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/DirtyDataInspector.java @@ -0,0 +1,26 @@ +package com.baeldung.hibernate.lifecycle; + +import org.hibernate.EmptyInterceptor; +import org.hibernate.type.Type; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +public class DirtyDataInspector extends EmptyInterceptor { + private static final ArrayList dirtyEntities = new ArrayList<>(); + + @Override + public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) { + dirtyEntities.add((FootballPlayer) entity); + return true; + } + + public static List getDirtyEntities() { + return dirtyEntities; + } + + public static void clearDirtyEntitites() { + dirtyEntities.clear(); + } +} \ No newline at end of file diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/FootballPlayer.java b/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/FootballPlayer.java new file mode 100644 index 0000000000..49799a5292 --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/FootballPlayer.java @@ -0,0 +1,35 @@ +package com.baeldung.hibernate.lifecycle; + +import javax.persistence.*; + +@Entity +@Table(name = "Football_Player") +public class FootballPlayer { + @Id + @GeneratedValue + private long id; + + @Column + private String name; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "FootballPlayer{" + "id=" + id + ", name='" + name + '\'' + '}'; + } +} \ No newline at end of file diff --git a/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUtil.java b/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUtil.java new file mode 100644 index 0000000000..a06685fb9c --- /dev/null +++ b/hibernate5/src/main/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUtil.java @@ -0,0 +1,96 @@ +package com.baeldung.hibernate.lifecycle; + +import org.h2.tools.RunScript; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.hibernate.boot.Metadata; +import org.hibernate.boot.MetadataSources; +import org.hibernate.boot.SessionFactoryBuilder; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.engine.spi.EntityEntry; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.service.ServiceRegistry; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.stream.Collectors; + +public class HibernateLifecycleUtil { + private static SessionFactory sessionFactory; + private static Connection connection; + + public static void init() throws Exception { + Properties hbConfigProp = getHibernateProperties(); + Class.forName(hbConfigProp.getProperty("hibernate.connection.driver_class")); + connection = DriverManager.getConnection(hbConfigProp.getProperty("hibernate.connection.url"), hbConfigProp.getProperty("hibernate.connection.username"), hbConfigProp.getProperty("hibernate.connection.password")); + + try (InputStream h2InitStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("lifecycle-init.sql"); + InputStreamReader h2InitReader = new InputStreamReader(h2InitStream)) { + RunScript.execute(connection, h2InitReader); + } + + ServiceRegistry serviceRegistry = configureServiceRegistry(); + sessionFactory = getSessionFactoryBuilder(serviceRegistry).applyInterceptor(new DirtyDataInspector()).build(); + } + + public static void tearDown() throws Exception { + sessionFactory.close(); + connection.close(); + } + + public static SessionFactory getSessionFactory() { + return sessionFactory; + } + + private static SessionFactoryBuilder getSessionFactoryBuilder(ServiceRegistry serviceRegistry) { + MetadataSources metadataSources = new MetadataSources(serviceRegistry); + metadataSources.addAnnotatedClass(FootballPlayer.class); + + Metadata metadata = metadataSources.buildMetadata(); + return metadata.getSessionFactoryBuilder(); + + } + + private static ServiceRegistry configureServiceRegistry() throws IOException { + Properties properties = getHibernateProperties(); + return new StandardServiceRegistryBuilder().applySettings(properties).build(); + } + + private static Properties getHibernateProperties() throws IOException { + Properties properties = new Properties(); + URL propertiesURL = Thread.currentThread().getContextClassLoader().getResource("hibernate-lifecycle.properties"); + try (FileInputStream inputStream = new FileInputStream(propertiesURL.getFile())) { + properties.load(inputStream); + } + return properties; + } + + public static List getManagedEntities(Session session) { + Map.Entry[] entries = ((SessionImplementor) session).getPersistenceContext().reentrantSafeEntityEntries(); + return Arrays.stream(entries).map(e -> e.getValue()).collect(Collectors.toList()); + } + + public static Transaction startTransaction(Session s) { + Transaction tx = s.getTransaction(); + tx.begin(); + return tx; + } + + public static int queryCount(String query) throws Exception { + try (ResultSet rs = connection.createStatement().executeQuery(query)) { + rs.next(); + return rs.getInt(1); + } + } +} diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/interceptors/HibernateInterceptorUnitTest.java b/hibernate5/src/test/java/com/baeldung/hibernate/interceptors/HibernateInterceptorUnitTest.java index 0049f3a6bd..e18e989905 100644 --- a/hibernate5/src/test/java/com/baeldung/hibernate/interceptors/HibernateInterceptorUnitTest.java +++ b/hibernate5/src/test/java/com/baeldung/hibernate/interceptors/HibernateInterceptorUnitTest.java @@ -58,5 +58,4 @@ public class HibernateInterceptorUnitTest { transaction.commit(); session.close(); } - } diff --git a/hibernate5/src/test/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUnitTest.java b/hibernate5/src/test/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUnitTest.java new file mode 100644 index 0000000000..e682b46481 --- /dev/null +++ b/hibernate5/src/test/java/com/baeldung/hibernate/lifecycle/HibernateLifecycleUnitTest.java @@ -0,0 +1,164 @@ +package com.baeldung.hibernate.lifecycle; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.hibernate.engine.spi.Status; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.List; + +import static com.baeldung.hibernate.lifecycle.DirtyDataInspector.getDirtyEntities; +import static com.baeldung.hibernate.lifecycle.HibernateLifecycleUtil.*; +import static org.assertj.core.api.Assertions.assertThat; + +public class HibernateLifecycleUnitTest { + + @BeforeClass + public static void setup() throws Exception { + HibernateLifecycleUtil.init(); + + } + + @AfterClass + public static void tearDown() throws Exception { + HibernateLifecycleUtil.tearDown(); + } + + @Before + public void beforeMethod() { + DirtyDataInspector.clearDirtyEntitites(); + } + + @Test + public void whenEntityLoaded_thenEntityManaged() throws Exception { + SessionFactory sessionFactory = HibernateLifecycleUtil.getSessionFactory(); + try (Session session = sessionFactory.openSession()) { + Transaction transaction = startTransaction(session); + + assertThat(getManagedEntities(session)).isEmpty(); + + List players = session.createQuery("from FootballPlayer").getResultList(); + assertThat(getManagedEntities(session)).size().isEqualTo(3); + + assertThat(getDirtyEntities()).isEmpty(); + + FootballPlayer gigiBuffon = players.stream().filter(p -> p.getId() == 3).findFirst().get(); + + gigiBuffon.setName("Gianluigi Buffon"); + transaction.commit(); + + assertThat(getDirtyEntities()).size().isEqualTo(1); + assertThat(getDirtyEntities().get(0).getId()).isEqualTo(3); + assertThat(getDirtyEntities().get(0).getName()).isEqualTo("Gianluigi Buffon"); + } + } + + @Test + public void whenDetached_thenNotTracked() throws Exception { + SessionFactory sessionFactory = HibernateLifecycleUtil.getSessionFactory(); + try (Session session = sessionFactory.openSession()) { + Transaction transaction = startTransaction(session); + + FootballPlayer cr7 = session.get(FootballPlayer.class, 1L); + assertThat(getManagedEntities(session)).size().isEqualTo(1); + assertThat(getManagedEntities(session).get(0).getId()).isEqualTo(cr7.getId()); + + session.evict(cr7); + assertThat(getManagedEntities(session)).size().isEqualTo(0); + + cr7.setName("CR7"); + transaction.commit(); + + assertThat(getDirtyEntities()).isEmpty(); + } + } + + @Test + public void whenReattached_thenTrackedAgain() throws Exception { + SessionFactory sessionFactory = HibernateLifecycleUtil.getSessionFactory(); + try (Session session = sessionFactory.openSession()) { + Transaction transaction = startTransaction(session); + + FootballPlayer messi = session.get(FootballPlayer.class, 2L); + + session.evict(messi); + messi.setName("Leo Messi"); + transaction.commit(); + assertThat(getDirtyEntities()).isEmpty(); + + transaction = startTransaction(session); + session.update(messi); + transaction.commit(); + assertThat(getDirtyEntities()).size().isEqualTo(1); + assertThat(getDirtyEntities().get(0).getName()).isEqualTo("Leo Messi"); + } + } + + @Test + public void givenNewEntityWithID_whenReattached_thenManaged() throws Exception { + SessionFactory sessionFactory = HibernateLifecycleUtil.getSessionFactory(); + try (Session session = sessionFactory.openSession()) { + Transaction transaction = startTransaction(session); + + FootballPlayer gigi = new FootballPlayer(); + gigi.setId(3); + gigi.setName("Gigi the Legend"); + + session.update(gigi); + assertThat(getManagedEntities(session)).size().isEqualTo(1); + + transaction.commit(); + assertThat(getDirtyEntities()).size().isEqualTo(1); + } + } + + @Test + public void givenTransientEntity_whenSave_thenManaged() throws Exception { + SessionFactory sessionFactory = HibernateLifecycleUtil.getSessionFactory(); + try (Session session = sessionFactory.openSession()) { + Transaction transaction = startTransaction(session); + + FootballPlayer neymar = new FootballPlayer(); + neymar.setName("Neymar"); + + session.save(neymar); + assertThat(getManagedEntities(session)).size().isEqualTo(1); + assertThat(neymar.getId()).isNotNull(); + + int count = queryCount("select count(*) from Football_Player where name='Neymar'"); + assertThat(count).isEqualTo(0); + + transaction.commit(); + + count = queryCount("select count(*) from Football_Player where name='Neymar'"); + assertThat(count).isEqualTo(1); + + transaction = startTransaction(session); + session.delete(neymar); + transaction.commit(); + } + } + + @Test() + public void whenDelete_thenMarkDeleted() throws Exception { + SessionFactory sessionFactory = HibernateLifecycleUtil.getSessionFactory(); + try (Session session = sessionFactory.openSession()) { + Transaction transaction = startTransaction(session); + + FootballPlayer neymar = new FootballPlayer(); + neymar.setName("Neymar"); + + session.save(neymar); + transaction.commit(); + + transaction = startTransaction(session); + session.delete(neymar); + assertThat(getManagedEntities(session).get(0).getStatus()).isEqualTo(Status.DELETED); + transaction.commit(); + } + } +} diff --git a/hibernate5/src/test/resources/hibernate-lifecycle.properties b/hibernate5/src/test/resources/hibernate-lifecycle.properties new file mode 100644 index 0000000000..d043b624f2 --- /dev/null +++ b/hibernate5/src/test/resources/hibernate-lifecycle.properties @@ -0,0 +1,9 @@ +hibernate.connection.driver_class=org.h2.Driver +hibernate.connection.url=jdbc:h2:mem:lifecycledb;DB_CLOSE_DELAY=-1; +hibernate.connection.username=sa +hibernate.connection.password= +hibernate.connection.autocommit=true + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=validate \ No newline at end of file diff --git a/hibernate5/src/test/resources/lifecycle-init.sql b/hibernate5/src/test/resources/lifecycle-init.sql new file mode 100644 index 0000000000..c0c9a3f34d --- /dev/null +++ b/hibernate5/src/test/resources/lifecycle-init.sql @@ -0,0 +1,25 @@ +create sequence hibernate_sequence start with 1 increment by 1; + +create table Football_Player ( + id bigint not null, + name varchar(255), + primary key (id) +); + +insert into + Football_Player + (name, id) + values + ('Cristiano Ronaldo', next value for hibernate_sequence); + +insert into + Football_Player + (name, id) + values + ('Lionel Messi', next value for hibernate_sequence); + +insert into + Football_Player + (name, id) + values + ('Gigi Buffon', next value for hibernate_sequence); \ No newline at end of file From 4bd162e5a5de28f9ea963b11d84daa2a5ffc6fb6 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Thu, 16 Aug 2018 00:05:58 +0530 Subject: [PATCH 199/298] Moved core persisatnce codes from core java to core java persistence --- core-java-persistence/pom.xml | 12 ++++++++++++ .../main/java/com/baeldung/jdbc/BatchProcessing.java | 0 .../src/main/java/com/baeldung/jdbc/Employee.java | 0 .../baeldung/jdbcrowset/DatabaseConfiguration.java | 0 .../com/baeldung/jdbcrowset/ExampleListener.java | 0 .../java/com/baeldung/jdbcrowset/FilterExample.java | 0 .../baeldung/jdbcrowset/JdbcRowsetApplication.java | 0 .../com/baeldung/jdbc/BatchProcessingLiveTest.java | 0 .../test/java/com/baeldung/jdbc/JdbcLiveTest.java | 0 .../com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java | 0 core-java/pom.xml | 6 ------ 11 files changed, 12 insertions(+), 6 deletions(-) rename {core-java => core-java-persistence}/src/main/java/com/baeldung/jdbc/BatchProcessing.java (100%) rename {core-java => core-java-persistence}/src/main/java/com/baeldung/jdbc/Employee.java (100%) rename {core-java => core-java-persistence}/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java (100%) rename {core-java => core-java-persistence}/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java (100%) rename {core-java => core-java-persistence}/src/main/java/com/baeldung/jdbcrowset/FilterExample.java (100%) rename {core-java => core-java-persistence}/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java (100%) rename {core-java => core-java-persistence}/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java (100%) rename {core-java => core-java-persistence}/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java (100%) rename {core-java => core-java-persistence}/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java (100%) diff --git a/core-java-persistence/pom.xml b/core-java-persistence/pom.xml index 0cb142c7b8..7279fd763b 100644 --- a/core-java-persistence/pom.xml +++ b/core-java-persistence/pom.xml @@ -39,6 +39,16 @@ c3p0 ${c3p0.version} + + org.springframework + spring-web + ${springframework.spring-web.version} + + + org.springframework.boot + spring-boot-starter + ${springframework.boot.spring-boot-starter.version} + core-java-persistence @@ -55,5 +65,7 @@ 2.4.0 3.2.0 0.9.5.2 + 1.5.8.RELEASE + 4.3.4.RELEASE \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/jdbc/BatchProcessing.java b/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java similarity index 100% rename from core-java/src/main/java/com/baeldung/jdbc/BatchProcessing.java rename to core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java diff --git a/core-java/src/main/java/com/baeldung/jdbc/Employee.java b/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java similarity index 100% rename from core-java/src/main/java/com/baeldung/jdbc/Employee.java rename to core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java diff --git a/core-java/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java b/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java similarity index 100% rename from core-java/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java rename to core-java-persistence/src/main/java/com/baeldung/jdbcrowset/DatabaseConfiguration.java diff --git a/core-java/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java b/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java similarity index 100% rename from core-java/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java rename to core-java-persistence/src/main/java/com/baeldung/jdbcrowset/ExampleListener.java diff --git a/core-java/src/main/java/com/baeldung/jdbcrowset/FilterExample.java b/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/jdbcrowset/FilterExample.java rename to core-java-persistence/src/main/java/com/baeldung/jdbcrowset/FilterExample.java diff --git a/core-java/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java b/core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java similarity index 100% rename from core-java/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java rename to core-java-persistence/src/main/java/com/baeldung/jdbcrowset/JdbcRowsetApplication.java diff --git a/core-java/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java b/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java rename to core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java diff --git a/core-java/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java b/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java rename to core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java diff --git a/core-java/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java b/core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java rename to core-java-persistence/src/test/java/com/baeldung/jdbcrowset/JdbcRowSetLiveTest.java diff --git a/core-java/pom.xml b/core-java/pom.xml index 3f44851f97..b4c9dd285f 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -127,11 +127,6 @@ spring-web ${springframework.spring-web.version} - - org.springframework.boot - spring-boot-starter - ${springframework.boot.spring-boot-starter.version} - com.h2database h2 @@ -532,7 +527,6 @@ 2.21.0 4.3.4.RELEASE - 1.5.8.RELEASE 1.1 1.4.197 From 854614166fd128600c4b948654a9fea9bdbe4ce2 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 15 Aug 2018 22:19:02 +0300 Subject: [PATCH 200/298] fix exceptions tests --- .../com/baeldung/exceptionhandling/Exceptions.java | 14 ++++++++++++-- .../exceptionhandling/ExceptionsUnitTest.java | 8 +------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java b/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java index 48f4b5c02b..9690648386 100644 --- a/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java +++ b/core-java/src/main/java/com/baeldung/exceptionhandling/Exceptions.java @@ -25,7 +25,11 @@ public class Exceptions { } public List loadAllPlayers(String playersFile) throws IOException{ - throw new IOException(); + try { + throw new IOException(); + } catch(IOException ex) { + throw new IllegalStateException(); + } } public int getPlayerScoreThrows(String playerFile) throws FileNotFoundException { @@ -160,7 +164,13 @@ public class Exceptions { } public void throwAsGotoAntiPattern() throws MyException { - throw new MyException(); + try { + // bunch of code + throw new MyException(); + // second bunch of code + } catch ( MyException e ) { + // third bunch of code + } } public int getPlayerScoreSwallowingExceptionAntiPattern(String playerFile) { diff --git a/core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java b/core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java index 1e86132116..b3f585cfe4 100644 --- a/core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java +++ b/core-java/src/test/java/com/baeldung/exceptionhandling/ExceptionsUnitTest.java @@ -21,7 +21,7 @@ public class ExceptionsUnitTest { @Test public void loadAllPlayers() { assertThatThrownBy(() -> exceptions.loadAllPlayers("")) - .isInstanceOf(IOException.class); + .isInstanceOf(IllegalStateException.class); } @Test @@ -72,12 +72,6 @@ public class ExceptionsUnitTest { .isInstanceOf(NullPointerException.class); } - @Test - public void throwAsGotoAntiPattern() { - assertThatThrownBy(() -> exceptions.throwAsGotoAntiPattern()) - .isInstanceOf(MyException.class); - } - @Test public void getPlayerScoreSwallowingExceptionAntiPatternAlternative2() { assertThatThrownBy(() -> exceptions.getPlayerScoreSwallowingExceptionAntiPatternAlternative2("")) From 32fd79061c5339b12b8cacf729535ba29413adb8 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Wed, 15 Aug 2018 23:42:45 +0300 Subject: [PATCH 201/298] ignore failing test --- maven/src/test/java/testfail/TestFail.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/maven/src/test/java/testfail/TestFail.java b/maven/src/test/java/testfail/TestFail.java index 16f1619db4..6d37809003 100644 --- a/maven/src/test/java/testfail/TestFail.java +++ b/maven/src/test/java/testfail/TestFail.java @@ -1,10 +1,13 @@ package testfail; import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertNotNull; public class TestFail { + + @Ignore //ignored so the entire tutorials build passes @Test public void whenMessageAssigned_thenItIsNotNull() { String message = "hello there"; From 623e29cecb279a0a8300a447fbe9f42d610fb5c4 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Wed, 15 Aug 2018 23:10:18 +0200 Subject: [PATCH 202/298] fixed async timing and 404 bug, refactored code --- jersey-client-rx/pom.xml | 11 + .../samples/jerseyrx/ClientOrchestration.java | 217 ---------------- .../samples/jerseyrx/EmployeeDTO.java | 54 ---- .../ClientOrchestrationIntegrationTest.java | 244 ++++++++++++++++++ .../jerseyrx/ClientOrchestrationTest.java | 78 ------ pom.xml | 1 + 6 files changed, 256 insertions(+), 349 deletions(-) delete mode 100644 jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java delete mode 100644 jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java create mode 100644 jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationIntegrationTest.java delete mode 100644 jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java diff --git a/jersey-client-rx/pom.xml b/jersey-client-rx/pom.xml index 4e35be31b4..24894869a5 100644 --- a/jersey-client-rx/pom.xml +++ b/jersey-client-rx/pom.xml @@ -47,6 +47,17 @@ jackson-jaxrs-json-provider 2.4.1 + + org.slf4j + slf4j-jdk14 + 1.7.25 + + + org.assertj + assertj-core + 3.10.0 + test + UTF-8 diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java deleted file mode 100644 index f2687c8c8d..0000000000 --- a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/ClientOrchestration.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.baeldung.samples.jerseyrx; - -import io.reactivex.Flowable; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import org.glassfish.jersey.client.rx.rxjava.RxObservableInvokerProvider; -import org.glassfish.jersey.client.rx.rxjava.RxObservableInvoker; -import java.util.logging.Logger; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.InvocationCallback; -import javax.ws.rs.client.WebTarget; -import javax.ws.rs.core.GenericType; -import javax.ws.rs.core.MediaType; -import org.glassfish.jersey.client.rx.rxjava2.RxFlowableInvoker; -import org.glassfish.jersey.client.rx.rxjava2.RxFlowableInvokerProvider; -import rx.Observable; - -/** - * - * @author baeldung - */ -public class ClientOrchestration { - - Client client = ClientBuilder.newClient(); - - WebTarget userIdService = client.target("http://localhost:8080/serviceA/id"); - WebTarget nameService = client.target("http://localhost:8080/serviceA/{empId}/name"); - WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/hash"); - - - LinkedList failures = new LinkedList<>(); - - Logger logger = Logger.getLogger("ClientOrchestrator"); - - public void callBackOrchestrate() { - logger.info("Orchestrating with the pyramid of doom"); - userIdService.request() - .accept(MediaType.APPLICATION_JSON) - .async() - .get(new InvocationCallback() { - @Override - public void completed(EmployeeDTO empIdList) { - logger.info("[InvocationCallback] Got all the IDs " + empIdList.getEmpIds()); - List empIds = empIdList.getEmpIds(); - CountDownLatch completionTracker = new CountDownLatch(empIds.size()); //used to keep track of the progress of the subsequent calls - empIds.forEach((id) -> { - //for each employee ID, get the name - nameService.resolveTemplate("empId", id).request() - .async() - .get(new InvocationCallback() { - - @Override - public void completed(String response) { - completionTracker.countDown(); - hashService.resolveTemplate("comboIDandName", response + id).request().async().get(new InvocationCallback() { - @Override - public void completed(String response) { - logger.log(Level.INFO, "[InvocationCallback] The hash output {0}", response); - } - - @Override - public void failed(Throwable throwable) { - completionTracker.countDown(); - failures.add(throwable); - logger.log(Level.WARNING, "[InvocationCallback] An error has occurred in the hashing request step {0}", throwable.getMessage()); - } - }); - } - - @Override - public void failed(Throwable throwable) { - completionTracker.countDown(); - failures.add(throwable); - logger.log(Level.WARNING, "[InvocationCallback] An error has occurred in the username request step {0}", throwable.getMessage()); - } - }); - }); - - try { - if (!completionTracker.await(10, TimeUnit.SECONDS)) { //wait for inner requests to complete in 10 seconds - logger.warning("[InvocationCallback] Some requests didn't complete within the timeout"); - } - } catch (InterruptedException ex) { - failures.add(ex); - Logger.getLogger(ClientOrchestration.class.getName()).log(Level.SEVERE, null, ex); - } - - } - - @Override - public void failed(Throwable throwable) { - failures.add(throwable); - logger.warning("Couldn't get the list of IDs"); - } - }); - } - - public void rxOrchestrate() { - logger.info("Orchestrating with a CompletionStage"); - CompletionStage userIdStage = userIdService.request().accept(MediaType.APPLICATION_JSON) - .rx() - .get(new GenericType() { - }) - .exceptionally((throwable) -> { - failures.add(throwable); - logger.warning("[CompletionStage] An error has occurred"); - return null; - }); - - userIdStage.thenAcceptAsync(empIdDto -> { - logger.info("[CompletionStage] Got all the IDs " + empIdDto.getEmpIds()); - empIdDto.getEmpIds().stream().forEach((Long id) -> { - CompletableFuture completable = nameService.resolveTemplate("empId", id) - .request() - .rx() - .get(String.class) - .toCompletableFuture(); - - completable.thenAccept((String userName) -> { - hashService.resolveTemplate("comboIDandName", userName + id) - .request() - .rx() - .get(String.class) - .toCompletableFuture() - .thenAcceptAsync(hashValue -> logger.log(Level.INFO, "[CompletionFuture] The hash output {0}", hashValue)) - .exceptionally((throwable) -> { - failures.add(throwable); - logger.log(Level.WARNING, "[CompletionStage] Hash computation failed for {0}", id); - return null; - }); - - }); - - }); - }); - - } - - public void observableJavaOrchestrate() { - - logger.info("Orchestrating with Observables"); - Observable observableUserIdService = userIdService.register(RxObservableInvokerProvider.class).request() - .accept(MediaType.APPLICATION_JSON) - .rx(RxObservableInvoker.class) - .get(new GenericType() { - }).asObservable(); - - observableUserIdService.subscribe((EmployeeDTO empIdList) -> { - logger.info("[Observable] Got all the IDs " + empIdList.getEmpIds()); - Observable.from(empIdList.getEmpIds()).subscribe(id - -> nameService.register(RxObservableInvokerProvider.class) - .resolveTemplate("empId", id) - .request() - .rx(RxObservableInvoker.class) - .get(String.class) - .asObservable() //gotten the name for the given empId - .doOnError((throwable) -> { - failures.add(throwable); - logger.log(Level.WARNING, " [Observable] An error has occurred in the username request step {0}", throwable.getMessage()); - }) - .subscribe(userName -> hashService.register(RxObservableInvokerProvider.class) - .resolveTemplate("comboIDandName", userName + id) - .request() - .rx(RxObservableInvoker.class) - .get(String.class) - .asObservable() //gotten the hash value for empId+username - .doOnError((throwable) -> { - failures.add(throwable); - logger.log(Level.WARNING, " [Observable]An error has occurred in the hashing request step {0}", throwable.getMessage()); - }) - .subscribe(hashValue -> logger.log(Level.INFO, "[Observable] The hash output {0}", hashValue)))); - }); - - } - - public void flowableJavaOrchestrate() { - - Flowable userIdFlowable = userIdService.register(RxFlowableInvokerProvider.class) - .request() - .rx(RxFlowableInvoker.class) - .get(new GenericType() { - }); - - userIdFlowable.subscribe((EmployeeDTO dto) -> { - logger.info("Orchestrating with Flowable"); - List listOfIds = dto.getEmpIds(); - Flowable.just(listOfIds).subscribe(id - -> nameService.register(RxFlowableInvokerProvider.class) - .resolveTemplate("empId", id) - .request() - .rx(RxFlowableInvoker.class) - .get(String.class) //gotten the name for the given empId - .doOnError((throwable) -> { - failures.add(throwable); - logger.log(Level.WARNING, "[Flowable] An error has occurred in the username request step {0}", throwable.getMessage()); - }) - .subscribe(userName -> hashService.register(RxFlowableInvokerProvider.class) - .resolveTemplate("comboIDandName", userName + id) - .request() - .rx(RxFlowableInvoker.class) - .get(String.class) //gotten the hash value for empId+username - .doOnError((throwable) -> { - failures.add(throwable); - logger.warning(" [Flowable] An error has occurred in the hashing request step " + throwable.getMessage()); - }) - .subscribe(hashValue -> logger.log(Level.INFO, "[Flowable] The hash output {0}", hashValue)))); - }); - - } - -} diff --git a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java b/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java deleted file mode 100644 index 3a818f979e..0000000000 --- a/jersey-client-rx/src/main/java/com/baeldung/samples/jerseyrx/EmployeeDTO.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.baeldung.samples.jerseyrx; - -import java.util.List; -import java.util.Objects; - -/** - * - * @author baeldung - */ -public class EmployeeDTO { - - private List empIds; - - public List getEmpIds() { - return empIds; - } - - public void setEmpIds(List empIds) { - this.empIds = empIds; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 59 * hash + Objects.hashCode(this.empIds); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final EmployeeDTO other = (EmployeeDTO) obj; - if (!Objects.equals(this.empIds, other.empIds)) { - return false; - } - return true; - } - - @Override - public String toString() { - return "EmployeeDTO{" + "empIds=" + empIds + '}'; - } - - - -} diff --git a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationIntegrationTest.java b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationIntegrationTest.java new file mode 100644 index 0000000000..10cdab7c7a --- /dev/null +++ b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationIntegrationTest.java @@ -0,0 +1,244 @@ +package com.baeldung.samples.jerseyrx; + +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static org.assertj.core.api.Assertions.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.InvocationCallback; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.MediaType; + +import org.glassfish.jersey.client.rx.rxjava.RxObservableInvoker; +import org.glassfish.jersey.client.rx.rxjava.RxObservableInvokerProvider; +import org.glassfish.jersey.client.rx.rxjava2.RxFlowableInvoker; +import org.glassfish.jersey.client.rx.rxjava2.RxFlowableInvokerProvider; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +import io.reactivex.Flowable; +import rx.Observable; + +/** + * + * @author baeldung + */ +public class ClientOrchestrationIntegrationTest { + + private Client client = ClientBuilder.newClient(); + + private WebTarget userIdService = client.target("http://localhost:8080/id-service/ids"); + private WebTarget nameService = client.target("http://localhost:8080/name-service/users/{userId}/name"); + private WebTarget hashService = client.target("http://localhost:8080/hash-service/{rawValue}"); + + private Logger logger = LoggerFactory.getLogger(ClientOrchestrationIntegrationTest.class); + + private String expectedUserIds = "[1,2,3,4,5,6]"; + + private List expectedNames = Arrays.asList("n/a", "Thor", "Hulk", "BlackWidow", "BlackPanther", "TheTick", "Hawkeye"); + + private List expectedHashValues = Arrays.asList("roht1", "kluh2", "WodiwKcalb3", "RehtnapKclab4", "kciteht5", "eyekwah6"); + + @Rule + public WireMockRule wireMockServer = new WireMockRule(); + + @Before + public void setup() { + + stubFor(get(urlEqualTo("/id-service/ids")).willReturn(aResponse().withBody(expectedUserIds).withHeader("Content-Type", "application/json"))); + + stubFor(get(urlEqualTo("/name-service/users/1/name")).willReturn(aResponse().withBody(expectedNames.get(1)))); + stubFor(get(urlEqualTo("/name-service/users/2/name")).willReturn(aResponse().withBody(expectedNames.get(2)))); + stubFor(get(urlEqualTo("/name-service/users/3/name")).willReturn(aResponse().withBody(expectedNames.get(3)))); + stubFor(get(urlEqualTo("/name-service/users/4/name")).willReturn(aResponse().withBody(expectedNames.get(4)))); + stubFor(get(urlEqualTo("/name-service/users/5/name")).willReturn(aResponse().withBody(expectedNames.get(5)))); + stubFor(get(urlEqualTo("/name-service/users/6/name")).willReturn(aResponse().withBody(expectedNames.get(6)))); + + stubFor(get(urlEqualTo("/hash-service/Thor1")).willReturn(aResponse().withBody(expectedHashValues.get(0)))); + stubFor(get(urlEqualTo("/hash-service/Hulk2")).willReturn(aResponse().withBody(expectedHashValues.get(1)))); + stubFor(get(urlEqualTo("/hash-service/BlackWidow3")).willReturn(aResponse().withBody(expectedHashValues.get(2)))); + stubFor(get(urlEqualTo("/hash-service/BlackPanther4")).willReturn(aResponse().withBody(expectedHashValues.get(3)))); + stubFor(get(urlEqualTo("/hash-service/TheTick5")).willReturn(aResponse().withBody(expectedHashValues.get(4)))); + stubFor(get(urlEqualTo("/hash-service/Hawkeye6")).willReturn(aResponse().withBody(expectedHashValues.get(5)))); + + } + + @Test + public void callBackOrchestrate() throws InterruptedException { + List receivedHashValues = new ArrayList<>(); + + userIdService.request().accept(MediaType.APPLICATION_JSON).async().get(new InvocationCallback>() { + @Override + public void completed(List employeeIds) { + logger.info("[CallbackExample] id-service result: {}", employeeIds); + CountDownLatch completionTracker = new CountDownLatch(employeeIds.size()); // used to keep track of the progress of the subsequent calls + employeeIds.forEach((id) -> { + // for each employee ID, get the name + nameService.resolveTemplate("userId", id).request().async().get(new InvocationCallback() { + + @Override + public void completed(String response) { + logger.info("[CallbackExample] name-service result: {}", response); + + completionTracker.countDown(); + hashService.resolveTemplate("rawValue", response + id).request().async().get(new InvocationCallback() { + @Override + public void completed(String response) { + logger.info("[CallbackExample] hash-service result: {}", response); + receivedHashValues.add(response); + } + + @Override + public void failed(Throwable throwable) { + completionTracker.countDown(); + logger.warn("[CallbackExample] An error has occurred in the hashing request step!", throwable); + } + }); + } + + @Override + public void failed(Throwable throwable) { + completionTracker.countDown(); + logger.warn("[CallbackExample] An error has occurred in the username request step!", throwable); + } + }); + }); + + try { + // wait for inner requests to complete in 10 seconds + if (!completionTracker.await(10, TimeUnit.SECONDS)) { + logger.warn("[CallbackExample] Some requests didn't complete within the timeout"); + } + } catch (InterruptedException e) { + logger.error("Interrupted!", e); + } + + } + + @Override + public void failed(Throwable throwable) { + logger.warn("[CallbackExample] An error has occurred in the userId request step!", throwable); + } + }); + + // wait for async calls to complete + Thread.sleep(1000); + + assertThat(receivedHashValues).containsAll(expectedHashValues); + } + + @Test + public void rxOrchestrate() throws InterruptedException { + List receivedHashValues = new ArrayList<>(); + + CompletionStage> userIdStage = userIdService.request().accept(MediaType.APPLICATION_JSON).rx().get(new GenericType>() { + }).exceptionally((throwable) -> { + logger.warn("[CompletionStageExample] An error has occurred"); + return null; + }); + + userIdStage.thenAcceptAsync(employeeIds -> { + logger.info("[CompletionStageExample] id-service result: {}", employeeIds); + employeeIds.forEach((Long id) -> { + CompletableFuture completable = nameService.resolveTemplate("userId", id).request().rx().get(String.class).toCompletableFuture(); + + completable.thenAccept((String userName) -> { + logger.info("[CompletionStageExample] name-service result: {}", userName); + hashService.resolveTemplate("rawValue", userName + id).request().rx().get(String.class).toCompletableFuture().thenAcceptAsync(hashValue -> { + logger.info("[CompletionStageExample] hash-service result: {}", hashValue); + receivedHashValues.add(hashValue); + }).exceptionally((throwable) -> { + logger.warn("[CompletionStageExample] Hash computation failed for {}", id); + return null; + }); + + }); + + }); + }); + + // wait for async calls to complete + Thread.sleep(1000); + + assertThat(receivedHashValues).containsAll(expectedHashValues); + } + + @Test + public void observableJavaOrchestrate() throws InterruptedException { + List receivedHashValues = new ArrayList<>(); + + Observable> observableUserIdService = userIdService.register(RxObservableInvokerProvider.class).request().accept(MediaType.APPLICATION_JSON).rx(RxObservableInvoker.class).get(new GenericType>() { + }).asObservable(); + + observableUserIdService.subscribe((List employeeIds) -> { + logger.info("[ObservableExample] id-service result: {}", employeeIds); + Observable.from(employeeIds).subscribe(id -> nameService.register(RxObservableInvokerProvider.class).resolveTemplate("userId", id).request().rx(RxObservableInvoker.class).get(String.class).asObservable() // gotten the name for the given + // userId + .doOnError((throwable) -> { + logger.warn("[ObservableExample] An error has occurred in the username request step {}", throwable.getMessage()); + }).subscribe(userName -> { + logger.info("[ObservableExample] name-service result: {}", userName); + hashService.register(RxObservableInvokerProvider.class).resolveTemplate("rawValue", userName + id).request().rx(RxObservableInvoker.class).get(String.class).asObservable() // gotten the hash value for + // userId+username + .doOnError((throwable) -> { + logger.warn("[ObservableExample] An error has occurred in the hashing request step {}", throwable.getMessage()); + }).subscribe(hashValue -> { + logger.info("[ObservableExample] hash-service result: {}", hashValue); + receivedHashValues.add(hashValue); + }); + })); + }); + + // wait for async calls to complete + Thread.sleep(1000); + + assertThat(receivedHashValues).containsAll(expectedHashValues); + } + + @Test + public void flowableJavaOrchestrate() throws InterruptedException { + List receivedHashValues = new ArrayList<>(); + + Flowable> userIdFlowable = userIdService.register(RxFlowableInvokerProvider.class).request().rx(RxFlowableInvoker.class).get(new GenericType>() { + }); + + userIdFlowable.subscribe((List employeeIds) -> { + logger.info("[FlowableExample] id-service result: {}", employeeIds); + Flowable.fromIterable(employeeIds).subscribe(id -> { + nameService.register(RxFlowableInvokerProvider.class).resolveTemplate("userId", id).request().rx(RxFlowableInvoker.class).get(String.class) // gotten the name for the given userId + .doOnError((throwable) -> { + logger.warn("[FlowableExample] An error has occurred in the username request step {}", throwable.getMessage()); + }).subscribe(userName -> { + logger.info("[FlowableExample] name-service result: {}", userName); + hashService.register(RxFlowableInvokerProvider.class).resolveTemplate("rawValue", userName + id).request().rx(RxFlowableInvoker.class).get(String.class) // gotten the hash value for userId+username + .doOnError((throwable) -> { + logger.warn(" [FlowableExample] An error has occurred in the hashing request step!", throwable); + }).subscribe(hashValue -> { + logger.info("[FlowableExample] hash-service result: {}", hashValue); + receivedHashValues.add(hashValue); + }); + }); + }); + }); + + // wait for async calls to complete + Thread.sleep(1000); + + assertThat(receivedHashValues).containsAll(expectedHashValues); + } + +} diff --git a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java deleted file mode 100644 index 6df0e1c110..0000000000 --- a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.baeldung.samples.jerseyrx; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import com.github.tomakehurst.wiremock.junit.WireMockRule; -import java.util.LinkedList; -import java.util.logging.Logger; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; -import javax.ws.rs.client.WebTarget; -import static junit.framework.Assert.assertTrue; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -/** - * - * @author baeldung - */ -public class ClientOrchestrationTest { - - Client client = ClientBuilder.newClient(); - - WebTarget userIdService = client.target("http://localhost:8080/serviceA/id"); - WebTarget nameService = client.target("http://localhost:8080/serviceA/{empId}/name"); - WebTarget hashService = client.target("http://localhost:8080/serviceA/{comboIDandName}/hash"); - - LinkedList failures = new LinkedList<>(); - - Logger logger = Logger.getLogger("ClientOrchestrator"); - - ClientOrchestration orchestrator = new ClientOrchestration(); - - String jsonIdList = "{\"empIds\":[1,2,3,4,5,6]}"; - - String[] nameList = new String[]{"n/a", "Thor", "Hulk", "BlackWidow", "BlackPanther", "TheTick", "Hawkeye"}; - - String[] hashResultList = new String[]{"roht1", "kluh2", "WodiwKcalb3", "RehtnapKclab4", "kciteht5", "eyekwah6"}; - - @Rule - public WireMockRule wireMockServer = new WireMockRule(); - - @Before - public void setup() { - - stubFor(get(urlEqualTo("/serviceA/id")).willReturn(aResponse().withBody(jsonIdList).withHeader("Content-Type", "application/json"))); - - stubFor(get(urlEqualTo("/serviceA/1/name")).willReturn(aResponse().withBody(nameList[1]))); - stubFor(get(urlEqualTo("/serviceA/2/name")).willReturn(aResponse().withBody(nameList[2]))); - stubFor(get(urlEqualTo("/serviceA/3/name")).willReturn(aResponse().withBody(nameList[3]))); - stubFor(get(urlEqualTo("/serviceA/4/name")).willReturn(aResponse().withBody(nameList[4]))); - stubFor(get(urlEqualTo("/serviceA/5/name")).willReturn(aResponse().withBody(nameList[5]))); - stubFor(get(urlEqualTo("/serviceA/6/name")).willReturn(aResponse().withBody(nameList[6]))); - - stubFor(get(urlEqualTo("/serviceA/Thor1/hash")).willReturn(aResponse().withBody(hashResultList[0]))); - stubFor(get(urlEqualTo("/serviceA/Hulk2/hash")).willReturn(aResponse().withBody(hashResultList[1]))); - stubFor(get(urlEqualTo("/serviceA/BlackWidow3/hash")).willReturn(aResponse().withBody(hashResultList[2]))); - stubFor(get(urlEqualTo("/serviceA/BlackPanther4/hash")).willReturn(aResponse().withBody(hashResultList[3]))); - stubFor(get(urlEqualTo("/serviceA/TheTick5/hash")).willReturn(aResponse().withBody(hashResultList[4]))); - stubFor(get(urlEqualTo("/serviceA/Hawkeye6/hash")).willReturn(aResponse().withBody(hashResultList[5]))); - - } - - @Test - public void hits() { - - orchestrator.callBackOrchestrate(); - orchestrator.rxOrchestrate(); - orchestrator.observableJavaOrchestrate(); - orchestrator.flowableJavaOrchestrate(); - - assertTrue(orchestrator.failures.isEmpty()); - } - - -} diff --git a/pom.xml b/pom.xml index 4a25459fcb..87278ee3d0 100644 --- a/pom.xml +++ b/pom.xml @@ -188,6 +188,7 @@ spring-integration spring-jenkins-pipeline spring-jersey + jersey-client-rx jmeter spring-jms spring-jooq From fac564c4d5b3727a4da9cc1966cea3c34104debe Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Wed, 15 Aug 2018 23:23:18 +0200 Subject: [PATCH 203/298] added jersey-client-rx to parent POM --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index db3bef7fda..0bed4ead26 100644 --- a/pom.xml +++ b/pom.xml @@ -576,6 +576,7 @@ spring-security-thymeleaf persistence-modules/java-jdbi jersey + jersey-client-rx java-spi performance-tests twilio @@ -1106,6 +1107,7 @@ spring-security-thymeleaf persistence-modules/java-jdbi jersey + jersey-client-rx java-spi performance-tests twilio From e6abd9d474023f339d02f72f55bb4f536da564aa Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Thu, 16 Aug 2018 08:27:17 +0200 Subject: [PATCH 204/298] added CountDownLatch to all examples --- .../ClientOrchestrationIntegrationTest.java | 88 ++++++++++++------- 1 file changed, 58 insertions(+), 30 deletions(-) diff --git a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationIntegrationTest.java b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationIntegrationTest.java index 10cdab7c7a..88a8d67a7d 100644 --- a/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationIntegrationTest.java +++ b/jersey-client-rx/src/test/java/com/baeldung/samples/jerseyrx/ClientOrchestrationIntegrationTest.java @@ -81,11 +81,12 @@ public class ClientOrchestrationIntegrationTest { public void callBackOrchestrate() throws InterruptedException { List receivedHashValues = new ArrayList<>(); + final CountDownLatch completionTracker = new CountDownLatch(expectedHashValues.size()); // used to keep track of the progress of the subsequent calls + userIdService.request().accept(MediaType.APPLICATION_JSON).async().get(new InvocationCallback>() { @Override public void completed(List employeeIds) { logger.info("[CallbackExample] id-service result: {}", employeeIds); - CountDownLatch completionTracker = new CountDownLatch(employeeIds.size()); // used to keep track of the progress of the subsequent calls employeeIds.forEach((id) -> { // for each employee ID, get the name nameService.resolveTemplate("userId", id).request().async().get(new InvocationCallback() { @@ -94,17 +95,16 @@ public class ClientOrchestrationIntegrationTest { public void completed(String response) { logger.info("[CallbackExample] name-service result: {}", response); - completionTracker.countDown(); hashService.resolveTemplate("rawValue", response + id).request().async().get(new InvocationCallback() { @Override public void completed(String response) { logger.info("[CallbackExample] hash-service result: {}", response); receivedHashValues.add(response); + completionTracker.countDown(); } @Override public void failed(Throwable throwable) { - completionTracker.countDown(); logger.warn("[CallbackExample] An error has occurred in the hashing request step!", throwable); } }); @@ -112,21 +112,11 @@ public class ClientOrchestrationIntegrationTest { @Override public void failed(Throwable throwable) { - completionTracker.countDown(); logger.warn("[CallbackExample] An error has occurred in the username request step!", throwable); } }); }); - try { - // wait for inner requests to complete in 10 seconds - if (!completionTracker.await(10, TimeUnit.SECONDS)) { - logger.warn("[CallbackExample] Some requests didn't complete within the timeout"); - } - } catch (InterruptedException e) { - logger.error("Interrupted!", e); - } - } @Override @@ -136,7 +126,14 @@ public class ClientOrchestrationIntegrationTest { }); // wait for async calls to complete - Thread.sleep(1000); + try { + // wait for inner requests to complete in 10 seconds + if (!completionTracker.await(10, TimeUnit.SECONDS)) { + logger.warn("[CallbackExample] Some requests didn't complete within the timeout"); + } + } catch (InterruptedException e) { + logger.error("Interrupted!", e); + } assertThat(receivedHashValues).containsAll(expectedHashValues); } @@ -145,6 +142,8 @@ public class ClientOrchestrationIntegrationTest { public void rxOrchestrate() throws InterruptedException { List receivedHashValues = new ArrayList<>(); + final CountDownLatch completionTracker = new CountDownLatch(expectedHashValues.size()); // used to keep track of the progress of the subsequent calls + CompletionStage> userIdStage = userIdService.request().accept(MediaType.APPLICATION_JSON).rx().get(new GenericType>() { }).exceptionally((throwable) -> { logger.warn("[CompletionStageExample] An error has occurred"); @@ -161,8 +160,10 @@ public class ClientOrchestrationIntegrationTest { hashService.resolveTemplate("rawValue", userName + id).request().rx().get(String.class).toCompletableFuture().thenAcceptAsync(hashValue -> { logger.info("[CompletionStageExample] hash-service result: {}", hashValue); receivedHashValues.add(hashValue); + completionTracker.countDown(); }).exceptionally((throwable) -> { logger.warn("[CompletionStageExample] Hash computation failed for {}", id); + completionTracker.countDown(); return null; }); @@ -172,7 +173,14 @@ public class ClientOrchestrationIntegrationTest { }); // wait for async calls to complete - Thread.sleep(1000); + try { + // wait for inner requests to complete in 10 seconds + if (!completionTracker.await(10, TimeUnit.SECONDS)) { + logger.warn("[CallbackExample] Some requests didn't complete within the timeout"); + } + } catch (InterruptedException e) { + logger.error("Interrupted!", e); + } assertThat(receivedHashValues).containsAll(expectedHashValues); } @@ -181,13 +189,15 @@ public class ClientOrchestrationIntegrationTest { public void observableJavaOrchestrate() throws InterruptedException { List receivedHashValues = new ArrayList<>(); + final CountDownLatch completionTracker = new CountDownLatch(expectedHashValues.size()); // used to keep track of the progress of the subsequent calls + Observable> observableUserIdService = userIdService.register(RxObservableInvokerProvider.class).request().accept(MediaType.APPLICATION_JSON).rx(RxObservableInvoker.class).get(new GenericType>() { }).asObservable(); observableUserIdService.subscribe((List employeeIds) -> { logger.info("[ObservableExample] id-service result: {}", employeeIds); Observable.from(employeeIds).subscribe(id -> nameService.register(RxObservableInvokerProvider.class).resolveTemplate("userId", id).request().rx(RxObservableInvoker.class).get(String.class).asObservable() // gotten the name for the given - // userId + // userId .doOnError((throwable) -> { logger.warn("[ObservableExample] An error has occurred in the username request step {}", throwable.getMessage()); }).subscribe(userName -> { @@ -197,14 +207,22 @@ public class ClientOrchestrationIntegrationTest { .doOnError((throwable) -> { logger.warn("[ObservableExample] An error has occurred in the hashing request step {}", throwable.getMessage()); }).subscribe(hashValue -> { - logger.info("[ObservableExample] hash-service result: {}", hashValue); - receivedHashValues.add(hashValue); - }); + logger.info("[ObservableExample] hash-service result: {}", hashValue); + receivedHashValues.add(hashValue); + completionTracker.countDown(); + }); })); }); // wait for async calls to complete - Thread.sleep(1000); + try { + // wait for inner requests to complete in 10 seconds + if (!completionTracker.await(10, TimeUnit.SECONDS)) { + logger.warn("[CallbackExample] Some requests didn't complete within the timeout"); + } + } catch (InterruptedException e) { + logger.error("Interrupted!", e); + } assertThat(receivedHashValues).containsAll(expectedHashValues); } @@ -213,6 +231,8 @@ public class ClientOrchestrationIntegrationTest { public void flowableJavaOrchestrate() throws InterruptedException { List receivedHashValues = new ArrayList<>(); + final CountDownLatch completionTracker = new CountDownLatch(expectedHashValues.size()); // used to keep track of the progress of the subsequent calls + Flowable> userIdFlowable = userIdService.register(RxFlowableInvokerProvider.class).request().rx(RxFlowableInvoker.class).get(new GenericType>() { }); @@ -223,20 +243,28 @@ public class ClientOrchestrationIntegrationTest { .doOnError((throwable) -> { logger.warn("[FlowableExample] An error has occurred in the username request step {}", throwable.getMessage()); }).subscribe(userName -> { - logger.info("[FlowableExample] name-service result: {}", userName); - hashService.register(RxFlowableInvokerProvider.class).resolveTemplate("rawValue", userName + id).request().rx(RxFlowableInvoker.class).get(String.class) // gotten the hash value for userId+username - .doOnError((throwable) -> { - logger.warn(" [FlowableExample] An error has occurred in the hashing request step!", throwable); - }).subscribe(hashValue -> { - logger.info("[FlowableExample] hash-service result: {}", hashValue); - receivedHashValues.add(hashValue); - }); - }); + logger.info("[FlowableExample] name-service result: {}", userName); + hashService.register(RxFlowableInvokerProvider.class).resolveTemplate("rawValue", userName + id).request().rx(RxFlowableInvoker.class).get(String.class) // gotten the hash value for userId+username + .doOnError((throwable) -> { + logger.warn(" [FlowableExample] An error has occurred in the hashing request step!", throwable); + }).subscribe(hashValue -> { + logger.info("[FlowableExample] hash-service result: {}", hashValue); + receivedHashValues.add(hashValue); + completionTracker.countDown(); + }); + }); }); }); // wait for async calls to complete - Thread.sleep(1000); + try { + // wait for inner requests to complete in 10 seconds + if (!completionTracker.await(10, TimeUnit.SECONDS)) { + logger.warn("[CallbackExample] Some requests didn't complete within the timeout"); + } + } catch (InterruptedException e) { + logger.error("Interrupted!", e); + } assertThat(receivedHashValues).containsAll(expectedHashValues); } From fb61a7ea3af3d3cda883f6406630a8862e4d2c8a Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 16 Aug 2018 14:33:58 +0530 Subject: [PATCH 205/298] BAEL-8143 Update Mockito articles -Mockito version fixes -MessageMatcher implementation changed as ArugmentMatcher is an Interface now --- spring-core/pom.xml | 13 ------------- spring-mockito/pom.xml | 2 +- .../baeldung/domain/util/MessageMatcher.java | 19 +++++++------------ 3 files changed, 8 insertions(+), 26 deletions(-) diff --git a/spring-core/pom.xml b/spring-core/pom.xml index 708ba7c5a2..60f3262f08 100644 --- a/spring-core/pom.xml +++ b/spring-core/pom.xml @@ -16,11 +16,6 @@ - - org.mockito - mockito-all - ${mockito.version} - org.springframework spring-test @@ -82,15 +77,7 @@ - - - java.net - https://maven.java.net/content/repositories/releases/ - - - - 2.21.0 1.4.4.RELEASE 1 20.0 diff --git a/spring-mockito/pom.xml b/spring-mockito/pom.xml index a7a1c834ed..d1fa7f410e 100644 --- a/spring-mockito/pom.xml +++ b/spring-mockito/pom.xml @@ -24,7 +24,7 @@ org.mockito - mockito-all + mockito-core ${mockito.version} diff --git a/spring-mockito/src/main/java/com/baeldung/domain/util/MessageMatcher.java b/spring-mockito/src/main/java/com/baeldung/domain/util/MessageMatcher.java index 05cb43e4df..51db07fde7 100644 --- a/spring-mockito/src/main/java/com/baeldung/domain/util/MessageMatcher.java +++ b/spring-mockito/src/main/java/com/baeldung/domain/util/MessageMatcher.java @@ -3,7 +3,7 @@ package com.baeldung.domain.util; import com.baeldung.domain.model.Message; import org.mockito.ArgumentMatcher; -public class MessageMatcher extends ArgumentMatcher { +public class MessageMatcher implements ArgumentMatcher { private Message left; @@ -12,16 +12,11 @@ public class MessageMatcher extends ArgumentMatcher { } @Override - public boolean matches(Object object) { - if (object instanceof Message) { - Message right = (Message) object; - return left.getFrom().equals(right.getFrom()) && - left.getTo().equals(right.getTo()) && - left.getText().equals(right.getText()) && - right.getDate() != null && - right.getId() != null; - } - - return false; + public boolean matches(Message right) { + return left.getFrom().equals(right.getFrom()) && + left.getTo().equals(right.getTo()) && + left.getText().equals(right.getText()) && + right.getDate() != null && + right.getId() != null; } } \ No newline at end of file From cecb8f2c2c36b3a3b56a294daaa69824fc5c4951 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Fri, 17 Aug 2018 00:19:06 +0530 Subject: [PATCH 206/298] BAEL-8231 Disabled "is working" statement in a test case in CoroutinesTest.kt --- .../src/test/kotlin/com/baeldung/kotlin/CoroutinesTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesTest.kt index 54fafdb3e1..d724933654 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesTest.kt +++ b/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesTest.kt @@ -103,7 +103,7 @@ class CoroutinesTest { //given val job = launch(CommonPool) { while (isActive) { - println("is working") + //println("is working") } } From 1f5157b2649c04205429fec77e12dc05116ebbcd Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 16 Aug 2018 22:15:26 +0300 Subject: [PATCH 207/298] update criteria links --- persistence-modules/spring-hibernate-5/README.md | 2 ++ spring-hibernate4/README.md | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/persistence-modules/spring-hibernate-5/README.md b/persistence-modules/spring-hibernate-5/README.md index d48723ac31..b22c90b4d4 100644 --- a/persistence-modules/spring-hibernate-5/README.md +++ b/persistence-modules/spring-hibernate-5/README.md @@ -3,3 +3,5 @@ - [Guide to @Immutable Annotation in Hibernate](http://www.baeldung.com/hibernate-immutable) - [Hibernate Many to Many Annotation Tutorial](http://www.baeldung.com/hibernate-many-to-many) - [Programmatic Transactions in the Spring TestContext Framework](http://www.baeldung.com/spring-test-programmatic-transactions) +- [Hibernate Criteria Queries](http://www.baeldung.com/hibernate-criteria-queries) + diff --git a/spring-hibernate4/README.md b/spring-hibernate4/README.md index 88ee7fadd3..b15b7278f4 100644 --- a/spring-hibernate4/README.md +++ b/spring-hibernate4/README.md @@ -11,7 +11,6 @@ - [Stored Procedures with Hibernate](http://www.baeldung.com/stored-procedures-with-hibernate-tutorial) - [Hibernate: save, persist, update, merge, saveOrUpdate](http://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate) - [Eager/Lazy Loading In Hibernate](http://www.baeldung.com/hibernate-lazy-eager-loading) -- [Hibernate Criteria Queries](http://www.baeldung.com/hibernate-criteria-queries) - [Hibernate One to Many Annotation Tutorial](http://www.baeldung.com/hibernate-one-to-many) - [Guide to @Immutable Annotation in Hibernate](http://www.baeldung.com/hibernate-immutable) - [The DAO with Spring and Hibernate](http://www.baeldung.com/persistence-layer-with-spring-and-hibernate) From 880bd891b99448731276d86390940bc73e69c1c9 Mon Sep 17 00:00:00 2001 From: Alejandro Gervasio Date: Thu, 16 Aug 2018 23:00:43 -0300 Subject: [PATCH 208/298] BAEL-2066 - Java Constructors vs Static Factory Methods (#4934) * Initial Commit * Update User.java * Update UserUnitTest.java * Update User.java - UserUnitTest.java --- .../application/Application.java | 12 ++++ .../entities/User.java | 63 +++++++++++++++++++ .../UserUnitTest.java | 43 +++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/application/Application.java create mode 100644 core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java create mode 100644 core-java/src/test/java/com/baeldung/constructorsstaticfactorymethods/UserUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/application/Application.java b/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/application/Application.java new file mode 100644 index 0000000000..d19772072f --- /dev/null +++ b/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/application/Application.java @@ -0,0 +1,12 @@ +package com.baeldung.constructorsstaticfactorymethods.application; + +import com.baeldung.constructorsstaticfactorymethods.entities.User; + +public class Application { + + public static void main(String[] args) { + User user1 = User.createWithDefaultCountry("John", "john@domain.com"); + User user2 = User.createWithLoggedInstantiationTime("John", "john@domain.com", "Argentina"); + User user3 = User.getSingletonInstance("John", "john@domain.com", "Argentina"); + } +} \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java b/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java new file mode 100644 index 0000000000..ec7bf6b5fa --- /dev/null +++ b/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java @@ -0,0 +1,63 @@ +package com.baeldung.constructorsstaticfactorymethods.entities; + +import java.time.LocalTime; +import java.util.logging.ConsoleHandler; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; + +public class User { + + private static User instance = null; + private static final Logger LOGGER = Logger.getLogger(User.class.getName()); + private final String name; + private final String email; + private final String country; + + public static User createWithDefaultCountry(String name, String email) { + return new User(name, email, "Argentina"); + } + + public static User createWithLoggedInstantiationTime(String name, String email, String country) { + setLoggerProperties(); + LOGGER.log(Level.INFO, "Creating User instance at : {0}", LocalTime.now()); + return new User(name, email, country); + } + + public static User getSingletonInstance(String name, String email, String country) { + if (instance == null) { + synchronized (User.class) { + if (instance == null) { + instance = new User(name, email, country); + } + } + } + return instance; + + } + + private User(String name, String email, String country) { + this.name = name; + this.email = email; + this.country = country; + } + + public String getName() { + return name; + } + + public String getEmail() { + return email; + } + + public String getCountry() { + return country; + } + + private static void setLoggerProperties() { + ConsoleHandler handler = new ConsoleHandler(); + handler.setLevel(Level.INFO); + handler.setFormatter(new SimpleFormatter()); + LOGGER.addHandler(handler); + } +} diff --git a/core-java/src/test/java/com/baeldung/constructorsstaticfactorymethods/UserUnitTest.java b/core-java/src/test/java/com/baeldung/constructorsstaticfactorymethods/UserUnitTest.java new file mode 100644 index 0000000000..0c0266a111 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/constructorsstaticfactorymethods/UserUnitTest.java @@ -0,0 +1,43 @@ +package com.baeldung.constructorsstaticfactorymethods; + +import com.baeldung.constructorsstaticfactorymethods.entities.User; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class UserUnitTest { + + @Test + public void givenUserClass_whenCalledcreateWithDefaultCountry_thenCorrect() { + assertThat(User.createWithDefaultCountry("John", "john@domain.com")).isInstanceOf(User.class); + } + + @Test + public void givenUserIntanceCreatedWithcreateWithDefaultCountry_whenCalledgetName_thenCorrect() { + User user = User.createWithDefaultCountry("John", "john@domain.com"); + assertThat(user.getName()).isEqualTo("John"); + } + + @Test + public void givenUserIntanceCreatedWithcreateWithDefaultCountry_whenCalledgetEmail_thenCorrect() { + User user = User.createWithDefaultCountry("John", "john@domain.com"); + assertThat(user.getEmail()).isEqualTo("john@domain.com"); + } + + @Test + public void givenUserIntanceCreatedWithcreateWithDefaultCountry_whenCalledgetCountry_thenCorrect() { + User user = User.createWithDefaultCountry("John", "john@domain.com"); + assertThat(user.getCountry()).isEqualTo("Argentina"); + } + + @Test + public void givenUserInstanceCreatedWithcreateWithInstantiationTime_whenCalledcreateWithInstantiationTime_thenCorrect() { + assertThat(User.createWithLoggedInstantiationTime("John", "john@domain.com", "Argentina")).isInstanceOf(User.class); + } + + @Test + public void givenUserInstanceCreatedWithgetSingletonIntance_whenCalledgetSingletonInstance_thenCorrect() { + User user1 = User.getSingletonInstance("John", "john@domain.com", "Argentina"); + User user2 = User.getSingletonInstance("John", "john@domain.com", "Argentina"); + assertThat(user1).isEqualTo(user2); + } +} \ No newline at end of file From 71c247b0c96051646968391a93c2c5cab52d5351 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 17 Aug 2018 13:18:09 +0300 Subject: [PATCH 209/298] move security code --- spring-5-reactive-security/.gitignore | 12 ++ spring-5-reactive-security/README.md | 18 +++ spring-5-reactive-security/pom.xml | 135 ++++++++++++++++ ...nstreamServiceReactiveHealthIndicator.java | 0 .../reactive/actuator/FeaturesEndpoint.java | 0 .../actuator/InfoWebEndpointExtension.java | 0 .../actuator/Spring5ReactiveApplication.java | 15 ++ .../reactive/actuator/WebSecurityConfig.java | 2 +- .../reactive/security/GreetController.java | 0 .../reactive/security/GreetService.java | 0 .../reactive/security/SecurityConfig.java | 19 ++- .../security}/SpringSecurity5Application.java | 2 +- .../java/com/baeldung}/webflux/Employee.java | 34 ++-- .../com/baeldung}/webflux/EmployeeConfig.java | 66 ++++---- .../baeldung}/webflux/EmployeeController.java | 76 ++++----- .../webflux/EmployeeCreationEvent.java | 2 +- .../baeldung}/webflux/EmployeeRepository.java | 128 +++++++-------- .../webflux/EmployeeSpringApplication.java | 34 ++-- .../baeldung}/webflux/EmployeeWebClient.java | 54 +++---- .../webflux/EmployeeWebSecurityConfig.java | 84 +++++----- .../webflux/EmployeeWebSocketClient.java | 2 +- .../webflux/EmployeeWebSocketHandler.java | 78 ++++----- .../src/main/resources/application.properties | 5 + .../src/main/resources/files/hello.txt | 1 + .../src/main/resources/files/test/test.txt | 1 + .../src/main/resources/logback.xml | 13 ++ .../resources/static/client-websocket.html | 34 ++++ .../src/main/webapp/WEB-INF/web.xml | 21 +++ .../actuator/ActuatorInfoIntegrationTest.java | 2 - .../EmployeeControllerIntegrationTest.java | 150 +++++++++--------- .../security/SecurityIntegrationTest.java | 3 +- .../src/test/resources/baeldung-weekly.png | Bin 0 -> 28106 bytes spring-5-reactive/pom.xml | 17 -- .../FunctionalSpringBootApplication.java | 15 -- .../src/main/resources/application.properties | 3 - 35 files changed, 631 insertions(+), 395 deletions(-) create mode 100644 spring-5-reactive-security/.gitignore create mode 100644 spring-5-reactive-security/README.md create mode 100644 spring-5-reactive-security/pom.xml rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/actuator/DownstreamServiceReactiveHealthIndicator.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/actuator/InfoWebEndpointExtension.java (100%) create mode 100644 spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java (91%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/security/GreetController.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/security/GreetService.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/security/SecurityConfig.java (76%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung/reactive/security}/SpringSecurity5Application.java (97%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/Employee.java (81%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/EmployeeConfig.java (93%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/EmployeeController.java (93%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/EmployeeCreationEvent.java (89%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/EmployeeRepository.java (95%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/EmployeeSpringApplication.java (88%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/EmployeeWebClient.java (91%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/EmployeeWebSecurityConfig.java (71%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/EmployeeWebSocketClient.java (94%) rename {spring-5-reactive/src/main/java/com/baeldung/reactive => spring-5-reactive-security/src/main/java/com/baeldung}/webflux/EmployeeWebSocketHandler.java (94%) create mode 100644 spring-5-reactive-security/src/main/resources/application.properties create mode 100644 spring-5-reactive-security/src/main/resources/files/hello.txt create mode 100644 spring-5-reactive-security/src/main/resources/files/test/test.txt create mode 100644 spring-5-reactive-security/src/main/resources/logback.xml create mode 100644 spring-5-reactive-security/src/main/resources/static/client-websocket.html create mode 100644 spring-5-reactive-security/src/main/webapp/WEB-INF/web.xml rename {spring-5-reactive => spring-5-reactive-security}/src/test/java/com/baeldung/reactive/actuator/ActuatorInfoIntegrationTest.java (95%) rename {spring-5-reactive => spring-5-reactive-security}/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java (93%) rename {spring-5-reactive => spring-5-reactive-security}/src/test/java/com/baeldung/security/SecurityIntegrationTest.java (94%) create mode 100644 spring-5-reactive-security/src/test/resources/baeldung-weekly.png diff --git a/spring-5-reactive-security/.gitignore b/spring-5-reactive-security/.gitignore new file mode 100644 index 0000000000..dec013dfa4 --- /dev/null +++ b/spring-5-reactive-security/.gitignore @@ -0,0 +1,12 @@ +#folders# +.idea +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/spring-5-reactive-security/README.md b/spring-5-reactive-security/README.md new file mode 100644 index 0000000000..0a7fe7a47e --- /dev/null +++ b/spring-5-reactive-security/README.md @@ -0,0 +1,18 @@ +## Spring REST Example Project + +### The Course +The "REST With Spring" Classes: http://bit.ly/restwithspring + +### Relevant Articles + +- [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web) +- [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient) +- [Spring Boot Actuator](http://www.baeldung.com/spring-boot-actuators) +- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching) +- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive) +- [Reactive WebSockets with Spring 5](http://www.baeldung.com/spring-5-reactive-websockets) +- [Spring Webflux Filters](http://www.baeldung.com/spring-webflux-filters) +- [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) +- [Guide to Spring 5 WebFlux](http://www.baeldung.com/spring-webflux) diff --git a/spring-5-reactive-security/pom.xml b/spring-5-reactive-security/pom.xml new file mode 100644 index 0000000000..3b64b9b3ac --- /dev/null +++ b/spring-5-reactive-security/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + + com.baeldung + spring-5-reactive-security + 0.0.1-SNAPSHOT + jar + spring-5-reactive-security + spring 5 security sample project about new features + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-validation + + + org.springframework.boot + spring-boot-starter-tomcat + + + org.springframework.boot + spring-boot-starter-webflux + + + org.projectreactor + reactor-spring + ${reactor-spring.version} + + + javax.json.bind + javax.json.bind-api + + + org.springframework.boot + spring-boot-starter-actuator + + + org.projectlombok + lombok + compile + + + org.apache.geronimo.specs + geronimo-json_1.1_spec + ${geronimo-json_1.1_spec.version} + + + org.apache.johnzon + johnzon-jsonb + + + + org.apache.commons + commons-lang3 + + + + + + org.springframework.boot + spring-boot-devtools + runtime + + + org.springframework + spring-test + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + test + + + + io.reactivex.rxjava2 + rxjava + ${rxjava-version} + + + io.projectreactor + reactor-test + ${project-reactor-test} + test + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.security + spring-security-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + com.baeldung.webflux.EmployeeSpringApplication + JAR + + + + + + + 1.0.1.RELEASE + 2.1.12 + 1.1.3 + 1.0 + 1.0 + 4.1 + 3.1.6.RELEASE + + + diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/actuator/DownstreamServiceReactiveHealthIndicator.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/DownstreamServiceReactiveHealthIndicator.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/actuator/DownstreamServiceReactiveHealthIndicator.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/DownstreamServiceReactiveHealthIndicator.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/actuator/InfoWebEndpointExtension.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/InfoWebEndpointExtension.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/actuator/InfoWebEndpointExtension.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/InfoWebEndpointExtension.java diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java new file mode 100644 index 0000000000..f07ddfb0f7 --- /dev/null +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.reactive.actuator; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class Spring5ReactiveApplication{ + + public static void main(String[] args) { + SpringApplication.run(Spring5ReactiveApplication.class, args); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java similarity index 91% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java index 427fd70a6c..07f805fea4 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java @@ -22,7 +22,7 @@ public class WebSecurityConfig { .authorizeExchange() .matchers(EndpointRequest.to( FeaturesEndpoint.class - )).permitAll().and().csrf().disable().build(); + )).permitAll().anyExchange().permitAll().and().csrf().disable().build(); } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/security/GreetController.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/GreetController.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/security/GreetController.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/GreetController.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/security/GreetService.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/GreetService.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/security/GreetService.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/GreetService.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java similarity index 76% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java index 5ec3b6e241..225f78b3f7 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/security/SecurityConfig.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java @@ -8,6 +8,8 @@ import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.server.SecurityWebFilterChain; import com.baeldung.reactive.actuator.FeaturesEndpoint; @@ -35,19 +37,24 @@ public class SecurityConfig { @Bean public MapReactiveUserDetailsService userDetailsService() { - UserDetails user = User.withDefaultPasswordEncoder() - .username("user") - .password("password") + UserDetails user = User + .withUsername("user") + .password(passwordEncoder().encode("password")) .roles("USER") .build(); - UserDetails admin = User.withDefaultPasswordEncoder() - .username("admin") - .password("password") + UserDetails admin = User + .withUsername("admin") + .password(passwordEncoder().encode("password")) .roles("ADMIN") .build(); return new MapReactiveUserDetailsService(user, admin); } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } } diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/SpringSecurity5Application.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java similarity index 97% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/SpringSecurity5Application.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java index ca49ec6826..f2963c4fa5 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/SpringSecurity5Application.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java @@ -1,4 +1,4 @@ -package com.baeldung.reactive; +package com.baeldung.reactive.security; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/Employee.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/Employee.java similarity index 81% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/Employee.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/Employee.java index 6a03555654..bbdf85d293 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/Employee.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/Employee.java @@ -1,17 +1,17 @@ -package com.baeldung.reactive.webflux; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class Employee { - - private String id; - private String name; - - // standard getters and setters - -} +package com.baeldung.webflux; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Employee { + + private String id; + private String name; + + // standard getters and setters + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeConfig.java similarity index 93% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeConfig.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeConfig.java index 082be68698..6e73004650 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeConfig.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeConfig.java @@ -1,33 +1,33 @@ -package com.baeldung.reactive.webflux; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.reactive.HandlerMapping; -import org.springframework.web.reactive.config.EnableWebFlux; -import org.springframework.web.reactive.handler.SimpleUrlHandlerMapping; -import org.springframework.web.reactive.socket.WebSocketHandler; -import org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter; - -@Configuration -@EnableWebFlux -public class EmployeeConfig { - - @Bean - public HandlerMapping handlerMapping() { - Map map = new HashMap<>(); - map.put("/employee-feed", new EmployeeWebSocketHandler()); - - SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping(); - mapping.setUrlMap(map); - mapping.setOrder(10); - return mapping; - } - - @Bean - public WebSocketHandlerAdapter handlerAdapter() { - return new WebSocketHandlerAdapter(); - } -} +package com.baeldung.webflux; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.reactive.HandlerMapping; +import org.springframework.web.reactive.config.EnableWebFlux; +import org.springframework.web.reactive.handler.SimpleUrlHandlerMapping; +import org.springframework.web.reactive.socket.WebSocketHandler; +import org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter; + +@Configuration +@EnableWebFlux +public class EmployeeConfig { + + @Bean + public HandlerMapping handlerMapping() { + Map map = new HashMap<>(); + map.put("/employee-feed", new EmployeeWebSocketHandler()); + + SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping(); + mapping.setUrlMap(map); + mapping.setOrder(10); + return mapping; + } + + @Bean + public WebSocketHandlerAdapter handlerAdapter() { + return new WebSocketHandlerAdapter(); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeController.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeController.java similarity index 93% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeController.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeController.java index 98b16dafab..34e44afc8b 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeController.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeController.java @@ -1,38 +1,38 @@ -package com.baeldung.reactive.webflux; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -@RestController -@RequestMapping("/employees") -public class EmployeeController { - - private EmployeeRepository employeeRepository; - - public EmployeeController(EmployeeRepository employeeRepository) { - this.employeeRepository = employeeRepository; - } - - @GetMapping("/{id}") - private Mono getEmployeeById(@PathVariable String id) { - return employeeRepository.findEmployeeById(id); - } - - @GetMapping - private Flux getAllEmployees() { - return employeeRepository.findAllEmployees(); - } - - @PostMapping("/update") - private Mono updateEmployee(@RequestBody Employee employee) { - return employeeRepository.updateEmployee(employee); - } - -} +package com.baeldung.webflux; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@RestController +@RequestMapping("/employees") +public class EmployeeController { + + private EmployeeRepository employeeRepository; + + public EmployeeController(EmployeeRepository employeeRepository) { + this.employeeRepository = employeeRepository; + } + + @GetMapping("/{id}") + private Mono getEmployeeById(@PathVariable String id) { + return employeeRepository.findEmployeeById(id); + } + + @GetMapping + private Flux getAllEmployees() { + return employeeRepository.findAllEmployees(); + } + + @PostMapping("/update") + private Mono updateEmployee(@RequestBody Employee employee) { + return employeeRepository.updateEmployee(employee); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeCreationEvent.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeCreationEvent.java similarity index 89% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeCreationEvent.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeCreationEvent.java index 7a66e1e147..d4f9a4fb02 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeCreationEvent.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeCreationEvent.java @@ -1,4 +1,4 @@ -package com.baeldung.reactive.webflux; +package com.baeldung.webflux; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeRepository.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeRepository.java similarity index 95% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeRepository.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeRepository.java index a407c76fa8..d7f618f178 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeRepository.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeRepository.java @@ -1,64 +1,64 @@ -package com.baeldung.reactive.webflux; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.stereotype.Repository; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -@Repository -public class EmployeeRepository { - - static Map employeeData; - - static Map employeeAccessData; - - static - { - employeeData = new HashMap<>(); - employeeData.put("1",new Employee("1","Employee 1")); - employeeData.put("2",new Employee("2","Employee 2")); - employeeData.put("3",new Employee("3","Employee 3")); - employeeData.put("4",new Employee("4","Employee 4")); - employeeData.put("5",new Employee("5","Employee 5")); - employeeData.put("6",new Employee("6","Employee 6")); - employeeData.put("7",new Employee("7","Employee 7")); - employeeData.put("8",new Employee("8","Employee 8")); - employeeData.put("9",new Employee("9","Employee 9")); - employeeData.put("10",new Employee("10","Employee 10")); - - employeeAccessData=new HashMap<>(); - employeeAccessData.put("1", "Employee 1 Access Key"); - employeeAccessData.put("2", "Employee 2 Access Key"); - employeeAccessData.put("3", "Employee 3 Access Key"); - employeeAccessData.put("4", "Employee 4 Access Key"); - employeeAccessData.put("5", "Employee 5 Access Key"); - employeeAccessData.put("6", "Employee 6 Access Key"); - employeeAccessData.put("7", "Employee 7 Access Key"); - employeeAccessData.put("8", "Employee 8 Access Key"); - employeeAccessData.put("9", "Employee 9 Access Key"); - employeeAccessData.put("10", "Employee 10 Access Key"); - } - - public Mono findEmployeeById(String id) - { - return Mono.just(employeeData.get(id)); - } - - public Flux findAllEmployees() - { - return Flux.fromIterable(employeeData.values()); - } - - public Mono updateEmployee(Employee employee) - { - Employee existingEmployee=employeeData.get(employee.getId()); - if(existingEmployee!=null) - { - existingEmployee.setName(employee.getName()); - } - return Mono.just(existingEmployee); - } -} +package com.baeldung.webflux; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.stereotype.Repository; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@Repository +public class EmployeeRepository { + + static Map employeeData; + + static Map employeeAccessData; + + static + { + employeeData = new HashMap<>(); + employeeData.put("1",new Employee("1","Employee 1")); + employeeData.put("2",new Employee("2","Employee 2")); + employeeData.put("3",new Employee("3","Employee 3")); + employeeData.put("4",new Employee("4","Employee 4")); + employeeData.put("5",new Employee("5","Employee 5")); + employeeData.put("6",new Employee("6","Employee 6")); + employeeData.put("7",new Employee("7","Employee 7")); + employeeData.put("8",new Employee("8","Employee 8")); + employeeData.put("9",new Employee("9","Employee 9")); + employeeData.put("10",new Employee("10","Employee 10")); + + employeeAccessData=new HashMap<>(); + employeeAccessData.put("1", "Employee 1 Access Key"); + employeeAccessData.put("2", "Employee 2 Access Key"); + employeeAccessData.put("3", "Employee 3 Access Key"); + employeeAccessData.put("4", "Employee 4 Access Key"); + employeeAccessData.put("5", "Employee 5 Access Key"); + employeeAccessData.put("6", "Employee 6 Access Key"); + employeeAccessData.put("7", "Employee 7 Access Key"); + employeeAccessData.put("8", "Employee 8 Access Key"); + employeeAccessData.put("9", "Employee 9 Access Key"); + employeeAccessData.put("10", "Employee 10 Access Key"); + } + + public Mono findEmployeeById(String id) + { + return Mono.just(employeeData.get(id)); + } + + public Flux findAllEmployees() + { + return Flux.fromIterable(employeeData.values()); + } + + public Mono updateEmployee(Employee employee) + { + Employee existingEmployee=employeeData.get(employee.getId()); + if(existingEmployee!=null) + { + existingEmployee.setName(employee.getName()); + } + return Mono.just(existingEmployee); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeSpringApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeSpringApplication.java similarity index 88% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeSpringApplication.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeSpringApplication.java index 54b23a18de..2652c36695 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeSpringApplication.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeSpringApplication.java @@ -1,17 +1,17 @@ -package com.baeldung.reactive.webflux; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class EmployeeSpringApplication { - - public static void main(String[] args) { - - SpringApplication.run(EmployeeSpringApplication.class, args); - - EmployeeWebClient employeeWebClient = new EmployeeWebClient(); - employeeWebClient.consume(); - } - -} +package com.baeldung.webflux; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class EmployeeSpringApplication { + + public static void main(String[] args) { + + SpringApplication.run(EmployeeSpringApplication.class, args); + + EmployeeWebClient employeeWebClient = new EmployeeWebClient(); + employeeWebClient.consume(); + } + +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebClient.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebClient.java similarity index 91% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebClient.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebClient.java index 45d42ecda9..eb32408a7f 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebClient.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebClient.java @@ -1,28 +1,28 @@ -package com.baeldung.reactive.webflux; - -import org.springframework.web.reactive.function.client.WebClient; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -public class EmployeeWebClient { - - WebClient client = WebClient.create("http://localhost:8080"); - - public void consume() { - - Mono employeeMono = client.get() - .uri("/employees/{id}", "1") - .retrieve() - .bodyToMono(Employee.class); - - employeeMono.subscribe(System.out::println); - - Flux employeeFlux = client.get() - .uri("/employees") - .retrieve() - .bodyToFlux(Employee.class); - - employeeFlux.subscribe(System.out::println); - } +package com.baeldung.webflux; + +import org.springframework.web.reactive.function.client.WebClient; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public class EmployeeWebClient { + + WebClient client = WebClient.create("http://localhost:8080"); + + public void consume() { + + Mono employeeMono = client.get() + .uri("/employees/{id}", "1") + .retrieve() + .bodyToMono(Employee.class); + + employeeMono.subscribe(System.out::println); + + Flux employeeFlux = client.get() + .uri("/employees") + .retrieve() + .bodyToFlux(Employee.class); + + employeeFlux.subscribe(System.out::println); + } } \ No newline at end of file diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSecurityConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebSecurityConfig.java similarity index 71% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSecurityConfig.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebSecurityConfig.java index 7922e6ba44..75475a0f08 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSecurityConfig.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebSecurityConfig.java @@ -1,38 +1,46 @@ -package com.baeldung.reactive.webflux; - -import org.springframework.context.annotation.Bean; -import org.springframework.http.HttpMethod; -import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; -import org.springframework.security.config.web.server.ServerHttpSecurity; -import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; -import org.springframework.security.core.userdetails.User; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.web.server.SecurityWebFilterChain; - -@EnableWebFluxSecurity -public class EmployeeWebSecurityConfig { - - @Bean - public MapReactiveUserDetailsService userDetailsService() { - UserDetails user = User.withDefaultPasswordEncoder() - .username("admin") - .password("password") - .roles("ADMIN") - .build(); - return new MapReactiveUserDetailsService(user); - } - - @Bean - public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { - http.csrf() - .disable() - .authorizeExchange() - .pathMatchers(HttpMethod.POST, "/employees/update") - .hasRole("ADMIN") - .pathMatchers("/**") - .permitAll() - .and() - .httpBasic(); - return http.build(); - } -} +package com.baeldung.webflux; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; +import org.springframework.security.config.web.server.ServerHttpSecurity; +import org.springframework.security.core.userdetails.MapReactiveUserDetailsService; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.server.SecurityWebFilterChain; + +@EnableWebFluxSecurity +public class EmployeeWebSecurityConfig { + + @Bean + public MapReactiveUserDetailsService userDetailsService() { + UserDetails user = User + .withUsername("admin") + .password(passwordEncoder().encode("password")) + .roles("ADMIN") + .build(); + return new MapReactiveUserDetailsService(user); + } + + @Bean + public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { + http.csrf() + .disable() + .authorizeExchange() + .pathMatchers(HttpMethod.POST, "/employees/update") + .hasRole("ADMIN") + .pathMatchers("/**") + .permitAll() + .and() + .httpBasic(); + return http.build(); + } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } +} diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketClient.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebSocketClient.java similarity index 94% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketClient.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebSocketClient.java index 4571cadc47..feb1eb62fb 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketClient.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebSocketClient.java @@ -1,4 +1,4 @@ -package com.baeldung.reactive.webflux; +package com.baeldung.webflux; import java.net.URI; diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketHandler.java b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebSocketHandler.java similarity index 94% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketHandler.java rename to spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebSocketHandler.java index c696bc8215..40b7b760ee 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/webflux/EmployeeWebSocketHandler.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/webflux/EmployeeWebSocketHandler.java @@ -1,39 +1,39 @@ -package com.baeldung.reactive.webflux; - -import static java.time.LocalDateTime.now; -import static java.util.UUID.randomUUID; - -import java.time.Duration; - -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.socket.WebSocketHandler; -import org.springframework.web.reactive.socket.WebSocketSession; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -@Component("EmployeeWebSocketHandler") -public class EmployeeWebSocketHandler implements WebSocketHandler { - - ObjectMapper om = new ObjectMapper(); - - @Override - public Mono handle(WebSocketSession webSocketSession) { - - Flux employeeCreationEvent = Flux.generate(sink -> { - EmployeeCreationEvent event = new EmployeeCreationEvent(randomUUID().toString(), now().toString()); - try { - sink.next(om.writeValueAsString(event)); - } catch (JsonProcessingException e) { - sink.error(e); - } - }); - - return webSocketSession.send(employeeCreationEvent - .map(webSocketSession::textMessage) - .delayElements(Duration.ofSeconds(1))); - } -} +package com.baeldung.webflux; + +import static java.time.LocalDateTime.now; +import static java.util.UUID.randomUUID; + +import java.time.Duration; + +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.socket.WebSocketHandler; +import org.springframework.web.reactive.socket.WebSocketSession; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@Component("EmployeeWebSocketHandler") +public class EmployeeWebSocketHandler implements WebSocketHandler { + + ObjectMapper om = new ObjectMapper(); + + @Override + public Mono handle(WebSocketSession webSocketSession) { + + Flux employeeCreationEvent = Flux.generate(sink -> { + EmployeeCreationEvent event = new EmployeeCreationEvent(randomUUID().toString(), now().toString()); + try { + sink.next(om.writeValueAsString(event)); + } catch (JsonProcessingException e) { + sink.error(e); + } + }); + + return webSocketSession.send(employeeCreationEvent + .map(webSocketSession::textMessage) + .delayElements(Duration.ofSeconds(1))); + } +} diff --git a/spring-5-reactive-security/src/main/resources/application.properties b/spring-5-reactive-security/src/main/resources/application.properties new file mode 100644 index 0000000000..234834b894 --- /dev/null +++ b/spring-5-reactive-security/src/main/resources/application.properties @@ -0,0 +1,5 @@ +logging.level.root=INFO + +management.endpoints.web.exposure.include.=* + +info.app.name=Spring Boot 2 actuator Application diff --git a/spring-5-reactive-security/src/main/resources/files/hello.txt b/spring-5-reactive-security/src/main/resources/files/hello.txt new file mode 100644 index 0000000000..b6fc4c620b --- /dev/null +++ b/spring-5-reactive-security/src/main/resources/files/hello.txt @@ -0,0 +1 @@ +hello \ No newline at end of file diff --git a/spring-5-reactive-security/src/main/resources/files/test/test.txt b/spring-5-reactive-security/src/main/resources/files/test/test.txt new file mode 100644 index 0000000000..30d74d2584 --- /dev/null +++ b/spring-5-reactive-security/src/main/resources/files/test/test.txt @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/spring-5-reactive-security/src/main/resources/logback.xml b/spring-5-reactive-security/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-5-reactive-security/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-5-reactive-security/src/main/resources/static/client-websocket.html b/spring-5-reactive-security/src/main/resources/static/client-websocket.html new file mode 100644 index 0000000000..3f840e8bd4 --- /dev/null +++ b/spring-5-reactive-security/src/main/resources/static/client-websocket.html @@ -0,0 +1,34 @@ + + + + +Baeldung: Spring 5 Reactive Client WebSocket (Browser) + + + +
+ + + \ No newline at end of file diff --git a/spring-5-reactive-security/src/main/webapp/WEB-INF/web.xml b/spring-5-reactive-security/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..bfcf43dad2 --- /dev/null +++ b/spring-5-reactive-security/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,21 @@ + + + + Spring Functional Application + + + functional + com.baeldung.functional.RootServlet + 1 + true + + + functional + / + + + + \ No newline at end of file diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/actuator/ActuatorInfoIntegrationTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/actuator/ActuatorInfoIntegrationTest.java similarity index 95% rename from spring-5-reactive/src/test/java/com/baeldung/reactive/actuator/ActuatorInfoIntegrationTest.java rename to spring-5-reactive-security/src/test/java/com/baeldung/reactive/actuator/ActuatorInfoIntegrationTest.java index 3020e86723..94979a18ca 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/actuator/ActuatorInfoIntegrationTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/actuator/ActuatorInfoIntegrationTest.java @@ -9,8 +9,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.reactive.Spring5ReactiveApplication; - import java.io.IOException; import static org.junit.Assert.assertEquals; diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java similarity index 93% rename from spring-5-reactive/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java rename to spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java index e8c8c25723..3dc832d781 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/webflux/EmployeeControllerIntegrationTest.java @@ -1,74 +1,76 @@ -package com.baeldung.reactive.webflux; - -import static org.mockito.BDDMockito.given; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.MethodSorters; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.reactive.server.WebTestClient; - -import com.baeldung.reactive.Spring5ReactiveApplication; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes=Spring5ReactiveApplication.class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class EmployeeControllerIntegrationTest { - - @Autowired - private WebTestClient testClient; - - @MockBean - private EmployeeRepository employeeRepository; - - @Test - public void givenEmployeeId_whenGetEmployeeById_thenCorrectEmployee() { - - Employee employee = new Employee("1", "Employee 1 Name"); - - given(employeeRepository.findEmployeeById("1")).willReturn(Mono.just(employee)); - testClient.get() - .uri("/employees/1") - .exchange() - .expectStatus() - .isOk() - .expectBody(Employee.class) - .isEqualTo(employee); - } - - @Test - public void whenGetAllEmployees_thenCorrectEmployees() { - - List employeeList = new ArrayList<>(); - - Employee employee1 = new Employee("1", "Employee 1 Name"); - Employee employee2 = new Employee("2", "Employee 2 Name"); - Employee employee3 = new Employee("3", "Employee 3 Name"); - - employeeList.add(employee1); - employeeList.add(employee2); - employeeList.add(employee3); - - Flux employeeFlux = Flux.fromIterable(employeeList); - - given(employeeRepository.findAllEmployees()).willReturn(employeeFlux); - testClient.get() - .uri("/employees") - .exchange() - .expectStatus() - .isOk() - .expectBodyList(Employee.class) - .hasSize(3) - .isEqualTo(employeeList); - } -} +package com.baeldung.reactive.webflux; + +import static org.mockito.BDDMockito.given; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.reactive.server.WebTestClient; + +import com.baeldung.reactive.actuator.Spring5ReactiveApplication; +import com.baeldung.webflux.Employee; +import com.baeldung.webflux.EmployeeRepository; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes=Spring5ReactiveApplication.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class EmployeeControllerIntegrationTest { + + @Autowired + private WebTestClient testClient; + + @MockBean + private EmployeeRepository employeeRepository; + + @Test + public void givenEmployeeId_whenGetEmployeeById_thenCorrectEmployee() { + + Employee employee = new Employee("1", "Employee 1 Name"); + + given(employeeRepository.findEmployeeById("1")).willReturn(Mono.just(employee)); + testClient.get() + .uri("/employees/1") + .exchange() + .expectStatus() + .isOk() + .expectBody(Employee.class) + .isEqualTo(employee); + } + + @Test + public void whenGetAllEmployees_thenCorrectEmployees() { + + List employeeList = new ArrayList<>(); + + Employee employee1 = new Employee("1", "Employee 1 Name"); + Employee employee2 = new Employee("2", "Employee 2 Name"); + Employee employee3 = new Employee("3", "Employee 3 Name"); + + employeeList.add(employee1); + employeeList.add(employee2); + employeeList.add(employee3); + + Flux employeeFlux = Flux.fromIterable(employeeList); + + given(employeeRepository.findAllEmployees()).willReturn(employeeFlux); + testClient.get() + .uri("/employees") + .exchange() + .expectStatus() + .isOk() + .expectBodyList(Employee.class) + .hasSize(3) + .isEqualTo(employeeList); + } +} diff --git a/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/security/SecurityIntegrationTest.java similarity index 94% rename from spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java rename to spring-5-reactive-security/src/test/java/com/baeldung/security/SecurityIntegrationTest.java index a59ef57db8..423500e09c 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/security/SecurityIntegrationTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/security/SecurityIntegrationTest.java @@ -1,6 +1,5 @@ package com.baeldung.security; -import com.baeldung.reactive.SpringSecurity5Application; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; @@ -12,6 +11,8 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; +import com.baeldung.reactive.security.SpringSecurity5Application; + @RunWith(SpringRunner.class) @ContextConfiguration(classes = SpringSecurity5Application.class) public class SecurityIntegrationTest { diff --git a/spring-5-reactive-security/src/test/resources/baeldung-weekly.png b/spring-5-reactive-security/src/test/resources/baeldung-weekly.png new file mode 100644 index 0000000000000000000000000000000000000000..a1b7eebcabe64f27e1c4d5ec9948dd38165d331e GIT binary patch literal 28106 zcmeFZS5Q-J_%9lJL9hZMO$9-^Qlx{5(n3*sM?^qc=p6zU@B;)sKzi>Tq=uFRK|lyS zgh-8mlo079QbP8d?>}eGnK?J-;#}?7BTNQNvhuF=uIKr+hwv9#D)bj`U4%d&^lGZl zbRdwEA++!FXTfhS_4jarhqJGtD$gKP+P`dMQ9Ss~1y@yL5Adk^-?ws)qXGottfBVo ziJtGoDuwL9=99U$udqNj6L9&;=?nh6Ix}^nH5CSk35^(OS&u@W^(Iy_tS{Kz*4iaq z%ExYCE!|DtZqz}*g-`qC4)^)?Ycm15`uCF#Pn|!1`(3Z#&4^bh%c~LDAsm?aqVaH_ZON0v>+Sod6GQw&z2@508`}ry-E9EGKV6AR+x%ASWOYr!WY3 z_A9Z|kHP<^-GQ70FS+!8Uh@CpjKLVb`7EjK!{t$=FWh`=bR=}(UJQY_J#KDP#(XO) zj=OX2A%!#Rm{1tJjpY(45iB!`8&#Cg#|xvrvC=`>y1n&R)o|?|ogPoSL_2t6=4#R_rdG^R|PrqNy3eMDnX#BR>d_1OG z0rnjyFwvWWQ@$@`h#<)7I#Mp`^`9LY<%g2=PBg|k$0sC$$OI^D&QQ8s;icPJnBAf@<1-xtJQcaC+tzMd8Q=meha386^ z@bbdHJAw1@y{)@4ua(U@YV!^{aO4{ig07(_Ax@D2D7wagT$goWWt>+!ZW5=2GkCXINfRu{5wS8F2p_pMN99GG<+-AnCGP{6^ENa5=8* zlZ6rO{oI@DTE2SY0&0ly!?Qy%mle=#>4_XmZ};CVWDBe5H!U3O4<{vc5atLn`e}v* z(`V`hq6r6NNrq2K!SK0m8M6i#T($d;oIhVQC>w3HGR9tS_LuBYdX&M-$4|ZXahO>b zqFbcs#T{l|3tZ*<6-Lf-mzeG0h*J{@mdHQ_Rh=*qO-0$QI5>P~VPON|$&qNwL>$y^ z?ZsVye05&ihxnq%D_dx6Yl*uwbC$a~99O#9TZ^W@8%p%UP*I{ot^Cgn7QYBlWqqFi ziqEIqqmRpPtxI1p;8zN(yd++AG4>pktR5F3MrU}2zY4>JwtLvNYI#+>dx_UDv~Kr1 zz0&%ltg&FqT$Vw7FOGS%SgQ8L$m_C#B?Cx!SKdKO)v-SHke8}S-Pm;$t^0eELAq{z z%&|v%5SQo0>$0j?sXZ~cOg-AN+)>7!i|ERW%b#fFUlkZfE_%32vH5!s&SR(q`SB_= zb;a;t$pbz7r+q3BP1v5zhI`GD|NG5T@z$elC7UP=)grY-P^e*xLNP>-pwka4Y?&7g zkeuOiIss4pN+RzlGQ|)PhBL#2pxr754w&W4;Kt*~?y}}S@E>ei8N}vn>OrR>(QG|IUok2FvZ*3Ic>jpgs|0Po??ar?OR!<4 zgM_TQ4xVd^9e?;7c7{=HLbnbYr}y>lZ#A7TMRRbyiKw~-5eKC(P!fFpUO~$*3pevd}{i6Ccm(f+{GfWpQ<7coN zeZ^giJO-f!Ure8r^CJSAI)!hT51}oO@)nsEC1fNkgZ~~7gw8mtO;~O@Kc@C4AaL@- zMWFu7I4e}V;;uVt3A#t$tKMS-V~_5#KInFVS8VR9^^2UQUFusItd>U)q|;?ydi{;= zUdgyMlu}7|@j26uU-$UJFCn!c-4D$&u1d3Sjfy5wCc7fe&&WWyB2Q2kf>uBKN4h*IcyvWp5Bq@qE`~? zU@wDvqsS2s+x+*08h)#d6rgy_R~+Lei8{{kgv{dL7fmJ7pp3`6JST6)B}|XRj45QR zIC2_oZyG8P5**wG5~)ERuXmFh-^vx1wDpx%Zuj5HWTET@HAxugj%-N{mwBEi>Iv$vR6U_v974YXDmt-hK6O&VZKkqSpC?R^=AF*F| zJYS+1%Pql#FT0=jYTu_{z=XE*y5^=a@iI?i|D8~7(M!%0Nx~MCf9cb=J_1z$I#POt z=qaTiXI%W}OJ8S@_GLarc|$+2Zq-5a-6PwlwGmy`g;ft5x*l135W+qbR6YkiB#R9` zy!ErCK-fbJq0M7Fw;d>}0DI(Vm$d%Wlf=V6HIsTX>bar96SX+10j7}qO#3(4y@#9( z{E9-G^ZDgJRk)cR23gn(ba4yUH&%jOe!S;faZ|gIo5NCGEWjqjZ1qq7j9D$roT_eQ!qlI0$Evg{@0-GlI^pN zTp{dba*app)u#89)eY;8kUsO*kzN!obN0rZrqKO`>KFmd0c{~_3%pZM-`)G^Xz78MOPz zCveNWQzKW^NwL`4o0Uuw4Q4Cc6`=qI8OygUxzWCHi-sjOzb7mAN6On}c~ZqIli#7X z_D?`ut0o?v*qCUGl7%2lRgmxkYa8x5k*gj39u zldNv0G7L-&<5)j`G^png3avo<%_WtomkRp9)~`>P8wq4hmZ^|9j5w&gYId+F0aF%v zg9h(MOzRd5^^vT?uzj`elm$-QqCPRU`P`Q^sIECY0q(tX4nVxt?LVpANSl1?eXj!F zBU*b;nAJA4Fo`}cItOpC&891VD-v)elKWqF_)2FiQC!EJB6^&I>GTg zr?3F*s+wH-9PBoyzfiDnAD5O3;Ij$CziwQWV$;k`r4Y!PpRDbd{oR~L06{L7W|^}( z#pX-UUCXk3_`%cf@Et2Z?63FdSNE@(!0tJ*H#NzXC^d_<3bCZH8g53og`L6@v~J(b z$}*BTySewY-8P+Jsq`8zbV8*?TuSV&+O3QvZ&03TT6EeyB9=_k-^p$J;BWU9iD=UZ>T+|WBp?^IuK zB7#a3Edms0x1CtlhFq#z^JsTbR_Eu&%FFdDy^m{|a;=1(b)>fL9-Dz%%tJoO5Qzf! zs$`l%o%o%uKHNK2|5~C_f0b{HwX#{py!^^7YJ-`!;5TcQupH2GCCph{b2cKvZ--sd zJY%=hBCx(3IEYv$OtrTjuVI35{hOKkRd>MJML~yFAhTlT zY{oky2&FF@MbpQ}E#)>=-2Xar!0;{oMKm5Y753CxcJ$dR2mQ!mb160kic1W2*PYj8 za#=G7>tPH)1OUh74*RXI+)gq;Al^!l@6oSsh6z{P#2Q(?$UAtSD%&7S2-uB2*$3$I z)e~1_2Y6TQ#KmPxb#W>QtAl2l`z_*HJMnvBU#w3+Zl5@L+dDsTHd;1u;1mQh_9xl6 z4e;xqxBhpc*)UnuGOYq7HXKf3g9lk^I;6pQE&4}WpO zdt$SXKqEg`a)H<8P+HQ3DOEAY+V0ZV2(_B03wL7dg8NyselG>JD3TV&?;Z5aGGB*b z|A#MIO_FA>i2HO=_IBf4%+jf-ri;MGDe(gZ4b)ug?G?Y9a)F{D|*PIQsfCg8QktpZAtf z2*ali9n9>nzJJ<>AN*fWm+yEWSbtLH_X{^$E1koEjUoYTmX+UO`%a+W^h`bnmxz#x zMN+qCOXh{<;1iIsD-bKX#O@P3)5xRGe-DG&g7b<;+`1$i35#f3_bzeSG~LA9ht;ly1RQN^liB>&h*0 z%2!SF`V%&WPX!ll0{|M)J>NPEfk44~(hHd9TO_IY*-IzxB@wj^!$gFLOE15~io}FI z42t_Q3pGrY#I-w;=IPHujFcfCosERgS-X9nQ8uCGclPiYaOMfN_(CmNA&_e)t~?q+ zcM81MbNX7C^#;lIIpG2qpfd$)&JalAPj{hTtG~Sh^iy<8b3dP4$hQT%K^N#576?OF z5p>vBW7t>ko2#nFY>2H=?X669><|s5^S-&+6%D8C6PrqZ23Cd@+PyBA{d z3$b^AX2E|g@-6I6HVxztYCHIP>wOU80&u%ww+YmuTdC~&Zpu&ESIhfOdrPsYF@~Tr zaAQgWR&{nYBE;>k_019)#8Ys&d!d+@2I^sf!d2;7MR%)<0bJ}lrF$!d9ShJ85Kv&4 zrj&%ZoRz7IfDj4zbnf4kz7ZZO!O7qd2-i7) z_^`_sZU;{LMeH_h;Zt>NHbrkLn|V5I?q7>~dxvRE&s9189Up!F=TgU9A84ftEXfq0 zIIz~2-s*`px;0-GHDkLM61x{(igV~nF&W&i$?j>Z<2j|fl6FgvFq)ma`7?+NZ%o(H zU;I*Xw@B{{aUVm7;Yc!#HPV|kGKzm^AJwm28jx#<1XsN)H~q)tM@Zvy=9K0mes zqMGu#kMZYQg^OB+V|3*CFxLHh1P9erhW=9fug?w7!tUR=P;o4aFr-#}qE30r|E!fy z+Ob(`%D3!@VUVvXO|SVld9=3DvT|!3Iln|iiL+NoWrww!U^gAWH3b)!1?8!x6Z9mC zn-54bpmmm=>Ytp*7#ACNxdjoU5Y@>A_XIgI65{Oboo4)jT=Cnx>AJ;~jvRcU(ALyf zb1cU2iGQY+9>+-Kdk1N}bW$q<#U@5!Deb8k>M7+)y`)8Yx~?xl-@p%Z5*`8-9rs&* z*|+oC#}oLay`H5#KF|?%&q(+O;`w&9=vUG*p#x3jJI(#r^7Xzj-SK&fKt9e^Jdxg#cNGaDWE>92KDDc;T z1&x(?wr>5KyIDM;?6N{ygQi~8;0-LN)zHGhB^PaK&`6b)06A?@6GziR3~Nl`=4tFW?F8pjY~fxy>gPCxaWjaIt>HXV)Iohk?zqrYxI zBaA@qKxHehTAKslQn1K$()1XtT{*^QQxZG+=6*2fIeoYFO9m%=9mUK`vx28NIP$vP)p$EPY}+O(G$CE9S;=)4{6b z))>d{t=uGyeX7V3xWX_~Kj`laFUTYu<`*~S$U#Z{PNi z-{rwyR%?DZ)nMI`)iFDiQ==?z;xn>iJAPy)pbx08KhNQ=*0w!#DRpvTEPnU0z2)Yb zrhLOBaSTX*t9%m$&>+o&^6fv-=?m-bGG28@AzJ#Jnm0e<=Y0-$9xqt2-yhGT$v0gQ z>(87xtRa$aInu^n&#E}!R?v2WIv)o*bNcWjN2PrA%94TbU+A=7Pw{|I5;lKFZSpO? zl;^&yK=$K5e`De; znr!m;Juo{Xs3M_+^ZrHqJ7Miv+`HPB?RmuQnx}OzexjmBL_pysr`HZ%qL^)a z%^JPl!ZGFf*K~Jg=?hUi2ASLbx%J~@!J*D>WS-)G|Irkyq|!?!;gm#vtZ%Ltlewmo z3bQ!&-_cf_13o}Rch%CKLQWAY$N1JdtL(fgY^Y=<&;RRUGMl^8q;-0+Tz($oxkM`3 zqg7?Nao_hJ89JYRfz_I?l-`Y$H7Hh_0sW@QtXDbTPj`1EhZ%8{%N*4Wbn!RM=DCnY zBdUm-FDdJmPF7F;_1Yk#loL({6Sjs=>Mi7Va={H~>ND&rwd>iDS2oc93=~(Iw9QN6 z6h#iJuCb{N0|E1^oUVUfZ%yQG2ZbO>nS1zVxq`&$T$<4S;1YDUny2dN8aKY85>q8Q zZTkjhHoqM|5e}A?12oLZnsrahR14{i^pQZv%ZIMg8UAhr?4-A*AclV|@-TDa;Vdt& z1Qac`r-Yq-)H7jOqayMrKwXP>*hawhhU6XI%MYT`_lq6iIdtgLxP-**42Lz_xZvfSW=<}7H|uAZW{$!u zrj{kvhsMyQQ||1wzDhMOOJ;5$fBr>En7-pIS7^8=G#ReRhgy1KSvsX_~3BMVR)l2`DAQ%IztgCF!2hg(ki_-9##@39fza{a_c|t<%6JO_ZAek!Z>#emyR(+@?T9;b^4AM7}ZbScLkP=ZnKT<&y=mC{K0FyHHh`qvq&-o3V$i4 zYUDWXESB6XUZx68MVW~og(EBa%erLH5zt!AIT|ZbB~Q+@Kk1BW)RE%@yxLIdWk$gm zW}fkrr}Nk6*l*(jTS2Ze8UB7$u}P-mL^jaT!7DIJiet(U4IS&vwU4#EiGjoWQ3Jac zO?jSOp03JDVq8F79NL|I1XOvlCORKe8|k%Y&|yh_h6em?e`@Aqux^^6eThJidRf~@ z(tGUeXzW%{;iNX8WN8?e>8lqLZE<^`835uA|4L=iPwkW2Yn0>v@dN*BXCo2$iOa(} zG1|)BU^w-}kkgSRbtn5$#}MFfg-W%(TXx*OF3_<{AqHbq_H>q)QvORCFMy)9zV6p2 z{u3Gr{ULD~Q4;L$yAS2V%^SMe=Ik-98ziU+0Khk<+rl}vUfCMZy{^*=mq#AH#4f%1 z@dD%e3Fyuej})5%Yk{7j?`IIskhCtwZfE*$W>FsFp;zTnZ(=$Z@YMWwhv*8IRHyzS zMHOBil^&}tz^4EOy70u;M^)}kbzf2@TGg>64g9lp^9;ROeIR8NR=DIWzdznRT3<^Z z=ZyH2h^b6pN9GzbC=?ylO?^D1)pve~!ID98!f1fh(BwpK~8GA`}q6Z z!+O)V_FqTn|F}v4k1EAA?Xgs&oNXm&Dtt^`zmdZ`?}(500AC=(0)Yz>ig%gONxsza zU{uy-hQ4)-`%>9FH8I)iRF&k_@4c6P?RHUDd#fG=MFVi|Vop`9vV=oHCkB8;fQ??@ z)_*$WSgaOhuU8iIo;spmt5Ns*K)0;E*XWL|J-<|5usm57i48OXR3Au?{I??c+2|c# z!_^JXrtWGJS}UOxyk<;yH~Y|Fn#DBvaXZd{Pa>x z8*K0u88Z8MQrN(BW0I;}dyQ6{IO58XsU~O2nqxJ?8+DzS;1X)Hy;}A=qE*n?W<3!V z$1>+3S#UT)GscMCgdMXH#h`7+3{q2hb<>42Tz5L>+`!%CrM*M!NF3ZP+eTvpr8a*z z00%SLjFe)S-Nm>!>2Zj0^J-w$qWve>9JmRfv*nXKze{CumFZ}k(W?76bq#z~Kefm-M zIMKC~+r#?A(5&n78?U*|lCVpZwO&~VcA_}Fk7U^7uJMvFc4@24nfVy_vkYI>H2+H0 z(rx>%jr_Hji-Pjj=b8)Nx6zS zykv5-$R_~myZ$@G{-p*2Tc93a*((FB4MwwHe`AwP2?=FsP(vR(-|QZ<&hgH~FEr)J z{&3oj30-b4wHfa_nGI0hu(KrN8DbMj>#^~*@aN)n%0j4-^1E2!@@;uTjV!!6^I>I* zu!LcPDXO%s5B0>o&&CGu3izl)lRgH`cv8xqIa>spH zpzfJ0S6_L&$AmYP5#g#Xwx6}LcT`$RY&|E8*kj}s7L$+?%XRS=Hl0}->iZ{E!~X|p zhXoUfMy$iq7l5b~OkP0qOz~9u>foqi8YaKS0xxk@jty&J$D${WNr6+vn8G1dDQ zpmzcbQijSWx?wzQf>{fLFW@GX1tOaXfXcuFm;Dy<-`txL25|r%!x>Hf$1bC76{#WN z1MF3pya+(~gkr~5Y<0Q0SWRz%Pq!FwP7`1n& za0wWXLEXr65`GDV*WV6QJ>;3`3q?5s>P17H5xdw6PmrJNgs=D#m6apsO4h4wM=;AFvH%Yr*$6)Fb62_XtL8=XDfjY z&N!i%yK0Ix5B@5G)gqDzO#;A`W~;x}cg^cmOS%>=`SW(h#ewqi)K*Ndm$-p*ws#&_PaXH-h2314cpSO^ z{pgFmd2i{I=*mgh6`>HHl#baKTIz}3jHAn{`wGx_{xQ)9^7;F&w`YwC^t2;@e1m7h z>e$)uxhy53;Z>7)5r1@6MaHfDhkwH4<4+ZqS(jf5p$T41*L}EltFAH}6rRN;X9wg1 zFrihXyXk8NB&m^0zv@i}M}kT)j)GNoZ@dGQy7_Njun&Zb&T1;TDZl$q5fbF8wPy9_ z5a9h;Uc@c1@9*@SscTQ>_fX*PwShRK!lsjW${dcM4 zPp4ANtkYj)s?jBK1GYUnThrw%oe7{|%CRT3>`rUlI?*}6l1}Kx(9C&YCaz1$mEwhw zet1;A-P2lNm}xZb)eWxd`g!-HKL1wXNj2e<3lfR^p4%+*vpjF1hxxtMZsA))_^!LO zV8;V-aK0+T6+jcR_k>ODAZe%P$JEcTfff*)03S%0a9jEHRRC%Q6^}KRXUfTlgM$T8 zWaU!9!m>-|--W%PMX{|5A*_DuQm50F$buFjkz#Z-Xbhq~*v%`ZIX3wn;*c@m0B=Xv zBIGU6_5!-3w?zvgP2dR$Zx~CY@*a1lgp&1sK;HlvExhfEy^oE(!G94S_yuUBNdWTs`OW9?SK-_Jjm zGt!lBd*Cv*n`40WaPfK4&rWM}#lj++Q5FC#7u0`R_p+RktLjY`#lix`ph6oq#-09+ zi;eGN{{^g{*xR=26)D0RmIJ(xaz*()E=lj{k zk}RX}syXvaqk;T!S&w}zSZ>z?_?!a%ukjy1#KE!qBl?~}@3$|uj3V%d$$=Mm9f-9i zmxpx7>oOR0ikCKl-X2vKFz1&Kn^!*_Gn(jNq4;$%KS^5id3FM17Tckv4?9b@8Cj#x!em=vjc!kD*bNvfrKuK|uf%io;UL|at zBt%ZPvCF`80&9iQCQAkyXi3s>21CCC_Y)6)8(2!_^!DFGL2_*h9?b|O60aZmP|#LX zX&lR(Ou3-`Ye$pb!DYD8E7&qopBsn;qR=zhc!mmC{I%ykAG(PsyUgx}pyLb}EyM-) z*k5fKVPp$`jstNu`eeD{dGj~hU3w>Vs=>Zw)vg|spkWnsEQ}FFO zfI7aNPk>lS>n-LUcX1nkl8-n4ko+6>8uyr8oQ<|yg8Z9jUjmVd^kHmpjBS12+)WyN zcyl&~=~vjFfAShg9HrayUIDv#9|oQMXV<}o1?jC~ABPu!N#%v0B6IlF5`zXXSAnqO%p2La%%H;S4t#Zo9da{Y!u$Hz$Lu1UF9p+4YI1}t&PwmAx!j>Gpjf`{Vk~8 z$7Dz0Z_E)NcdRf=GFY!ChY_qarkwk^f;E1^$gHaIDi#16f>>78UwQZGCtGW2KLN5A zoQ`tYi=6E__!M_B7|;`1C1pt-dGpGIruLrWNy2pA$X{|^+5g#<{?1HQjijhbL|_~csu4f){qeQINV_=)S5s^@)PGk@{TP|y}cRTY27?Z z$hT%Zr-=wEU(0XiIS>zE?i!-+yOdTbfD}M0gUm~u)lHzbKNMnWjd!G`WPYkHuB2~R zo_G~GC5-5;h3aLPR@RhXW6XDfrN08WL<`5(V(ql6zD-AyR*P$=nG@!A%lM1T^qXw> zG5q5@H^%|78dVs}808l?KyxN>V{^S-%zV6UuWqkT1YL(rYa#A3X+0~O)^&_(D*3^u z`7;W^ZTsD;fZ7b|jJ*^5wP{N@kOKf&xA!gXFB`4@#)RDxiT_6QA_>daA6h|uMz}oY zWe5S!&F7KiKWz&M;O5c9gd}@WQ|mW`#@N|LGf$t1s}Ri1ybm!cQSq)`PX$S)+KO&$ zui&pv3D1`GlI`2qBEgm?;M#Wnb=URKz})aN;{Y7?Dh0^rlQWD?H^V9~H>`lz76}%= zsQJ>~Huj(hKyT_|#|h}X<@z~LKfuv3?|MjkrE+CP2~9RY1pivsKD^5C<j ztoRV1@P8zCd3mv6!cSCM%kE&70TJ8(E) zf!n(q4Br&-2hO$whgKz%wLZ*GC!Rh&BRRRRZ^l*JNoM~Zh2yZ*dN}%g2+$|Z4H|l` zX+g`i%#uy5(-X#jUr+-}F3VrJ>fHIcC%kPmb$7|2wAHKI-oP4$d|f<08|+3e!rjG^M}wcdPxb?po7+J zRtiFlsw5;ZrXXo;;5j`}&s90oa{@Ve6n;GW2MuoG_AP>NhKB))Gafms?j2eR- z^FgJ9iyM-dlry-B1M7TN18dRjUlDDr>xO2zVKB)*b%zl?6HuVDqjR@ zt@+=t7Kt6RU#HAH0w8rG?l&WZxu@gwGIeY2br*Zp>0VAVJKx`Kn_KxtfMif9DeEN< zXg;~mKUw}dg_R-1pv4=gfYi}!Z{{)BA8C{2QW)#1Xoh}JT_9S)fpVAFt!U!*IOg7Y zX8c)~oFpwNM+rdW58mH`b}+-pTkqC+*?Kp;x4Ruc?!p$R7C}D`LgD^@ zpJSaJxA}1|j1Y1IjxBXDUVPUgx&Mrau~O{{1on$mENaAm&*PJ3S{)s^s_wm-O^r`^ z7W=F5sv-GVRsrN@xJrdQ{F($80L`~RY)V}E!8J>#)yvPBH3Ga#-7z?)&8eMcWNE*4 zrKnQ35dxqR{@F(~Utr=DbVO1ul*R7=YprNPChLARZg+Y~OLHKREGZq_pKQ zG6=6hZi=nMey|C+9)^D5`Gh^s+|=7*N1NV6IPvHi<-;Ug>3Y<2$$Dk-NPhKUXL4v_ zUupX9E{riduL58L#LakQmub*ZK@YR;I~J@niOxYVcnk>nTK-KV{}JVD!D}G3?p3p* zs&l9b?5(L8Ud>9`{*P$-iK{0z3OmQOTDHn|Bdx36g8d9k7m%-|Nz`%r`F4A9h3l*E z?<4Tnn?KoWg(~!XePq&U#e3%_U^j!SL9d}CX6HhjwI}TE>@UjWpGUj+1$|?NHc;bb zjGD=r(%s6o-H+s~{ceZj&OMU3n(yM!rbG4@e{{vnxM0v+CPIb z=mt;N-)RM`6_crz*n%lcYez6CyO|Tfh-8!`N7CfZqD}ZDv8GOEWJKC!VX;cC<-2>N z3EaQZUGTGA*5z}FgzlbSUx<4^#eA6AuO z&tTm&M_!kF>A_$xbm*l@>JLgP*f&Xx*gWKJh?)_14ztuQQ!8uJ8#)rMeZXZ2+*>@e zM=7IAgZcxu z5j%EE5;06g6Hy^j{1Uk36Uqpe&?rDiK@94VIQ%c%_`q3Bj>8b}Hqh+V8mD8oC>K9| zkiiGoOgqL;E;O{Z4?laQuKUg&Tz{-gdECy^`FNU4cP(1?zqDOfksxv{n(^M3vxT2% zZYPld{G4SFrY{8{Eu5@G_P*;225FErcxmiiy_fW7eDvfwFv_r!x~yNX#`Pn-S82ku z4hn?kQAvqnfVhEC0FG4Pr%MaY%0KriJdDk!LmIA?v8J{-tDJt^@xZfr6-qf;#!Lo3 zc{q1acsP=ZCb6wQWLHWC_Fon!wc12khW2Jnu8-+r&opJg0L9l&G|vSC8~GQVP0Sta zfQU}PDkXNUO%0SEB0S1fwEy@Ic`9}bTrQERdJ59ZspmBWZeHNG{hlzlS$12<5E%Vx zgAk-CG;&vCkCz>CSQHjF0q1)=#yrYRnJT}i!bMZ5;hr1PSZ6wr$1p-Su`~f`+7Vt2 z@)yfaoM@vE4I}vp|Yl89>NW6>@PJ_(xKw?uE zE&b#W&AaPEH+%+z*HvHe6Wd1Y_Sj_ zTUs9b0F&mm@|2F!6L0mx0@jqMgX{${%J?Q{+RQI-js+P}+HXM0Z+s2Y-nE+ibO=OY zn&n*0KdG}KcHIWNElm*hBwz#=sB!;~5hsMBuiN2~Hg}gcPvl9iyX3>o4*6u)EzX{< z+1L+ozI$VzHbx)rT-nfT@TIrz?sd-!_pR8tk1B;FG#C73Gp z1D)e)$qWLednM-dKP~WS59OKZaeVS zyR$qfGr)tp76&93i=gQsw`l@di@^zsk4~sIH#nDsh?@SA^ZV>~lZzfrqzH*@}A1U5uyJ_5c>Qt8@07>wRK^Q2D?y zdj>1v#s0s$p9i&9zz5YtVAOLzci7$xiyci``Fr#`ta%@}0vDf`SIK-GPU8TV4x}k) zvjq#?4q$&dCe768?MPo?SgD7)z%c!jZ988rTK+2QbbE-Qn*Hur{W2#8v~a5V+Xjlp zU670aW)EG*X@TXX&S%BV0$tSHBvLkMoiF07rt58KT z6R4kY&x=906pW(fDVhZkMtW`mdVNrUcw~O)AS0Crbh;9N764xsoksn9Q!$YcmqITG zcN_DuF#f0`4Hsv_lI^ ztkJWgNpww}bE@R?7+l6g!;-s4Yqxu3;P#8jAWMGhO*6$Zup{!vLz{%A$x*Qkl*xSp zZ~7E-gy1r5%7-Q1zpe*N6di0W`cXC~4lnSgo3FS`jLHzefykx`Kys+KU?{}JevssW z9^bjB3RMQ9Y>L9iZu(@|M|RzxPqb1#zzfjE?0M5NMh%9C5k9=gK8?PA%4{0VEqyG- z*{R+wAh&C2>90$3>&xdtwnp3qsjEYO09Bs?-f_c%aM?`H6Rfcr{d2Fxb(m~d^9@Ok zYQ5LCT%o>Im+MP?93EfBv0>NVn=}b(jTiyH31~!-NW8e4z>adg(ffPD->(2SA+`0Q zSM=`NmU~$L=9IJ$RL>LW?zgTbUIh0qPt6@7I*U@j$Fw>E+MQZP?Z{jP8HDjbQdhd< zm(StS-fM!y^i6yGY)z2NiyB_y8YOi3J!mVtnu81ZFtY|7fLQ^CG2!1I1zO5jY_yQe z1>*xb;P^qU>r)X;k9U#zUirH0*5(t2BiUd+j9-KBle-AmqXU~TAT_*c3Xp_-_X5RC zm~4p$VJwIH<+XJYBPM|80GFB=cumY)WX~K6Ha|y|V!=pXZvFsqP^Zpl zKl>oo;Zsqz0^4jtmi7u6S}CKpbZQs2|Ni#!yAiE?BO>g^`A_1avW4$btUz3H>jX*# zOa&H;7HNRgVXsyX80gaENKz60q)RvawY~ZuS`;&d6%V4AKxA`j)XE)SYLIJr_B`cG z@17lhe-eKTR!B)lifQbrczI9T7v;q+i3jrKnLWqOoFqhiWdJoxg*vixwwxxJ0me>S5s7=A(&iVt??!yTn|k@2 z1Y`0Ts23D)4!}f|Q~XjYuui~O0%)fRNr`z=qfRz|v0#DV%jRvhzTf8dqoST)bv%nj zqhjM#)%)S}mLlv7pTOzWOS3GP>pKY&DG4i@v0!SW?;nAi3=U3kogm#)4q$4)c0D9P z)TU?VbP>Qd8HPE)b_7X85Zk?jo)iFDKiC|ug5>}$0Uz{#!l4}ffhv;z4UJ(_mqD8N zPa)7#6-~LmOs|1b0xR{c;|4R8=C#VxRIf$C-}h&|i`ga5g69noJyR@_rfc{$^AlWB5{ruvu7BJZz5-GTa}2=wdA0rUhoiT{&rhEzB-hsJk5bi7$Ye66;RWJ>hYMQ*1ed6n9Fk#(z4rGB>*hmITMv~`FwIy0JJ^257`2BO5Qb-Gt=EyXo z|BJ$(I0^YBoPFm1J$T;*f!zVbsHXfipaUgfs&t&s7;wek-p!2R&u;*_dp#BV_vqu< zLX}a_%wKTV6@Wn37VRGGOgTeaZJ~%JJcgE=1|Hw6(X(1Q4=~^9_{yIa@szlpimaOX z1m+REN)MJB{>XxWG+X5T|AxlOfXx7kD-H~umb8g;zNhCO6dtBgMc1@r;vJ;-W>mn6 z98HG?*k>vohOWYVE_V|~8 zx)B{QWOC7&-W0z0Odx~&a#(V*m^mA|G);d5T0B08h1PQ{+Y=YpzW0+2Sl`Ha` z+%r$nE#zI{)Pp&Aj|7wcRRa9GUI1+ZBqbtdz~x3%cie;upoqYj8JfvGpht&A{JEz8 zCW)5H=B$V3qztiTeWw4R**^wEB~O6LwGcrC4Z~?{H^4!ND9%&M|7B>Jgbw8a0aR4j zISOkhtVSoU;|HUUAA^7#CRi6RSn5Wb_9Mn)gVKSDp)7W4b*Tqt|BVv}MCgNXUS_lb z+pkw(Xh)441epS3&G$|?-vgH(gcV1?kTAj%9ZK9kh|g2hJCK?FApmB?h_uM%(jJWH zvC)J)n0;rbUrV1e4g&$d5@hEt+j;QWmQV~Kz>5Sl`sWrU6C^D^6a*j^r0ou{yB((n zd*`>xTQos&v~UVk7cO!%&HMlYvfEMG{Jav8+CO;Yt4Vq~70qB4hMw#U@dVj1Hv;)f zMqE?DVFj4LSCZ&P>^3pyFRg5v7mXcdfQTa9IF2q#yF|Rq7fL3%H}3#(WUbfnr{zd?Vk`s54VNG6f2&ajb6v^DLEKFG z;Qp5BYNpNEf`;8HTm^zwpjYAF#htZD`8a=6XGV)3d*#P#_wxJ!SzQpseb8|W;yTz^ zbut^jipv>6${6^)fFoQmWOUUV#7JvNVgq|x)=(#k2ORAF6$TJmEx9dkd8qE~Xb7(_ z2$C})htMK?m~Y>J{{+k^ESi+Mj0NLc4)8l)SC+o{s(w>d1tlE}d##Rr#!)Vi0qAK9 zVue(Uxq3)vsBh-q$B`@>x$7+ZR07|L;29*<8wee6LePa7Hl_9yMk7G9U4 z%?JSR0}On|F=0NxIlx{&)+E0{AG@w1^<$8UfN5yUq7n)7P^rj9F!c(yAb>KHaMjnF zjkK|4#Dl8XaW_C9b&b8lK`_rABY6u9@Pc8ZHhJsrGi@L~K>0hg?L%=ZbI0I?wpvF* zQDs0^PWw2yqp?QAFwFv-&#&oxHS{&y-A_l%MzI zWd-pFT<_U^H`0ksK#k_ysV9Nt} zZ4hwb@8Q>hIV2vz&~lZX^-Xrn|4oyxg~RKCHp@moxoCn@l=tigfeianAoT!C7KFSL zRyHw2Pmqq|yTb4mq~?I`1D@{ePgDo#snk|={U!b4+wz9S$Cv!fEY!k)_M&;V5JZm3 z_o`t)xOnjH;?J|E9}Ar8S!mGHDhw)@EujEL1^$4BBd~HmPU`>uvI5LCrq|)<>^O5} zShyAUn&?dL12?qsS6`>{=o}4l0r73;2~d$!wWNSgf>GhbSZ~_kLr>d|&lXB=@e46_;yS;X z-OrC;as@crKsyB+r>JP|GR?K8G4GD0L+zN>H@8rV6{Ef?Gf0m~8Nh4`-tY_D(*=KZLIy~P=0I_%qkIOHjzMV+>YOA|Ee;>^XB$H3ahZT|#xR zSdMh)qoI|D59Ht6fp|HsfBWwLa=te_Tz`y+=bi!_qfEh z=akyWK1;7cFcQisN&H1V|_{UFUjoWk|^k99jIsKra zgOt>>ra}}=Ai1Il8$X+K0_8(l_7C=BIhQ>r4T1B@t>$3VWG7+~P<5geuciG;!rwTnw1umzy^g7k8jreXtjb_i5B048w% z**9W6U_$4B7@H(G{k4J@xGtRRffg=i0aTQt4>>`6IVDU*@_)5==HF2E@&6xflGGig zY-yuKqoNR^JC*FZv(6+$wz0*al4wzPNedZD(t_-geQYhaWZ${1b4!*nG1*1{nH^M1cx&)4JmeE*yxr0@NzaTiomq5a%wXPjHd(Y*Dn-6-rP zv8nIh*kt5>lYjM_r4dWcUadG1boZ24VNa$)wp2xQf}!o77NLF|*B-Bn<7S;@F(zCk zW3O%22cI<8RSN`LW?V1tkkffFG?7`JK4!V^bx5Ecv11S>^Bxym-=cY2njr zpP$v-5jO8^G{Zi~?!Ah{szXM;r%4L;Wv%#=D;=;@>@4A!?tR*!1WUpqopv(0T|wzk za>e2nulUUKoi3R4#LE_I>s==^57rUOWT1`p#iv1`=DR%0GmGi>*%9vzRI1Ge6*3pM zj2^v(GO)>f1uu$N|ANVRCOKXcu+H8?HFR~D0f8DrfNn5yr@+gGf)}nEv~cw2^t9OT z4WMai+KSJ}2OKi-`3pnM_Dd^+bZSMp&U)xf`6kZ9W7SsD3Vl$tlpHHV)SF-w zxk@dPDJls@HO*cBMHuUmtOR&!uMu$qyU$+gZpG*|X|dvNZcDej*_pqbdza2OOv+z!jVR%Y?@%SP6VD(b=MT{lh)n|juhR)+8;@Scu zAqWp#CXxA-L$dKFZAM%hnl27&LUe$4;v{SQ!J_T}EYu*0(KizowAdBPVbTK=g2u>v z-W;rbZM<(A8^$1km^cij53B#%pvc=Q|Z)<&c$MXh{-20jt+|>w8Z=3T$*$P>c zJ7p27T9;n2udAT82AIdyzd?z7W2nka=P>5oxcAX))Fxdr&M-Xmu z5=N{8bu>p|w;h7@lBtDht<;oI&dwUylj)%LrAvA&Q~e@7Ll`P98t;?n=2qKms3oFq zU<9TkT0)kp-sg4sTP#Vi;gl30;P#;gSwH)#AC4l!y07odP@7Pnb$ z)w4W67^+sqo4qzupitnw+0?Du@w9O_0p)86%oqFp;f2;slcPVFCiydPGNN%!Cb3B^ zRA~68V!mlxQM$af1cD#(o#qmr(Jsq%=N9bd?{r#BOKyJfcUXF2P7Xstjy)q#y5$o0 z(`yE2I&cd=>d$1hH?Q`T^Ng7y`0B*R({>HFC~tDhHKFMOay#L4EIP_zvuL*Jdm8XW zZ+_ZU`?L+W@{*pnWoF5`{xdNgY_MCBBldA9S!EaIUa&K&^$*GNBZ%rl^~a8H%~hFZ)Jt zTURESrQfj*%+%X~uSA zSLkMukVe&xxRD=U87GKIN$*uV2{Ox{^(;E7r*nm7N(=wclYvv134CxdS#@k@m0a5W zi+=HBww4_P*v!U3{&(U$d-*JVEQ~DB!JOX_YhDs(^CDzT-nwP07{dfB(KXpJh+ga4 zv(m6Wy}G<-G6g>(m2M_%EUun9V=<8*=wQa*#>}$Eii}(Ym4xDS!RHEc;_vpZ%nI(( zRa#crKS`jU*TtT$`~s%TYb(_v_KP=M2g4jv#5e8jCPy;uO9UJf0vEBd!f2^;VVS@< za<`r?&w~y4XuqJ89!|`sVV5xcEim+qk1WJToVNqqDShqK3eAtB%!2ZwtY`gK>kApo z=aLD2heNN5pe{YX$hj8nFCr|Ot42~JsBAA^qlXrWpty`eO&^Z4sE)CS?P#y{ga>ec z)Dp-Dx!t6Q$R{psi#9?Yac{qCp9Gv_?cE!@^%`4me+oVQ(WlvVOUU@p-gQ$cS=Xza z#|ycUqL7=Y0i=i+xJ-;6VN5CAx!D9+6-DeKTgts{qCtbc!VDL}C-J2(?*Ok4Z_j2} zLIAf804s`0JQ#<(551`$jl;JZRhpuW!t3!8M`{&g8?%$ z$05AFpxGqn0xY;QTzlS-GsY#H$z2uEFM#r#n_0h5ppyE(3SNlLQXX!OSUAQzSS zvQ)nOkgygt1$FC-$LELOlEUaEd)=q`RC7MMj8sNJOjxa|(38&ZD}Vrx`vXEx54afXqVBO` zpP~9J1x@R)J2B792s1JaN#S)`ddSFASF@suQ+sZ@p8h=MPfR8ST}>Z7Ohb9I&VDUY z&)lh0WjVbSSKV@w^;C<@3;)!L%ebPqpr+)>TK3L%QPeh_jDT>K82`BhbWQ^5QwKxM z`$)-~Nv;9b8;COfQ{Sfvht4tqFQH>SCkbAOFg|y;3B|Qj9a9cAc)kB?n##tgRQv6U ztekkYZtq#0$$`thf8e+Nch_2Vo#oKunVs&^JUQg`Z2xdoro z<4S%)w8hjFkT8SOSC)QYT1w@MTgpZI%7iw&{PfA*{Fcp>slk%(7WhOT5FdlyiUajR z`E;|x#q_c2k&S+BBNHC{fno1w?JR;(YQSCMGT=qH<{U|t`ejB;BqF44RhdrY6u^TM z*3Q<>wLoKu)gIb3!{6jF)tmNKZ!j)ev*YjW2l6}4jb6@~`;u{c!rDSujaGMoeyV2A zCCTt>t<_=&Wq7K3IxZ}|epD)(WTr{#h;iSaT%%Gw=sfjhWjE}X>*D%%ehileeu{P< zGBdIPCiGS(xWt?~_5QK(>}N&CPI=piRPS1q18=(bB5+@^AmwGBQevBmeTB z9FzU0ilH^C#0{?K(GOBFague7o0z&16|tCj=*WWijyI|{GU%NJa7VH4<{egYXgh*Z zrL%ENGCF#{KmfH)+p8Eu2(vcX&SIr|^2oMexn0I!0xg&uAig*8LAQcquB_&J(a$l#}^ z*=BnPkZ8*TSo>tISK4cM#&y#&I*m=3F4;Z&BUh{^ruPI}_!1^~rWGg>FGQO$Klv(- zpL_hhfD$1er8{D&wxAjKYO2djNhax;nTTTK3GcyXgLkbbl3tf)Wym&Q=7HHxgWRd! z)>yG!dyF4?`s-Kn3@b3M&E7j;wqv`z$o}Z6h|0GfwDfw4pyDvMH(g_LDQ1ir6 z7fq_d0VSr=t9SIsK;Jh~1J9=aI2gq+X);s3>Gh+pXB?4AGw~A@G0Ql!s%3#u-H%T; zxZoX!%WTw&|JY0B{X$pLRk!5$KU+Z#v#0DlYhADPmga0fU9Y!&ePp?fX65<>KK?+13?K`SPCkDj zVAN8hSC!ppp^#q2bec*65lp_X7`alPx*`Cxi%{9KPlpUrE9$k&o+B6#bq6c7)X%}& zC|`F`6Wsh+cj?;>ahjY>eo~UxDpVU7xc;P^(`VoNsY}1R$3%1Q7!<~dwi0!U=#lgB znJ3Xqsf=DAO>J59{22VLe2c9xSp~+yD9yxlYry@7TEmd+q{XRC;+dH>rQT7EwDqhL zgB8^f17EcD#I=_QXrL|okORLmRD;@&2TI8urTtqMo8`Tf_EQF;XqP>XEGIfw20cRefX+j;J*QWt4RQ+|>4YR(5AtN)L8LH*A zR8qFxenx5+IkouW9{pvxRP>num(UFpqCd>~1Qn^5sFP^_mNmL>eEUI_mh!59h&^a& zXxl^mU(NZG#;;4EuGoui)Y~wR`JXE@#*nD2WGJfO|9km110va@pqBNbOw`0=qt;Zc zxf2f~1~XmbZ?$13KvXwa1;x6^c$OpL^UBLmW6ej=&k#>0gVhZ)JBeMi#^{ayf!}$Z z7gI>&L2+)~k^N8IPZK`{b>-=&^X?OKUQ~B1v(Ul0kzFEUa^n~KTYDFZ<=i#kSc$6{ zL+~ybq=}R5>-oZ|9{C-N@O`1!?)9cReJ`Q^V~bW&*~kacdfWJt8g3e!(HXuwYprn~ zgKfp`5;*jlcAbn=(rwo3y@5#+o{_G?k=xh0|H*J8M1U(FZ4&pgnFY%K7O;Cn;Bt_w zPr#6vFK3LYN+<*bj?e@X%&<3pMKzj2fK zXe74}-#!#TH#z%bL8bK4IFvfQh2aamn+dV?T&@QE5KFiIS;AOkN=Ze6i&4bG(^_}4 z>>iyND2#(7+fctBvAoESbUk1%D=i6n(@(n}|>oBMuw6Vkx3Ry}7X+}r}f)`4z zvzaqG@ZyQhr2#d!5#mY5ZDcf;XAfSkStpUE`cL4}f442N5=797a_4*)K|N+4I=)G; zQ8LZ%OsHX=sYUzlu$lSB zCR|;9rAD;(W#pJ-vBh|`2$>22T1yUF@$co^riIqPD{o;2BgM7mwFLFTUSe?rwGumY zGA(<~>r-%Um&44agw{|q7jUNw-rZA4%+c_t;Pr22XB#(Zw?<4z+f|a6jNeM)np4); zy+Rv2;Wbr4X1V`7Ci3g^pJ;R02iTxHd?{vd_gZn&wR4%6fR2Sgc;o^!W53P{POfuo() zivkttuZ1oeeBcVkXL=RMx|2{C)_ZIkYgZL5N0N% zoCRz|>x6oVI?9A11I}{XYwFmsvnMwnB+@qU5@MZgj)!!$7EiwIoCaZmeDFeMt_m49 z$?T)c9nX7cy;PjOQLryF- zKA4|vZ5ekTx*cP(P9#dKr9X-l@B5NlG%pU1Ha$H}YyE5pS1bMPQOlQtW+dTXiG`Zf zAHvA)07q;LjaU2a9Spr6u!cfwhK%8aMl=|L+z^!~`gG&TQZt|Wq(c!!kCC$^$8U`0 z>;s}yV|zbyCoB3V%Q=&n@9$b`Zn#6Ve)?w&;Ro9<|FSOcc7AjHcSVDr9-XYYA$D=j z#KEtgzQ(ZFOn1fFRrHUPaYlED2k%%bfWecat+(!C`H$FJ3TWKNrM)H~a?0P{F-9B( zC=#T&5V!QpKJq^wkgW#eZUX8Rm{J{VUB9Wg6=E*Dt7+h(t#>LZ-V^Kbu;yQSm_Y})q;hc9GzAS?z*TPfYn7uzx@5e|lCUV7tBa(h!w zsP016gR_4e@Ex!C?JzpH%H zDpING)OxHm3O-9^7e8eanJ;p2n;uJ|ffassL0MQnm%6dM;HL zr52Xt6M8*ldxgyCx;#Eir|aOZYu?SPa1}>RY2$`P<_lZ-tAO@%>YEGf9fMIl(noG$;OMr)7spOGuY_?T&adJN%;-^IX=9Sh|up z#UhjRC3S`fqx_RZ`cLIJ|EB+K)aUon7{3n_`F)lOqHKR3CG-0vo!GvsG|0jot^)2vRe(wHG?N0nD>_CF_V`liLbzIrN!||Le-J0&`=1SUk!|WRu|4Y(3 Mrhhc`h}E_K0cCQtZ~y=R literal 0 HcmV?d00001 diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml index f89fd45581..e81d3d8b79 100644 --- a/spring-5-reactive/pom.xml +++ b/spring-5-reactive/pom.xml @@ -39,10 +39,6 @@ javax.json.bind javax.json.bind-api - - org.springframework.boot - spring-boot-starter-actuator - org.projectlombok lombok @@ -86,10 +82,6 @@ ${commons-collections4.version} test - - org.apache.commons - commons-lang3 - io.reactivex.rxjava2 @@ -102,15 +94,6 @@ ${project-reactor-test} test - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.security - spring-security-test - test - diff --git a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java index 402b607b19..a1d5d87d5c 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java +++ b/spring-5-reactive/src/main/java/com/baeldung/functional/FunctionalSpringBootApplication.java @@ -21,9 +21,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.springframework.core.io.ClassPathResource; import org.springframework.http.server.reactive.HttpHandler; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; @@ -68,18 +65,6 @@ public class FunctionalSpringBootApplication { return registrationBean; } - @Configuration - @EnableWebSecurity - @Profile("!https") - static class SecurityConfig extends WebSecurityConfigurerAdapter { - @Override - protected void configure(final HttpSecurity http) throws Exception { - http.authorizeRequests() - .anyRequest() - .permitAll(); - } - } - public static void main(String[] args) { SpringApplication.run(FunctionalSpringBootApplication.class, args); } diff --git a/spring-5-reactive/src/main/resources/application.properties b/spring-5-reactive/src/main/resources/application.properties index 234834b894..92f3116f84 100644 --- a/spring-5-reactive/src/main/resources/application.properties +++ b/spring-5-reactive/src/main/resources/application.properties @@ -1,5 +1,2 @@ logging.level.root=INFO -management.endpoints.web.exposure.include.=* - -info.app.name=Spring Boot 2 actuator Application From bbb6f5f2c50fc73b1326884e113d850858188cf2 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 17 Aug 2018 14:03:32 +0300 Subject: [PATCH 210/298] add new project --- pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pom.xml b/pom.xml index 5a46ae2b19..e7ea24a544 100644 --- a/pom.xml +++ b/pom.xml @@ -441,7 +441,9 @@ spring-4 spring-5 spring-5-reactive + spring-5-reactive-security spring-5-reactive-client + spring-5-reactive-security spring-5-mvc spring-5-security spring-activiti @@ -698,6 +700,7 @@ spring-4 spring-5 spring-5-reactive + spring-5-reactive-security spring-5-reactive-client spring-5-mvc spring-5-security @@ -978,6 +981,7 @@ spark-java spring-4 spring-5-reactive + spring-5-reactive-security spring-5-reactive-client spring-5-mvc spring-5-security From 967480b347892a046866a8da728b0fd47d084134 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 17 Aug 2018 14:47:56 +0300 Subject: [PATCH 211/298] fix duplicate module --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index e7ea24a544..70d85873b7 100644 --- a/pom.xml +++ b/pom.xml @@ -443,7 +443,6 @@ spring-5-reactive spring-5-reactive-security spring-5-reactive-client - spring-5-reactive-security spring-5-mvc spring-5-security spring-activiti From 2ac42e378d4d9559e4b36bec89b4b670cd17f2bc Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 17 Aug 2018 14:50:52 +0300 Subject: [PATCH 212/298] fix links --- spring-5-reactive-security/README.md | 10 +--------- spring-5-reactive/README.md | 5 +---- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/spring-5-reactive-security/README.md b/spring-5-reactive-security/README.md index 0a7fe7a47e..1b298df86c 100644 --- a/spring-5-reactive-security/README.md +++ b/spring-5-reactive-security/README.md @@ -1,18 +1,10 @@ -## Spring REST Example Project +## Spring 5 Reactive Security Examples ### The Course The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles -- [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web) -- [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient) - [Spring Boot Actuator](http://www.baeldung.com/spring-boot-actuators) -- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching) - [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive) -- [Reactive WebSockets with Spring 5](http://www.baeldung.com/spring-5-reactive-websockets) -- [Spring Webflux Filters](http://www.baeldung.com/spring-webflux-filters) -- [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) - [Guide to Spring 5 WebFlux](http://www.baeldung.com/spring-webflux) diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md index 0a7fe7a47e..0665eb4f57 100644 --- a/spring-5-reactive/README.md +++ b/spring-5-reactive/README.md @@ -1,4 +1,4 @@ -## Spring REST Example Project +## Spring 5 Reactive Project ### The Course The "REST With Spring" Classes: http://bit.ly/restwithspring @@ -7,12 +7,9 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web) - [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient) -- [Spring Boot Actuator](http://www.baeldung.com/spring-boot-actuators) - [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching) -- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive) - [Reactive WebSockets with Spring 5](http://www.baeldung.com/spring-5-reactive-websockets) - [Spring Webflux Filters](http://www.baeldung.com/spring-webflux-filters) - [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) -- [Guide to Spring 5 WebFlux](http://www.baeldung.com/spring-webflux) From 79a8c80853aca952a184831def891feef443d55b Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 17 Aug 2018 15:39:55 +0300 Subject: [PATCH 213/298] fix equals method --- .../src/main/java/com/baeldung/hashcode/entities/User.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java/src/main/java/com/baeldung/hashcode/entities/User.java b/core-java/src/main/java/com/baeldung/hashcode/entities/User.java index c46c3de65a..75a1c363da 100644 --- a/core-java/src/main/java/com/baeldung/hashcode/entities/User.java +++ b/core-java/src/main/java/com/baeldung/hashcode/entities/User.java @@ -25,7 +25,7 @@ public class User { if (this.getClass() != o.getClass()) return false; User user = (User) o; - return id != user.id && (!name.equals(user.name) && !email.equals(user.email)); + return id == user.id && (name.equals(user.name) && email.equals(user.email)); } @Override From 061d1191f107fde0d8690348f9d8131ac7bccc29 Mon Sep 17 00:00:00 2001 From: Patryk Date: Fri, 17 Aug 2018 15:00:08 +0200 Subject: [PATCH 214/298] Bael 1704 (#4973) * BAEL-1704: Non-Trivial Work in Kotlin vs Java * BAEL-1704: Non-Trivial Work in Kotlin vs Java Renaming one test class * BAEL-1704: Kotlin vs Java * BAEL-1704: Kotlin vs Java The files moved to the guest branch. --- guest/core-kotlin/.gitignore | 14 ++ guest/core-kotlin/pom.xml | 199 ++++++++++++++++++ .../kotlinvsjava/CompanionObjectTest.kt | 0 .../baeldung/kotlinvsjava/ConstructorTest.kt | 0 .../baeldung/kotlinvsjava/DataClassTest.kt | 0 .../baeldung/kotlinvsjava/DelegationTest.kt | 0 .../baeldung/kotlinvsjava/ExceptionsTest.kt | 2 +- .../kotlinvsjava/ExtensionFunctionsTest.kt | 0 .../baeldung/kotlinvsjava/FunctionsTest.kt | 0 .../baeldung/kotlinvsjava/IsOperatorTest.kt | 0 .../baeldung/kotlinvsjava/NullSafetyTest.kt | 0 .../kotlinvsjava/OperatorsOverloadingTest.kt | 0 .../baeldung/kotlinvsjava/PropertiesTest.kt | 0 13 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 guest/core-kotlin/.gitignore create mode 100644 guest/core-kotlin/pom.xml rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/CompanionObjectTest.kt (100%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/ConstructorTest.kt (100%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/DataClassTest.kt (100%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/DelegationTest.kt (100%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt (88%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/ExtensionFunctionsTest.kt (100%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/FunctionsTest.kt (100%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/IsOperatorTest.kt (100%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/NullSafetyTest.kt (100%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/OperatorsOverloadingTest.kt (100%) rename {core-kotlin => guest/core-kotlin}/src/test/kotlin/com/baeldung/kotlinvsjava/PropertiesTest.kt (100%) diff --git a/guest/core-kotlin/.gitignore b/guest/core-kotlin/.gitignore new file mode 100644 index 0000000000..0c017e8f8c --- /dev/null +++ b/guest/core-kotlin/.gitignore @@ -0,0 +1,14 @@ +/bin/ + +#ignore gradle +.gradle/ + + +#ignore build and generated files +build/ +node/ +out/ + +#ignore installed node modules and package lock file +node_modules/ +package-lock.json diff --git a/guest/core-kotlin/pom.xml b/guest/core-kotlin/pom.xml new file mode 100644 index 0000000000..6b189143a4 --- /dev/null +++ b/guest/core-kotlin/pom.xml @@ -0,0 +1,199 @@ + + + 4.0.0 + core-kotlin + 1.0-SNAPSHOT + com.stackify + jar + + + + jcenter + http://jcenter.bintray.com + + + + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin-stdlib.version} + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin-stdlib.version} + + + org.jetbrains.kotlin + kotlin-test-junit + ${kotlin-test-junit.version} + test + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin-reflect.version} + + + org.jetbrains.spek + spek-api + 1.1.5 + test + + + org.jetbrains.spek + spek-subject-extension + 1.1.5 + test + + + org.jetbrains.spek + spek-junit-platform-engine + 1.1.5 + test + + + com.nhaarman + mockito-kotlin + ${mockito-kotlin.version} + test + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + test + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin-maven-plugin.version} + provided + + + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin-maven-plugin.version} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + + + + default-compile + none + + + + default-testCompile + none + + + java-compile + compile + + compile + + + + + + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + org.junit.platform + junit-platform-surefire-provider + ${junit.platform.version} + + + + + junit5 + + integration-test + verify + + + + **/*Test5.java + + + + + + + + + + 2.22.0 + UTF-8 + 1.2.60 + 1.2.51 + 1.2.51 + 1.2.51 + 0.22.5 + 1.5.0 + 3.6.1 + 1.0.0 + 5.2.0 + 3.10.0 + 3.7.0 + + + diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/CompanionObjectTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/CompanionObjectTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/CompanionObjectTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/CompanionObjectTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ConstructorTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ConstructorTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ConstructorTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ConstructorTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DataClassTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DataClassTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DataClassTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DataClassTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DelegationTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DelegationTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DelegationTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/DelegationTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt similarity index 88% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt index d1b3390544..073c4dd890 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt +++ b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExceptionsTest.kt @@ -24,7 +24,7 @@ class ExceptionsTest { fun givenANullString_whenUsingElvisOperator_thenExceptionIsThrown() { val sampleString: String? = null - val length: Int = sampleString?.length ?: throw IllegalArgumentException("String must not be null") + sampleString?.length ?: throw IllegalArgumentException("String must not be null") } private fun funThrowingException(): Nothing { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExtensionFunctionsTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExtensionFunctionsTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExtensionFunctionsTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/ExtensionFunctionsTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/FunctionsTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/FunctionsTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/FunctionsTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/FunctionsTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/IsOperatorTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/IsOperatorTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/IsOperatorTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/IsOperatorTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/NullSafetyTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/NullSafetyTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/NullSafetyTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/NullSafetyTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/OperatorsOverloadingTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/OperatorsOverloadingTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/OperatorsOverloadingTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/OperatorsOverloadingTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/PropertiesTest.kt b/guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/PropertiesTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/PropertiesTest.kt rename to guest/core-kotlin/src/test/kotlin/com/baeldung/kotlinvsjava/PropertiesTest.kt From 65fa376887740ecab6b29254d6f5aaff37bfd796 Mon Sep 17 00:00:00 2001 From: Alejandro Gervasio Date: Fri, 17 Aug 2018 19:50:13 -0300 Subject: [PATCH 215/298] BAEL #4987 - Java Constructors vs Static Factory Methods (#4987) * Initial Commit * Update User.java * Update UserUnitTest.java * Update User.java - UserUnitTest.java * Update User.java --- .../constructorsstaticfactorymethods/entities/User.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java b/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java index ec7bf6b5fa..4036b622c6 100644 --- a/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java +++ b/core-java/src/main/java/com/baeldung/constructorsstaticfactorymethods/entities/User.java @@ -8,7 +8,7 @@ import java.util.logging.SimpleFormatter; public class User { - private static User instance = null; + private static volatile User instance = null; private static final Logger LOGGER = Logger.getLogger(User.class.getName()); private final String name; private final String email; From 9bb33102f97badd68ffcba5b17cf4cc7087e80d3 Mon Sep 17 00:00:00 2001 From: Kartik Singla Date: Sat, 18 Aug 2018 11:10:55 +0530 Subject: [PATCH 216/298] [BAEL-1858] - How to mock a static method using JMockit (#4925) --- .../baeldung/mocks/jmockit/AppManager.java | 26 +++++++++++ .../mocks/jmockit/AppManagerUnitTest.java | 44 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 testing-modules/mocks/jmockit/src/main/java/com/baeldung/mocks/jmockit/AppManager.java create mode 100644 testing-modules/mocks/jmockit/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java diff --git a/testing-modules/mocks/jmockit/src/main/java/com/baeldung/mocks/jmockit/AppManager.java b/testing-modules/mocks/jmockit/src/main/java/com/baeldung/mocks/jmockit/AppManager.java new file mode 100644 index 0000000000..615650ea6d --- /dev/null +++ b/testing-modules/mocks/jmockit/src/main/java/com/baeldung/mocks/jmockit/AppManager.java @@ -0,0 +1,26 @@ +package com.baeldung.mocks.jmockit; + +import java.util.Random; + +public class AppManager { + + public boolean managerResponse(String question) { + return AppManager.isResponsePositive(question); + } + + public static boolean isResponsePositive(String value) { + if (value == null) + return false; + int orgLength = value.length(); + int randomNumber = randomNumber(); + return orgLength == randomNumber ? true : false; + } + + private static int randomNumber() { + return new Random().nextInt(7); + } + + private static Integer stringToInteger(String num) { + return Integer.parseInt(num); + } +} diff --git a/testing-modules/mocks/jmockit/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java b/testing-modules/mocks/jmockit/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java new file mode 100644 index 0000000000..2c5aa2a3ed --- /dev/null +++ b/testing-modules/mocks/jmockit/src/test/java/com/baeldung/mocks/jmockit/AppManagerUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.mocks.jmockit; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import mockit.Deencapsulation; +import mockit.Mock; +import mockit.MockUp; + +public class AppManagerUnitTest { + + private AppManager appManager; + + @BeforeEach + public void setUp() { + appManager = new AppManager(); + } + + @Test + public void givenAppManager_whenStaticMethodCalled_thenValidateExpectedResponse() { + new MockUp() { + @Mock + public boolean isResponsePositive(String value) { + return false; + } + }; + + Assertions.assertFalse(appManager.managerResponse("Why are you coming late?")); + } + + @Test + public void givenAppManager_whenPrivateStaticMethod_thenValidateExpectedResponse() { + final int response = Deencapsulation.invoke(AppManager.class, "stringToInteger", "110"); + Assertions.assertEquals(110, response); + } + + @Test + public void givenAppManager_whenPrivateStaticMethod_thenExpectException() { + Assertions.assertThrows(IllegalArgumentException.class, () -> { + Deencapsulation.invoke(AppManager.class, "stringToInteger", "11r"); + }); + } +} From 36ec9311c28f0b048fc54e7ceef20b5c83720879 Mon Sep 17 00:00:00 2001 From: shreyas Date: Sat, 18 Aug 2018 11:44:14 +0530 Subject: [PATCH 217/298] Shreyas Mahajan - Adding unit tests for comparing flatmap and switchmap in RxJava --- .../RxFlatmapAndSwitchmapUnitTest.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 rxjava/src/test/java/com/baeldung/rxjava/operators/RxFlatmapAndSwitchmapUnitTest.java diff --git a/rxjava/src/test/java/com/baeldung/rxjava/operators/RxFlatmapAndSwitchmapUnitTest.java b/rxjava/src/test/java/com/baeldung/rxjava/operators/RxFlatmapAndSwitchmapUnitTest.java new file mode 100644 index 0000000000..ade48a2cb9 --- /dev/null +++ b/rxjava/src/test/java/com/baeldung/rxjava/operators/RxFlatmapAndSwitchmapUnitTest.java @@ -0,0 +1,65 @@ +package com.baeldung.rxjava.operators; + +import io.reactivex.Observable; +import io.reactivex.schedulers.TestScheduler; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.hamcrest.CoreMatchers.hasItems; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +public class RxFlatmapAndSwitchmapUnitTest { + @Test + public void givenObservable_whenFlatmap_shouldAssertAllItemsReturned() { + //given + List actualOutput = new ArrayList<>(); + final TestScheduler scheduler = new TestScheduler(); + final List keywordToSearch = Arrays.asList("b", "bo", "boo", "book", "books"); + + //when + Observable.fromIterable(keywordToSearch) + .flatMap(s -> Observable + .just(s + " FirstResult", s + " SecondResult") + .delay(10, TimeUnit.SECONDS, scheduler)) + .toList() + .doOnSuccess(s -> actualOutput.addAll(s)) + .subscribe(); + + scheduler.advanceTimeBy(1, TimeUnit.MINUTES); + + //then + assertThat(actualOutput, hasItems("b FirstResult", "b SecondResult", + "boo FirstResult", "boo SecondResult", + "bo FirstResult", "bo SecondResult", + "book FirstResult", "book SecondResult", + "books FirstResult", "books SecondResult")); + } + + @Test + public void givenObservable_whenSwitchmap_shouldAssertLatestItemReturned() { + //given + List actualOutput = new ArrayList<>(); + final TestScheduler scheduler = new TestScheduler(); + final List keywordToSearch = Arrays.asList("b", "bo", "boo", "book", "books"); + + //when + Observable.fromIterable(keywordToSearch) + .switchMap(s -> Observable + .just(s + " FirstResult", s + " SecondResult") + .delay(10, TimeUnit.SECONDS, scheduler)) + .toList() + .doOnSuccess(s -> actualOutput.addAll(s)) + .subscribe(); + + scheduler.advanceTimeBy(1, TimeUnit.MINUTES); + + //then + assertEquals(2, actualOutput.size()); + assertThat(actualOutput, hasItems("books FirstResult", "books SecondResult")); + } +} From 8c4585bc463bb6267852ae47c9ad2d195c2443ab Mon Sep 17 00:00:00 2001 From: Neeraj Yadav Date: Sat, 18 Aug 2018 14:28:03 +0530 Subject: [PATCH 218/298] Bael 1873 - Spring Data JPA Composable repository (#4953) * Merging into own fork (#3) * [BAEL-7621] - Fixed integration test of spring-hibernate-5 module by introducing H2 database * BAEL-1985: Added Examples showing how to Initialize HashSet when it's constructed (#4715) * Added Class for Initalizing HahsSet * Updated Class name * Delete InitializingSetTest.java * Copy list to another list examples (#4725) * Update README.MD (#4720) * [BAEL-7621] - Fixed integration test of spring-hibernate-5 module by introducing H2 database (#4728) * [BAEL-7645] - Fixed integration test of spring-jpa module through H2 inmemory DB * BAEL-1814 Guide to Spring Webflux (#4450) * BAEL-1814 Guide to Spring Webflux -Added files for Employee reactive application -Updated pom.xml for Spring Security * BAEL-1814 Guide to Spring Webflux -Added EmployeeControllerTest -Updated method name in EmployeeController and corrected secured url in EmployeeWebSecurityConfig * BAEL-1814 Guide to spring webflux -Fixed security config, now only specific url prompts for authentication and not all endpoints -Removed @WithMockUser as it is not needed now * BAEL-1814 Guide To Webflux -Feedback incorporation * BAEL-1814 Spring Webflux Guide -Formatted coded for EmployeeWebSocketHandler. * Update and rename EmployeeControllerTest.java to EmployeeControllerUnitTest.java * BAEL-1814 Guide to spring webflux -Fixed EmployeeControllerUnitTest.java * BAEL - 1916 (#4729) Code refactored * Renamed test methods to use BDD style * Fixed integration test of spring-jpa module through inmemory H2 DB (#4740) * [BAEL-7621] - Fixed integration test of spring-hibernate-5 module by introducing H2 database * [BAEL-7645] - Fixed integration test of spring-jpa module through H2 inmemory DB * guide to jmapper * [BAEL-7651] - Fixed integration tests of spring-security-mvc-custom module by adding proper authentication manager * clean only generated files * added spring-rest-hal-browser code (#4701) * Added spring-rest-template * Updated README.md file * Updated README.md file * Update Makefile * Update Makefile * moved AuthenticationFailureHandler example to spring-security-mvc-login * trying out separate modules in the integration profile * maven cleanup * fixing name of module * running group 2 * running group 1 * fixing relative path * Update Makefile * Update Makefile * Update JMapperIntegrationTest.java * Update JMapperRelationalIntegrationTest.java * Update MultipartFileUploadClient.java * BAEL-1914 refactor (#4749) * Server Sent Events example using Spring Webflux and React * spring security custom AuthenticationFailureHandler * refactor * moved SSE to branch * remove pom properties * moved AuthenticationFailureHandler example to spring-security-mvc-login * added link * trying out profile-driven build * minor maven cleanup * activating group 2 * Update README.md * BAEL-1850 (#4744) * Micronaut server * More server stuff; create client and test * Rename directory, new concerete client example * Remove hello-world directory from micronaut * Update MavenWrapperDownloader.java * running group 1, and small logging fix * jnosql * live test properly categorized * temporarily making a test live * moving the libraries module from group 1 * group 2 * enabling group 3 * * Added changes for BAEL-1922 Enable CORS in Spring Webflux (#4724) * BAEL-2018 (#4753) * BAEL-2018 * Update Animal.java * rename * running group 3 * jmeter excluded * running group 2 * properly classifying a testclear * live tests * BAEL-1838 (#4692) * #BAEL-1838 code samples. Renamed LambdaKotlinTest to have the build succeed. * #BAEL-1838 code samples w/inheritance. * #BAEL-1838 renamed logger helper function to getLogger to avoid confusion. * #BAEL-1838 renamed logger helper function to getLogger to avoid confusion. * BEAL-1985 - Removed Java 9 Example (#4734) * Added Class for Initalizing HahsSet * Updated Class name * Delete InitializingSetTest.java * Modified HashSet Initilization Example * Removed Java 9 Example * Update HashSetInitalizingUnitTest.java * Update HashSetInitalizingUnitTest.java * Update HashSetInitalizingUnitTest.java * Update HashSetInitalizingUnitTest.java * group 3.2 * enabling 3.1 * running group 3 * Update README.md Documenting the new default profile. * fixing the default profile testing config * groups 2 and 3 * minor major cleanup * BAEL-1907 Created new module spring-testing * new integration-lite profile * integration-lite work * BAEL-1862 Move the Junit 5 logic in the right module (#4747) * BAEL-1862 Move the Junit 5 logic in the right module -Moved Method Orders Tests from tutorails/junit5 project into correct project tutorials/testing-modules/junit-5 -Removed tutorials/junit5 project * Update DefaultOrderOfExecutionTest.java * Update README.md * BAEL-1862 Move the Junit 5 logic in the right module -Renamed *Test to *UnitTest * Update README.md * maven cleanup work * logging cleanup * BAEL-1907 Corrected formatting * working through modules * maven cleanup * trying problematic modules * integration heavy profile * maven work * Bael 1864 (#4727) * running project without building tests * include the DataCheck class * Update TestFail.java * guide to jmapper (#4745) * guide to jmapper * Update JMapperIntegrationTest.java * Update JMapperRelationalIntegrationTest.java * dupirefr/dupire.francois+pro@gmail.com [BAEL-1981] Query entities by dates and times with Spring Data JPA (#4737) * [BAEL-1981] Article entity and repository + tests * [BAEL-1981] Removing unnecessary fields * moving long-running module * BAEL-1992 * maven cleanup work * BAEL-1818 - A Guide to Connection Pools in Java (#4735) * Strange git issue with README.MD, wouldn't revert the file * Initial Commit * Initial Commit * Update pom.xml * Update pom.xml * Initial Commit * Update pom.xml * Update source files * Update source files * Update source files * Update source files * Update Application.java * Update pom.xml * Update HikariCPDataSourceUnitTest class * Update HikariCPDataSourceUnitTest.java * Update pom.xml * Update unit test classes * Update BasicConnectionPoolUnitTest.java * Fix indentation in DBCDDataSource class * Update DBCPDataSource.java * Update BasicConnectionPool class * Update BasicConnectionPool class * Update BasicConnectionPool.java * Update BasicConnectionPool.java * Update pom.xml * Update pom.xml * BAEL-1818 Refactored getConnection(), added shutdown(), cleaned up pom.xml * BAEL-1818 Removed getConnectionPool(), upgraded c3po version * BAEL-1818 Deleted obsolete connectionpool module * BAEL-1818 Deleted obsolete connectionpool module * move jmapper to libraries-data * [BAEL-7635] Removed test generated files : Will be gitignored * [BAEL-7635] - Commented out sortpom-maven-plugin that changes pom.xml in every build, added new entries in .gitignore * BAEL-1852 - Testing an Abstract Class with JUnit (#4773) * BAEL-1852 - Testing an Abstract Class with JUnit * Fixed test method names and class names according to naming compliances. * BAEL-1934 (#4768) * Bean Object, server side and client side example for event streaming example * BAEL-1628 Access a File from the Classpath in a Spring Application * inputstream retrieval added * Removed files related to evaluation article * + Aligning code to the article. Removed Utility methods and classes * BAEL - 1628 * PMD fixes * Code Review changes Refactored : whenResourceUtils_thenReadSuccessful * BAEL-1934 * +indentation correction in pom.xml * synced with master * indentation correction * update to spring 5 * Bael 2018 (#4774) * BAEL-2018 * Update Animal.java * rename * tests added * generic type shorten * update test * BAEL-1911 - Fixing author's review comments (#4782) * Strange git issue with README.MD, wouldn't revert the file * Fixing review comments * BAEL-1911 Refactored SQL code, fixed formatting * fix swagger parent * Update pom.xml * Update pom.xml * Overriding System time for testing (#4779) * Overriding System time for testing * Remove Joda Date Time examples * BAEL-1728: add java instrumentation * dupirefr/dupire.francois+pro@gmail.com [BAEL-1981] Spring data jpa dates (#4795) * [BAEL-1981] Article entity and repository + tests * [BAEL-1981] Removing unnecessary fields * [BAEL-1981] spring-data-jpa module creation * BAEL-1818 lamdba instead of loop; isEmpty() instead of == 0 (#4791) * BAEL-2018 Moved to core-java-collections (#4796) * BAEL-1691: comparing embedded servlet containers in spring boot * vaadin spring * format * remove reactive ex * move to reactive, extract mongodb ex * PR for http://jira.baeldung.com/browse/BAEL-1947 Spring Boot Vue (#4687) * commit first as binodpanta * revert test change * A short example of real-time event streaming using Spring WebFlux * Code for http://jira.baeldung.com/browse/BAEL-1527 * remove unrelated files * Apply feedback changes to rename test and remove link from readme file, ongoing work * Update formatting fixes to code and add pom changes, that partially fix test runnning issues in IDE but not in cmdline * Apply Eclipse formatter to test code and apply suggested pom fixes * BAEL-1527 Formatting fix in pom.xml * Use string.format to cleanup logging code * BAEL-1527 Changed logging pattern * Start the spring-boot-vue module, WIP * some small updates with comments * Add index html template page * merge pom.xml fixes * Add integration test with MockMvc to verify index.html content is rendered correctly * fix up pom merge issues * merge issues fix for pom * pom end of file newline * Update README.md * Update README.md (#4706) * add links (#4804) * Update README.md * Update README.md * Update README.md * Update README.md * Create README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.MD * Create README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * move mongodb ex * fix readme files * Bael 1832 (#4748) * @Primary annotation * @Primary annotation Employee name * Update PrimaryApplication.java * @Primary annotation with @Component * add security exc * added readme * added link * BAEL-2030 remove first element from list (#4803) * BAEL-2042 JavaFaker unit tests * Moved javafaker unit tests to testing-modules * Update PushController.java * * added examples of filtering collections using Streams, Apache CollectionUtils, Guava and Eclipse Collections * * Added examples for java-9 filtering collector * * minor fixes and cleaning duties * add elements to list (#4814) * BAEL-1960: Custom appender for log4j (#4731) * BAEL-1960: Custom appender for log4j * Changes as per suggestion to BAEL-1960 * Changes as [er review for BAEL-1960 * Changes for formatting as per suggestion. * BAEL-1960. Copied pom.xml from master and pasted my changes against it. * Chnages for spaces instead of tabs. * Changes for spaces instead of tabs. * PrincipalExtractor and AuthoritiesExtractor example * Bael 1743 improved (#4826) * compile only for firefox * added parent module * changed artifact id * commenting out problematic modules in the integration-lite build * integratio-lite profile work * integration-lite work * update spring data elasticsearch * BAEL-1818 A Simple Guide to Connection Pooling in Java (#4823) * Initial Commit * Update parent pom.xml * Update BasicConnectionPool class * Update BasicConnectionPool class * BAEL-1818 removed code from core-java module, cleaned up a little pom files * BAEL-1818 moved the code from connectionpool.connectionpools package to connectionpool * added link * integration-lite trying out a few modules * moved PrincipalExtractor and AuthoritiesExtractor example to spring-5-security module * removed comment on pom * [refs#BAEL-1992] Minor refactoring * BAEL-1983 Intialize a HashMap in Java (#4819) * move mqtt project * added link * Add items to list in core-java-collections (#4841) * [BAEL-7608] - Fixed spring-5-reactive integration tests * [BAEL-7608] - Reverted NettyContext to Embedded Tomcat example with Async = true * [BAEL-7608] - Removed unused imports * Update pom.xml * [BAEL-7609] - Fixed spring-boot integration tests * Added PR files for BAEL-2031 (#4844) * Added source files for BAEL-2031 * Added test files for BAEL-2031 * upgrade sockets to spring5 * BAEL-1979 Added examples for SnakeYAML Library (#4802) * BAEL-1979 Added examples for SnakeYAML Library * BAEL-1979 Moved the snakeyaml related code to libraries module * BAEL-1979 Removed the System.out.println() statements and converted the assertTrue to assertEquals wherever possible. * BAEL-1979 Removed println statements, small formatting fix in pom.xml * [BAEL-7608] - Fixed SecurityIntegrationTest with redirecting to login * Bael 1555 - Improve Example (#4852) * BAEL-1555 * Corrected indents and spacing * RequestMapping to GetMapping * Improved Performance For Concurrent Users * BAEL-1958 Log using SLF4J (#4790) * Log using SLF4J Jira Ticket: BAEL-1958 * Incorporate first review comments * Bael 2023 (#4851) * bael-2023: removing all occurrences of a value from a list * adjusting examples to match the article * [BAEL-7437] - Added spring tx dependency to fix spring-mvc-simple junit 5 TCs * add libraries server project * remove extra files * BAEL-1865 - Java Objects Sizes (#4584) * BAEL-1865 - Java Objects Sizes * BAEL-1865 - PR fix * OAuth2 Principal and Authorities example - refactor and added example using custom authorization server * Server-Sent Evensts * BAEL-1936 Use of FilenameFilter (#4520) * Added tests for FilenameFilter demo -added a test to show FilenameFilter implementation -added another test to show similar functionality using Predicate * refactored code to get directory at a single location * fixing formatting * changed test class name to conform to custom rule UnitTestNamingConventionRule lists the allowed test class names. Added ManualTest at the end to conform to the rule. * add new module * Update pom.xml (#4843) * BAEL-1861 - Running JUnit tests from a Java application (#4526) * BAEL-1562 - Thymeleaf sample working * BAEL-1562 Code added for Fragments sample * BAEL-1562 - Last correction for the test * BAEL-1562 - Thymeleaf sample working * BAEL-1562 Code added for Fragments sample * BAEL-1562 - Last correction for the test * Updates Thymeleaf version to 3.0.9.RELEASE * Added msf4j projects * updated msf4j project folder * fixed issue with spring-thymeleaf/pom.xml * Removed depedency-reduced-pom.xml * Whitespacing fix * Strange git issue with README.MD, wouldn't revert the file * Added jupiter api * Corrected junit test * Added test engine to plugin * Removed extra tag * Little fixes to junit4 and junit4 run from java * Removed scope from pom.xml * Removed bin file from testing * Slight changes for PMD * Slight changes for PMD * ok, moved code to another folder * Renamed and fixed runjunitfromjava * moved test classes to test folder * moved main to src/java * BAEL-1861 Moved test running classes to src/test/java * Added changes to runjunitfromjava * Added changes to runjunitfromjava * BAEL-1861 Changed test execution code examples * BAEL-1861 Changed test execution code examples; formatting * Bael 1852 - Test case code is aligned to support Junit5 (#4847) * add prototype bean ex with function * remove extra classes * remove extra import * separate configs * separate configs * Update AppConfig.java * Code update to support Junit5 * BAEL-1979 Added examples for SnakeYAML Library (#4802) * BAEL-1979 Added examples for SnakeYAML Library * BAEL-1979 Moved the snakeyaml related code to libraries module * BAEL-1979 Removed the System.out.println() statements and converted the assertTrue to assertEquals wherever possible. * BAEL-1979 Removed println statements, small formatting fix in pom.xml * BAEL-1852 Renamed one test method, fixed formatting * Bael 1273 Spring RSS Feed View (#4707) * Added example for BAEL-1273 - rss feed with Spring. * Fixed javadoc * Removed useless SpringBootServletInitializer in RSS app's launcher * Explicitely added Spring Boot starting class in pom.xml to prevent errors in package phase. * Adding files for Exception Handling article (#4507) * Adding files for Exception Handling article * Updating files * Test folder * testing renaming * Formatting and Naming Conventions This commit reworks the code for the Intro to Exception Handling article, ensuring that packages and classes are formatted and named according to site standards. * Update SseEmitterController.java (#4864) * fixing package hierarchy (*.list.list.listoflist -> *.list.listoflist) (#4879) * moved examples for 'removing all occurrences of an element from a list' to core-java-collections (#4878) * BAEL-1958 Moved the example to logging-modules (#4886) * Example for removing first element of array (BAEL-2029) (#4836) * Example for removing first element of array (BAEL-2029) * Use AssertJ assertions * BAEL-1986 List initialization in one line (#4696) * list initializations in one line * Enhance after review * formatting and naming * Formatting and renaming 2 * Unit tests and DequeBasedSynchronizedStack added up * Unit tests method names and class names modified as per the guidelines * BAEL-1840 Builder Pattern in Kotlin (#4730) * builder pattern in kotlin * builder pattern in kotlin new-line * deleted Sandbox, added unit test * add other tests * named and default parameters builder * Make FoodOrderNamed a data class * BAEL-1861 Replaced real tests with demo test "placeholders" (#4887) * Spring Boot and Angular E-Commerce Application (#4874) * Spring Boot and Angular E-Commerce Application * Spring Boot and Angular E-Commerce Application pom.xml updated * Spring Boot and Angular E-Commerce Application tests added * BAEL-7965 JMH module fails when build (#4888) * BAEL-7965 JMH module fails when build -Added jmh module in default profile in parent pom * Update pom.xml moved jmh module to integration profile * Create pom.xml * Create FunctionTestSuite.java BAEL-1857 * BAEL-1857 Running Parallel JUnit Tests with Maven * BAEL-1901 and BAEL-1555 add links (#4892) * 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-1967] - Custom validation MessageSource in Spring Boot * POM file updated for BAEL-1967 * BAEL-1704: Non-Trivial Work in Kotlin vs Java (#4861) * BAEL-1704: Non-Trivial Work in Kotlin vs Java * BAEL-1704: Non-Trivial Work in Kotlin vs Java Renaming one test class * Bael 1964 (#4881) * Added initial code for BAEL-1964, in-memory authentication application * Switched to default security encoder instead of a specific one * Fix typo (#4897) * add new module * fix typo * [BAEL-7670] Added logback.xml in missing modules in src/main/resources * Spring Data JPA Composable repository --- .../main/java/com/baeldung/domain/Item.java | 81 ++++++++++++++++ .../java/com/baeldung/domain/ItemType.java | 46 +++++++++ .../java/com/baeldung/domain/Location.java | 55 +++++++++++ .../main/java/com/baeldung/domain/Store.java | 76 +++++++++++++++ .../repository/CustomItemRepository.java | 15 +++ .../repository/CustomItemTypeRepository.java | 13 +++ .../repository/ItemTypeRepository.java | 10 ++ .../repository/LocationRepository.java | 10 ++ .../ReadOnlyLocationRepository.java | 15 +++ .../baeldung/repository/StoreRepository.java | 13 +++ .../impl/CustomItemRepositoryImpl.java | 32 +++++++ .../impl/CustomItemTypeRepositoryImpl.java | 31 +++++++ .../JpaRepositoriesIntegrationTest.java | 93 +++++++++++++++++++ .../src/test/resources/application.properties | 2 +- .../src/test/resources/import_articles.sql | 3 - .../src/test/resources/import_entities.sql | 21 +++++ 16 files changed, 512 insertions(+), 4 deletions(-) create mode 100644 spring-data-jpa/src/main/java/com/baeldung/domain/Item.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/domain/Location.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/domain/Store.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/repository/CustomItemRepository.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/repository/CustomItemTypeRepository.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/repository/ItemTypeRepository.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/repository/LocationRepository.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/repository/ReadOnlyLocationRepository.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/repository/StoreRepository.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/repository/impl/CustomItemRepositoryImpl.java create mode 100644 spring-data-jpa/src/main/java/com/baeldung/repository/impl/CustomItemTypeRepositoryImpl.java create mode 100644 spring-data-jpa/src/test/java/com/baeldung/repository/JpaRepositoriesIntegrationTest.java delete mode 100644 spring-data-jpa/src/test/resources/import_articles.sql create mode 100644 spring-data-jpa/src/test/resources/import_entities.sql diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java b/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java new file mode 100644 index 0000000000..97ce14d92d --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/domain/Item.java @@ -0,0 +1,81 @@ +package com.baeldung.domain; + +import java.math.BigDecimal; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +public class Item { + + private String color; + private String grade; + + @Id + private Long id; + + @ManyToOne + private ItemType itemType; + + private String name; + private BigDecimal price; + @ManyToOne + private Store store; + + public String getColor() { + return color; + } + + public String getGrade() { + return grade; + } + + public Long getId() { + return id; + } + + public ItemType getItemType() { + return itemType; + } + + public String getName() { + return name; + } + + public BigDecimal getPrice() { + return price; + } + + public Store getStore() { + return store; + } + + public void setColor(String color) { + this.color = color; + } + + public void setGrade(String grade) { + this.grade = grade; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItemType(ItemType itemType) { + this.itemType = itemType; + } + + public void setName(String name) { + this.name = name; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public void setStore(Store store) { + this.store = store; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java b/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java new file mode 100644 index 0000000000..412079c2ae --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/domain/ItemType.java @@ -0,0 +1,46 @@ +package com.baeldung.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; + +@Entity +public class ItemType { + + @Id + private Long id; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "ITEM_TYPE_ID") + private List items = new ArrayList<>(); + + private String name; + + public Long getId() { + return id; + } + + public List getItems() { + return items; + } + + public String getName() { + return name; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItems(List items) { + this.items = items; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java b/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java new file mode 100644 index 0000000000..2178d378eb --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/domain/Location.java @@ -0,0 +1,55 @@ +package com.baeldung.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; + +@Entity +public class Location { + + private String city; + private String country; + @Id + private Long id; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "LOCATION_ID") + private List stores = new ArrayList<>(); + + public String getCity() { + return city; + } + + public String getCountry() { + return country; + } + + public Long getId() { + return id; + } + + public List getStores() { + return stores; + } + + public void setCity(String city) { + this.city = city; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setId(Long id) { + this.id = id; + } + + public void setStores(List stores) { + this.stores = stores; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java b/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java new file mode 100644 index 0000000000..e04684c479 --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/domain/Store.java @@ -0,0 +1,76 @@ +package com.baeldung.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; + +@Entity +public class Store { + + private Boolean active; + @Id + private Long id; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "STORE_ID") + private List items = new ArrayList<>(); + private Long itemsSold; + + @ManyToOne + private Location location; + + private String name; + + public Boolean getActive() { + return active; + } + + public Long getId() { + return id; + } + + public List getItems() { + return items; + } + + public Long getItemsSold() { + return itemsSold; + } + + public Location getLocation() { + return location; + } + + public String getName() { + return name; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItems(List items) { + this.items = items; + } + + public void setItemsSold(Long itemsSold) { + this.itemsSold = itemsSold; + } + + public void setLocation(Location location) { + this.location = location; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/repository/CustomItemRepository.java b/spring-data-jpa/src/main/java/com/baeldung/repository/CustomItemRepository.java new file mode 100644 index 0000000000..91eddb800a --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/repository/CustomItemRepository.java @@ -0,0 +1,15 @@ +package com.baeldung.repository; + +import org.springframework.stereotype.Repository; + +import com.baeldung.domain.Item; + +@Repository +public interface CustomItemRepository { + + void deleteCustom(Item entity); + + Item findItemById(Long id); + + void findThenDelete(Long id); +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/repository/CustomItemTypeRepository.java b/spring-data-jpa/src/main/java/com/baeldung/repository/CustomItemTypeRepository.java new file mode 100644 index 0000000000..77bbf294a0 --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/repository/CustomItemTypeRepository.java @@ -0,0 +1,13 @@ +package com.baeldung.repository; + +import org.springframework.stereotype.Repository; + +import com.baeldung.domain.ItemType; + +@Repository +public interface CustomItemTypeRepository { + + void deleteCustom(ItemType entity); + + void findThenDelete(Long id); +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/repository/ItemTypeRepository.java b/spring-data-jpa/src/main/java/com/baeldung/repository/ItemTypeRepository.java new file mode 100644 index 0000000000..c3146aa297 --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/repository/ItemTypeRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.domain.ItemType; + +@Repository +public interface ItemTypeRepository extends JpaRepository, CustomItemTypeRepository, CustomItemRepository { +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/repository/LocationRepository.java b/spring-data-jpa/src/main/java/com/baeldung/repository/LocationRepository.java new file mode 100644 index 0000000000..f119ff916b --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/repository/LocationRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.repository; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.domain.Location; + +@Repository +public interface LocationRepository extends JpaRepository { +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/repository/ReadOnlyLocationRepository.java b/spring-data-jpa/src/main/java/com/baeldung/repository/ReadOnlyLocationRepository.java new file mode 100644 index 0000000000..2107712484 --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/repository/ReadOnlyLocationRepository.java @@ -0,0 +1,15 @@ +package com.baeldung.repository; + +import java.util.Optional; + +import org.springframework.data.repository.Repository; + +import com.baeldung.domain.Location; + +@org.springframework.stereotype.Repository +public interface ReadOnlyLocationRepository extends Repository { + + Optional findById(Long id); + + Location save(Location location); +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/repository/StoreRepository.java b/spring-data-jpa/src/main/java/com/baeldung/repository/StoreRepository.java new file mode 100644 index 0000000000..939ca1dacb --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/repository/StoreRepository.java @@ -0,0 +1,13 @@ +package com.baeldung.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.domain.Store; + +@Repository +public interface StoreRepository extends JpaRepository { + List findStoreByLocationId(Long locationId); +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/repository/impl/CustomItemRepositoryImpl.java b/spring-data-jpa/src/main/java/com/baeldung/repository/impl/CustomItemRepositoryImpl.java new file mode 100644 index 0000000000..44492a8f35 --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/repository/impl/CustomItemRepositoryImpl.java @@ -0,0 +1,32 @@ +package com.baeldung.repository.impl; + +import javax.persistence.EntityManager; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import com.baeldung.domain.Item; +import com.baeldung.repository.CustomItemRepository; + +@Repository +public class CustomItemRepositoryImpl implements CustomItemRepository { + + @Autowired + private EntityManager entityManager; + + @Override + public void deleteCustom(Item item) { + entityManager.remove(item); + } + + @Override + public Item findItemById(Long id) { + return entityManager.find(Item.class, id); + } + + @Override + public void findThenDelete(Long id) { + final Item item = entityManager.find(Item.class, id); + entityManager.remove(item); + } +} diff --git a/spring-data-jpa/src/main/java/com/baeldung/repository/impl/CustomItemTypeRepositoryImpl.java b/spring-data-jpa/src/main/java/com/baeldung/repository/impl/CustomItemTypeRepositoryImpl.java new file mode 100644 index 0000000000..594fd24ea9 --- /dev/null +++ b/spring-data-jpa/src/main/java/com/baeldung/repository/impl/CustomItemTypeRepositoryImpl.java @@ -0,0 +1,31 @@ +package com.baeldung.repository.impl; + +import javax.persistence.EntityManager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import com.baeldung.domain.ItemType; +import com.baeldung.repository.CustomItemTypeRepository; + +@Repository +public class CustomItemTypeRepositoryImpl implements CustomItemTypeRepository { + + private static final Logger LOGGER = LoggerFactory.getLogger(CustomItemTypeRepositoryImpl.class); + + @Autowired + private EntityManager entityManager; + + @Override + public void deleteCustom(ItemType itemType) { + entityManager.remove(itemType); + } + + @Override + public void findThenDelete(Long id) { + ItemType itemTypeToDelete = entityManager.find(ItemType.class, id); + entityManager.remove(itemTypeToDelete); + } +} diff --git a/spring-data-jpa/src/test/java/com/baeldung/repository/JpaRepositoriesIntegrationTest.java b/spring-data-jpa/src/test/java/com/baeldung/repository/JpaRepositoriesIntegrationTest.java new file mode 100644 index 0000000000..d8b7bc4a88 --- /dev/null +++ b/spring-data-jpa/src/test/java/com/baeldung/repository/JpaRepositoriesIntegrationTest.java @@ -0,0 +1,93 @@ +package com.baeldung.repository; + +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertFalse; +import static junit.framework.TestCase.assertNotNull; +import static junit.framework.TestCase.assertNull; +import static junit.framework.TestCase.assertTrue; + +import java.util.List; +import java.util.Optional; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.domain.Item; +import com.baeldung.domain.ItemType; +import com.baeldung.domain.Location; +import com.baeldung.domain.Store; + +@RunWith(SpringRunner.class) +@DataJpaTest +public class JpaRepositoriesIntegrationTest { + @Autowired + private LocationRepository locationRepository; + @Autowired + private StoreRepository storeRepository; + @Autowired + private ItemTypeRepository compositeRepository; + @Autowired + private ReadOnlyLocationRepository readOnlyRepository; + + @Test + public void whenSaveLocation_ThenGetSameLocation() { + Location location = new Location(); + location.setId(100L); + location.setCountry("Country H"); + location.setCity("City Hundred"); + location = locationRepository.saveAndFlush(location); + + Location otherLocation = locationRepository.getOne(location.getId()); + assertEquals("Country H", otherLocation.getCountry()); + assertEquals("City Hundred", otherLocation.getCity()); + + locationRepository.delete(otherLocation); + } + + @Test + public void givenLocationId_whenFindStores_thenGetStores() { + List stores = storeRepository.findStoreByLocationId(1L); + assertEquals(1, stores.size()); + } + + @Test + public void givenItemTypeId_whenDeleted_ThenItemTypeDeleted() { + Optional itemType = compositeRepository.findById(1L); + assertTrue(itemType.isPresent()); + compositeRepository.deleteCustom(itemType.get()); + itemType = compositeRepository.findById(1L); + assertFalse(itemType.isPresent()); + } + + @Test + public void givenItemId_whenUsingCustomRepo_ThenDeleteAppropriateEntity() { + Item item = compositeRepository.findItemById(1L); + assertNotNull(item); + compositeRepository.deleteCustom(item); + item = compositeRepository.findItemById(1L); + assertNull(item); + } + + @Test + public void givenItemAndItemType_WhenAmbiguousDeleteCalled_ThenItemTypeDeletedAndNotItem() { + Optional itemType = compositeRepository.findById(1L); + assertTrue(itemType.isPresent()); + Item item = compositeRepository.findItemById(2L); + assertNotNull(item); + + compositeRepository.findThenDelete(1L); + Optional sameItemType = compositeRepository.findById(1L); + assertFalse(sameItemType.isPresent()); + Item sameItem = compositeRepository.findItemById(2L); + assertNotNull(sameItem); + } + + @Test + public void whenCreatingReadOnlyRepo_thenHaveOnlyReadOnlyOperationsAvailable() { + Optional location = readOnlyRepository.findById(1L); + assertNotNull(location); + } +} diff --git a/spring-data-jpa/src/test/resources/application.properties b/spring-data-jpa/src/test/resources/application.properties index de6ee2e6b5..73d72bc7d6 100644 --- a/spring-data-jpa/src/test/resources/application.properties +++ b/spring-data-jpa/src/test/resources/application.properties @@ -12,4 +12,4 @@ hibernate.cache.use_second_level_cache=true hibernate.cache.use_query_cache=true hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory -spring.datasource.data=import_articles.sql \ No newline at end of file +spring.datasource.data=import_entities.sql \ No newline at end of file diff --git a/spring-data-jpa/src/test/resources/import_articles.sql b/spring-data-jpa/src/test/resources/import_articles.sql deleted file mode 100644 index 4fe18bf4aa..0000000000 --- a/spring-data-jpa/src/test/resources/import_articles.sql +++ /dev/null @@ -1,3 +0,0 @@ -insert into Article(id, publication_date, publication_time, creation_date_time) values(1, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:00', 'HH24:MI'), TO_DATE('31/12/2017 07:30', 'DD/MM/YYYY HH24:MI')); -insert into Article(id, publication_date, publication_time, creation_date_time) values(2, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:30', 'HH24:MI'), TO_DATE('15/12/2017 08:00', 'DD/MM/YYYY HH24:MI')); -insert into Article(id, publication_date, publication_time, creation_date_time) values(3, TO_DATE('15/12/2017', 'DD/MM/YYYY'), TO_DATE('16:00', 'HH24:MI'), TO_DATE('01/12/2017 13:45', 'DD/MM/YYYY HH24:MI')); \ No newline at end of file diff --git a/spring-data-jpa/src/test/resources/import_entities.sql b/spring-data-jpa/src/test/resources/import_entities.sql new file mode 100644 index 0000000000..deb9d07f05 --- /dev/null +++ b/spring-data-jpa/src/test/resources/import_entities.sql @@ -0,0 +1,21 @@ +insert into Article(id, publication_date, publication_time, creation_date_time) values(1, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:00', 'HH24:MI'), TO_DATE('31/12/2017 07:30', 'DD/MM/YYYY HH24:MI')); +insert into Article(id, publication_date, publication_time, creation_date_time) values(2, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:30', 'HH24:MI'), TO_DATE('15/12/2017 08:00', 'DD/MM/YYYY HH24:MI')); +insert into Article(id, publication_date, publication_time, creation_date_time) values(3, TO_DATE('15/12/2017', 'DD/MM/YYYY'), TO_DATE('16:00', 'HH24:MI'), TO_DATE('01/12/2017 13:45', 'DD/MM/YYYY HH24:MI')); + +insert into location (id, country, city) values (1, 'Country X', 'City One'); +insert into location (id, country, city) values (2, 'Country X', 'City Two'); +insert into location (id, country, city) values (3, 'Country X', 'City Three'); + +insert into store (id, name, location_id, items_sold, active) values (1, 'Store One', 3, 130000, true); +insert into store (id, name, location_id, items_sold, active) values (2, 'Store Two', 1, 170000, false); + +insert into item_type (id, name) values (1, 'Food'); +insert into item_type (id, name) values (2, 'Furniture'); +insert into item_type (id, name) values (3, 'Electronics'); + +insert into item (id, name, store_id, item_type_id, price, grade, color) values (1, 'Food Item One', 1, 1, 100, 'A', 'Color x'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (2, 'Furniture Item One', 1, 2, 2500, 'B', 'Color y'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (3, 'Food Item Two', 1, 1, 35, 'A', 'Color z'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (5, 'Furniture Item Two', 2, 2, 1600, 'A', 'Color w'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (6, 'Food Item Three', 2, 1, 5, 'B', 'Color a'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (7, 'Electronics Item One', 2, 3, 999, 'B', 'Color b'); From 538d2a4ef1bd87ae6c998620ee55a7b0dcf48900 Mon Sep 17 00:00:00 2001 From: saikat Date: Sat, 18 Aug 2018 14:40:54 +0530 Subject: [PATCH 219/298] Code sample for BAEL-2085 --- .../java/org/baeldung/gson/entities/User.java | 19 ++++++++ .../serialization/test/JsonFileUnitTest.java | 43 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 gson/src/main/java/org/baeldung/gson/entities/User.java create mode 100644 gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java diff --git a/gson/src/main/java/org/baeldung/gson/entities/User.java b/gson/src/main/java/org/baeldung/gson/entities/User.java new file mode 100644 index 0000000000..b413f3300e --- /dev/null +++ b/gson/src/main/java/org/baeldung/gson/entities/User.java @@ -0,0 +1,19 @@ +package org.baeldung.gson.entities; + +public class User { + + private int id; + private String name; + private transient String nationality; + + public User(int id, String name, String nationality) { + this.id = id; + this.name = name; + this.nationality = nationality; + } + + public User(int id, String name) { + this(id, name, null); + } + +} diff --git a/gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java b/gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java new file mode 100644 index 0000000000..f6a8de080c --- /dev/null +++ b/gson/src/test/java/org/baeldung/gson/serialization/test/JsonFileUnitTest.java @@ -0,0 +1,43 @@ +package org.baeldung.gson.serialization.test; + +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.baeldung.gson.entities.User; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameter; +import org.junit.runners.Parameterized.Parameters; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +@RunWith(Parameterized.class) +public class JsonFileUnitTest { + + @Parameter + public Object object; + + @Parameters + public static Object[] data() { + return new Object[] { 123.45, new User(1, "Tom", "American") }; + } + + @Test + public void givenProperData_whenStoredInFile_shouldSaveJsonSuccessfully() { + String filePath = "target/output.json"; + try (Writer writer = new FileWriter(filePath)) { + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + gson.toJson(object, writer); + Assert.assertTrue(Files.exists(Paths.get(filePath))); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} From cb86a05efd5a057677a3d7669f7853c653d58fe1 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Sat, 18 Aug 2018 14:01:01 +0200 Subject: [PATCH 220/298] Kotlin Builder example refactor (#4895) * encoding * Refactor builder * Usage * Builder as data class --- .../kotlin/com/baeldung/builder/FoodOrder.kt | 43 ++++++------------- .../com/baeldung/builder/FoodOrderNamed.kt | 8 ++-- .../main/kotlin/com/baeldung/builder/Main.kt | 9 ++++ 3 files changed, 26 insertions(+), 34 deletions(-) create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/builder/Main.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrder.kt b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrder.kt index 7d10d849b9..1384cd9937 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrder.kt +++ b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrder.kt @@ -1,39 +1,22 @@ package com.baeldung.builder -class FoodOrder private constructor(builder: FoodOrder.Builder) { - - val bread: String? - val condiments: String? - val meat: String? - val fish: String? - - init { - this.bread = builder.bread - this.condiments = builder.condiments - this.meat = builder.meat - this.fish = builder.fish - } - - class Builder { - - var bread: String? = null - private set - var condiments: String? = null - private set - var meat: String? = null - private set - var fish: String? = null - private set +class FoodOrder( + val bread: String?, + val condiments: String?, + val meat: String?, + val fish: String? +) { + data class Builder( + var bread: String? = null, + var condiments: String? = null, + var meat: String? = null, + var fish: String? = null) { fun bread(bread: String) = apply { this.bread = bread } - fun condiments(condiments: String) = apply { this.condiments = condiments } - fun meat(meat: String) = apply { this.meat = meat } - fun fish(fish: String) = apply { this.fish = fish } - - fun build() = FoodOrder(this) - + fun build() = FoodOrder(bread, condiments, meat, fish) } } + diff --git a/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderNamed.kt b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderNamed.kt index 6e20cf51b9..0e4219b40e 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderNamed.kt +++ b/core-kotlin/src/main/kotlin/com/baeldung/builder/FoodOrderNamed.kt @@ -1,7 +1,7 @@ package com.baeldung.builder data class FoodOrderNamed( - val bread: String? = null, - val condiments: String? = null, - val meat: String? = null, - val fish: String? = null) + val bread: String? = null, + val condiments: String? = null, + val meat: String? = null, + val fish: String? = null) diff --git a/core-kotlin/src/main/kotlin/com/baeldung/builder/Main.kt b/core-kotlin/src/main/kotlin/com/baeldung/builder/Main.kt new file mode 100644 index 0000000000..cc348e3fbf --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/builder/Main.kt @@ -0,0 +1,9 @@ +package com.baeldung.builder + +fun main(args: Array) { + FoodOrder.Builder() + .bread("bread") + .condiments("condiments") + .meat("meat") + .fish("bread").let { println(it) } +} \ No newline at end of file From 08d4356d5beefa0ef648b3858f10312b4af11ba8 Mon Sep 17 00:00:00 2001 From: DOHA Date: Sat, 18 Aug 2018 15:34:42 +0300 Subject: [PATCH 221/298] fix blocking queue --- .../concurrent/blockingqueue/BlockingQueueUsage.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java index 052136bfe4..842d4e630e 100644 --- a/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java +++ b/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java @@ -10,15 +10,18 @@ public class BlockingQueueUsage { int N_CONSUMERS = Runtime.getRuntime().availableProcessors(); int poisonPill = Integer.MAX_VALUE; int poisonPillPerProducer = N_CONSUMERS / N_PRODUCERS; - + int mod = N_CONSUMERS % N_PRODUCERS; BlockingQueue queue = new LinkedBlockingQueue<>(BOUND); - for (int i = 0; i < N_PRODUCERS; i++) { + for (int i = 1; i < N_PRODUCERS; i++) { new Thread(new NumbersProducer(queue, poisonPill, poisonPillPerProducer)).start(); } for (int j = 0; j < N_CONSUMERS; j++) { new Thread(new NumbersConsumer(queue, poisonPill)).start(); } + + new Thread(new NumbersProducer(queue, poisonPill, poisonPillPerProducer+mod)).start(); + } } \ No newline at end of file From 7cdb05125f4dd5955e41c78e073adc4446c2c2f8 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 18 Aug 2018 15:39:43 +0300 Subject: [PATCH 222/298] Update TestFail.java --- maven/src/test/java/testfail/TestFail.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven/src/test/java/testfail/TestFail.java b/maven/src/test/java/testfail/TestFail.java index 6d37809003..3febd21031 100644 --- a/maven/src/test/java/testfail/TestFail.java +++ b/maven/src/test/java/testfail/TestFail.java @@ -7,7 +7,7 @@ import static org.junit.Assert.assertNotNull; public class TestFail { - @Ignore //ignored so the entire tutorials build passes + @Ignore //ignored so the entire tutorials build passes @Test public void whenMessageAssigned_thenItIsNotNull() { String message = "hello there"; From c3d9f21d42f2a555f31cc18c89966155f66027e7 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 18 Aug 2018 15:57:20 +0300 Subject: [PATCH 223/298] Update AvroSerealizerDeSerealizerTest.java --- .../avro/util/serealization/AvroSerealizerDeSerealizerTest.java | 1 + 1 file changed, 1 insertion(+) 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/AvroSerealizerDeSerealizerTest.java index a1c2e88f57..ecd15ccbbc 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/AvroSerealizerDeSerealizerTest.java @@ -78,5 +78,6 @@ public class AvroSerealizerDeSerealizerTest { assertTrue(actualRequest.getRequestTime() .equals(request.getRequestTime())); } + } From ff8fbf763024f22d9c4c9ecaad70e0a8a6335f1a Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 18 Aug 2018 15:58:42 +0300 Subject: [PATCH 224/298] Update README.md --- persistence-modules/spring-hibernate-5/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/persistence-modules/spring-hibernate-5/README.md b/persistence-modules/spring-hibernate-5/README.md index b22c90b4d4..b4d73708c3 100644 --- a/persistence-modules/spring-hibernate-5/README.md +++ b/persistence-modules/spring-hibernate-5/README.md @@ -4,4 +4,3 @@ - [Hibernate Many to Many Annotation Tutorial](http://www.baeldung.com/hibernate-many-to-many) - [Programmatic Transactions in the Spring TestContext Framework](http://www.baeldung.com/spring-test-programmatic-transactions) - [Hibernate Criteria Queries](http://www.baeldung.com/hibernate-criteria-queries) - From b4f0f403e21124cf6899a6e59f39d6b7c03e1639 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 18 Aug 2018 16:00:18 +0300 Subject: [PATCH 225/298] Update User.java --- core-java/src/main/java/com/baeldung/hashcode/entities/User.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/src/main/java/com/baeldung/hashcode/entities/User.java b/core-java/src/main/java/com/baeldung/hashcode/entities/User.java index 75a1c363da..524f176e6b 100644 --- a/core-java/src/main/java/com/baeldung/hashcode/entities/User.java +++ b/core-java/src/main/java/com/baeldung/hashcode/entities/User.java @@ -38,4 +38,5 @@ public class User { return hash; } // getters and setters here + } From c467a4e7d6240dff5ef8315e1cbd1ecb9a3e9103 Mon Sep 17 00:00:00 2001 From: nguyennamthai Date: Sat, 18 Aug 2018 21:56:15 +0700 Subject: [PATCH 226/298] Bael 1854 (#4954) * Fix a division method mistake * Maven integration testing * Move Maven integration tests to the maven module * Remove Maven integration tests in the old module --- maven/pom.xml | 442 ++++++++++++------ .../com/baeldung/maven/it/RestITCase.java | 24 + .../com/baeldung/maven/it/EndpointConfig.java | 9 + .../com/baeldung/maven/it/RestEndpoint.java | 12 + maven/src/main/webapp/WEB-INF/web.xml | 17 + .../com/baeldung/maven/it/Integration.java | 4 + .../java/com/baeldung/maven/it/RestIT.java | 24 + .../maven/it/RestIntegrationTest.java | 24 + .../com/baeldung/maven/it/RestJUnitTest.java | 26 ++ 9 files changed, 437 insertions(+), 145 deletions(-) create mode 100644 maven/src/integration-test/java/com/baeldung/maven/it/RestITCase.java create mode 100644 maven/src/main/java/com/baeldung/maven/it/EndpointConfig.java create mode 100644 maven/src/main/java/com/baeldung/maven/it/RestEndpoint.java create mode 100644 maven/src/main/webapp/WEB-INF/web.xml create mode 100644 maven/src/test/java/com/baeldung/maven/it/Integration.java create mode 100644 maven/src/test/java/com/baeldung/maven/it/RestIT.java create mode 100644 maven/src/test/java/com/baeldung/maven/it/RestIntegrationTest.java create mode 100644 maven/src/test/java/com/baeldung/maven/it/RestJUnitTest.java diff --git a/maven/pom.xml b/maven/pom.xml index a24b6b16bd..4bec533226 100644 --- a/maven/pom.xml +++ b/maven/pom.xml @@ -1,151 +1,303 @@ - 4.0.0 - com.baeldung - maven - 0.0.1-SNAPSHOT + 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 + maven + 0.0.1-SNAPSHOT + war - - parent-modules - com.baeldung - 1.0.0-SNAPSHOT - + + + org.glassfish.jersey.containers + jersey-container-servlet-core + ${jersey.version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey.version} + + + junit + junit + ${junit.version} + test + + - - - - maven-resources-plugin - ${maven.resources.version} - - output-resources - - - input-resources - - *.png - - true - - - - - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - - -Xlint:unchecked - - - - - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - DataTest.java - - - TestFail.java - DataCheck.java - - true - - - - maven-failsafe-plugin - ${maven.failsafe.version} - - - - integration-test - verify - - - - - - - - - maven-verifier-plugin - ${maven.verifier.version} - - input-resources/verifications.xml - - - - - verify - - - - - - maven-clean-plugin - ${maven.clean.version} - - - - output-resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - ${maven.build.helper.version} - - - generate-sources - - add-source - - - - src/main/another-src - - - - - - - + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.version} + + + 8999 + + quit + 9000 + + + + start-jetty + pre-integration-test + + start + + + + stop-jetty + post-integration-test + + stop + + + + + + maven-resources-plugin + ${maven.resources.version} + + output-resources + + + input-resources + + *.png + + true + + + + + + maven-compiler-plugin + ${maven.compiler.version} + + ${java.version} + ${java.version} + + -Xlint:unchecked + + + + + maven-surefire-plugin + ${maven.surefire.version} + + + DataTest.java + **/*IntegrationTest + + com.baeldung.maven.it.Integration + + TestFail.java + DataCheck.java + + true + + + + maven-failsafe-plugin + ${maven.failsafe.version} + + + + integration-test + verify + + + + + + + + + maven-verifier-plugin + ${maven.verifier.version} + + input-resources/verifications.xml + + + + + verify + + + + + + maven-clean-plugin + ${maven.clean.version} + + + + output-resources + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${maven.build.helper.version} + + + generate-sources + + add-source + + + + src/main/another-src + + + + + add-integration-test-source + generate-test-sources + + add-test-source + + + + src/integration-test/java + + + + + add-integration-test-resource + generate-test-resources + + add-test-resource + + + + + src/integration-test/resources + + + + + + + + - - - default - - - - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - DataTest.java - - - TestFail.java - DataCheck.java - - true - - - - - - - - - 3.0.2 - 2.21.0 - 1.1 - 3.0.0 - 3.0.0 - Baeldung - + + + default + + + + maven-surefire-plugin + ${maven.surefire.version} + + + DataTest.java + + + TestFail.java + DataCheck.java + + true + + + + + + + failsafe + + + + maven-failsafe-plugin + ${maven.failsafe.version} + + + **/*RestIT + **/RestITCase + + + + + + integration-test + verify + + + + + + + + + surefire + + + + maven-surefire-plugin + ${maven.surefire.version} + + + integration-test + + test + + + + none + + + **/*IntegrationTest + + + + + + + + + + category + + + + maven-failsafe-plugin + ${maven.failsafe.version} + + + **/* + + com.baeldung.maven.it.Integration + + + + + integration-test + verify + + + + + + + + + + 1.8 + 3.0.2 + 3.8.0 + 2.22.0 + 2.22.0 + 1.1 + 3.0.0 + 3.0.0 + Baeldung + 9.4.11.v20180605 + 2.27 + 4.12 + \ No newline at end of file diff --git a/maven/src/integration-test/java/com/baeldung/maven/it/RestITCase.java b/maven/src/integration-test/java/com/baeldung/maven/it/RestITCase.java new file mode 100644 index 0000000000..aaeeedb661 --- /dev/null +++ b/maven/src/integration-test/java/com/baeldung/maven/it/RestITCase.java @@ -0,0 +1,24 @@ +package com.baeldung.maven.it; + +import org.junit.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.util.Scanner; + +import static org.junit.Assert.assertEquals; + +public class RestITCase { + @Test + public void whenSendingGet_thenMessageIsReturned() throws IOException { + String url = "http://localhost:8999"; + URLConnection connection = new URL(url).openConnection(); + try (InputStream response = connection.getInputStream(); + Scanner scanner = new Scanner(response)) { + String responseBody = scanner.nextLine(); + assertEquals("Welcome to Baeldung!", responseBody); + } + } +} diff --git a/maven/src/main/java/com/baeldung/maven/it/EndpointConfig.java b/maven/src/main/java/com/baeldung/maven/it/EndpointConfig.java new file mode 100644 index 0000000000..919210ccff --- /dev/null +++ b/maven/src/main/java/com/baeldung/maven/it/EndpointConfig.java @@ -0,0 +1,9 @@ +package com.baeldung.maven.it; + +import org.glassfish.jersey.server.ResourceConfig; + +public class EndpointConfig extends ResourceConfig { + public EndpointConfig() { + register(RestEndpoint.class); + } +} diff --git a/maven/src/main/java/com/baeldung/maven/it/RestEndpoint.java b/maven/src/main/java/com/baeldung/maven/it/RestEndpoint.java new file mode 100644 index 0000000000..c234891865 --- /dev/null +++ b/maven/src/main/java/com/baeldung/maven/it/RestEndpoint.java @@ -0,0 +1,12 @@ +package com.baeldung.maven.it; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; + +@Path("/") +public class RestEndpoint { + @GET + public String hello() { + return "Welcome to Baeldung!"; + } +} diff --git a/maven/src/main/webapp/WEB-INF/web.xml b/maven/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..1751ad17a5 --- /dev/null +++ b/maven/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,17 @@ + + + rest-servlet + org.glassfish.jersey.servlet.ServletContainer + + javax.ws.rs.Application + com.baeldung.maven.it.EndpointConfig + + + + rest-servlet + /* + + \ No newline at end of file diff --git a/maven/src/test/java/com/baeldung/maven/it/Integration.java b/maven/src/test/java/com/baeldung/maven/it/Integration.java new file mode 100644 index 0000000000..112ce178ce --- /dev/null +++ b/maven/src/test/java/com/baeldung/maven/it/Integration.java @@ -0,0 +1,4 @@ +package com.baeldung.maven.it; + +public interface Integration { +} diff --git a/maven/src/test/java/com/baeldung/maven/it/RestIT.java b/maven/src/test/java/com/baeldung/maven/it/RestIT.java new file mode 100644 index 0000000000..0115d34f1e --- /dev/null +++ b/maven/src/test/java/com/baeldung/maven/it/RestIT.java @@ -0,0 +1,24 @@ +package com.baeldung.maven.it; + +import org.junit.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.util.Scanner; + +import static org.junit.Assert.assertEquals; + +public class RestIT { + @Test + public void whenSendingGet_thenMessageIsReturned() throws IOException { + String url = "http://localhost:8999"; + URLConnection connection = new URL(url).openConnection(); + try (InputStream response = connection.getInputStream(); + Scanner scanner = new Scanner(response)) { + String responseBody = scanner.nextLine(); + assertEquals("Welcome to Baeldung!", responseBody); + } + } +} diff --git a/maven/src/test/java/com/baeldung/maven/it/RestIntegrationTest.java b/maven/src/test/java/com/baeldung/maven/it/RestIntegrationTest.java new file mode 100644 index 0000000000..2f913c8429 --- /dev/null +++ b/maven/src/test/java/com/baeldung/maven/it/RestIntegrationTest.java @@ -0,0 +1,24 @@ +package com.baeldung.maven.it; + +import org.junit.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.util.Scanner; + +import static org.junit.Assert.assertEquals; + +public class RestIntegrationTest { + @Test + public void whenSendingGet_thenMessageIsReturned() throws IOException { + String url = "http://localhost:8999"; + URLConnection connection = new URL(url).openConnection(); + try (InputStream response = connection.getInputStream(); + Scanner scanner = new Scanner(response)) { + String responseBody = scanner.nextLine(); + assertEquals("Welcome to Baeldung!", responseBody); + } + } +} diff --git a/maven/src/test/java/com/baeldung/maven/it/RestJUnitTest.java b/maven/src/test/java/com/baeldung/maven/it/RestJUnitTest.java new file mode 100644 index 0000000000..60995d75bd --- /dev/null +++ b/maven/src/test/java/com/baeldung/maven/it/RestJUnitTest.java @@ -0,0 +1,26 @@ +package com.baeldung.maven.it; + +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.util.Scanner; + +import static org.junit.Assert.assertEquals; + +@Category(Integration.class) +public class RestJUnitTest { + @Test + public void whenSendingGet_thenMessageIsReturned() throws IOException { + String url = "http://localhost:8999"; + URLConnection connection = new URL(url).openConnection(); + try (InputStream response = connection.getInputStream(); + Scanner scanner = new Scanner(response)) { + String responseBody = scanner.nextLine(); + assertEquals("Welcome to Baeldung!", responseBody); + } + } +} From bbc36e0daffe935d45275caddce3b2cdba358aea Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 18 Aug 2018 21:14:31 +0530 Subject: [PATCH 227/298] [BAEL-8217] - Updated github links --- core-java-persistence/README.md | 8 ++++++++ core-java/README.md | 4 ---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 core-java-persistence/README.md diff --git a/core-java-persistence/README.md b/core-java-persistence/README.md new file mode 100644 index 0000000000..08afcadb72 --- /dev/null +++ b/core-java-persistence/README.md @@ -0,0 +1,8 @@ +========= + +## Core Java Persistence Examples + +### Relevant Articles: +- [Introduction to JDBC](http://www.baeldung.com/java-jdbc) +- [Batch Processing in JDBC](http://www.baeldung.com/jdbc-batch-processing) +- [Introduction to the JDBC RowSet Interface in Java](http://www.baeldung.com/java-jdbc-rowset) \ No newline at end of file diff --git a/core-java/README.md b/core-java/README.md index f05b2625e8..6d8db8d388 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -53,7 +53,6 @@ - [How to Get a Name of a Method Being Executed?](http://www.baeldung.com/java-name-of-executing-method) - [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) - [How to Copy an Array in Java](http://www.baeldung.com/java-array-copy) -- [Introduction to JDBC](http://www.baeldung.com/java-jdbc) - [Period and Duration in Java](http://www.baeldung.com/java-period-duration) - [Converting a Stack Trace to a String in Java](http://www.baeldung.com/java-stacktrace-to-string) - [Count Occurrences of a Char in a String](http://www.baeldung.com/java-count-chars) @@ -82,7 +81,6 @@ - [Quick Guide to Java Stack](http://www.baeldung.com/java-stack) - [The Java continue and break Keywords](http://www.baeldung.com/java-continue-and-break) - [Guide to java.util.Formatter](http://www.baeldung.com/java-string-formatter) -- [Batch Processing in JDBC](http://www.baeldung.com/jdbc-batch-processing) - [Check if a Java Array Contains a Value](http://www.baeldung.com/java-array-contains-value) - [How to Invert an Array in Java](http://www.baeldung.com/java-invert-array) - [Guide to the Cipher Class](http://www.baeldung.com/java-cipher-class) @@ -90,7 +88,6 @@ - [Implementing a Binary Tree in Java](http://www.baeldung.com/java-binary-tree) - [A Guide to ThreadLocalRandom in Java](http://www.baeldung.com/java-thread-local-random) - [RegEx for matching Date Pattern in Java](http://www.baeldung.com/java-date-regular-expressions) -- [Introduction to the JDBC RowSet Interface in Java](http://www.baeldung.com/java-jdbc-rowset) - [Nested Classes in Java](http://www.baeldung.com/java-nested-classes) - [A Guide to Java Loops](http://www.baeldung.com/java-loops) - [Varargs in Java](http://www.baeldung.com/java-varargs) @@ -113,7 +110,6 @@ - [A Practical Guide to DecimalFormat](http://www.baeldung.com/java-decimalformat) - [How to Detect the OS Using Java](http://www.baeldung.com/java-detect-os) - [ASCII Art in Java](http://www.baeldung.com/ascii-art-in-java) -- [An Advanced Tagging Implementation with JPA](http://www.baeldung.com/jpa-tagging-advanced) - [Handling Daylight Savings Time in Java](http://www.baeldung.com/java-daylight-savings) - [Inheritance and Composition (Is-a vs Has-a relationship) in Java](http://www.baeldung.com/java-inheritance-composition) - [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) From ab17b8e697b3c04a16b0c47561ce6a8b9d5a7869 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 18 Aug 2018 20:54:24 +0530 Subject: [PATCH 228/298] [BAEL-8232] - Moved java string related code and github links into new module java-strings --- core-java-8/README.md | 4 - core-java-9/README.md | 1 - core-java/README.md | 17 -- core-java/pom.xml | 5 - java-strings/README.md | 27 +++ java-strings/pom.xml | 174 ++++++++++++++++++ .../baeldung/datetime/UseLocalDateTime.java | 0 .../compactstring/CompactStringDemo.java | 0 .../com/baeldung/string/JoinerSplitter.java | 0 .../java/com/baeldung/string/Palindrome.java | 0 .../string/StringBufferStringBuilder.java | 90 ++++----- .../com/baeldung/string/StringHelper.java | 0 .../baeldung/string/TitleCaseConverter.java | 9 +- .../stringisnumeric/Benchmarking.java | 0 .../baeldung/stringisnumeric/IsNumeric.java | 0 .../stringisnumeric/IsNumericDriver.java | 0 .../baeldung/stringtokenizer/MyTokenizer.java | 0 .../src/main/resources/data.csv | 0 java-strings/src/main/resources/logback.xml | 13 ++ .../baeldung/CharArrayToStringUnitTest.java | 0 .../com/baeldung/CharToStringUnitTest.java | 0 .../baeldung/StringToCharArrayUnitTest.java | 0 .../StringToIntOrIntegerUnitTest.java | 0 .../PasswordStoreExamplesUnitTest.java | 0 .../FileToBase64StringConversionUnitTest.java | 0 .../com/baeldung/java/conversion/README.md | 0 .../conversion/StringConversionUnitTest.java | 0 .../ApacheCommonsEncodeDecodeUnitTest.java | 0 .../base64/Java8EncodeDecodeUnitTest.java | 0 .../string/CharSequenceVsStringUnitTest.java | 0 .../string/JoinerSplitterUnitTest.java | 0 .../baeldung/string/PalindromeUnitTest.java | 0 .../com/baeldung/string/SplitUnitTest.java | 9 +- .../string/StringComparisonUnitTest.java | 0 .../baeldung/string/StringHelperUnitTest.java | 0 .../string/StringToCharStreamUnitTest.java | 0 .../com/baeldung/string/StringUnitTest.java | 0 .../string/TitleCaseConverterUnitTest.java | 0 .../StringFormatterExampleUnitTest.java | 0 .../CoreJavaIsNumericUnitTest.java | 0 .../NumberUtilsIsCreatableUnitTest.java | 0 .../NumberUtilsIsParsableUnitTest.java | 0 .../RegularExpressionsUnitTest.java | 0 .../StringUtilsIsNumericSpaceUnitTest.java | 0 .../StringUtilsIsNumericUnitTest.java | 0 .../stringjoiner/StringJoinerUnitTest.java | 0 .../stringpool/StringPoolUnitTest.java | 0 .../stringtokenizer/TokenizerUnitTest.java | 0 java-strings/src/test/resources/.gitignore | 13 ++ .../src/test/resources/test_image.jpg | Bin pom.xml | 2 + 51 files changed, 284 insertions(+), 80 deletions(-) create mode 100644 java-strings/README.md create mode 100644 java-strings/pom.xml rename {core-java => java-strings}/src/main/java/com/baeldung/datetime/UseLocalDateTime.java (100%) rename {core-java-9 => java-strings}/src/main/java/com/baeldung/java9/compactstring/CompactStringDemo.java (100%) rename {core-java-8 => java-strings}/src/main/java/com/baeldung/string/JoinerSplitter.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/string/Palindrome.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/string/StringBufferStringBuilder.java (96%) rename {core-java => java-strings}/src/main/java/com/baeldung/string/StringHelper.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/string/TitleCaseConverter.java (97%) rename {core-java => java-strings}/src/main/java/com/baeldung/stringisnumeric/Benchmarking.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/stringisnumeric/IsNumeric.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/stringisnumeric/IsNumericDriver.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/stringtokenizer/MyTokenizer.java (100%) rename {core-java => java-strings}/src/main/resources/data.csv (100%) create mode 100644 java-strings/src/main/resources/logback.xml rename {core-java => java-strings}/src/test/java/com/baeldung/CharArrayToStringUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/CharToStringUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/StringToCharArrayUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/StringToIntOrIntegerUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/chararraypassword/PasswordStoreExamplesUnitTest.java (100%) rename {core-java-8 => java-strings}/src/test/java/com/baeldung/fileToBase64StringConversion/FileToBase64StringConversionUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/java/conversion/README.md (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/java/conversion/StringConversionUnitTest.java (100%) rename {core-java-8 => java-strings}/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java (100%) rename {core-java-8 => java-strings}/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/string/CharSequenceVsStringUnitTest.java (100%) rename {core-java-8 => java-strings}/src/test/java/com/baeldung/string/JoinerSplitterUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/string/PalindromeUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/string/SplitUnitTest.java (97%) rename {core-java => java-strings}/src/test/java/com/baeldung/string/StringComparisonUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/string/StringHelperUnitTest.java (100%) rename {core-java-8 => java-strings}/src/test/java/com/baeldung/string/StringToCharStreamUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/string/StringUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/string/TitleCaseConverterUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/string/formatter/StringFormatterExampleUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/stringisnumeric/CoreJavaIsNumericUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsCreatableUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsParsableUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/stringisnumeric/RegularExpressionsUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericSpaceUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericUnitTest.java (100%) rename {core-java-8 => java-strings}/src/test/java/com/baeldung/stringjoiner/StringJoinerUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/stringpool/StringPoolUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/stringtokenizer/TokenizerUnitTest.java (100%) create mode 100644 java-strings/src/test/resources/.gitignore rename {core-java-8 => java-strings}/src/test/resources/test_image.jpg (100%) diff --git a/core-java-8/README.md b/core-java-8/README.md index 6f31a8b886..e0cd0e7c0a 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -14,7 +14,6 @@ - [Guide to Java 8 groupingBy Collector](http://www.baeldung.com/java-groupingby-collector) - [Strategy Design Pattern in Java 8](http://www.baeldung.com/java-strategy-pattern) - [Java 8 and Infinite Streams](http://www.baeldung.com/java-inifinite-streams) -- [String Operations with Java Streams](http://www.baeldung.com/java-stream-operations-on-strings) - [Exceptions in Java 8 Lambda Expressions](http://www.baeldung.com/java-lambda-exceptions) - [Java 8 Stream findFirst() vs. findAny()](http://www.baeldung.com/java-stream-findfirst-vs-findany) - [Guide to Java 8 Comparator.comparing()](http://www.baeldung.com/java-8-comparator-comparing) @@ -34,13 +33,11 @@ - [Copy a File with Java](http://www.baeldung.com/java-copy-file) - [Static and Default Methods in Interfaces in Java](http://www.baeldung.com/java-static-default-methods) - [Iterable to Stream in Java](http://www.baeldung.com/java-iterable-to-stream) -- [Converting String to Stream of chars](http://www.baeldung.com/java-string-to-stream) - [How to Iterate Over a Stream With Indices](http://www.baeldung.com/java-stream-indices) - [Efficient Word Frequency Calculator in Java](http://www.baeldung.com/java-word-frequency) - [Primitive Type Streams in Java 8](http://www.baeldung.com/java-8-primitive-streams) - [Fail-Safe Iterator vs Fail-Fast Iterator](http://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator) - [Shuffling Collections In Java](http://www.baeldung.com/java-shuffle-collection) -- [Java 8 StringJoiner](http://www.baeldung.com/java-string-joiner) - [Introduction to Spliterator in Java](http://www.baeldung.com/java-spliterator) - [Java 8 Math New Methods](http://www.baeldung.com/java-8-math) - [Overview of Java Built-in Annotations](http://www.baeldung.com/java-default-annotations) @@ -54,7 +51,6 @@ - [Java 8 Unsigned Arithmetic Support](http://www.baeldung.com/java-unsigned-arithmetic) - [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end) - [Generalized Target-Type Inference in Java](http://www.baeldung.com/java-generalized-target-type-inference) -- [Image to Base64 String Conversion](http://www.baeldung.com/java-base64-image-string) - [Calculate Age in Java](http://www.baeldung.com/java-get-age) - [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another) - [Increment Date in Java](http://www.baeldung.com/java-increment-date) diff --git a/core-java-9/README.md b/core-java-9/README.md index a76dcefc69..8c869f56bb 100644 --- a/core-java-9/README.md +++ b/core-java-9/README.md @@ -17,7 +17,6 @@ - [Java 9 Reactive Streams](http://www.baeldung.com/java-9-reactive-streams) - [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates) - [Java 9 java.util.Objects Additions](http://www.baeldung.com/java-9-objects-new) -- [Compact Strings in Java 9](http://www.baeldung.com/java-9-compact-string) - [Convert Date to LocalDate or LocalDateTime and Back](http://www.baeldung.com/java-date-to-localdate-and-localdatetime) - [Java 9 Variable Handles Demistyfied](http://www.baeldung.com/java-variable-handles) - [Exploring the New HTTP Client in Java 9](http://www.baeldung.com/java-9-http-client) diff --git a/core-java/README.md b/core-java/README.md index 6d8db8d388..b35e1d6e35 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -3,18 +3,14 @@ ## Core Java Cookbooks and Examples ### Relevant Articles: -- [Java – Generate Random String](http://www.baeldung.com/java-random-string) - [Java Timer](http://www.baeldung.com/java-timer-and-timertask) - [How to Run a Shell Command in Java](http://www.baeldung.com/run-shell-command-in-java) - [MD5 Hashing in Java](http://www.baeldung.com/java-md5) - [Guide to Java Reflection](http://www.baeldung.com/java-reflection) - [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets) -- [Convert char to String in Java](http://www.baeldung.com/java-convert-char-to-string) -- [Convert String to int or Integer in Java](http://www.baeldung.com/java-convert-string-to-int-or-integer) - [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) - [Guide to the Fork/Join Framework in Java](http://www.baeldung.com/java-fork-join) - [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) -- [How to Convert String to different data types in Java](http://www.baeldung.com/java-string-conversions) - [Introduction to Java Generics](http://www.baeldung.com/java-generics) - [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) - [A Guide To Java Regular Expressions API](http://www.baeldung.com/regular-expressions-java) @@ -37,8 +33,6 @@ - [A Quick JUnit vs TestNG Comparison](http://www.baeldung.com/junit-vs-testng) - [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions) - [Java Money and the Currency API](http://www.baeldung.com/java-money-and-currency) -- [Converting Strings to Enums in Java](http://www.baeldung.com/java-string-to-enum) -- [Quick Guide to the Java StringTokenizer](http://www.baeldung.com/java-stringtokenizer) - [JVM Log Forging](http://www.baeldung.com/jvm-log-forging) - [Guide to sun.misc.Unsafe](http://www.baeldung.com/java-unsafe) - [How to Perform a Simple HTTP Request in Java](http://www.baeldung.com/java-http-request) @@ -55,28 +49,22 @@ - [How to Copy an Array in Java](http://www.baeldung.com/java-array-copy) - [Period and Duration in Java](http://www.baeldung.com/java-period-duration) - [Converting a Stack Trace to a String in Java](http://www.baeldung.com/java-stacktrace-to-string) -- [Count Occurrences of a Char in a String](http://www.baeldung.com/java-count-chars) - [Java Double Brace Initialization](http://www.baeldung.com/java-double-brace-initialization) - [The StackOverflowError in Java](http://www.baeldung.com/java-stack-overflow-error) -- [Split a String in Java](http://www.baeldung.com/java-split-string) - [Introduction to Java Serialization](http://www.baeldung.com/java-serialization) -- [How to Remove the Last Character of a String?](http://www.baeldung.com/java-remove-last-character-of-string) - [ClassNotFoundException vs NoClassDefFoundError](http://www.baeldung.com/java-classnotfoundexception-and-noclassdeffounderror) - [Guide to UUID in Java](http://www.baeldung.com/java-uuid) - [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char) - [Guide to hashCode() in Java](http://www.baeldung.com/java-hashcode) - [Difference between URL and URI](http://www.baeldung.com/java-url-vs-uri) - [Broadcasting and Multicasting in Java](http://www.baeldung.com/java-broadcast-multicast) -- [CharSequence vs. String in Java](http://www.baeldung.com/java-char-sequence-string) - [Period and Duration in Java](http://www.baeldung.com/java-period-duration) - [Guide to the Diamond Operator in Java](http://www.baeldung.com/java-diamond-operator) - [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws) - [OutOfMemoryError: GC Overhead Limit Exceeded](http://www.baeldung.com/java-gc-overhead-limit-exceeded) -- [StringBuilder and StringBuffer in Java](http://www.baeldung.com/java-string-builder-string-buffer) - [Creating a Java Compiler Plugin](http://www.baeldung.com/java-build-compiler-plugin) - [A Guide to the Static Keyword in Java](http://www.baeldung.com/java-static) - [Initializing Arrays in Java](http://www.baeldung.com/java-initialize-array) -- [Guide to Java String Pool](http://www.baeldung.com/java-string-pool) - [Quick Example - Comparator vs Comparable in Java](http://www.baeldung.com/java-comparator-comparable) - [Quick Guide to Java Stack](http://www.baeldung.com/java-stack) - [The Java continue and break Keywords](http://www.baeldung.com/java-continue-and-break) @@ -102,8 +90,6 @@ - [The Trie Data Structure in Java](http://www.baeldung.com/trie-java) - [Introduction to Javadoc](http://www.baeldung.com/javadoc) - [How to Make a Deep Copy of an Object in Java](http://www.baeldung.com/java-deep-copy) -- [Check if a String is a Palindrome](http://www.baeldung.com/java-palindrome) -- [Comparing Strings in Java](http://www.baeldung.com/java-compare-strings) - [Guide to Inheritance in Java](http://www.baeldung.com/java-inheritance) - [Guide to Externalizable Interface in Java](http://www.baeldung.com/java-externalizable) - [Object Type Casting in Java](http://www.baeldung.com/java-type-casting) @@ -135,11 +121,9 @@ - [Infinite Loops in Java](http://www.baeldung.com/infinite-loops-java) - [Using Java Assertions](http://www.baeldung.com/java-assert) - [Pass-By-Value as a Parameter Passing Mechanism in Java](http://www.baeldung.com/java-pass-by-value-or-pass-by-reference) -- [Check If a String Is Numeric in Java](http://www.baeldung.com/java-check-string-number) - [Variable and Method Hiding in Java](http://www.baeldung.com/java-variable-method-hiding) - [Access Modifiers in Java](http://www.baeldung.com/java-access-modifiers) - [Infinite Loops in Java](http://www.baeldung.com/infinite-loops-java) -- [Why Use char[] Array Over a String for Storing Passwords in Java?](http://www.baeldung.com/java-storing-passwords) - [Introduction to Creational Design Patterns](http://www.baeldung.com/creational-design-patterns) - [Proxy, Decorator, Adapter and Bridge Patterns](http://www.baeldung.com/java-structural-design-patterns) - [Singletons in Java](http://www.baeldung.com/java-singleton) @@ -153,7 +137,6 @@ - [Importance of Main Manifest Attribute in a Self-Executing JAR](http://www.baeldung.com/java-jar-executable-manifest-main-class) - [Extracting Year, Month and Day from Date in Java](http://www.baeldung.com/java-year-month-day) - [Get Date Without Time in Java](http://www.baeldung.com/java-date-without-time) -- [Convert a String to Title Case](http://www.baeldung.com/java-string-title-case) - [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension) - [Immutable Objects in Java](http://www.baeldung.com/java-immutable-object) - [Console I/O in Java](http://www.baeldung.com/java-console-input-output) diff --git a/core-java/pom.xml b/core-java/pom.xml index b4c9dd285f..477a01375d 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -137,11 +137,6 @@ mail ${javax.mail.version} - - com.ibm.icu - icu4j - ${icu4j.version} - org.apache.tika diff --git a/java-strings/README.md b/java-strings/README.md new file mode 100644 index 0000000000..d5b9b45b20 --- /dev/null +++ b/java-strings/README.md @@ -0,0 +1,27 @@ +========= + +## Java Strings Cookbooks and Examples + +### Relevant Articles: +- [String Operations with Java Streams](http://www.baeldung.com/java-stream-operations-on-strings) +- [Converting String to Stream of chars](http://www.baeldung.com/java-string-to-stream) +- [Java 8 StringJoiner](http://www.baeldung.com/java-string-joiner) +- [Image to Base64 String Conversion](http://www.baeldung.com/java-base64-image-string) +- [Java – Generate Random String](http://www.baeldung.com/java-random-string) +- [Convert char to String in Java](http://www.baeldung.com/java-convert-char-to-string) +- [Convert String to int or Integer in Java](http://www.baeldung.com/java-convert-string-to-int-or-integer) +- [How to Convert String to different data types in Java](http://www.baeldung.com/java-string-conversions) +- [Converting Strings to Enums in Java](http://www.baeldung.com/java-string-to-enum) +- [Quick Guide to the Java StringTokenizer](http://www.baeldung.com/java-stringtokenizer) +- [Count Occurrences of a Char in a String](http://www.baeldung.com/java-count-chars) +- [Split a String in Java](http://www.baeldung.com/java-split-string) +- [How to Remove the Last Character of a String?](http://www.baeldung.com/java-remove-last-character-of-string) +- [CharSequence vs. String in Java](http://www.baeldung.com/java-char-sequence-string) +- [StringBuilder and StringBuffer in Java](http://www.baeldung.com/java-string-builder-string-buffer) +- [Guide to Java String Pool](http://www.baeldung.com/java-string-pool) +- [Check if a String is a Palindrome](http://www.baeldung.com/java-palindrome) +- [Comparing Strings in Java](http://www.baeldung.com/java-compare-strings) +- [Check If a String Is Numeric in Java](http://www.baeldung.com/java-check-string-number) +- [Why Use char[] Array Over a String for Storing Passwords in Java?](http://www.baeldung.com/java-storing-passwords) +- [Convert a String to Title Case](http://www.baeldung.com/java-string-title-case) +- [Compact Strings in Java 9](http://www.baeldung.com/java-9-compact-string) \ No newline at end of file diff --git a/java-strings/pom.xml b/java-strings/pom.xml new file mode 100644 index 0000000000..c145fd4070 --- /dev/null +++ b/java-strings/pom.xml @@ -0,0 +1,174 @@ + + 4.0.0 + com.baeldung + java-strings + 0.1.0-SNAPSHOT + jar + java-strings + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + commons-io + commons-io + ${commons-io.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + log4j + log4j + ${log4j.version} + + + commons-codec + commons-codec + ${commons-codec.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + org.assertj + assertj-core + ${assertj.version} + test + + + com.jayway.awaitility + awaitility + ${avaitility.version} + test + + + org.openjdk.jmh + jmh-core + ${jmh-core.version} + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh-generator.version} + + + org.openjdk.jmh + jmh-generator-bytecode + ${jmh-generator.version} + + + com.codepoetics + protonpack + ${protonpack.version} + + + io.vavr + vavr + ${vavr.version} + + + one.util + streamex + ${streamex.version} + + + joda-time + joda-time + ${joda.version} + + + org.aspectj + aspectjrt + ${asspectj.version} + + + org.aspectj + aspectjweaver + ${asspectj.version} + + + com.ibm.icu + icu4j + ${icu4j.version} + + + + + java-strings + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + -parameters + + + + + + + + 3.5 + 4.1 + 4.01 + 1.10 + 1.16.12 + 0.9.0 + 1.13 + 0.6.5 + 2.10 + + 3.6.1 + 1.8.9 + 1.7.0 + 1.19 + 1.19 + 61.1 + + + \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/datetime/UseLocalDateTime.java b/java-strings/src/main/java/com/baeldung/datetime/UseLocalDateTime.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/UseLocalDateTime.java rename to java-strings/src/main/java/com/baeldung/datetime/UseLocalDateTime.java diff --git a/core-java-9/src/main/java/com/baeldung/java9/compactstring/CompactStringDemo.java b/java-strings/src/main/java/com/baeldung/java9/compactstring/CompactStringDemo.java similarity index 100% rename from core-java-9/src/main/java/com/baeldung/java9/compactstring/CompactStringDemo.java rename to java-strings/src/main/java/com/baeldung/java9/compactstring/CompactStringDemo.java diff --git a/core-java-8/src/main/java/com/baeldung/string/JoinerSplitter.java b/java-strings/src/main/java/com/baeldung/string/JoinerSplitter.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/string/JoinerSplitter.java rename to java-strings/src/main/java/com/baeldung/string/JoinerSplitter.java diff --git a/core-java/src/main/java/com/baeldung/string/Palindrome.java b/java-strings/src/main/java/com/baeldung/string/Palindrome.java similarity index 100% rename from core-java/src/main/java/com/baeldung/string/Palindrome.java rename to java-strings/src/main/java/com/baeldung/string/Palindrome.java diff --git a/core-java/src/main/java/com/baeldung/string/StringBufferStringBuilder.java b/java-strings/src/main/java/com/baeldung/string/StringBufferStringBuilder.java similarity index 96% rename from core-java/src/main/java/com/baeldung/string/StringBufferStringBuilder.java rename to java-strings/src/main/java/com/baeldung/string/StringBufferStringBuilder.java index 74f489d57f..72af4a9aee 100644 --- a/core-java/src/main/java/com/baeldung/string/StringBufferStringBuilder.java +++ b/java-strings/src/main/java/com/baeldung/string/StringBufferStringBuilder.java @@ -1,46 +1,46 @@ -package com.baeldung.string; - -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.RunnerException; -import org.openjdk.jmh.runner.options.Options; -import org.openjdk.jmh.runner.options.OptionsBuilder; - -public class StringBufferStringBuilder { - - public static void main(String[] args) throws RunnerException { - - Options opt = new OptionsBuilder() - .include(StringBufferStringBuilder.class.getSimpleName()) - .build(); - - new Runner(opt).run(); - } - - @State(Scope.Benchmark) - public static class MyState { - int iterations = 1000; - String initial = "abc"; - String suffix = "def"; - } - - @Benchmark - public StringBuffer benchmarkStringBuffer(MyState state) { - StringBuffer stringBuffer = new StringBuffer(state.initial); - for (int i = 0; i < state.iterations; i++) { - stringBuffer.append(state.suffix); - } - return stringBuffer; - } - - @Benchmark - public StringBuilder benchmarkStringBuilder(MyState state) { - StringBuilder stringBuilder = new StringBuilder(state.initial); - for (int i = 0; i < state.iterations; i++) { - stringBuilder.append(state.suffix); - } - return stringBuilder; - } +package com.baeldung.string; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.RunnerException; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +public class StringBufferStringBuilder { + + public static void main(String[] args) throws RunnerException { + + Options opt = new OptionsBuilder() + .include(StringBufferStringBuilder.class.getSimpleName()) + .build(); + + new Runner(opt).run(); + } + + @State(Scope.Benchmark) + public static class MyState { + int iterations = 1000; + String initial = "abc"; + String suffix = "def"; + } + + @Benchmark + public StringBuffer benchmarkStringBuffer(MyState state) { + StringBuffer stringBuffer = new StringBuffer(state.initial); + for (int i = 0; i < state.iterations; i++) { + stringBuffer.append(state.suffix); + } + return stringBuffer; + } + + @Benchmark + public StringBuilder benchmarkStringBuilder(MyState state) { + StringBuilder stringBuilder = new StringBuilder(state.initial); + for (int i = 0; i < state.iterations; i++) { + stringBuilder.append(state.suffix); + } + return stringBuilder; + } } \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/string/StringHelper.java b/java-strings/src/main/java/com/baeldung/string/StringHelper.java similarity index 100% rename from core-java/src/main/java/com/baeldung/string/StringHelper.java rename to java-strings/src/main/java/com/baeldung/string/StringHelper.java diff --git a/core-java/src/main/java/com/baeldung/string/TitleCaseConverter.java b/java-strings/src/main/java/com/baeldung/string/TitleCaseConverter.java similarity index 97% rename from core-java/src/main/java/com/baeldung/string/TitleCaseConverter.java rename to java-strings/src/main/java/com/baeldung/string/TitleCaseConverter.java index 0fdda86f2a..81043f6dac 100644 --- a/core-java/src/main/java/com/baeldung/string/TitleCaseConverter.java +++ b/java-strings/src/main/java/com/baeldung/string/TitleCaseConverter.java @@ -1,12 +1,13 @@ package com.baeldung.string; -import com.ibm.icu.lang.UCharacter; -import com.ibm.icu.text.BreakIterator; -import org.apache.commons.lang.WordUtils; - import java.util.Arrays; import java.util.stream.Collectors; +import org.apache.commons.lang3.text.WordUtils; + +import com.ibm.icu.lang.UCharacter; +import com.ibm.icu.text.BreakIterator; + public class TitleCaseConverter { private static final String WORD_SEPARATOR = " "; diff --git a/core-java/src/main/java/com/baeldung/stringisnumeric/Benchmarking.java b/java-strings/src/main/java/com/baeldung/stringisnumeric/Benchmarking.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stringisnumeric/Benchmarking.java rename to java-strings/src/main/java/com/baeldung/stringisnumeric/Benchmarking.java diff --git a/core-java/src/main/java/com/baeldung/stringisnumeric/IsNumeric.java b/java-strings/src/main/java/com/baeldung/stringisnumeric/IsNumeric.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stringisnumeric/IsNumeric.java rename to java-strings/src/main/java/com/baeldung/stringisnumeric/IsNumeric.java diff --git a/core-java/src/main/java/com/baeldung/stringisnumeric/IsNumericDriver.java b/java-strings/src/main/java/com/baeldung/stringisnumeric/IsNumericDriver.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stringisnumeric/IsNumericDriver.java rename to java-strings/src/main/java/com/baeldung/stringisnumeric/IsNumericDriver.java diff --git a/core-java/src/main/java/com/baeldung/stringtokenizer/MyTokenizer.java b/java-strings/src/main/java/com/baeldung/stringtokenizer/MyTokenizer.java similarity index 100% rename from core-java/src/main/java/com/baeldung/stringtokenizer/MyTokenizer.java rename to java-strings/src/main/java/com/baeldung/stringtokenizer/MyTokenizer.java diff --git a/core-java/src/main/resources/data.csv b/java-strings/src/main/resources/data.csv similarity index 100% rename from core-java/src/main/resources/data.csv rename to java-strings/src/main/resources/data.csv diff --git a/java-strings/src/main/resources/logback.xml b/java-strings/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-strings/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/CharArrayToStringUnitTest.java b/java-strings/src/test/java/com/baeldung/CharArrayToStringUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/CharArrayToStringUnitTest.java rename to java-strings/src/test/java/com/baeldung/CharArrayToStringUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/CharToStringUnitTest.java b/java-strings/src/test/java/com/baeldung/CharToStringUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/CharToStringUnitTest.java rename to java-strings/src/test/java/com/baeldung/CharToStringUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/StringToCharArrayUnitTest.java b/java-strings/src/test/java/com/baeldung/StringToCharArrayUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/StringToCharArrayUnitTest.java rename to java-strings/src/test/java/com/baeldung/StringToCharArrayUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/StringToIntOrIntegerUnitTest.java b/java-strings/src/test/java/com/baeldung/StringToIntOrIntegerUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/StringToIntOrIntegerUnitTest.java rename to java-strings/src/test/java/com/baeldung/StringToIntOrIntegerUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/chararraypassword/PasswordStoreExamplesUnitTest.java b/java-strings/src/test/java/com/baeldung/chararraypassword/PasswordStoreExamplesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/chararraypassword/PasswordStoreExamplesUnitTest.java rename to java-strings/src/test/java/com/baeldung/chararraypassword/PasswordStoreExamplesUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/fileToBase64StringConversion/FileToBase64StringConversionUnitTest.java b/java-strings/src/test/java/com/baeldung/fileToBase64StringConversion/FileToBase64StringConversionUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/fileToBase64StringConversion/FileToBase64StringConversionUnitTest.java rename to java-strings/src/test/java/com/baeldung/fileToBase64StringConversion/FileToBase64StringConversionUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/java/conversion/README.md b/java-strings/src/test/java/com/baeldung/java/conversion/README.md similarity index 100% rename from core-java/src/test/java/com/baeldung/java/conversion/README.md rename to java-strings/src/test/java/com/baeldung/java/conversion/README.md diff --git a/core-java/src/test/java/com/baeldung/java/conversion/StringConversionUnitTest.java b/java-strings/src/test/java/com/baeldung/java/conversion/StringConversionUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/java/conversion/StringConversionUnitTest.java rename to java-strings/src/test/java/com/baeldung/java/conversion/StringConversionUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java b/java-strings/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java rename to java-strings/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java b/java-strings/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java rename to java-strings/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/string/CharSequenceVsStringUnitTest.java b/java-strings/src/test/java/com/baeldung/string/CharSequenceVsStringUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/CharSequenceVsStringUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/CharSequenceVsStringUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/string/JoinerSplitterUnitTest.java b/java-strings/src/test/java/com/baeldung/string/JoinerSplitterUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/string/JoinerSplitterUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/JoinerSplitterUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/string/PalindromeUnitTest.java b/java-strings/src/test/java/com/baeldung/string/PalindromeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/PalindromeUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/PalindromeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/string/SplitUnitTest.java b/java-strings/src/test/java/com/baeldung/string/SplitUnitTest.java similarity index 97% rename from core-java/src/test/java/com/baeldung/string/SplitUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/SplitUnitTest.java index 83fd253b97..3859a2b26b 100644 --- a/core-java/src/test/java/com/baeldung/string/SplitUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/SplitUnitTest.java @@ -1,12 +1,13 @@ package com.baeldung.string; -import com.google.common.base.Splitter; -import org.apache.commons.lang.StringUtils; -import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; import java.util.List; -import static org.assertj.core.api.Assertions.assertThat; +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; + +import com.google.common.base.Splitter; public class SplitUnitTest { diff --git a/core-java/src/test/java/com/baeldung/string/StringComparisonUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringComparisonUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/StringComparisonUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/StringComparisonUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/string/StringHelperUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringHelperUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/StringHelperUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/StringHelperUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/string/StringToCharStreamUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringToCharStreamUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/string/StringToCharStreamUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/StringToCharStreamUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/string/StringUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/StringUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/StringUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/string/TitleCaseConverterUnitTest.java b/java-strings/src/test/java/com/baeldung/string/TitleCaseConverterUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/TitleCaseConverterUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/TitleCaseConverterUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/string/formatter/StringFormatterExampleUnitTest.java b/java-strings/src/test/java/com/baeldung/string/formatter/StringFormatterExampleUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/string/formatter/StringFormatterExampleUnitTest.java rename to java-strings/src/test/java/com/baeldung/string/formatter/StringFormatterExampleUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stringisnumeric/CoreJavaIsNumericUnitTest.java b/java-strings/src/test/java/com/baeldung/stringisnumeric/CoreJavaIsNumericUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stringisnumeric/CoreJavaIsNumericUnitTest.java rename to java-strings/src/test/java/com/baeldung/stringisnumeric/CoreJavaIsNumericUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsCreatableUnitTest.java b/java-strings/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsCreatableUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsCreatableUnitTest.java rename to java-strings/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsCreatableUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsParsableUnitTest.java b/java-strings/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsParsableUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsParsableUnitTest.java rename to java-strings/src/test/java/com/baeldung/stringisnumeric/NumberUtilsIsParsableUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stringisnumeric/RegularExpressionsUnitTest.java b/java-strings/src/test/java/com/baeldung/stringisnumeric/RegularExpressionsUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stringisnumeric/RegularExpressionsUnitTest.java rename to java-strings/src/test/java/com/baeldung/stringisnumeric/RegularExpressionsUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericSpaceUnitTest.java b/java-strings/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericSpaceUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericSpaceUnitTest.java rename to java-strings/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericSpaceUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericUnitTest.java b/java-strings/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericUnitTest.java rename to java-strings/src/test/java/com/baeldung/stringisnumeric/StringUtilsIsNumericUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stringjoiner/StringJoinerUnitTest.java b/java-strings/src/test/java/com/baeldung/stringjoiner/StringJoinerUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/stringjoiner/StringJoinerUnitTest.java rename to java-strings/src/test/java/com/baeldung/stringjoiner/StringJoinerUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stringpool/StringPoolUnitTest.java b/java-strings/src/test/java/com/baeldung/stringpool/StringPoolUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stringpool/StringPoolUnitTest.java rename to java-strings/src/test/java/com/baeldung/stringpool/StringPoolUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/stringtokenizer/TokenizerUnitTest.java b/java-strings/src/test/java/com/baeldung/stringtokenizer/TokenizerUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/stringtokenizer/TokenizerUnitTest.java rename to java-strings/src/test/java/com/baeldung/stringtokenizer/TokenizerUnitTest.java diff --git a/java-strings/src/test/resources/.gitignore b/java-strings/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/java-strings/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/core-java-8/src/test/resources/test_image.jpg b/java-strings/src/test/resources/test_image.jpg similarity index 100% rename from core-java-8/src/test/resources/test_image.jpg rename to java-strings/src/test/resources/test_image.jpg diff --git a/pom.xml b/pom.xml index 5a46ae2b19..50d2bbc568 100644 --- a/pom.xml +++ b/pom.xml @@ -342,6 +342,7 @@ azure bootique cdi + java-strings core-java core-java-collections @@ -891,6 +892,7 @@ azure bootique cdi + java-strings core-java-collections core-java-io From 392289a565e0eac95325b9638b6a70ef9ba3d50b Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 18 Aug 2018 21:20:14 +0300 Subject: [PATCH 229/298] Update README.md --- spring-5-reactive-security/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-5-reactive-security/README.md b/spring-5-reactive-security/README.md index 1b298df86c..3395cf5562 100644 --- a/spring-5-reactive-security/README.md +++ b/spring-5-reactive-security/README.md @@ -8,3 +8,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Boot Actuator](http://www.baeldung.com/spring-boot-actuators) - [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive) - [Guide to Spring 5 WebFlux](http://www.baeldung.com/spring-webflux) + From ca9b13d705d0630afee38f2109f5cca34a616b8a Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 19 Aug 2018 00:02:02 +0530 Subject: [PATCH 230/298] [BAEL-8232] - Removed unwanted dependencies and moved CountCharsExampleUnitTest from core-java to java-strings module --- java-strings/pom.xml | 67 ------------------- .../CountCharsExampleUnitTest.java | 9 +-- 2 files changed, 5 insertions(+), 71 deletions(-) rename {core-java => java-strings}/src/test/java/com/baeldung/java/countingChars/CountCharsExampleUnitTest.java (98%) diff --git a/java-strings/pom.xml b/java-strings/pom.xml index c145fd4070..86b8924c4b 100644 --- a/java-strings/pom.xml +++ b/java-strings/pom.xml @@ -15,11 +15,6 @@ - - org.apache.commons - commons-collections4 - ${commons-collections4.version} - commons-io commons-io @@ -40,12 +35,6 @@ commons-codec ${commons-codec.version} - - org.projectlombok - lombok - ${lombok.version} - provided - org.assertj @@ -53,57 +42,11 @@ ${assertj.version} test - - com.jayway.awaitility - awaitility - ${avaitility.version} - test - org.openjdk.jmh jmh-core ${jmh-core.version} - - org.openjdk.jmh - jmh-generator-annprocess - ${jmh-generator.version} - - - org.openjdk.jmh - jmh-generator-bytecode - ${jmh-generator.version} - - - com.codepoetics - protonpack - ${protonpack.version} - - - io.vavr - vavr - ${vavr.version} - - - one.util - streamex - ${streamex.version} - - - joda-time - joda-time - ${joda.version} - - - org.aspectj - aspectjrt - ${asspectj.version} - - - org.aspectj - aspectjweaver - ${asspectj.version} - com.ibm.icu icu4j @@ -154,20 +97,10 @@ 3.5 - 4.1 - 4.01 1.10 - 1.16.12 - 0.9.0 - 1.13 - 0.6.5 - 2.10 3.6.1 - 1.8.9 - 1.7.0 1.19 - 1.19 61.1 diff --git a/core-java/src/test/java/com/baeldung/java/countingChars/CountCharsExampleUnitTest.java b/java-strings/src/test/java/com/baeldung/java/countingChars/CountCharsExampleUnitTest.java similarity index 98% rename from core-java/src/test/java/com/baeldung/java/countingChars/CountCharsExampleUnitTest.java rename to java-strings/src/test/java/com/baeldung/java/countingChars/CountCharsExampleUnitTest.java index aeb33fe875..e2dd0ac1db 100644 --- a/core-java/src/test/java/com/baeldung/java/countingChars/CountCharsExampleUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/java/countingChars/CountCharsExampleUnitTest.java @@ -1,13 +1,14 @@ package com.baeldung.java.countingChars; -import com.google.common.base.CharMatcher; -import org.apache.commons.lang.StringUtils; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.junit.Assert.assertEquals; +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; + +import com.google.common.base.CharMatcher; /*** From 742c77a931520361d88b0a81de6ce37c52330dd8 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 19 Aug 2018 00:34:16 +0530 Subject: [PATCH 231/298] [BAEL-8232] - Moved code from core-java to java-strings module for 'Converting Strings to Enums in Java' article --- .../src/main/java/com/baeldung/enums/Pizza.java | 0 .../src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java | 0 .../java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java | 0 .../src/main/java/com/baeldung/enums/README.md | 0 .../src/test/java/com/baeldung/enums/PizzaUnitTest.java | 0 .../src/test/java/org/baeldung/java/enums/PizzaUnitTest.java | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {core-java => java-strings}/src/main/java/com/baeldung/enums/Pizza.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java (100%) rename {core-java => java-strings}/src/main/java/com/baeldung/enums/README.md (100%) rename {core-java => java-strings}/src/test/java/com/baeldung/enums/PizzaUnitTest.java (100%) rename {core-java => java-strings}/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java (100%) diff --git a/core-java/src/main/java/com/baeldung/enums/Pizza.java b/java-strings/src/main/java/com/baeldung/enums/Pizza.java similarity index 100% rename from core-java/src/main/java/com/baeldung/enums/Pizza.java rename to java-strings/src/main/java/com/baeldung/enums/Pizza.java diff --git a/core-java/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java b/java-strings/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java similarity index 100% rename from core-java/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java rename to java-strings/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java diff --git a/core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java b/java-strings/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java similarity index 100% rename from core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java rename to java-strings/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java diff --git a/core-java/src/main/java/com/baeldung/enums/README.md b/java-strings/src/main/java/com/baeldung/enums/README.md similarity index 100% rename from core-java/src/main/java/com/baeldung/enums/README.md rename to java-strings/src/main/java/com/baeldung/enums/README.md diff --git a/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java b/java-strings/src/test/java/com/baeldung/enums/PizzaUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java rename to java-strings/src/test/java/com/baeldung/enums/PizzaUnitTest.java diff --git a/core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java b/java-strings/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java similarity index 100% rename from core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java rename to java-strings/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java From b4036907b9ca4d119d4cb7f610eb6ef920774d09 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 19 Aug 2018 01:20:13 +0530 Subject: [PATCH 232/298] [BAEL-8232] - Moved non-string related code to core-java and copied PizzaStatusEnum class and PizzaUnitTest relavent TCs to java-strings module --- .../main/java/com/baeldung/enums/Pizza.java | 0 .../baeldung/enums/PizzaDeliveryStrategy.java | 0 .../PizzaDeliverySystemConfiguration.java | 0 .../main/java/com/baeldung/enums/README.md | 0 .../com/baeldung/enums/PizzaUnitTest.java | 100 ++++++++++++++++++ .../baeldung/java/enums/PizzaUnitTest.java | 0 .../com/baeldung/enums/PizzaStatusEnum.java | 44 ++++++++ .../com/baeldung/enums/PizzaUnitTest.java | 79 +------------- 8 files changed, 147 insertions(+), 76 deletions(-) rename {java-strings => core-java}/src/main/java/com/baeldung/enums/Pizza.java (100%) rename {java-strings => core-java}/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java (100%) rename {java-strings => core-java}/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java (100%) rename {java-strings => core-java}/src/main/java/com/baeldung/enums/README.md (100%) create mode 100644 core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java rename {java-strings => core-java}/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java (100%) create mode 100644 java-strings/src/main/java/com/baeldung/enums/PizzaStatusEnum.java diff --git a/java-strings/src/main/java/com/baeldung/enums/Pizza.java b/core-java/src/main/java/com/baeldung/enums/Pizza.java similarity index 100% rename from java-strings/src/main/java/com/baeldung/enums/Pizza.java rename to core-java/src/main/java/com/baeldung/enums/Pizza.java diff --git a/java-strings/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java b/core-java/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java similarity index 100% rename from java-strings/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java rename to core-java/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java diff --git a/java-strings/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java b/core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java similarity index 100% rename from java-strings/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java rename to core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java diff --git a/java-strings/src/main/java/com/baeldung/enums/README.md b/core-java/src/main/java/com/baeldung/enums/README.md similarity index 100% rename from java-strings/src/main/java/com/baeldung/enums/README.md rename to core-java/src/main/java/com/baeldung/enums/README.md diff --git a/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java b/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java new file mode 100644 index 0000000000..35aa07821c --- /dev/null +++ b/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java @@ -0,0 +1,100 @@ +package com.baeldung.enums; + +import com.baeldung.enums.Pizza.PizzaStatusEnum; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.List; + +import static junit.framework.TestCase.assertTrue; + +public class PizzaUnitTest { + + @Test + public void givenPizaOrder_whenReady_thenDeliverable() { + Pizza testPz = new Pizza(); + testPz.setStatus(Pizza.PizzaStatusEnum.READY); + assertTrue(testPz.isDeliverable()); + } + + @Test + public void givenPizaOrders_whenRetrievingUnDeliveredPzs_thenCorrectlyRetrieved() { + List pzList = new ArrayList<>(); + Pizza pz1 = new Pizza(); + pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED); + + Pizza pz2 = new Pizza(); + pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED); + + Pizza pz3 = new Pizza(); + pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED); + + Pizza pz4 = new Pizza(); + pz4.setStatus(Pizza.PizzaStatusEnum.READY); + + pzList.add(pz1); + pzList.add(pz2); + pzList.add(pz3); + pzList.add(pz4); + + List undeliveredPzs = Pizza.getAllUndeliveredPizzas(pzList); + assertTrue(undeliveredPzs.size() == 3); + } + + @Test + public void givenPizaOrders_whenGroupByStatusCalled_thenCorrectlyGrouped() { + + List pzList = new ArrayList<>(); + Pizza pz1 = new Pizza(); + pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED); + + Pizza pz2 = new Pizza(); + pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED); + + Pizza pz3 = new Pizza(); + pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED); + + Pizza pz4 = new Pizza(); + pz4.setStatus(Pizza.PizzaStatusEnum.READY); + + pzList.add(pz1); + pzList.add(pz2); + pzList.add(pz3); + pzList.add(pz4); + + EnumMap> map = Pizza.groupPizzaByStatus(pzList); + assertTrue(map.get(Pizza.PizzaStatusEnum.DELIVERED).size() == 1); + assertTrue(map.get(Pizza.PizzaStatusEnum.ORDERED).size() == 2); + assertTrue(map.get(Pizza.PizzaStatusEnum.READY).size() == 1); + } + + @Test + public void whenDelivered_thenPizzaGetsDeliveredAndStatusChanges() { + Pizza pz = new Pizza(); + pz.setStatus(Pizza.PizzaStatusEnum.READY); + pz.deliver(); + assertTrue(pz.getStatus() == Pizza.PizzaStatusEnum.DELIVERED); + } + + @Test + public void whenConvertedIntoEnum_thenGetsConvertedCorrectly() { + String pizzaEnumValue = "READY"; + PizzaStatusEnum pizzaStatusEnum = PizzaStatusEnum.valueOf(pizzaEnumValue); + assertTrue(pizzaStatusEnum == PizzaStatusEnum.READY); + } + + @Test(expected = IllegalArgumentException.class) + public void whenConvertedIntoEnum_thenThrowsException() { + String pizzaEnumValue = "rEAdY"; + PizzaStatusEnum pizzaStatusEnum = PizzaStatusEnum.valueOf(pizzaEnumValue); + } + + @Test(expected = IllegalArgumentException.class) + public void givenInvalidEnumValueContentWiseAsString_whenConvertedIntoEnum_thenThrowsException() { + String pizzaEnumValue = "invalid"; + PizzaStatusEnum pizzaStatusEnum = PizzaStatusEnum.valueOf(pizzaEnumValue); + } + + +} diff --git a/java-strings/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java b/core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java similarity index 100% rename from java-strings/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java rename to core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java diff --git a/java-strings/src/main/java/com/baeldung/enums/PizzaStatusEnum.java b/java-strings/src/main/java/com/baeldung/enums/PizzaStatusEnum.java new file mode 100644 index 0000000000..a84829c38d --- /dev/null +++ b/java-strings/src/main/java/com/baeldung/enums/PizzaStatusEnum.java @@ -0,0 +1,44 @@ +package com.baeldung.enums; + +public enum PizzaStatusEnum { + ORDERED(5) { + @Override + public boolean isOrdered() { + return true; + } + }, + READY(2) { + @Override + public boolean isReady() { + return true; + } + }, + DELIVERED(0) { + @Override + public boolean isDelivered() { + return true; + } + }; + + private int timeToDelivery; + + public boolean isOrdered() { + return false; + } + + public boolean isReady() { + return false; + } + + public boolean isDelivered() { + return false; + } + + public int getTimeToDelivery() { + return timeToDelivery; + } + + PizzaStatusEnum(int timeToDelivery) { + this.timeToDelivery = timeToDelivery; + } +} diff --git a/java-strings/src/test/java/com/baeldung/enums/PizzaUnitTest.java b/java-strings/src/test/java/com/baeldung/enums/PizzaUnitTest.java index 35aa07821c..3e52a89bad 100644 --- a/java-strings/src/test/java/com/baeldung/enums/PizzaUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/enums/PizzaUnitTest.java @@ -1,81 +1,10 @@ package com.baeldung.enums; -import com.baeldung.enums.Pizza.PizzaStatusEnum; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.List; - import static junit.framework.TestCase.assertTrue; +import org.junit.Test; + public class PizzaUnitTest { - - @Test - public void givenPizaOrder_whenReady_thenDeliverable() { - Pizza testPz = new Pizza(); - testPz.setStatus(Pizza.PizzaStatusEnum.READY); - assertTrue(testPz.isDeliverable()); - } - - @Test - public void givenPizaOrders_whenRetrievingUnDeliveredPzs_thenCorrectlyRetrieved() { - List pzList = new ArrayList<>(); - Pizza pz1 = new Pizza(); - pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED); - - Pizza pz2 = new Pizza(); - pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED); - - Pizza pz3 = new Pizza(); - pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED); - - Pizza pz4 = new Pizza(); - pz4.setStatus(Pizza.PizzaStatusEnum.READY); - - pzList.add(pz1); - pzList.add(pz2); - pzList.add(pz3); - pzList.add(pz4); - - List undeliveredPzs = Pizza.getAllUndeliveredPizzas(pzList); - assertTrue(undeliveredPzs.size() == 3); - } - - @Test - public void givenPizaOrders_whenGroupByStatusCalled_thenCorrectlyGrouped() { - - List pzList = new ArrayList<>(); - Pizza pz1 = new Pizza(); - pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED); - - Pizza pz2 = new Pizza(); - pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED); - - Pizza pz3 = new Pizza(); - pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED); - - Pizza pz4 = new Pizza(); - pz4.setStatus(Pizza.PizzaStatusEnum.READY); - - pzList.add(pz1); - pzList.add(pz2); - pzList.add(pz3); - pzList.add(pz4); - - EnumMap> map = Pizza.groupPizzaByStatus(pzList); - assertTrue(map.get(Pizza.PizzaStatusEnum.DELIVERED).size() == 1); - assertTrue(map.get(Pizza.PizzaStatusEnum.ORDERED).size() == 2); - assertTrue(map.get(Pizza.PizzaStatusEnum.READY).size() == 1); - } - - @Test - public void whenDelivered_thenPizzaGetsDeliveredAndStatusChanges() { - Pizza pz = new Pizza(); - pz.setStatus(Pizza.PizzaStatusEnum.READY); - pz.deliver(); - assertTrue(pz.getStatus() == Pizza.PizzaStatusEnum.DELIVERED); - } @Test public void whenConvertedIntoEnum_thenGetsConvertedCorrectly() { @@ -95,6 +24,4 @@ public class PizzaUnitTest { String pizzaEnumValue = "invalid"; PizzaStatusEnum pizzaStatusEnum = PizzaStatusEnum.valueOf(pizzaEnumValue); } - - -} +} \ No newline at end of file From 65cd3b3bd543a3812e9d678207042b1206254cc5 Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Sat, 18 Aug 2018 19:29:20 -0500 Subject: [PATCH 233/298] BAEL-2066 Update README (#5000) * 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 --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 6d8db8d388..194b3e9e29 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -167,3 +167,4 @@ - [Guide to Java Instrumentation](http://www.baeldung.com/java-instrumentation) - [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) - [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) +- [Java Constructors vs Static Factory Methods](https://www.baeldung.com/java-constructors-vs-static-factory-methods) From ba7efbcc438f68db207b166edbc77535edac8ba0 Mon Sep 17 00:00:00 2001 From: Kevin Wittek Date: Sun, 19 Aug 2018 02:34:47 +0200 Subject: [PATCH 234/298] Example for removing first element of array (BAEL-2029) (#4970) * Example for removing first element of array (BAEL-2029) * Use AssertJ assertions * Move array test to collections module. * Remove redundant test --- .../RemoveFirstElementUnitTest.java | 11 +++++ .../array/RemoveFirstElementUnitTest.java | 42 ------------------- 2 files changed, 11 insertions(+), 42 deletions(-) delete mode 100644 core-java/src/test/java/com/baeldung/array/RemoveFirstElementUnitTest.java diff --git a/core-java-collections/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java b/core-java-collections/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java index 09f0bb248c..f2b1bd9d88 100644 --- a/core-java-collections/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java +++ b/core-java-collections/src/test/java/com/baeldung/list/removefirst/RemoveFirstElementUnitTest.java @@ -4,6 +4,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -48,4 +49,14 @@ public class RemoveFirstElementUnitTest { assertThat(linkedList, not(contains("cat"))); } + @Test + public void givenStringArray_whenRemovingFirstElement_thenArrayIsSmallerAndElementRemoved() { + String[] stringArray = {"foo", "bar", "baz"}; + + String[] modifiedArray = Arrays.copyOfRange(stringArray, 1, stringArray.length); + + assertThat(modifiedArray.length, is(2)); + assertThat(modifiedArray[0], is("bar")); + } + } diff --git a/core-java/src/test/java/com/baeldung/array/RemoveFirstElementUnitTest.java b/core-java/src/test/java/com/baeldung/array/RemoveFirstElementUnitTest.java deleted file mode 100644 index 7d11016d7f..0000000000 --- a/core-java/src/test/java/com/baeldung/array/RemoveFirstElementUnitTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.array; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public class RemoveFirstElementUnitTest { - - @Test - public void givenStringArray_whenRemovingFirstElement_thenArrayIsSmallerAndElementRemoved() { - String[] stringArray = {"foo", "bar", "baz"}; - - String[] modifiedArray = Arrays.copyOfRange(stringArray, 1, stringArray.length); - - assertThat(modifiedArray.length).isEqualTo(2); - assertThat(modifiedArray[0]).isEqualTo("bar"); - } - - @Test - public void givenArrayList_whenRemovingFirstElement_thenListSmallerAndElementRemoved() { - List stringList = new ArrayList<>(Arrays.asList("foo", "bar", "baz")); - stringList.remove(0); - - assertThat(stringList.size()).isEqualTo(2); - assertThat(stringList.get(0)).isEqualTo("bar"); - } - - @Test - public void givenLinkedList_whenRemovingFirstElement_thenListSmallerAndElementRemoved() { - List stringList = new LinkedList<>(Arrays.asList("foo", "bar", "baz")); - stringList.remove(0); - - assertThat(stringList.size()).isEqualTo(2); - assertThat(stringList.get(0)).isEqualTo("bar"); - } - -} From 7fe80d891768a9776a9f6780ae7ce72077912876 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 19 Aug 2018 06:52:15 +0300 Subject: [PATCH 235/298] Update README.md From ab560b758036da5a1f69caa79338c94694a1fa9e Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 19 Aug 2018 07:33:37 +0300 Subject: [PATCH 236/298] remove string-related code --- .../com/baeldung/enums/PizzaUnitTest.java | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java b/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java index 35aa07821c..d8638ecec0 100644 --- a/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java +++ b/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java @@ -75,26 +75,6 @@ public class PizzaUnitTest { pz.setStatus(Pizza.PizzaStatusEnum.READY); pz.deliver(); assertTrue(pz.getStatus() == Pizza.PizzaStatusEnum.DELIVERED); - } - - @Test - public void whenConvertedIntoEnum_thenGetsConvertedCorrectly() { - String pizzaEnumValue = "READY"; - PizzaStatusEnum pizzaStatusEnum = PizzaStatusEnum.valueOf(pizzaEnumValue); - assertTrue(pizzaStatusEnum == PizzaStatusEnum.READY); - } - - @Test(expected = IllegalArgumentException.class) - public void whenConvertedIntoEnum_thenThrowsException() { - String pizzaEnumValue = "rEAdY"; - PizzaStatusEnum pizzaStatusEnum = PizzaStatusEnum.valueOf(pizzaEnumValue); - } - - @Test(expected = IllegalArgumentException.class) - public void givenInvalidEnumValueContentWiseAsString_whenConvertedIntoEnum_thenThrowsException() { - String pizzaEnumValue = "invalid"; - PizzaStatusEnum pizzaStatusEnum = PizzaStatusEnum.valueOf(pizzaEnumValue); - } - + } } From 0a679c1978369120651324a62da32aa86c5b2156 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 19 Aug 2018 10:35:26 +0530 Subject: [PATCH 237/298] [BAEL-8401] - Added new module core-java-concurrency-collections and moved code and github references from core-java-concurrency module --- core-java-concurrency-collections/README.md | 16 ++++ core-java-concurrency-collections/pom.xml | 94 +++++++++++++++++++ .../blockingqueue/BlockingQueueUsage.java | 0 .../blockingqueue/NumbersConsumer.java | 0 .../blockingqueue/NumbersProducer.java | 0 .../concurrent/delayqueue/DelayObject.java | 0 .../delayqueue/DelayQueueConsumer.java | 0 .../delayqueue/DelayQueueProducer.java | 0 .../locks/ReentrantLockWithCondition.java | 0 .../locks/SharedObjectWithLock.java | 0 .../concurrent/locks/StampedLockDemo.java | 0 .../locks/SynchronizedHashMapWithRWLock.java | 0 .../baeldung/concurrent/skiplist/Event.java | 0 .../concurrent/skiplist/EventWindowSort.java | 0 .../com/baeldung/transferqueue/Consumer.java | 0 .../com/baeldung/transferqueue/Producer.java | 0 .../src/main/resources/logback.xml | 19 ++++ .../CopyOnWriteArrayListUnitTest.java | 0 .../delayqueue/DelayQueueIntegrationTest.java | 0 .../locks/SharedObjectWithLockManualTest.java | 0 ...nchronizedHashMapWithRWLockManualTest.java | 0 .../PriorityBlockingQueueIntegrationTest.java | 0 .../ConcurrentSkipListSetIntegrationTest.java | 0 ...oncurrentMapAggregateStatusManualTest.java | 0 .../ConcurrentMapNullKeyValueManualTest.java | 0 .../ConcurrentMapPerformanceManualTest.java | 0 .../ConcurrentNavigableMapManualTest.java | 0 ...ncurretMapMemoryConsistencyManualTest.java | 0 .../ConcurrentModificationUnitTest.java | 0 .../SynchronousQueueIntegrationTest.java | 0 .../TransferQueueIntegrationTest.java | 0 ...adPoolInParallelStreamIntegrationTest.java | 0 .../src/test/resources/.gitignore | 13 +++ core-java-concurrency/README.md | 11 --- pom.xml | 2 + 35 files changed, 144 insertions(+), 11 deletions(-) create mode 100644 core-java-concurrency-collections/README.md create mode 100644 core-java-concurrency-collections/pom.xml rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersConsumer.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueConsumer.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueProducer.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/skiplist/Event.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/concurrent/skiplist/EventWindowSort.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/transferqueue/Consumer.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/main/java/com/baeldung/transferqueue/Producer.java (100%) create mode 100644 core-java-concurrency-collections/src/main/resources/logback.xml rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/concurrent/copyonwrite/CopyOnWriteArrayListUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/concurrent/delayqueue/DelayQueueIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/concurrent/priorityblockingqueue/PriorityBlockingQueueIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/concurrent/skiplist/ConcurrentSkipListSetIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/synchronousqueue/SynchronousQueueIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java (100%) rename {core-java-concurrency => core-java-concurrency-collections}/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java (100%) create mode 100644 core-java-concurrency-collections/src/test/resources/.gitignore diff --git a/core-java-concurrency-collections/README.md b/core-java-concurrency-collections/README.md new file mode 100644 index 0000000000..aaee8e5eee --- /dev/null +++ b/core-java-concurrency-collections/README.md @@ -0,0 +1,16 @@ +========= + +## Core Java Concurrency Collections Examples + +### Relevant Articles: +- [Guide to java.util.concurrent.BlockingQueue](http://www.baeldung.com/java-blocking-queue) +- [A Guide to ConcurrentMap](http://www.baeldung.com/java-concurrent-map) +- [Guide to PriorityBlockingQueue in Java](http://www.baeldung.com/java-priority-blocking-queue) +- [Avoiding the ConcurrentModificationException in Java](http://www.baeldung.com/java-concurrentmodificationexception) +- [Custom Thread Pools In Java 8 Parallel Streams](http://www.baeldung.com/java-8-parallel-streams-custom-threadpool) +- [Guide to java.util.concurrent.Locks](http://www.baeldung.com/java-concurrent-locks) +- [Guide to DelayQueue](http://www.baeldung.com/java-delay-queue) +- [A Guide to Java SynchronousQueue](http://www.baeldung.com/java-synchronous-queue) +- [Guide to the Java TransferQueue](http://www.baeldung.com/java-transfer-queue) +- [Guide to the ConcurrentSkipListMap](http://www.baeldung.com/java-concurrent-skip-list-map) +- [Guide to CopyOnWriteArrayList](http://www.baeldung.com/java-copy-on-write-arraylist) diff --git a/core-java-concurrency-collections/pom.xml b/core-java-concurrency-collections/pom.xml new file mode 100644 index 0000000000..5e0a80d33c --- /dev/null +++ b/core-java-concurrency-collections/pom.xml @@ -0,0 +1,94 @@ + + 4.0.0 + com.baeldung + core-java-concurrency-collections + 0.1.0-SNAPSHOT + jar + core-java-concurrency-collections + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + commons-io + commons-io + ${commons-io.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + com.jayway.awaitility + awaitility + ${avaitility.version} + test + + + + + core-java-concurrency-collections + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + + + + + + + + + + + 21.0 + 3.5 + 3.6.1 + 4.1 + 4.01 + + 3.6.1 + 1.7.0 + + + diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/blockingqueue/BlockingQueueUsage.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersConsumer.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersConsumer.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersConsumer.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersConsumer.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/blockingqueue/NumbersProducer.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/delayqueue/DelayObject.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueConsumer.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueConsumer.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueConsumer.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueConsumer.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueProducer.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueProducer.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueProducer.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/delayqueue/DelayQueueProducer.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/skiplist/Event.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/skiplist/Event.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/skiplist/Event.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/skiplist/Event.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/concurrent/skiplist/EventWindowSort.java b/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/skiplist/EventWindowSort.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/concurrent/skiplist/EventWindowSort.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/skiplist/EventWindowSort.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/transferqueue/Consumer.java b/core-java-concurrency-collections/src/main/java/com/baeldung/transferqueue/Consumer.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/transferqueue/Consumer.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/transferqueue/Consumer.java diff --git a/core-java-concurrency/src/main/java/com/baeldung/transferqueue/Producer.java b/core-java-concurrency-collections/src/main/java/com/baeldung/transferqueue/Producer.java similarity index 100% rename from core-java-concurrency/src/main/java/com/baeldung/transferqueue/Producer.java rename to core-java-concurrency-collections/src/main/java/com/baeldung/transferqueue/Producer.java diff --git a/core-java-concurrency-collections/src/main/resources/logback.xml b/core-java-concurrency-collections/src/main/resources/logback.xml new file mode 100644 index 0000000000..ec0dc2469a --- /dev/null +++ b/core-java-concurrency-collections/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + web - %date [%thread] %-5level %logger{36} - %message%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/copyonwrite/CopyOnWriteArrayListUnitTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/copyonwrite/CopyOnWriteArrayListUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/copyonwrite/CopyOnWriteArrayListUnitTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/copyonwrite/CopyOnWriteArrayListUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/delayqueue/DelayQueueIntegrationTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/delayqueue/DelayQueueIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/delayqueue/DelayQueueIntegrationTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/delayqueue/DelayQueueIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/priorityblockingqueue/PriorityBlockingQueueIntegrationTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/priorityblockingqueue/PriorityBlockingQueueIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/priorityblockingqueue/PriorityBlockingQueueIntegrationTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/priorityblockingqueue/PriorityBlockingQueueIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/concurrent/skiplist/ConcurrentSkipListSetIntegrationTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/skiplist/ConcurrentSkipListSetIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/concurrent/skiplist/ConcurrentSkipListSetIntegrationTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/skiplist/ConcurrentSkipListSetIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapAggregateStatusManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapNullKeyValueManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurrentMapPerformanceManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurrentNavigableMapManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmap/ConcurretMapMemoryConsistencyManualTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/java/concurrentmodification/ConcurrentModificationUnitTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/synchronousqueue/SynchronousQueueIntegrationTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/synchronousqueue/SynchronousQueueIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/synchronousqueue/SynchronousQueueIntegrationTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/synchronousqueue/SynchronousQueueIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java b/core-java-concurrency-collections/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java rename to core-java-concurrency-collections/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java diff --git a/core-java-concurrency/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java b/core-java-concurrency-collections/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java similarity index 100% rename from core-java-concurrency/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java rename to core-java-concurrency-collections/src/test/java/org/baeldung/java/streams/ThreadPoolInParallelStreamIntegrationTest.java diff --git a/core-java-concurrency-collections/src/test/resources/.gitignore b/core-java-concurrency-collections/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/core-java-concurrency-collections/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/core-java-concurrency/README.md b/core-java-concurrency/README.md index a16d885b0c..1b95fc6e09 100644 --- a/core-java-concurrency/README.md +++ b/core-java-concurrency/README.md @@ -7,22 +7,11 @@ - [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) - [Introduction to Thread Pools in Java](http://www.baeldung.com/thread-pool-java-and-guava) - [Guide to java.util.concurrent.Future](http://www.baeldung.com/java-future) -- [Guide to java.util.concurrent.BlockingQueue](http://www.baeldung.com/java-blocking-queue) - [Guide to CountDownLatch in Java](http://www.baeldung.com/java-countdown-latch) -- [A Guide to ConcurrentMap](http://www.baeldung.com/java-concurrent-map) -- [Guide to PriorityBlockingQueue in Java](http://www.baeldung.com/java-priority-blocking-queue) -- [Avoiding the ConcurrentModificationException in Java](http://www.baeldung.com/java-concurrentmodificationexception) -- [Custom Thread Pools In Java 8 Parallel Streams](http://www.baeldung.com/java-8-parallel-streams-custom-threadpool) -- [Guide to java.util.concurrent.Locks](http://www.baeldung.com/java-concurrent-locks) - [An Introduction to ThreadLocal in Java](http://www.baeldung.com/java-threadlocal) -- [Guide to DelayQueue](http://www.baeldung.com/java-delay-queue) -- [A Guide to Java SynchronousQueue](http://www.baeldung.com/java-synchronous-queue) -- [Guide to the Java TransferQueue](http://www.baeldung.com/java-transfer-queue) -- [Guide to the ConcurrentSkipListMap](http://www.baeldung.com/java-concurrent-skip-list-map) - [Difference Between Wait and Sleep in Java](http://www.baeldung.com/java-wait-and-sleep) - [LongAdder and LongAccumulator in Java](http://www.baeldung.com/java-longadder-and-longaccumulator) - [The Dining Philosophers Problem in Java](http://www.baeldung.com/java-dining-philoshophers) -- [Guide to CopyOnWriteArrayList](http://www.baeldung.com/java-copy-on-write-arraylist) - [Guide to the Java Phaser](http://www.baeldung.com/java-phaser) - [Guide to Synchronized Keyword in Java](http://www.baeldung.com/java-synchronized) - [An Introduction to Atomic Variables in Java](http://www.baeldung.com/java-atomic-variables) diff --git a/pom.xml b/pom.xml index 7cee3d6a01..98b8f68a50 100644 --- a/pom.xml +++ b/pom.xml @@ -352,6 +352,7 @@ core-kotlin core-groovy core-java-concurrency + core-java-concurrency-collections couchbase deltaspike dozer @@ -1216,6 +1217,7 @@ hibernate5 spring-data-elasticsearch core-java-concurrency + core-java-concurrency-collections From 351f2bc98c9b924d9eab2272e07931fc610d7537 Mon Sep 17 00:00:00 2001 From: myluckagain Date: Sun, 19 Aug 2018 12:36:54 +0500 Subject: [PATCH 238/298] BAEL-2072 (#4983) * BAEL-2072 * rename --- .../baeldung/componentscan/ExampleBean.java | 5 +++ .../springapp/SpringComponentScanApp.java | 38 +++++++++++++++++++ .../componentscan/springapp/animals/Cat.java | 8 ++++ .../componentscan/springapp/animals/Dog.java | 8 ++++ .../componentscan/springapp/flowers/Rose.java | 8 ++++ .../SpringBootComponentScanApp.java | 37 ++++++++++++++++++ .../springbootapp/animals/Cat.java | 8 ++++ .../springbootapp/animals/Dog.java | 8 ++++ .../springbootapp/flowers/Rose.java | 8 ++++ 9 files changed, 128 insertions(+) create mode 100644 spring-boot/src/main/java/com/baeldung/componentscan/ExampleBean.java create mode 100644 spring-boot/src/main/java/com/baeldung/componentscan/springapp/SpringComponentScanApp.java create mode 100644 spring-boot/src/main/java/com/baeldung/componentscan/springapp/animals/Cat.java create mode 100644 spring-boot/src/main/java/com/baeldung/componentscan/springapp/animals/Dog.java create mode 100644 spring-boot/src/main/java/com/baeldung/componentscan/springapp/flowers/Rose.java create mode 100644 spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/SpringBootComponentScanApp.java create mode 100644 spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/animals/Cat.java create mode 100644 spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/animals/Dog.java create mode 100644 spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/flowers/Rose.java diff --git a/spring-boot/src/main/java/com/baeldung/componentscan/ExampleBean.java b/spring-boot/src/main/java/com/baeldung/componentscan/ExampleBean.java new file mode 100644 index 0000000000..9ddcf12d4e --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/componentscan/ExampleBean.java @@ -0,0 +1,5 @@ +package com.baeldung.componentscan; + +public class ExampleBean { + +} diff --git a/spring-boot/src/main/java/com/baeldung/componentscan/springapp/SpringComponentScanApp.java b/spring-boot/src/main/java/com/baeldung/componentscan/springapp/SpringComponentScanApp.java new file mode 100644 index 0000000000..2377ed7a56 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/componentscan/springapp/SpringComponentScanApp.java @@ -0,0 +1,38 @@ +package com.baeldung.componentscan.springapp; + +import org.springframework.context.annotation.FilterType; +import org.springframework.stereotype.Component; + +import com.baeldung.componentscan.ExampleBean; +import com.baeldung.componentscan.springapp.flowers.Rose; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan +//@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = Rose.class)) +//@ComponentScan(basePackages = "com.baeldung.componentscan.springapp") +//@ComponentScan(basePackages = "com.baeldung.componentscan.springapp.animals") +//@ComponentScan (excludeFilters = @ComponentScan.Filter(type=FilterType.REGEX,pattern="com\\.baeldung\\.componentscan\\.springapp\\.flowers\\..*")) +public class SpringComponentScanApp { + + private static ApplicationContext applicationContext; + + @Bean + public ExampleBean exampleBean() { + return new ExampleBean(); + } + + public static void main(String[] args) { + applicationContext = new AnnotationConfigApplicationContext(SpringComponentScanApp.class); + + for (String beanName : applicationContext.getBeanDefinitionNames()) { + System.out.println(beanName); + } + } + +} \ No newline at end of file diff --git a/spring-boot/src/main/java/com/baeldung/componentscan/springapp/animals/Cat.java b/spring-boot/src/main/java/com/baeldung/componentscan/springapp/animals/Cat.java new file mode 100644 index 0000000000..5f5b482972 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/componentscan/springapp/animals/Cat.java @@ -0,0 +1,8 @@ +package com.baeldung.componentscan.springapp.animals; + +import org.springframework.stereotype.Component; + +@Component +public class Cat { + +} diff --git a/spring-boot/src/main/java/com/baeldung/componentscan/springapp/animals/Dog.java b/spring-boot/src/main/java/com/baeldung/componentscan/springapp/animals/Dog.java new file mode 100644 index 0000000000..009162b57f --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/componentscan/springapp/animals/Dog.java @@ -0,0 +1,8 @@ +package com.baeldung.componentscan.springapp.animals; + +import org.springframework.stereotype.Component; + +@Component +public class Dog { + +} diff --git a/spring-boot/src/main/java/com/baeldung/componentscan/springapp/flowers/Rose.java b/spring-boot/src/main/java/com/baeldung/componentscan/springapp/flowers/Rose.java new file mode 100644 index 0000000000..b777b073b9 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/componentscan/springapp/flowers/Rose.java @@ -0,0 +1,8 @@ +package com.baeldung.componentscan.springapp.flowers; + +import org.springframework.stereotype.Component; + +@Component +public class Rose { + +} diff --git a/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/SpringBootComponentScanApp.java b/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/SpringBootComponentScanApp.java new file mode 100644 index 0000000000..ba29a4e1f5 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/SpringBootComponentScanApp.java @@ -0,0 +1,37 @@ +package com.baeldung.componentscan.springbootapp; + +import org.springframework.boot.SpringApplication; +import org.springframework.context.annotation.FilterType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; + +import com.baeldung.componentscan.ExampleBean; +import com.baeldung.componentscan.springbootapp.flowers.Rose; + +@SpringBootApplication +//@ComponentScan(basePackages = "com.baeldung.componentscan.springbootapp.animals") +//@ComponentScan ( excludeFilters = @ComponentScan.Filter(type=FilterType.REGEX,pattern="com\\.baeldung\\.componentscan\\.springbootapp\\.flowers\\..*")) +//@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = Rose.class)) + +public class SpringBootComponentScanApp { + private static ApplicationContext applicationContext; + + @Bean + public ExampleBean exampleBean() { + return new ExampleBean(); + } + + public static void main(String[] args) { + applicationContext = SpringApplication.run(SpringBootComponentScanApp.class, args); + checkBeansPresence("cat", "dog", "rose", "exampleBean", "springBootApp"); + + } + + private static void checkBeansPresence(String... beans) { + for (String beanName : beans) { + System.out.println("Is " + beanName + " in ApplicationContext: " + applicationContext.containsBean(beanName)); + } + } +} diff --git a/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/animals/Cat.java b/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/animals/Cat.java new file mode 100644 index 0000000000..7c43d6a24c --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/animals/Cat.java @@ -0,0 +1,8 @@ +package com.baeldung.componentscan.springbootapp.animals; + +import org.springframework.stereotype.Component; + +@Component +public class Cat { + +} diff --git a/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/animals/Dog.java b/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/animals/Dog.java new file mode 100644 index 0000000000..145430cb54 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/animals/Dog.java @@ -0,0 +1,8 @@ +package com.baeldung.componentscan.springbootapp.animals; + +import org.springframework.stereotype.Component; + +@Component +public class Dog { + +} diff --git a/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/flowers/Rose.java b/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/flowers/Rose.java new file mode 100644 index 0000000000..0ccf782685 --- /dev/null +++ b/spring-boot/src/main/java/com/baeldung/componentscan/springbootapp/flowers/Rose.java @@ -0,0 +1,8 @@ +package com.baeldung.componentscan.springbootapp.flowers; + +import org.springframework.stereotype.Component; + +@Component +public class Rose { + +} From c0eca2772304eff92666b169561b1f00f01c8d9a Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 19 Aug 2018 14:41:53 +0530 Subject: [PATCH 239/298] [BAEL-8401] - Moved concurrent locks related codes to core-java-concurrency module --- core-java-concurrency-collections/.gitignore | 26 +++++++++++++++++++ core-java-concurrency-collections/README.md | 1 - core-java-concurrency/README.md | 1 + .../locks/ReentrantLockWithCondition.java | 0 .../locks/SharedObjectWithLock.java | 0 .../concurrent/locks/StampedLockDemo.java | 0 .../locks/SynchronizedHashMapWithRWLock.java | 0 .../locks/SharedObjectWithLockManualTest.java | 0 ...nchronizedHashMapWithRWLockManualTest.java | 0 9 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 core-java-concurrency-collections/.gitignore rename {core-java-concurrency-collections => core-java-concurrency}/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java (100%) rename {core-java-concurrency-collections => core-java-concurrency}/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java (100%) rename {core-java-concurrency-collections => core-java-concurrency}/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java (100%) rename {core-java-concurrency-collections => core-java-concurrency}/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java (100%) rename {core-java-concurrency-collections => core-java-concurrency}/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java (100%) rename {core-java-concurrency-collections => core-java-concurrency}/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java (100%) diff --git a/core-java-concurrency-collections/.gitignore b/core-java-concurrency-collections/.gitignore new file mode 100644 index 0000000000..3de4cc647e --- /dev/null +++ b/core-java-concurrency-collections/.gitignore @@ -0,0 +1,26 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +*.txt +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/core-java-concurrency-collections/README.md b/core-java-concurrency-collections/README.md index aaee8e5eee..b982a91861 100644 --- a/core-java-concurrency-collections/README.md +++ b/core-java-concurrency-collections/README.md @@ -8,7 +8,6 @@ - [Guide to PriorityBlockingQueue in Java](http://www.baeldung.com/java-priority-blocking-queue) - [Avoiding the ConcurrentModificationException in Java](http://www.baeldung.com/java-concurrentmodificationexception) - [Custom Thread Pools In Java 8 Parallel Streams](http://www.baeldung.com/java-8-parallel-streams-custom-threadpool) -- [Guide to java.util.concurrent.Locks](http://www.baeldung.com/java-concurrent-locks) - [Guide to DelayQueue](http://www.baeldung.com/java-delay-queue) - [A Guide to Java SynchronousQueue](http://www.baeldung.com/java-synchronous-queue) - [Guide to the Java TransferQueue](http://www.baeldung.com/java-transfer-queue) diff --git a/core-java-concurrency/README.md b/core-java-concurrency/README.md index 1b95fc6e09..d775d24dff 100644 --- a/core-java-concurrency/README.md +++ b/core-java-concurrency/README.md @@ -8,6 +8,7 @@ - [Introduction to Thread Pools in Java](http://www.baeldung.com/thread-pool-java-and-guava) - [Guide to java.util.concurrent.Future](http://www.baeldung.com/java-future) - [Guide to CountDownLatch in Java](http://www.baeldung.com/java-countdown-latch) +- [Guide to java.util.concurrent.Locks](http://www.baeldung.com/java-concurrent-locks) - [An Introduction to ThreadLocal in Java](http://www.baeldung.com/java-threadlocal) - [Difference Between Wait and Sleep in Java](http://www.baeldung.com/java-wait-and-sleep) - [LongAdder and LongAccumulator in Java](http://www.baeldung.com/java-longadder-and-longaccumulator) diff --git a/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java similarity index 100% rename from core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/ReentrantLockWithCondition.java diff --git a/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java similarity index 100% rename from core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SharedObjectWithLock.java diff --git a/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java similarity index 100% rename from core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/StampedLockDemo.java diff --git a/core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java b/core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java similarity index 100% rename from core-java-concurrency-collections/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java rename to core-java-concurrency/src/main/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLock.java diff --git a/core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java similarity index 100% rename from core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SharedObjectWithLockManualTest.java diff --git a/core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java b/core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java similarity index 100% rename from core-java-concurrency-collections/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java rename to core-java-concurrency/src/test/java/com/baeldung/concurrent/locks/SynchronizedHashMapWithRWLockManualTest.java From c7c1201da36503d7517ec166aa499cd6f62a1883 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 19 Aug 2018 14:08:34 +0300 Subject: [PATCH 240/298] BAEL-8403 update jmockit version --- testing-modules/mocks/mock-comparisons/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/mocks/mock-comparisons/pom.xml b/testing-modules/mocks/mock-comparisons/pom.xml index df54db0c70..11bfac7df7 100644 --- a/testing-modules/mocks/mock-comparisons/pom.xml +++ b/testing-modules/mocks/mock-comparisons/pom.xml @@ -48,7 +48,7 @@ 2.21.0 3.5.1 - 1.34 + 1.41 \ No newline at end of file From 01ff0f039e5eade172a722a6ae0fdb2f183fdec6 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 19 Aug 2018 14:21:33 +0300 Subject: [PATCH 241/298] Update pom.xml --- testing-modules/mocks/mock-comparisons/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testing-modules/mocks/mock-comparisons/pom.xml b/testing-modules/mocks/mock-comparisons/pom.xml index 11bfac7df7..ae36280300 100644 --- a/testing-modules/mocks/mock-comparisons/pom.xml +++ b/testing-modules/mocks/mock-comparisons/pom.xml @@ -49,6 +49,7 @@ 2.21.0 3.5.1 1.41 +
- \ No newline at end of file + From a6327bdcc2caacad19ad5ba1db488cc53a834faf Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 19 Aug 2018 14:22:32 +0300 Subject: [PATCH 242/298] Update PizzaUnitTest.java --- core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java b/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java index d8638ecec0..70bfe168dd 100644 --- a/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java +++ b/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java @@ -76,5 +76,4 @@ public class PizzaUnitTest { pz.deliver(); assertTrue(pz.getStatus() == Pizza.PizzaStatusEnum.DELIVERED); } - } From ec790a6a8c53e03a60bd920e081362010b6b2135 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 19 Aug 2018 15:14:16 +0300 Subject: [PATCH 243/298] delete duplicate test --- .../baeldung/java/enums/PizzaUnitTest.java | 81 ------------------- 1 file changed, 81 deletions(-) delete mode 100644 core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java diff --git a/core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java b/core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java deleted file mode 100644 index bb3abff28d..0000000000 --- a/core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.baeldung.java.enums; - -import static junit.framework.TestCase.assertTrue; - -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.List; - -import org.junit.Test; - -import com.baeldung.enums.Pizza; - -public class PizzaUnitTest { - - @Test - public void givenPizaOrder_whenReady_thenDeliverable() { - Pizza testPz = new Pizza(); - testPz.setStatus(Pizza.PizzaStatusEnum.READY); - assertTrue(testPz.isDeliverable()); - } - - @Test - public void givenPizaOrders_whenRetrievingUnDeliveredPzs_thenCorrectlyRetrieved() { - List pzList = new ArrayList<>(); - Pizza pz1 = new Pizza(); - pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED); - - Pizza pz2 = new Pizza(); - pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED); - - Pizza pz3 = new Pizza(); - pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED); - - Pizza pz4 = new Pizza(); - pz4.setStatus(Pizza.PizzaStatusEnum.READY); - - pzList.add(pz1); - pzList.add(pz2); - pzList.add(pz3); - pzList.add(pz4); - - List undeliveredPzs = Pizza.getAllUndeliveredPizzas(pzList); - assertTrue(undeliveredPzs.size() == 3); - } - - @Test - public void givenPizaOrders_whenGroupByStatusCalled_thenCorrectlyGrouped() { - - List pzList = new ArrayList<>(); - Pizza pz1 = new Pizza(); - pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED); - - Pizza pz2 = new Pizza(); - pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED); - - Pizza pz3 = new Pizza(); - pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED); - - Pizza pz4 = new Pizza(); - pz4.setStatus(Pizza.PizzaStatusEnum.READY); - - pzList.add(pz1); - pzList.add(pz2); - pzList.add(pz3); - pzList.add(pz4); - - EnumMap> map = Pizza.groupPizzaByStatus(pzList); - assertTrue(map.get(Pizza.PizzaStatusEnum.DELIVERED).size() == 1); - assertTrue(map.get(Pizza.PizzaStatusEnum.ORDERED).size() == 2); - assertTrue(map.get(Pizza.PizzaStatusEnum.READY).size() == 1); - } - - @Test - public void givenPizaOrder_whenDelivered_thenPizzaGetsDeliveredAndStatusChanges() { - Pizza pz = new Pizza(); - pz.setStatus(Pizza.PizzaStatusEnum.READY); - pz.deliver(); - assertTrue(pz.getStatus() == Pizza.PizzaStatusEnum.DELIVERED); - } - -} From 882c5e7dc197dabfc35684df8d53c2a7fdfb69ca Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 19 Aug 2018 16:31:07 +0300 Subject: [PATCH 244/298] remove deploy directory --- spring-mvc-forms-jsp/pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/spring-mvc-forms-jsp/pom.xml b/spring-mvc-forms-jsp/pom.xml index a51f76f9e1..6c75c9299b 100644 --- a/spring-mvc-forms-jsp/pom.xml +++ b/spring-mvc-forms-jsp/pom.xml @@ -83,7 +83,6 @@ src/main/webapp spring-mvc-forms false - ${deploy-path}
@@ -99,7 +98,6 @@ 2.3.1 3.1.0 6.0.10.Final - server default deploy directory 1.3.3 5.2.5.Final 6.0.6 From 9c221cfb24719c3a85b920cd085f398c7f69e82d Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Mon, 20 Aug 2018 00:36:06 +0530 Subject: [PATCH 245/298] BAEL-7636 Add the missing plugin versions in the tutorial repo -Reverted explicitly adding of spring-swagger child modules in parent pom.xml --- pom.xml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index d290adfdd2..98b8f68a50 100644 --- a/pom.xml +++ b/pom.xml @@ -436,8 +436,7 @@ testing-modules/rest-testing resteasy rxjava - spring-swagger-codegen/spring-swagger-codegen-api-client - spring-swagger-codegen/spring-swagger-codegen-app + spring-swagger-codegen testing-modules/selenium-junit-testng persistence-modules/solr spark-java @@ -695,8 +694,7 @@ testing-modules/rest-testing resteasy rxjava - spring-swagger-codegen/spring-swagger-codegen-api-client - spring-swagger-codegen/spring-swagger-codegen-app + spring-swagger-codegen testing-modules/selenium-junit-testng persistence-modules/solr spark-java @@ -979,8 +977,7 @@ testing-modules/rest-testing resteasy rxjava - spring-swagger-codegen/spring-swagger-codegen-api-client - spring-swagger-codegen/spring-swagger-codegen-app + spring-swagger-codegen testing-modules/selenium-junit-testng persistence-modules/solr spark-java From f36bea8dc5dcb0e73abf3dd13515a53ee3a0befd Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 19 Aug 2018 22:29:37 +0300 Subject: [PATCH 246/298] Update pom.xml --- spring-swagger-codegen/spring-swagger-codegen-app/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml index 4880eb9453..281ed59857 100644 --- a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml +++ b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml @@ -31,7 +31,7 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot-maven-plugin.version} + ${spring.version} @@ -40,6 +40,5 @@ 1.8 0.0.1-SNAPSHOT 1.5.10.RELEASE - 2.0.4.RELEASE From 9156ec3736cf84639a118782295c22f1b656df7c Mon Sep 17 00:00:00 2001 From: Kacper Date: Sun, 19 Aug 2018 22:02:27 +0200 Subject: [PATCH 247/298] Throw and throws in Java (#4990) --- .../baeldung/throwsexception/Calculator.java | 15 +++++++ .../throwsexception/DataAccessException.java | 9 ++++ .../DivideByZeroException.java | 9 ++++ .../com/baeldung/throwsexception/Main.java | 41 +++++++++++++++++++ .../throwsexception/PersonRepository.java | 18 ++++++++ .../throwsexception/SimpleService.java | 22 ++++++++++ .../baeldung/throwsexception/TryCatch.java | 13 ++++++ .../throwsexception/CalculatorUnitTest.java | 17 ++++++++ .../PersonRepositoryUnitTest.java | 32 +++++++++++++++ .../SimpleServiceUnitTest.java | 22 ++++++++++ 10 files changed, 198 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/throwsexception/Calculator.java create mode 100644 core-java/src/main/java/com/baeldung/throwsexception/DataAccessException.java create mode 100644 core-java/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java create mode 100644 core-java/src/main/java/com/baeldung/throwsexception/Main.java create mode 100644 core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java create mode 100644 core-java/src/main/java/com/baeldung/throwsexception/SimpleService.java create mode 100644 core-java/src/main/java/com/baeldung/throwsexception/TryCatch.java create mode 100644 core-java/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/throwsexception/PersonRepositoryUnitTest.java create mode 100644 core-java/src/test/java/com/baeldung/throwsexception/SimpleServiceUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/throwsexception/Calculator.java b/core-java/src/main/java/com/baeldung/throwsexception/Calculator.java new file mode 100644 index 0000000000..50dbc9c774 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/throwsexception/Calculator.java @@ -0,0 +1,15 @@ +package com.baeldung.throwsexception; + +public class Calculator { + + public double divide(double a, double b) { + if (b == 0) { + throw new DivideByZeroException("Divider cannot be equal to zero!"); + } + return a/b; + } + +} + + + diff --git a/core-java/src/main/java/com/baeldung/throwsexception/DataAccessException.java b/core-java/src/main/java/com/baeldung/throwsexception/DataAccessException.java new file mode 100644 index 0000000000..0b371dcedb --- /dev/null +++ b/core-java/src/main/java/com/baeldung/throwsexception/DataAccessException.java @@ -0,0 +1,9 @@ +package com.baeldung.throwsexception; + +public class DataAccessException extends RuntimeException { + + public DataAccessException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/core-java/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java b/core-java/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java new file mode 100644 index 0000000000..4413374c99 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/throwsexception/DivideByZeroException.java @@ -0,0 +1,9 @@ +package com.baeldung.throwsexception; + +public class DivideByZeroException extends RuntimeException { + + public DivideByZeroException(String message) { + super(message); + } + +} diff --git a/core-java/src/main/java/com/baeldung/throwsexception/Main.java b/core-java/src/main/java/com/baeldung/throwsexception/Main.java new file mode 100644 index 0000000000..17fbf5a582 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/throwsexception/Main.java @@ -0,0 +1,41 @@ +package com.baeldung.throwsexception; + +import com.sun.mail.iap.ConnectionException; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.net.SocketException; + +public class Main { + + public static void main(String[] args) throws FileNotFoundException { + TryCatch tryCatch = new TryCatch(); + + try { + tryCatch.execute(); + } catch (ConnectionException | SocketException ex) { + System.out.println("IOException"); + } catch (Exception ex) { + System.out.println("General exception"); + } + + checkedException(); + checkedExceptionWithThrows(); + } + + private static void checkedExceptionWithThrows() throws FileNotFoundException { + File file = new File("not_existing_file.txt"); + FileInputStream stream = new FileInputStream(file); + } + + private static void checkedException() { + File file = new File("not_existing_file.txt"); + try { + FileInputStream stream = new FileInputStream(file); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + +} diff --git a/core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java b/core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java new file mode 100644 index 0000000000..5fcbeb3d5f --- /dev/null +++ b/core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java @@ -0,0 +1,18 @@ +package com.baeldung.throwsexception; + +import javax.annotation.Nullable; +import java.sql.SQLException; +import java.util.List; + +public class PersonRepository { + + @Nullable + public String findNameById(String id) { + return id == null ? null : "example-name"; + } + + public List findAll() throws SQLException { + throw new SQLException(); + } + +} diff --git a/core-java/src/main/java/com/baeldung/throwsexception/SimpleService.java b/core-java/src/main/java/com/baeldung/throwsexception/SimpleService.java new file mode 100644 index 0000000000..6bb8b90bf1 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/throwsexception/SimpleService.java @@ -0,0 +1,22 @@ +package com.baeldung.throwsexception; + +import java.sql.SQLException; + +public class SimpleService { + + private PersonRepository personRepository = new PersonRepository(); + + public void wrappingException() { + try { + personRepository.findAll(); + } catch (SQLException e) { + throw new DataAccessException("SQL Exception", e); + } + } + + public void runtimeNullPointerException() { + String a = null; + a.length(); + } + +} diff --git a/core-java/src/main/java/com/baeldung/throwsexception/TryCatch.java b/core-java/src/main/java/com/baeldung/throwsexception/TryCatch.java new file mode 100644 index 0000000000..2fd87f124d --- /dev/null +++ b/core-java/src/main/java/com/baeldung/throwsexception/TryCatch.java @@ -0,0 +1,13 @@ +package com.baeldung.throwsexception; + +import com.sun.mail.iap.ConnectionException; + +import java.net.SocketException; + +public class TryCatch { + + public void execute() throws SocketException, ConnectionException, Exception { + //code that would throw any of: SocketException, ConnectionException, Exception + } + +} diff --git a/core-java/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java b/core-java/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java new file mode 100644 index 0000000000..ef838ed304 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/throwsexception/CalculatorUnitTest.java @@ -0,0 +1,17 @@ +package com.baeldung.throwsexception; + +import org.junit.Test; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class CalculatorUnitTest { + + @Test + public void whenDividerIsZero_thenDivideByZeroExceptionIsThrown() { + Calculator calculator = new Calculator(); + + assertThrows(DivideByZeroException.class, + () -> calculator.divide(10, 0)); + } + +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/throwsexception/PersonRepositoryUnitTest.java b/core-java/src/test/java/com/baeldung/throwsexception/PersonRepositoryUnitTest.java new file mode 100644 index 0000000000..6294d40090 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/throwsexception/PersonRepositoryUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.throwsexception; + +import org.junit.Test; + +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public class PersonRepositoryUnitTest { + + PersonRepository personRepository = new PersonRepository(); + + @Test + public void whenIdIsNull_thenExceptionIsThrown() throws Exception { + assertThrows(Exception.class, + () -> + Optional + .ofNullable(personRepository.findNameById(null)) + .orElseThrow(Exception::new)); + } + + @Test + public void whenIdIsNonNull_thenNoExceptionIsThrown() throws Exception { + assertAll( + () -> + Optional + .ofNullable(personRepository.findNameById("id")) + .orElseThrow(Exception::new)); + } + +} \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/throwsexception/SimpleServiceUnitTest.java b/core-java/src/test/java/com/baeldung/throwsexception/SimpleServiceUnitTest.java new file mode 100644 index 0000000000..b9a658a960 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/throwsexception/SimpleServiceUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.throwsexception; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class SimpleServiceUnitTest { + + SimpleService simpleService = new SimpleService(); + + @Test + void whenSQLExceptionIsThrown_thenShouldBeRethrownWithWrappedException() { + assertThrows(DataAccessException.class, + () -> simpleService.wrappingException()); + } + + @Test + void whenCalled_thenNullPointerExceptionIsThrown() { + assertThrows(NullPointerException.class, + () -> simpleService.runtimeNullPointerException()); + } +} \ No newline at end of file From 4e968e1b15a81a6dc6c9d72013cf7881cbab05d1 Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Sun, 19 Aug 2018 18:04:18 -0500 Subject: [PATCH 248/298] BAEL-2029 Update README.md (#5010) * 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 --- core-java-collections/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index 8f5dd137ed..99d03cad26 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -36,3 +36,4 @@ - [Remove the First Element from a List](http://www.baeldung.com/java-remove-first-element-from-list) - [How to Convert List to Map in Java](http://www.baeldung.com/java-list-to-map) - [Initializing HashSet at the Time of Construction](http://www.baeldung.com/java-initialize-hashset) +- [Removing the First Element of an Array](https://www.baeldung.com/java-array-remove-first-element) From f77e37ef3fc83ed0eb2e8d539a1619fe92f58d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norberto=20Ritzmann=20J=C3=BAnior?= Date: Mon, 20 Aug 2018 00:39:01 -0300 Subject: [PATCH 249/298] Iterate through a range of Dates in Java (#4959) * Iterating over collection of dates * Development of range dates iteration * Removed some tests * After editor review * Unused interface removed * Second code revision --- .../rangedates/DatesCollectionIteration.java | 24 ++++++++ .../java9/rangedates/RangeDatesIteration.java | 43 +++++++++++++ .../DatesCollectionIterationUnitTest.java | 61 +++++++++++++++++++ .../RangeDatesIterationUnitTest.java | 48 +++++++++++++++ 4 files changed, 176 insertions(+) create mode 100644 core-java-9/src/main/java/com/baeldung/java9/rangedates/DatesCollectionIteration.java create mode 100644 core-java-9/src/main/java/com/baeldung/java9/rangedates/RangeDatesIteration.java create mode 100644 core-java-9/src/test/java/com/baeldung/java9/rangedates/DatesCollectionIterationUnitTest.java create mode 100644 core-java-9/src/test/java/com/baeldung/java9/rangedates/RangeDatesIterationUnitTest.java diff --git a/core-java-9/src/main/java/com/baeldung/java9/rangedates/DatesCollectionIteration.java b/core-java-9/src/main/java/com/baeldung/java9/rangedates/DatesCollectionIteration.java new file mode 100644 index 0000000000..f5ec5d29dc --- /dev/null +++ b/core-java-9/src/main/java/com/baeldung/java9/rangedates/DatesCollectionIteration.java @@ -0,0 +1,24 @@ +package com.baeldung.java9.rangedates; + +import java.util.Collection; +import java.util.Date; + +public class DatesCollectionIteration { + + public void iteratingRangeOfDatesJava7(Collection dates) { + + for (Date date : dates) { + processDate(date); + } + } + + public void iteratingRangeOfDatesJava8(Collection dates) { + dates.stream() + .forEach(this::processDate); + } + + private void processDate(Date date) { + System.out.println(date); + } + +} diff --git a/core-java-9/src/main/java/com/baeldung/java9/rangedates/RangeDatesIteration.java b/core-java-9/src/main/java/com/baeldung/java9/rangedates/RangeDatesIteration.java new file mode 100644 index 0000000000..4972036c91 --- /dev/null +++ b/core-java-9/src/main/java/com/baeldung/java9/rangedates/RangeDatesIteration.java @@ -0,0 +1,43 @@ +package com.baeldung.java9.rangedates; + +import java.time.LocalDate; +import java.util.Calendar; +import java.util.Date; + +public class RangeDatesIteration { + + public void iterateBetweenDatesJava9(LocalDate startDate, LocalDate endDate) { + + startDate.datesUntil(endDate) + .forEach(this::processDate); + } + + public void iterateBetweenDatesJava8(LocalDate start, LocalDate end) { + for (LocalDate date = start; date.isBefore(end); date = date.plusDays(1)) { + processDate(date); + } + } + + public void iterateBetweenDatesJava7(Date start, Date end) { + Date current = start; + + while (current.before(end)) { + processDate(current); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(current); + + calendar.add(Calendar.DATE, 1); + + current = calendar.getTime(); + } + } + + private void processDate(LocalDate date) { + System.out.println(date); + } + + private void processDate(Date date) { + System.out.println(date); + } +} diff --git a/core-java-9/src/test/java/com/baeldung/java9/rangedates/DatesCollectionIterationUnitTest.java b/core-java-9/src/test/java/com/baeldung/java9/rangedates/DatesCollectionIterationUnitTest.java new file mode 100644 index 0000000000..522b00065e --- /dev/null +++ b/core-java-9/src/test/java/com/baeldung/java9/rangedates/DatesCollectionIterationUnitTest.java @@ -0,0 +1,61 @@ +package com.baeldung.java9.rangedates; + +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +import org.junit.Test; + +public class DatesCollectionIterationUnitTest { + + private Collection localDates = LocalDate.now() + .datesUntil(LocalDate.now() + .plus(10L, ChronoUnit.DAYS)) + .collect(Collectors.toList()); + + private Collection dates = localDates.stream() + .map(localDate -> Date.from(localDate.atStartOfDay(ZoneId.systemDefault()) + .toInstant())) + .collect(Collectors.toList()); + + @Test + public void givenIteratingListOfDatesJava7_WhenStartTodayAndEnding10DaysAhead() { + DatesCollectionIteration iterateInColleciton = new DatesCollectionIteration(); + Calendar today = Calendar.getInstance(); + Calendar next10Ahead = (Calendar) today.clone(); + next10Ahead.add(Calendar.DATE, 10); + + iterateInColleciton.iteratingRangeOfDatesJava7(createRangeDates(today.getTime(), next10Ahead.getTime())); + } + + @Test + public void givenIteratingListOfDatesJava8_WhenStartTodayAndEnd10DaysAhead() { + DatesCollectionIteration iterateInColleciton = new DatesCollectionIteration(); + + iterateInColleciton.iteratingRangeOfDatesJava8(dates); + } + + private List createRangeDates(Date start, Date end) { + + List dates = new ArrayList<>(); + Date current = start; + + while (current.before(end)) { + dates.add(current); + + Calendar calendar = Calendar.getInstance(); + calendar.setTime(current); + calendar.add(Calendar.DATE, 1); + + current = calendar.getTime(); + } + + return dates; + } +} diff --git a/core-java-9/src/test/java/com/baeldung/java9/rangedates/RangeDatesIterationUnitTest.java b/core-java-9/src/test/java/com/baeldung/java9/rangedates/RangeDatesIterationUnitTest.java new file mode 100644 index 0000000000..4f5cd17d98 --- /dev/null +++ b/core-java-9/src/test/java/com/baeldung/java9/rangedates/RangeDatesIterationUnitTest.java @@ -0,0 +1,48 @@ +package com.baeldung.java9.rangedates; + +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; +import java.util.Calendar; +import java.util.Date; + +import org.junit.Test; + +public class RangeDatesIterationUnitTest { + + @Test + public void givenIterateBetweenDatesJava9_WhenStartDateAsTodayAndEndDateAs10DaysAhead() { + LocalDate start = LocalDate.now(); + LocalDate end = start.plus(10L, ChronoUnit.DAYS); + + RangeDatesIteration iteration = new RangeDatesIteration(); + + iteration.iterateBetweenDatesJava9(start, end); + } + + @Test + public void givenIterateBetweenDatesJava8_WhenStartDateAsTodayAndEndDateAs10DaysAhead() { + LocalDate start = LocalDate.now(); + LocalDate end = start.plus(10L, ChronoUnit.DAYS); + + RangeDatesIteration iteration = new RangeDatesIteration(); + + iteration.iterateBetweenDatesJava8(start, end); + } + + @Test + public void givenIterateBetweenDatesJava7_WhenStartDateAsTodayAndEndDateAs10DaysAhead() { + Calendar today = Calendar.getInstance(); + Calendar calendar = Calendar.getInstance(); + calendar.clear(); + calendar.set(today.get(Calendar.YEAR), today.get(Calendar.MONTH), today.get(Calendar.DATE)); + Date start = calendar.getTime(); + + calendar.add(Calendar.DATE, 10); + Date end = calendar.getTime(); + + RangeDatesIteration iteration = new RangeDatesIteration(); + + iteration.iterateBetweenDatesJava7(start, end); + } + +} From d6bc6daa2ec5763a42da390571b675356a6f2691 Mon Sep 17 00:00:00 2001 From: Djordje Cvijetic Date: Mon, 20 Aug 2018 13:08:55 +0200 Subject: [PATCH 250/298] package.json updated --- spring-boot-angular-ecommerce/src/main/frontend/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-boot-angular-ecommerce/src/main/frontend/package.json b/spring-boot-angular-ecommerce/src/main/frontend/package.json index 28e716b9a6..958e9f1023 100644 --- a/spring-boot-angular-ecommerce/src/main/frontend/package.json +++ b/spring-boot-angular-ecommerce/src/main/frontend/package.json @@ -5,6 +5,9 @@ "ng": "ng", "start": "ng serve --proxy-config proxy-conf.json", "build": "ng build", + "postbuild": "npm run deploy", + "predeploy": "rimraf ../resources/static/ && mkdirp ../resources/static", + "deploy": "copyfiles -f dist/** ../resources/static", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" From 8136464a6e32d31e6a5e3cb3b8c32949b2dbe060 Mon Sep 17 00:00:00 2001 From: Kirti Deo Date: Mon, 20 Aug 2018 21:12:40 +0530 Subject: [PATCH 251/298] BAEL-2024 : ClassCastException : Fixing review comments --- .../ClassCastException.java | 28 ++++--------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java b/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java index 754713dadb..64d56e6438 100644 --- a/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java +++ b/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java @@ -8,32 +8,16 @@ public class ClassCastException { public static void main(String[] args) { - List> personList = new ArrayList>(); + List> strList = new ArrayList>(); // To correct the Exception at line #18, modify the line #11 code as: // List> personList = new ArrayList >(); // Line #18 code as personList.add(Arrays.asList(personArray)); - Person p1 = new Person(1, "John"); - Person p2 = new Person(2, "Snow"); - Person[] personArray = new Person[] { p1, p2 }; - personList.add((ArrayList) Arrays.asList(personArray)); - System.out.println("Personlist: " + personList); + String p1 = new String("John"); + String p2 = new String("Snow"); + String[] strArray = new String[] { p1, p2 }; + strList.add((ArrayList) Arrays.asList(strArray)); + System.out.println("String list: " + strList); } } - -class Person { - int id; - String name; - - Person(int id, String name) { - this.id = id; - this.name = name; - } - - @Override - public String toString() { - return "Person [id=" + id + ", name=" + name + "]"; - } - -} From b2b4d22fc1616fd70d5a39bbf6bd214e83179b39 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Tue, 21 Aug 2018 00:40:20 +0530 Subject: [PATCH 252/298] [BAEL-8417] - Seperated rxjava and rxjava2 code into two different modules --- pom.xml | 3 ++ rxjava-2/README.md | 6 +++ rxjava-2/pom.xml | 46 +++++++++++++++++++ .../java/com/baeldung/rxjava/RandomRelay.java | 0 rxjava-2/src/main/resources/logback.xml | 13 ++++++ .../rxjava/FlowableIntegrationTest.java | 0 .../com/baeldung/rxjava/MaybeUnitTest.java | 0 .../rxjava/RxRelayIntegrationTest.java | 0 .../ExceptionHandlingIntegrationTest.java | 0 .../onerror/OnErrorRetryIntegrationTest.java | 0 .../RxFlatmapAndSwitchmapUnitTest.java | 0 rxjava/README.md | 4 -- rxjava/pom.xml | 13 ------ 13 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 rxjava-2/README.md create mode 100644 rxjava-2/pom.xml rename {rxjava => rxjava-2}/src/main/java/com/baeldung/rxjava/RandomRelay.java (100%) create mode 100644 rxjava-2/src/main/resources/logback.xml rename {rxjava => rxjava-2}/src/test/java/com/baeldung/rxjava/FlowableIntegrationTest.java (100%) rename {rxjava => rxjava-2}/src/test/java/com/baeldung/rxjava/MaybeUnitTest.java (100%) rename {rxjava => rxjava-2}/src/test/java/com/baeldung/rxjava/RxRelayIntegrationTest.java (100%) rename {rxjava => rxjava-2}/src/test/java/com/baeldung/rxjava/onerror/ExceptionHandlingIntegrationTest.java (100%) rename {rxjava => rxjava-2}/src/test/java/com/baeldung/rxjava/onerror/OnErrorRetryIntegrationTest.java (100%) rename {rxjava => rxjava-2}/src/test/java/com/baeldung/rxjava/operators/RxFlatmapAndSwitchmapUnitTest.java (100%) diff --git a/pom.xml b/pom.xml index 98b8f68a50..080c288987 100644 --- a/pom.xml +++ b/pom.xml @@ -436,6 +436,7 @@ testing-modules/rest-testing resteasy rxjava + rxjava-2 spring-swagger-codegen testing-modules/selenium-junit-testng persistence-modules/solr @@ -694,6 +695,7 @@ testing-modules/rest-testing resteasy rxjava + rxjava-2 spring-swagger-codegen testing-modules/selenium-junit-testng persistence-modules/solr @@ -977,6 +979,7 @@ testing-modules/rest-testing resteasy rxjava + rxjava-2 spring-swagger-codegen testing-modules/selenium-junit-testng persistence-modules/solr diff --git a/rxjava-2/README.md b/rxjava-2/README.md new file mode 100644 index 0000000000..ccf575757f --- /dev/null +++ b/rxjava-2/README.md @@ -0,0 +1,6 @@ +## Relevant articles: + +- [RxJava and Error Handling](http://www.baeldung.com/rxjava-error-handling) +- [RxJava 2 – Flowable](http://www.baeldung.com/rxjava-2-flowable) +- [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 diff --git a/rxjava-2/pom.xml b/rxjava-2/pom.xml new file mode 100644 index 0000000000..4c5ea014d7 --- /dev/null +++ b/rxjava-2/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + + rxjava-2 + 1.0-SNAPSHOT + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + io.reactivex.rxjava2 + rxjava + ${rx.java2.version} + + + com.jayway.awaitility + awaitility + ${awaitility.version} + + + org.assertj + assertj-core + ${assertj.version} + + + com.jakewharton.rxrelay2 + rxrelay + ${rxrelay.version} + + + + + 3.8.0 + 2.1.3 + 1.7.0 + 2.0.0 + + + \ No newline at end of file diff --git a/rxjava/src/main/java/com/baeldung/rxjava/RandomRelay.java b/rxjava-2/src/main/java/com/baeldung/rxjava/RandomRelay.java similarity index 100% rename from rxjava/src/main/java/com/baeldung/rxjava/RandomRelay.java rename to rxjava-2/src/main/java/com/baeldung/rxjava/RandomRelay.java diff --git a/rxjava-2/src/main/resources/logback.xml b/rxjava-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/rxjava-2/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/rxjava/src/test/java/com/baeldung/rxjava/FlowableIntegrationTest.java b/rxjava-2/src/test/java/com/baeldung/rxjava/FlowableIntegrationTest.java similarity index 100% rename from rxjava/src/test/java/com/baeldung/rxjava/FlowableIntegrationTest.java rename to rxjava-2/src/test/java/com/baeldung/rxjava/FlowableIntegrationTest.java diff --git a/rxjava/src/test/java/com/baeldung/rxjava/MaybeUnitTest.java b/rxjava-2/src/test/java/com/baeldung/rxjava/MaybeUnitTest.java similarity index 100% rename from rxjava/src/test/java/com/baeldung/rxjava/MaybeUnitTest.java rename to rxjava-2/src/test/java/com/baeldung/rxjava/MaybeUnitTest.java diff --git a/rxjava/src/test/java/com/baeldung/rxjava/RxRelayIntegrationTest.java b/rxjava-2/src/test/java/com/baeldung/rxjava/RxRelayIntegrationTest.java similarity index 100% rename from rxjava/src/test/java/com/baeldung/rxjava/RxRelayIntegrationTest.java rename to rxjava-2/src/test/java/com/baeldung/rxjava/RxRelayIntegrationTest.java diff --git a/rxjava/src/test/java/com/baeldung/rxjava/onerror/ExceptionHandlingIntegrationTest.java b/rxjava-2/src/test/java/com/baeldung/rxjava/onerror/ExceptionHandlingIntegrationTest.java similarity index 100% rename from rxjava/src/test/java/com/baeldung/rxjava/onerror/ExceptionHandlingIntegrationTest.java rename to rxjava-2/src/test/java/com/baeldung/rxjava/onerror/ExceptionHandlingIntegrationTest.java diff --git a/rxjava/src/test/java/com/baeldung/rxjava/onerror/OnErrorRetryIntegrationTest.java b/rxjava-2/src/test/java/com/baeldung/rxjava/onerror/OnErrorRetryIntegrationTest.java similarity index 100% rename from rxjava/src/test/java/com/baeldung/rxjava/onerror/OnErrorRetryIntegrationTest.java rename to rxjava-2/src/test/java/com/baeldung/rxjava/onerror/OnErrorRetryIntegrationTest.java diff --git a/rxjava/src/test/java/com/baeldung/rxjava/operators/RxFlatmapAndSwitchmapUnitTest.java b/rxjava-2/src/test/java/com/baeldung/rxjava/operators/RxFlatmapAndSwitchmapUnitTest.java similarity index 100% rename from rxjava/src/test/java/com/baeldung/rxjava/operators/RxFlatmapAndSwitchmapUnitTest.java rename to rxjava-2/src/test/java/com/baeldung/rxjava/operators/RxFlatmapAndSwitchmapUnitTest.java diff --git a/rxjava/README.md b/rxjava/README.md index 5c60e3bbce..76135797a6 100644 --- a/rxjava/README.md +++ b/rxjava/README.md @@ -4,15 +4,11 @@ - [How to Test RxJava?](http://www.baeldung.com/rxjava-testing) - [Implementing Custom Operators in RxJava](http://www.baeldung.com/rxjava-custom-operators) - [Introduction to RxJava](http://www.baeldung.com/rx-java) -- [RxJava and Error Handling](http://www.baeldung.com/rxjava-error-handling) - [Observable Utility Operators in RxJava](http://www.baeldung.com/rxjava-observable-operators) - [Introduction to rxjava-jdbc](http://www.baeldung.com/rxjava-jdbc) - [Schedulers in RxJava](http://www.baeldung.com/rxjava-schedulers) - [Mathematical and Aggregate Operators in RxJava](http://www.baeldung.com/rxjava-math) - [Combining Observables in RxJava](http://www.baeldung.com/rxjava-combine-observables) -- [RxJava 2 – Flowable](http://www.baeldung.com/rxjava-2-flowable) - [RxJava StringObservable](http://www.baeldung.com/rxjava-string) -- [RxJava Maybe](http://www.baeldung.com/rxjava-maybe) -- [Introduction to RxRelay for RxJava](http://www.baeldung.com/rx-relay) - [Filtering Observables in RxJava](http://www.baeldung.com/rxjava-filtering) - [RxJava One Observable, Multiple Subscribers](http://www.baeldung.com/rxjava-multiple-subscribers-observable) diff --git a/rxjava/pom.xml b/rxjava/pom.xml index 49732c1ef4..b316001d87 100644 --- a/rxjava/pom.xml +++ b/rxjava/pom.xml @@ -20,12 +20,6 @@ ${rx.java.version} - - io.reactivex.rxjava2 - rxjava - ${rx.java2.version} - - io.reactivex rxjava-math @@ -59,22 +53,15 @@ assertj-core ${assertj.version} - - com.jakewharton.rxrelay2 - rxrelay - ${rxrelay.version} - 3.8.0 1.2.5 - 2.1.3 0.7.11 1.0.0 1.1.1 1.7.0 - 2.0.0 1.4.196 From 28d74a520f95b29c9a9e4b74f566b251d46c7a98 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 19 Aug 2018 23:32:13 +0530 Subject: [PATCH 253/298] [BAEL-8416] - Moved code from spring-boot to spring-boot-persistence module for persistence specific articles --- spring-boot-persistence/README.MD | 2 + .../com/baeldung/boot/config/H2JpaConfig.java | 67 +++++++++++++++++++ .../java/com/baeldung/domain/Country.java | 36 ++++++++++ .../baeldung/boot/domain/GenericEntity.java | 0 .../repository/GenericEntityRepository.java | 0 .../src/main/resources/application.properties | 2 + .../src/main/resources/data.sql | 10 +++ .../persistence-generic-entity.properties | 8 +++ .../src/main/resources/schema.sql | 15 +++++ .../baeldung/SpringBootH2IntegrationTest.java | 10 +-- .../SpringBootJPAIntegrationTest.java | 27 ++++++++ .../SpringBootProfileIntegrationTest.java | 9 ++- .../config/H2TestProfileJPAConfig.java | 4 +- .../src/test/resources/application.properties | 2 +- spring-boot/README.MD | 2 - 15 files changed, 179 insertions(+), 15 deletions(-) create mode 100644 spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java create mode 100644 spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java rename {spring-boot => spring-boot-persistence}/src/main/java/org/baeldung/boot/domain/GenericEntity.java (100%) rename {spring-boot => spring-boot-persistence}/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java (100%) create mode 100644 spring-boot-persistence/src/main/resources/data.sql create mode 100644 spring-boot-persistence/src/main/resources/persistence-generic-entity.properties create mode 100644 spring-boot-persistence/src/main/resources/schema.sql rename {spring-boot/src/test/java/org => spring-boot-persistence/src/test/java/com}/baeldung/SpringBootH2IntegrationTest.java (91%) create mode 100644 spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java rename {spring-boot/src/test/java/org => spring-boot-persistence/src/test/java/com}/baeldung/SpringBootProfileIntegrationTest.java (95%) rename {spring-boot => spring-boot-persistence}/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java (94%) diff --git a/spring-boot-persistence/README.MD b/spring-boot-persistence/README.MD index 3fe6eb62c8..72fdca74fa 100644 --- a/spring-boot-persistence/README.MD +++ b/spring-boot-persistence/README.MD @@ -1,3 +1,5 @@ ### Relevant Articles: - [Spring Boot with Multiple SQL Import Files](http://www.baeldung.com/spring-boot-sql-import-files) +- [Configuring Separate Spring DataSource for Tests](http://www.baeldung.com/spring-testing-separate-data-source) +- [Quick Guide on data.sql and schema.sql Files in Spring Boot](http://www.baeldung.com/spring-boot-data-sql-and-schema-sql) diff --git a/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java b/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java new file mode 100644 index 0000000000..ef90714347 --- /dev/null +++ b/spring-boot-persistence/src/main/java/com/baeldung/boot/config/H2JpaConfig.java @@ -0,0 +1,67 @@ +package com.baeldung.boot.config; + +import java.util.Properties; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@EnableJpaRepositories(basePackages = { "org.baeldung.boot.repository", "org.baeldung.repository" }) +@PropertySource("classpath:persistence-generic-entity.properties") +@EnableTransactionManagement +public class H2JpaConfig { + + @Autowired + private Environment env; + + @Bean + public DataSource dataSource() { + final DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName")); + dataSource.setUrl(env.getProperty("jdbc.url")); + dataSource.setUsername(env.getProperty("jdbc.user")); + dataSource.setPassword(env.getProperty("jdbc.pass")); + + return dataSource; + } + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource()); + em.setPackagesToScan(new String[] { "org.baeldung.boot.domain" }); + em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); + em.setJpaProperties(additionalProperties()); + return em; + } + + @Bean + JpaTransactionManager transactionManager(final EntityManagerFactory entityManagerFactory) { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManagerFactory); + return transactionManager; + } + + final Properties additionalProperties() { + final Properties hibernateProperties = new Properties(); + + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql")); + + return hibernateProperties; + } + +} diff --git a/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java b/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java new file mode 100644 index 0000000000..e6a88c7121 --- /dev/null +++ b/spring-boot-persistence/src/main/java/com/baeldung/domain/Country.java @@ -0,0 +1,36 @@ +package com.baeldung.domain; + +import static javax.persistence.GenerationType.IDENTITY; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class Country { + + @Id + @GeneratedValue(strategy = IDENTITY) + private Integer id; + + @Column(nullable = false) + private String name; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/spring-boot/src/main/java/org/baeldung/boot/domain/GenericEntity.java b/spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java similarity index 100% rename from spring-boot/src/main/java/org/baeldung/boot/domain/GenericEntity.java rename to spring-boot-persistence/src/main/java/org/baeldung/boot/domain/GenericEntity.java diff --git a/spring-boot/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java b/spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java similarity index 100% rename from spring-boot/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java rename to spring-boot-persistence/src/main/java/org/baeldung/boot/repository/GenericEntityRepository.java diff --git a/spring-boot-persistence/src/main/resources/application.properties b/spring-boot-persistence/src/main/resources/application.properties index e69de29bb2..d0fb785fe8 100644 --- a/spring-boot-persistence/src/main/resources/application.properties +++ b/spring-boot-persistence/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.jpa.show-sql=true +spring.jpa.hibernate.ddl-auto=none \ No newline at end of file diff --git a/spring-boot-persistence/src/main/resources/data.sql b/spring-boot-persistence/src/main/resources/data.sql new file mode 100644 index 0000000000..feef02b6cf --- /dev/null +++ b/spring-boot-persistence/src/main/resources/data.sql @@ -0,0 +1,10 @@ +insert into users values (1, 'Alex', 1); +insert into users values (2, 'Bob', 1); +insert into users values (3, 'John', 0); +insert into users values (4, 'Harry', 0); +insert into users values (5, 'Smith', 1); + +INSERT INTO country (name) VALUES ('India'); +INSERT INTO country (name) VALUES ('Brazil'); +INSERT INTO country (name) VALUES ('USA'); +INSERT INTO country (name) VALUES ('Italy'); \ No newline at end of file diff --git a/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties b/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties new file mode 100644 index 0000000000..b19304cb1f --- /dev/null +++ b/spring-boot-persistence/src/main/resources/persistence-generic-entity.properties @@ -0,0 +1,8 @@ +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 +jdbc.user=sa +jdbc.pass=sa + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop diff --git a/spring-boot-persistence/src/main/resources/schema.sql b/spring-boot-persistence/src/main/resources/schema.sql new file mode 100644 index 0000000000..4cfc8a7927 --- /dev/null +++ b/spring-boot-persistence/src/main/resources/schema.sql @@ -0,0 +1,15 @@ +drop table if exists USERS; +drop table if exists country; + +create table USERS( + ID int not null AUTO_INCREMENT, + NAME varchar(100) not null, + STATUS int, + PRIMARY KEY ( ID ) +); + +CREATE TABLE country ( + id INTEGER NOT NULL AUTO_INCREMENT, + name VARCHAR(128) NOT NULL, + PRIMARY KEY (id) +); \ No newline at end of file diff --git a/spring-boot/src/test/java/org/baeldung/SpringBootH2IntegrationTest.java b/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java similarity index 91% rename from spring-boot/src/test/java/org/baeldung/SpringBootH2IntegrationTest.java rename to spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java index 290cfbe081..6479e90113 100644 --- a/spring-boot/src/test/java/org/baeldung/SpringBootH2IntegrationTest.java +++ b/spring-boot-persistence/src/test/java/com/baeldung/SpringBootH2IntegrationTest.java @@ -1,7 +1,8 @@ -package org.baeldung; +package com.baeldung; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; -import org.baeldung.boot.Application; -import org.baeldung.boot.config.H2JpaConfig; import org.baeldung.boot.domain.GenericEntity; import org.baeldung.boot.repository.GenericEntityRepository; import org.junit.Test; @@ -10,8 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import com.baeldung.boot.config.H2JpaConfig; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = { Application.class, H2JpaConfig.class }) diff --git a/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java b/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java new file mode 100644 index 0000000000..eef9ebe953 --- /dev/null +++ b/spring-boot-persistence/src/test/java/com/baeldung/SpringBootJPAIntegrationTest.java @@ -0,0 +1,27 @@ +package com.baeldung; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.baeldung.boot.domain.GenericEntity; +import org.baeldung.boot.repository.GenericEntityRepository; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringBootJPAIntegrationTest { + @Autowired + private GenericEntityRepository genericEntityRepository; + + @Test + public void givenGenericEntityRepository_whenSaveAndRetreiveEntity_thenOK() { + GenericEntity genericEntity = genericEntityRepository.save(new GenericEntity("test")); + GenericEntity foundEntity = genericEntityRepository.findById(genericEntity.getId()).orElse(null); + assertNotNull(foundEntity); + assertEquals(genericEntity.getValue(), foundEntity.getValue()); + } +} \ No newline at end of file diff --git a/spring-boot/src/test/java/org/baeldung/SpringBootProfileIntegrationTest.java b/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java similarity index 95% rename from spring-boot/src/test/java/org/baeldung/SpringBootProfileIntegrationTest.java rename to spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java index 128a05f103..4c68f1d4a0 100644 --- a/spring-boot/src/test/java/org/baeldung/SpringBootProfileIntegrationTest.java +++ b/spring-boot-persistence/src/test/java/com/baeldung/SpringBootProfileIntegrationTest.java @@ -1,6 +1,8 @@ -package org.baeldung; +package com.baeldung; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; -import org.baeldung.boot.Application; import org.baeldung.boot.domain.GenericEntity; import org.baeldung.boot.repository.GenericEntityRepository; import org.baeldung.config.H2TestProfileJPAConfig; @@ -11,9 +13,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - @RunWith(SpringRunner.class) @SpringBootTest(classes = { Application.class, H2TestProfileJPAConfig.class }) @ActiveProfiles("test") diff --git a/spring-boot/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java b/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java similarity index 94% rename from spring-boot/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java rename to spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java index d0b92a7a93..7f962e1417 100644 --- a/spring-boot/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java +++ b/spring-boot-persistence/src/test/java/org/baeldung/config/H2TestProfileJPAConfig.java @@ -18,7 +18,7 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration -@EnableJpaRepositories(basePackages = { "org.baeldung.repository", "org.baeldung.boot.repository", "org.baeldung.boot.boottest" }) +@EnableJpaRepositories(basePackages = { "org.baeldung.repository", "org.baeldung.boot.repository" }) @EnableTransactionManagement public class H2TestProfileJPAConfig { @@ -41,7 +41,7 @@ public class H2TestProfileJPAConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "org.baeldung.domain", "org.baeldung.boot.domain", "org.baeldung.boot.boottest", "org.baeldung.model" }); + em.setPackagesToScan(new String[] { "org.baeldung.domain", "org.baeldung.boot.domain" }); em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); em.setJpaProperties(additionalProperties()); return em; diff --git a/spring-boot-persistence/src/test/resources/application.properties b/spring-boot-persistence/src/test/resources/application.properties index a5d09db840..a5c1d983cf 100644 --- a/spring-boot-persistence/src/test/resources/application.properties +++ b/spring-boot-persistence/src/test/resources/application.properties @@ -13,4 +13,4 @@ hibernate.cache.use_query_cache=true hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory spring.jpa.properties.hibernate.hbm2ddl.import_files=migrated_users.sql -spring.datasource.data=import_*_users.sql,import_articles.sql \ No newline at end of file +spring.datasource.data=import_*_users.sql \ No newline at end of file diff --git a/spring-boot/README.MD b/spring-boot/README.MD index 1532889a5c..6892278f09 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -12,7 +12,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Using Custom Banners in Spring Boot](http://www.baeldung.com/spring-boot-custom-banners) - [Guide to Internationalization in Spring Boot](http://www.baeldung.com/spring-boot-internationalization) - [Create a Custom FailureAnalyzer with Spring Boot](http://www.baeldung.com/spring-boot-failure-analyzer) -- [Configuring Separate Spring DataSource for Tests](http://www.baeldung.com/spring-testing-separate-data-source) - [Dynamic DTO Validation Config Retrieved from DB](http://www.baeldung.com/spring-dynamic-dto-validation) - [Custom Information in Spring Boot Info Endpoint](http://www.baeldung.com/spring-boot-info-actuator-custom) - [Using @JsonComponent in Spring Boot](http://www.baeldung.com/spring-boot-jsoncomponent) @@ -23,7 +22,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Boot and Togglz Aspect](http://www.baeldung.com/spring-togglz) - [Getting Started with GraphQL and Spring Boot](http://www.baeldung.com/spring-graphql) - [Guide to Spring Type Conversions](http://www.baeldung.com/spring-type-conversions) -- [Quick Guide on data.sql and schema.sql Files in Spring Boot](http://www.baeldung.com/spring-boot-data-sql-and-schema-sql) - [Spring Data Java 8 Support](http://www.baeldung.com/spring-data-java-8) - [An Introduction to Kong](http://www.baeldung.com/kong) - [Spring Boot Customize Whitelabel Error Page](http://www.baeldung.com/spring-boot-custom-error-page) From 8a9161701c1978dfa0cd74be4f15ffe6c80913c7 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Mon, 20 Aug 2018 23:12:04 +0300 Subject: [PATCH 254/298] Update pom.xml --- core-java-8/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml index ed145af5d2..ad37cdd7e8 100644 --- a/core-java-8/pom.xml +++ b/core-java-8/pom.xml @@ -187,5 +187,4 @@ 1.19 2.0.4.RELEASE - - \ No newline at end of file + From cb9e1f29b5886c21cf419c2ddc3ad84e524067d0 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Mon, 20 Aug 2018 22:43:50 +0200 Subject: [PATCH 255/298] added code example using HikariCP in Boot 1.x and 2.x (#5007) * added code example using HikariCP in Boot 1.x and 2.x * code formatting --- spring-4/pom.xml | 22 +++++++++++++++ .../ApplicationWithHikariConnectionPool.java | 12 ++++++++ .../connectionpool/HikariIntegrationTest.java | 28 +++++++++++++++++++ .../ApplicationWithHikariConnectionPool.java | 12 ++++++++ .../connectionpool/HikariIntegrationTest.java | 26 +++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 spring-4/src/test/java/com/baeldung/connectionpool/ApplicationWithHikariConnectionPool.java create mode 100644 spring-4/src/test/java/com/baeldung/connectionpool/HikariIntegrationTest.java create mode 100644 spring-5/src/test/java/com/baeldung/connectionpool/ApplicationWithHikariConnectionPool.java create mode 100644 spring-5/src/test/java/com/baeldung/connectionpool/HikariIntegrationTest.java diff --git a/spring-4/pom.xml b/spring-4/pom.xml index d2632b5f55..62da44882f 100644 --- a/spring-4/pom.xml +++ b/spring-4/pom.xml @@ -19,6 +19,27 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.apache.tomcat + tomcat-jdbc + + + + + com.h2database + h2 + ${h2database.version} + test + + + com.zaxxer + HikariCP + ${hikaricp.version} + org.springframework.boot spring-boot-starter-test @@ -58,6 +79,7 @@ 1.0.1 1.16.18 1.8 + 1.4.197 diff --git a/spring-4/src/test/java/com/baeldung/connectionpool/ApplicationWithHikariConnectionPool.java b/spring-4/src/test/java/com/baeldung/connectionpool/ApplicationWithHikariConnectionPool.java new file mode 100644 index 0000000000..0bd8637681 --- /dev/null +++ b/spring-4/src/test/java/com/baeldung/connectionpool/ApplicationWithHikariConnectionPool.java @@ -0,0 +1,12 @@ +package com.baeldung.connectionpool; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ApplicationWithHikariConnectionPool { + + public static void main(String[] args) { + SpringApplication.run(ApplicationWithHikariConnectionPool.class, args); + } +} diff --git a/spring-4/src/test/java/com/baeldung/connectionpool/HikariIntegrationTest.java b/spring-4/src/test/java/com/baeldung/connectionpool/HikariIntegrationTest.java new file mode 100644 index 0000000000..0cc876d5b1 --- /dev/null +++ b/spring-4/src/test/java/com/baeldung/connectionpool/HikariIntegrationTest.java @@ -0,0 +1,28 @@ +package com.baeldung.connectionpool; + +import static org.junit.Assert.*; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest( + // instead of setting this property, we can exclude the dependency to org.apache.tomcat:tomcat-jdbc in pom.xml + properties = "spring.datasource.type=com.zaxxer.hikari.HikariDataSource") +public class HikariIntegrationTest { + + @Autowired + private DataSource dataSource; + + @Test + public void hikariConnectionPoolIsConfigured() { + assertEquals("com.zaxxer.hikari.HikariDataSource", dataSource.getClass() + .getName()); + } + +} diff --git a/spring-5/src/test/java/com/baeldung/connectionpool/ApplicationWithHikariConnectionPool.java b/spring-5/src/test/java/com/baeldung/connectionpool/ApplicationWithHikariConnectionPool.java new file mode 100644 index 0000000000..0bd8637681 --- /dev/null +++ b/spring-5/src/test/java/com/baeldung/connectionpool/ApplicationWithHikariConnectionPool.java @@ -0,0 +1,12 @@ +package com.baeldung.connectionpool; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ApplicationWithHikariConnectionPool { + + public static void main(String[] args) { + SpringApplication.run(ApplicationWithHikariConnectionPool.class, args); + } +} diff --git a/spring-5/src/test/java/com/baeldung/connectionpool/HikariIntegrationTest.java b/spring-5/src/test/java/com/baeldung/connectionpool/HikariIntegrationTest.java new file mode 100644 index 0000000000..d91cca85ee --- /dev/null +++ b/spring-5/src/test/java/com/baeldung/connectionpool/HikariIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.connectionpool; + +import static org.junit.Assert.*; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class HikariIntegrationTest { + + @Autowired + private DataSource dataSource; + + @Test + public void hikariConnectionPoolIsConfigured() { + assertEquals("com.zaxxer.hikari.HikariDataSource", dataSource.getClass() + .getName()); + } + +} From 9adff856ee1827d716cf59094b015b70e4e6169d Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 21 Aug 2018 10:00:55 +0530 Subject: [PATCH 256/298] BAEL-7636 Add the missing plugin versions in the tutorial repo -Adding an extra line in spring-swagger-codegen-api-client project to trigger its build. --- .../spring-swagger-codegen-api-client/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-swagger-codegen/spring-swagger-codegen-api-client/README.md b/spring-swagger-codegen/spring-swagger-codegen-api-client/README.md index b1b7a63a9c..455a69b2f3 100644 --- a/spring-swagger-codegen/spring-swagger-codegen-api-client/README.md +++ b/spring-swagger-codegen/spring-swagger-codegen-api-client/README.md @@ -153,3 +153,5 @@ It's recommended to create an instance of `ApiClient` per thread in a multithrea apiteam@swagger.io + + From 862335278ad92954cb4fcf0388571151f4a10836 Mon Sep 17 00:00:00 2001 From: daoire Date: Tue, 21 Aug 2018 06:58:33 +0100 Subject: [PATCH 257/298] Update README.md --- json/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/json/README.md b/json/README.md index 1317ada8be..8c2abc3e47 100644 --- a/json/README.md +++ b/json/README.md @@ -8,3 +8,4 @@ - [Introduction to JSONForms](http://www.baeldung.com/introduction-to-jsonforms) - [Introduction to JsonPath](http://www.baeldung.com/guide-to-jayway-jsonpath) - [Introduction to JSON-Java (org.json)](http://www.baeldung.com/java-org-json) +- [Overview of JSON Pointer](https://www.baeldung.com/json-pointer) From e645f929116f3a9bdf9302fbde451a2071b221ff Mon Sep 17 00:00:00 2001 From: daoire Date: Tue, 21 Aug 2018 07:05:05 +0100 Subject: [PATCH 258/298] Update README.md --- testing-modules/mocks/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/mocks/README.md b/testing-modules/mocks/README.md index fe8e197061..2b24ed8536 100644 --- a/testing-modules/mocks/README.md +++ b/testing-modules/mocks/README.md @@ -5,4 +5,4 @@ - [JMockit 101](http://www.baeldung.com/jmockit-101) - [Mockito vs EasyMock vs JMockit](http://www.baeldung.com/mockito-vs-easymock-vs-jmockit) - [EasyMock Argument Matchers](http://www.baeldung.com/easymock-argument-matchers) - +- [Mock Static Method using JMockit](https://www.baeldung.com/jmockit-static-method) From cae45a3be62faadbeea74f32f44b267b36b0cce8 Mon Sep 17 00:00:00 2001 From: daoire Date: Tue, 21 Aug 2018 07:06:37 +0100 Subject: [PATCH 259/298] Update README.md --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index b957060c3a..4914d04dbd 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -151,3 +151,4 @@ - [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type) - [Common Java Exceptions](http://www.baeldung.com/java-common-exceptions) - [Java Constructors vs Static Factory Methods](https://www.baeldung.com/java-constructors-vs-static-factory-methods) +- [Differences Between Final, Finally and Finalize in Java](https://www.baeldung.com/java-final-finally-finalize) From e860f5d5a12386a4b697a547aca045c8a13895cd Mon Sep 17 00:00:00 2001 From: daoire Date: Tue, 21 Aug 2018 07:08:20 +0100 Subject: [PATCH 260/298] Update README.md --- spring-5-security/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-5-security/README.md b/spring-5-security/README.md index 94a8f83281..564dcd3c96 100644 --- a/spring-5-security/README.md +++ b/spring-5-security/README.md @@ -4,4 +4,4 @@ - [Extra Login Fields with Spring Security](http://www.baeldung.com/spring-security-extra-login-fields) - [A Custom Spring SecurityConfigurer](http://www.baeldung.com/spring-security-custom-configurer) - [New Password Storage In Spring Security 5](http://www.baeldung.com/spring-security-5-password-storage) - +- [Default Password Encoder in Spring Security 5](https://www.baeldung.com/spring-security-5-default-password-encoder) From ab81be29459c1d9e0ec08f99a7e5ced01d51f067 Mon Sep 17 00:00:00 2001 From: daoire Date: Tue, 21 Aug 2018 07:10:57 +0100 Subject: [PATCH 261/298] Update README.md --- testing-modules/testing/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/testing/README.md b/testing-modules/testing/README.md index c9c656dde9..6f13f45194 100644 --- a/testing-modules/testing/README.md +++ b/testing-modules/testing/README.md @@ -19,3 +19,4 @@ - [Guide to JSpec](http://www.baeldung.com/jspec) - [Custom Assertions with AssertJ](http://www.baeldung.com/assertj-custom-assertion) - [Using Conditions with AssertJ](http://www.baeldung.com/assertj-conditions) +- [Guide to JavaFaker](https://www.baeldung.com/java-faker) From 318c95f0c02a6a4a93fa42e951cf17799a84ff80 Mon Sep 17 00:00:00 2001 From: cdjole Date: Tue, 21 Aug 2018 13:41:26 +0200 Subject: [PATCH 262/298] String containing characters (#5026) --- .../StringContainingCharactersUnitTest.java | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java diff --git a/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java new file mode 100644 index 0000000000..75548f4d73 --- /dev/null +++ b/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java @@ -0,0 +1,98 @@ +package com.baeldung.string; + +import org.junit.Test; + +import java.util.regex.Pattern; + +import static junit.framework.TestCase.assertFalse; +import static junit.framework.TestCase.assertTrue; + +public class StringContainingCharactersUnitTest { + + private static final Pattern[] inputRegexes = new Pattern[4]; + + static { + inputRegexes[0] = Pattern.compile(".*[A-Z].*"); + inputRegexes[1] = Pattern.compile(".*[a-z].*"); + inputRegexes[2] = Pattern.compile(".*\\d.*"); + inputRegexes[3] = Pattern.compile(".*[`~!@#$%^&*()\\-_=+\\\\|\\[{\\]};:'\",<.>/?].*"); + } + + private static boolean isMatchingRegex(String input) { + boolean inputMatches = true; + for (Pattern inputRegex : inputRegexes) { + if (!inputRegex + .matcher(input) + .matches()) { + inputMatches = false; + } + } + return inputMatches; + } + + private static boolean checkString(String input) { + String specialChars = "~`!@#$%^&*()-_=+\\|[{]};:'\",<.>/?"; + char currentCharacter; + boolean numberPresent = false; + boolean upperCasePresent = false; + boolean lowerCasePresent = false; + boolean specialCharacterPresent = false; + + for (int i = 0; i < input.length(); i++) { + currentCharacter = input.charAt(i); + if (Character.isDigit(currentCharacter)) { + numberPresent = true; + } else if (Character.isUpperCase(currentCharacter)) { + upperCasePresent = true; + } else if (Character.isLowerCase(currentCharacter)) { + lowerCasePresent = true; + } else if (specialChars.contains(String.valueOf(currentCharacter))) { + specialCharacterPresent = true; + } + } + + return numberPresent && upperCasePresent && lowerCasePresent && specialCharacterPresent; + } + + @Test + public void givenRegexes_whenMatchingCorrectString_thenMatches() { + String validInput = "Ab3;"; + assertTrue(isMatchingRegex(validInput)); + } + + @Test + public void givenRegexes_whenMatchingWrongStrings_thenNotMatching() { + String invalidInput = "Ab3"; + assertFalse(isMatchingRegex(invalidInput)); + + invalidInput = "Ab;"; + assertFalse(isMatchingRegex(invalidInput)); + + invalidInput = "A3;"; + assertFalse(isMatchingRegex(invalidInput)); + + invalidInput = "b3;"; + assertFalse(isMatchingRegex(invalidInput)); + } + + @Test + public void givenValidString_whenChecking_thenCorrect() { + String validInput = "Ab3;"; + assertTrue(checkString(validInput)); + } + + @Test + public void givenInvalidStrings_whenChecking_thenNotCorrect() { + String invalidInput = "Ab3"; + assertFalse(checkString(invalidInput)); + + invalidInput = "Ab;"; + assertFalse(checkString(invalidInput)); + + invalidInput = "A3;"; + assertFalse(checkString(invalidInput)); + + invalidInput = "b3;"; + assertFalse(checkString(invalidInput)); + } +} From fb0023286ad5ba199aa63f729ef22dad1075609a Mon Sep 17 00:00:00 2001 From: sachin Date: Tue, 21 Aug 2018 18:22:53 -0400 Subject: [PATCH 263/298] BAEL-7674: Let's make sure our logging configuration has the same pattern --- apache-fop/src/main/resources/logback.xml | 2 +- apache-velocity/src/main/resources/logback.xml | 2 +- core-java-9/src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- core-java-io/src/main/resources/logback.xml | 2 +- core-java-sun/src/main/resources/logback.xml | 2 +- core-java/src/main/resources/logback.xml | 2 +- couchbase/src/main/resources/logback.xml | 2 +- couchbase/src/test/resources/logback.xml | 2 +- flyway/src/main/resources/logback.xml | 2 +- gson/src/main/resources/logback.xml | 2 +- guava/src/main/resources/logback.xml | 2 +- hazelcast/src/main/resources/logback.xml | 2 +- hibernate5/src/main/resources/logback.xml | 2 +- httpclient/src/main/resources/logback.xml | 2 +- influxdb/src/test/resources/logback.xml | 2 +- jackson/src/main/resources/logback.xml | 2 +- java-numbers/src/main/resources/logback.xml | 2 +- jaxb/src/main/resources/logback.xml | 2 +- jersey/src/main/resources/logback.xml | 2 +- jhipster/jhipster-monolithic/pom.xml | 2 +- jsf/src/main/resources/logback.xml | 2 +- json-path/src/test/resources/logback.xml | 2 +- orika/src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/test/resources/logback-test.xml | 2 +- spring-5/src/test/resources/logback-test.xml | 14 ++++++++++++-- spring-all/src/main/resources/logback.xml | 2 +- spring-aop/src/main/resources/logback.xml | 2 +- spring-batch/src/main/resources/logback.xml | 2 +- spring-boot/src/main/resources/logback.xml | 2 +- spring-custom-aop/src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/test/resources/logback.xml | 2 +- spring-data-mongodb/src/main/resources/logback.xml | 2 +- spring-exceptions/src/main/resources/logback.xml | 2 +- spring-hibernate4/src/main/resources/logback.xml | 2 +- .../src/test/resources/logback-test.xml | 14 ++++++++++++-- spring-jersey/src/main/resources/logback.xml | 2 +- spring-ldap/src/main/resources/logback.xml | 2 +- spring-mvc-java/src/main/resources/logback.xml | 2 +- .../src/test/resources/logback-test.xml | 2 +- spring-mvc-webflow/src/main/resources/logback.xml | 2 +- spring-mvc-xml/src/main/resources/logback.xml | 2 +- spring-quartz/src/main/resources/logback.xml | 2 +- spring-rest-full/src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- spring-rest-simple/src/main/resources/logback.xml | 2 +- spring-rest/src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- .../src/main/resources/logback.xml | 2 +- spring-thymeleaf/src/main/resources/logback.xml | 2 +- .../src/test/resources/logback-test.xml | 2 +- vertx/src/main/resources/logback.xml | 2 +- xstream/src/main/resources/logback.xml | 2 +- 64 files changed, 86 insertions(+), 66 deletions(-) diff --git a/apache-fop/src/main/resources/logback.xml b/apache-fop/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/apache-fop/src/main/resources/logback.xml +++ b/apache-fop/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/apache-velocity/src/main/resources/logback.xml b/apache-velocity/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/apache-velocity/src/main/resources/logback.xml +++ b/apache-velocity/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/core-java-9/src/main/resources/logback.xml b/core-java-9/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/core-java-9/src/main/resources/logback.xml +++ b/core-java-9/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/core-java-concurrency/src/main/resources/logback.xml b/core-java-concurrency/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/core-java-concurrency/src/main/resources/logback.xml +++ b/core-java-concurrency/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/core-java-io/src/main/resources/logback.xml b/core-java-io/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/core-java-io/src/main/resources/logback.xml +++ b/core-java-io/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/core-java-sun/src/main/resources/logback.xml b/core-java-sun/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/core-java-sun/src/main/resources/logback.xml +++ b/core-java-sun/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/core-java/src/main/resources/logback.xml b/core-java/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/core-java/src/main/resources/logback.xml +++ b/core-java/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/couchbase/src/main/resources/logback.xml b/couchbase/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/couchbase/src/main/resources/logback.xml +++ b/couchbase/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/couchbase/src/test/resources/logback.xml b/couchbase/src/test/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/couchbase/src/test/resources/logback.xml +++ b/couchbase/src/test/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/flyway/src/main/resources/logback.xml b/flyway/src/main/resources/logback.xml index 7f4aa46e0d..56af2d397e 100644 --- a/flyway/src/main/resources/logback.xml +++ b/flyway/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/gson/src/main/resources/logback.xml b/gson/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/gson/src/main/resources/logback.xml +++ b/gson/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/guava/src/main/resources/logback.xml b/guava/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/guava/src/main/resources/logback.xml +++ b/guava/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/hazelcast/src/main/resources/logback.xml b/hazelcast/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/hazelcast/src/main/resources/logback.xml +++ b/hazelcast/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/hibernate5/src/main/resources/logback.xml b/hibernate5/src/main/resources/logback.xml index d87a87bf53..7d900d8ea8 100644 --- a/hibernate5/src/main/resources/logback.xml +++ b/hibernate5/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/httpclient/src/main/resources/logback.xml b/httpclient/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/httpclient/src/main/resources/logback.xml +++ b/httpclient/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/influxdb/src/test/resources/logback.xml b/influxdb/src/test/resources/logback.xml index f8ebaf1ebd..7d900d8ea8 100644 --- a/influxdb/src/test/resources/logback.xml +++ b/influxdb/src/test/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/jackson/src/main/resources/logback.xml b/jackson/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/jackson/src/main/resources/logback.xml +++ b/jackson/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/java-numbers/src/main/resources/logback.xml b/java-numbers/src/main/resources/logback.xml index f8ebaf1ebd..7d900d8ea8 100644 --- a/java-numbers/src/main/resources/logback.xml +++ b/java-numbers/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/jaxb/src/main/resources/logback.xml b/jaxb/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/jaxb/src/main/resources/logback.xml +++ b/jaxb/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/jersey/src/main/resources/logback.xml b/jersey/src/main/resources/logback.xml index d87a87bf53..7d900d8ea8 100644 --- a/jersey/src/main/resources/logback.xml +++ b/jersey/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/jhipster/jhipster-monolithic/pom.xml b/jhipster/jhipster-monolithic/pom.xml index 8b753f6f93..1d224e6948 100644 --- a/jhipster/jhipster-monolithic/pom.xml +++ b/jhipster/jhipster-monolithic/pom.xml @@ -503,7 +503,7 @@ **/*IntTest.java - + plain diff --git a/jsf/src/main/resources/logback.xml b/jsf/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/jsf/src/main/resources/logback.xml +++ b/jsf/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/json-path/src/test/resources/logback.xml b/json-path/src/test/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/json-path/src/test/resources/logback.xml +++ b/json-path/src/test/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/orika/src/main/resources/logback.xml b/orika/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/orika/src/main/resources/logback.xml +++ b/orika/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-5-reactive-client/src/main/resources/logback.xml b/spring-5-reactive-client/src/main/resources/logback.xml index 8bbe8c1d67..7072369b8d 100644 --- a/spring-5-reactive-client/src/main/resources/logback.xml +++ b/spring-5-reactive-client/src/main/resources/logback.xml @@ -3,7 +3,7 @@ # Pattern of log message for console appender - %d{yyyy-MM-dd HH:mm:ss} %-5p %m%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-5-reactive-client/src/test/resources/logback-test.xml b/spring-5-reactive-client/src/test/resources/logback-test.xml index 8bbe8c1d67..7072369b8d 100644 --- a/spring-5-reactive-client/src/test/resources/logback-test.xml +++ b/spring-5-reactive-client/src/test/resources/logback-test.xml @@ -3,7 +3,7 @@ # Pattern of log message for console appender - %d{yyyy-MM-dd HH:mm:ss} %-5p %m%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-5/src/test/resources/logback-test.xml b/spring-5/src/test/resources/logback-test.xml index 84f8e4706a..424ab87f79 100644 --- a/spring-5/src/test/resources/logback-test.xml +++ b/spring-5/src/test/resources/logback-test.xml @@ -1,5 +1,15 @@ - - + + + # Pattern of log message for console appender + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-all/src/main/resources/logback.xml b/spring-all/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-all/src/main/resources/logback.xml +++ b/spring-all/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-aop/src/main/resources/logback.xml b/spring-aop/src/main/resources/logback.xml index 3245e94f08..7c15f603a0 100644 --- a/spring-aop/src/main/resources/logback.xml +++ b/spring-aop/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-batch/src/main/resources/logback.xml b/spring-batch/src/main/resources/logback.xml index 0313fb5008..91d4292b8e 100644 --- a/spring-batch/src/main/resources/logback.xml +++ b/spring-batch/src/main/resources/logback.xml @@ -3,7 +3,7 @@ - %d{yyyy-MM-dd HH:mm:ss} [%thread] %level %logger{35} - %msg%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-boot/src/main/resources/logback.xml b/spring-boot/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-boot/src/main/resources/logback.xml +++ b/spring-boot/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-custom-aop/src/main/resources/logback.xml b/spring-custom-aop/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-custom-aop/src/main/resources/logback.xml +++ b/spring-custom-aop/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-data-couchbase-2/src/main/resources/logback.xml b/spring-data-couchbase-2/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-data-couchbase-2/src/main/resources/logback.xml +++ b/spring-data-couchbase-2/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-data-couchbase-2/src/test/resources/logback.xml b/spring-data-couchbase-2/src/test/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-data-couchbase-2/src/test/resources/logback.xml +++ b/spring-data-couchbase-2/src/test/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-data-mongodb/src/main/resources/logback.xml b/spring-data-mongodb/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-data-mongodb/src/main/resources/logback.xml +++ b/spring-data-mongodb/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-exceptions/src/main/resources/logback.xml b/spring-exceptions/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-exceptions/src/main/resources/logback.xml +++ b/spring-exceptions/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-hibernate4/src/main/resources/logback.xml b/spring-hibernate4/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-hibernate4/src/main/resources/logback.xml +++ b/spring-hibernate4/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-integration/src/test/resources/logback-test.xml b/spring-integration/src/test/resources/logback-test.xml index a807be0ca2..8f1be4eb7a 100644 --- a/spring-integration/src/test/resources/logback-test.xml +++ b/spring-integration/src/test/resources/logback-test.xml @@ -1,5 +1,15 @@ - - + + + # Pattern of log message for console appender + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-jersey/src/main/resources/logback.xml b/spring-jersey/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-jersey/src/main/resources/logback.xml +++ b/spring-jersey/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-ldap/src/main/resources/logback.xml b/spring-ldap/src/main/resources/logback.xml index 32b78577ee..7bd5154680 100644 --- a/spring-ldap/src/main/resources/logback.xml +++ b/spring-ldap/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-mvc-java/src/main/resources/logback.xml b/spring-mvc-java/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-mvc-java/src/main/resources/logback.xml +++ b/spring-mvc-java/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-mvc-java/src/test/resources/logback-test.xml b/spring-mvc-java/src/test/resources/logback-test.xml index e0721aa890..e35a9680bb 100644 --- a/spring-mvc-java/src/test/resources/logback-test.xml +++ b/spring-mvc-java/src/test/resources/logback-test.xml @@ -3,7 +3,7 @@ - %date [%thread] %-5level %logger{6} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-mvc-webflow/src/main/resources/logback.xml b/spring-mvc-webflow/src/main/resources/logback.xml index 1146dade63..5ce05b3361 100644 --- a/spring-mvc-webflow/src/main/resources/logback.xml +++ b/spring-mvc-webflow/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-mvc-xml/src/main/resources/logback.xml b/spring-mvc-xml/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-mvc-xml/src/main/resources/logback.xml +++ b/spring-mvc-xml/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-quartz/src/main/resources/logback.xml b/spring-quartz/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-quartz/src/main/resources/logback.xml +++ b/spring-quartz/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-rest-full/src/main/resources/logback.xml b/spring-rest-full/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-rest-full/src/main/resources/logback.xml +++ b/spring-rest-full/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-rest-query-language/src/main/resources/logback.xml b/spring-rest-query-language/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-rest-query-language/src/main/resources/logback.xml +++ b/spring-rest-query-language/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-rest-simple/src/main/resources/logback.xml b/spring-rest-simple/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-rest-simple/src/main/resources/logback.xml +++ b/spring-rest-simple/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-rest/src/main/resources/logback.xml b/spring-rest/src/main/resources/logback.xml index 3496a4a03c..9f48d36486 100644 --- a/spring-rest/src/main/resources/logback.xml +++ b/spring-rest/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-mvc-custom/src/main/resources/logback.xml b/spring-security-mvc-custom/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-security-mvc-custom/src/main/resources/logback.xml +++ b/spring-security-mvc-custom/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-mvc-digest-auth/src/main/resources/logback.xml b/spring-security-mvc-digest-auth/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-security-mvc-digest-auth/src/main/resources/logback.xml +++ b/spring-security-mvc-digest-auth/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-mvc-ldap/src/main/resources/logback.xml b/spring-security-mvc-ldap/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-security-mvc-ldap/src/main/resources/logback.xml +++ b/spring-security-mvc-ldap/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-mvc-login/src/main/resources/logback.xml b/spring-security-mvc-login/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-security-mvc-login/src/main/resources/logback.xml +++ b/spring-security-mvc-login/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml b/spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml +++ b/spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-mvc-session/src/main/resources/logback.xml b/spring-security-mvc-session/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-security-mvc-session/src/main/resources/logback.xml +++ b/spring-security-mvc-session/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-react/src/main/resources/logback.xml b/spring-security-react/src/main/resources/logback.xml index 75fcb235e1..25f3f36d1a 100644 --- a/spring-security-react/src/main/resources/logback.xml +++ b/spring-security-react/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-rest-basic-auth/src/main/resources/logback.xml b/spring-security-rest-basic-auth/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-security-rest-basic-auth/src/main/resources/logback.xml +++ b/spring-security-rest-basic-auth/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-rest-custom/src/main/resources/logback.xml b/spring-security-rest-custom/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-security-rest-custom/src/main/resources/logback.xml +++ b/spring-security-rest-custom/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-security-rest/src/main/resources/logback.xml b/spring-security-rest/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-security-rest/src/main/resources/logback.xml +++ b/spring-security-rest/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-static-resources/src/main/resources/logback.xml b/spring-static-resources/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-static-resources/src/main/resources/logback.xml +++ b/spring-static-resources/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/spring-thymeleaf/src/main/resources/logback.xml b/spring-thymeleaf/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/spring-thymeleaf/src/main/resources/logback.xml +++ b/spring-thymeleaf/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/vertx-and-rxjava/src/test/resources/logback-test.xml b/vertx-and-rxjava/src/test/resources/logback-test.xml index 71e05a4e24..8b6abffc76 100644 --- a/vertx-and-rxjava/src/test/resources/logback-test.xml +++ b/vertx-and-rxjava/src/test/resources/logback-test.xml @@ -1,7 +1,7 @@ - [%thread{32}] %-5level %msg - %logger%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/vertx/src/main/resources/logback.xml b/vertx/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/vertx/src/main/resources/logback.xml +++ b/vertx/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/xstream/src/main/resources/logback.xml b/xstream/src/main/resources/logback.xml index ec0dc2469a..56af2d397e 100644 --- a/xstream/src/main/resources/logback.xml +++ b/xstream/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - web - %date [%thread] %-5level %logger{36} - %message%n + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n From 87a5fd7504d2c6b66da331df8c1d690e690c56a2 Mon Sep 17 00:00:00 2001 From: sachin Date: Tue, 21 Aug 2018 18:26:02 -0400 Subject: [PATCH 264/298] Reverted a change --- jhipster/jhipster-monolithic/pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/jhipster/jhipster-monolithic/pom.xml b/jhipster/jhipster-monolithic/pom.xml index 1d224e6948..3c08f9a842 100644 --- a/jhipster/jhipster-monolithic/pom.xml +++ b/jhipster/jhipster-monolithic/pom.xml @@ -1,4 +1,3 @@ - 4.0.0 @@ -503,7 +502,6 @@ **/*IntTest.java - plain From 7afb1b2dc885fe3318468a615a7471000821faec Mon Sep 17 00:00:00 2001 From: Kirti Deo Date: Wed, 22 Aug 2018 20:17:33 +0530 Subject: [PATCH 265/298] BAEL-2024 : Fixed review comments by Darragh. --- .../baeldung/classcastexception/ClassCastException.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java b/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java index 64d56e6438..26e5bf0c6b 100644 --- a/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java +++ b/core-java/src/main/java/com/baeldung/classcastexception/ClassCastException.java @@ -8,14 +8,12 @@ public class ClassCastException { public static void main(String[] args) { - List> strList = new ArrayList>(); - // To correct the Exception at line #18, modify the line #11 code as: - // List> personList = new ArrayList >(); - // Line #18 code as personList.add(Arrays.asList(personArray)); String p1 = new String("John"); String p2 = new String("Snow"); String[] strArray = new String[] { p1, p2 }; - strList.add((ArrayList) Arrays.asList(strArray)); + ArrayList strList = (ArrayList) Arrays.asList(strArray); + // To fix the ClassCastException at above line, modify the code as: + // List strList = Arrays.asList(strArray); System.out.println("String list: " + strList); } From 62fa3aa11bc695eb23c5e718c4e3a80f24f4ea23 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Wed, 22 Aug 2018 21:43:17 +0530 Subject: [PATCH 266/298] BAEL-1790 Spring Integration Java DSL Tutorlal --- .../baeldung/dsl/JavaDSLFileCopyConfig.java | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 spring-integration/src/main/java/com/baeldung/dsl/JavaDSLFileCopyConfig.java diff --git a/spring-integration/src/main/java/com/baeldung/dsl/JavaDSLFileCopyConfig.java b/spring-integration/src/main/java/com/baeldung/dsl/JavaDSLFileCopyConfig.java new file mode 100644 index 0000000000..7e91345f04 --- /dev/null +++ b/spring-integration/src/main/java/com/baeldung/dsl/JavaDSLFileCopyConfig.java @@ -0,0 +1,146 @@ +package com.baeldung.dsl; + +import java.io.File; +import java.util.Scanner; +import java.util.concurrent.TimeUnit; + +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.AbstractApplicationContext; +import org.springframework.integration.annotation.IntegrationComponentScan; +import org.springframework.integration.channel.PriorityChannel; +import org.springframework.integration.config.EnableIntegration; +import org.springframework.integration.core.GenericSelector; +import org.springframework.integration.core.MessageSource; +import org.springframework.integration.dsl.IntegrationFlow; +import org.springframework.integration.dsl.IntegrationFlows; +import org.springframework.integration.dsl.Pollers; +import org.springframework.integration.file.FileReadingMessageSource; +import org.springframework.integration.file.FileWritingMessageHandler; +import org.springframework.messaging.MessageHandler; + +/** + * JavaDSLFileCopyConfig contains various Integration Flows created from various spring integration components. + * Activate only one flow at a time by un-commenting @Bean annotation from IntegrationFlow beans. + *

+ * Different flows are :
+ * - {@link #fileMover()} - default app - activated
+ * - {@link #fileMoverWithLambda()} - app with file writing expressions as lambda
+ * - {@link #fileMoverWithPriorityChannel()} - app with priority channel
+ * - {@link #fileReader()}, {@link #fileWriter()}, {@link #anotherFileWriter()} - app with bridge + */ +@Configuration +@EnableIntegration +@IntegrationComponentScan +public class JavaDSLFileCopyConfig { + + public static final String INPUT_DIR = "source"; + public static final String OUTPUT_DIR = "target"; + public static final String OUTPUT_DIR2 = "target2"; + + @Bean + public MessageSource sourceDirectory() { + FileReadingMessageSource messageSource = new FileReadingMessageSource(); + messageSource.setDirectory(new File(INPUT_DIR)); + return messageSource; + } + + @Bean + public GenericSelector onlyJpgs() { + return new GenericSelector() { + + @Override + public boolean accept(File source) { + return source.getName() + .endsWith(".jpg"); + } + }; + } + + @Bean + public MessageHandler targetDirectory() { + FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR)); + handler.setExpectReply(false); // end of pipeline, reply not needed + return handler; + } + + @Bean + public IntegrationFlow fileMover() { + return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000))) + .filter(onlyJpgs()) + .handle(targetDirectory()) + .get(); + } + + // @Bean + public IntegrationFlow fileMoverWithLambda() { + return IntegrationFlows.from(sourceDirectory(), configurer -> configurer.poller(Pollers.fixedDelay(10000))) + .filter(message -> ((File) message).getName() + .endsWith(".jpg")) + .handle(targetDirectory()) + .get(); + } + + @Bean + public PriorityChannel alphabetically() { + return new PriorityChannel(1000, (left, right) -> ((File) left.getPayload()).getName() + .compareTo(((File) right.getPayload()).getName())); + } + + // @Bean + public IntegrationFlow fileMoverWithPriorityChannel() { + return IntegrationFlows.from(sourceDirectory()) + .filter(onlyJpgs()) + .channel("alphabetically") + .handle(targetDirectory()) + .get(); + } + + @Bean + public MessageHandler anotherTargetDirectory() { + FileWritingMessageHandler handler = new FileWritingMessageHandler(new File(OUTPUT_DIR2)); + handler.setExpectReply(false); // end of pipeline, reply not needed + return handler; + } + + // @Bean + public IntegrationFlow fileReader() { + return IntegrationFlows.from(sourceDirectory()) + .filter(onlyJpgs()) + .channel("holdingTank") + .get(); + } + + // @Bean + public IntegrationFlow fileWriter() { + return IntegrationFlows.from("holdingTank") + .bridge(e -> e.poller(Pollers.fixedRate(1, TimeUnit.SECONDS, 20))) + .handle(targetDirectory()) + .get(); + } + + // @Bean + public IntegrationFlow anotherFileWriter() { + return IntegrationFlows.from("holdingTank") + .bridge(e -> e.poller(Pollers.fixedRate(2, TimeUnit.SECONDS, 10))) + .handle(anotherTargetDirectory()) + .get(); + } + + public static void main(final String... args) { + final AbstractApplicationContext context = new AnnotationConfigApplicationContext(JavaDSLFileCopyConfig.class); + context.registerShutdownHook(); + final Scanner scanner = new Scanner(System.in); + System.out.print("Please enter a string and press : "); + while (true) { + final String input = scanner.nextLine(); + if ("q".equals(input.trim())) { + context.close(); + scanner.close(); + break; + } + } + System.exit(0); + } +} From 387f9e7e526c46097d7216127d3f12cf0ae7a138 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 22 Aug 2018 10:14:59 -0600 Subject: [PATCH 267/298] BAEL-1990: IntelliJ plugin example (#4942) * Initial revision * Add actions and plugin config * Add language tag to search action * Cleanup before submitting --- .../resources/META-INF/plugin.xml | 62 ++++++++++++++ .../resources/so-icon-16x16.png | Bin 0 -> 454 bytes .../AskQuestionAction.java | 14 ++++ .../stackoverflowplugin/SearchAction.java | 58 +++++++++++++ ...sources.reladomo.ReladomoClassList.xml.log | 2 - .../introduction/views/index.scala.html | 20 ----- .../introduction/views/main.scala.html | 23 ------ out/production/main122/.gitignore | 13 --- .../main151/com/baeldung/.gitignore | 13 --- out/production/main151/com/baeldung/README.md | 2 - .../main155/com/baeldung/git/README.md | 2 - out/production/main173/log4j.properties | 9 --- .../JavaEEAnnotationsSample/README.txt | 76 ------------------ .../JavaEEAnnotationsSample/pom.xml | 57 ------------- .../src/main/webapp/WEB-INF/web.xml | 10 --- .../src/main/webapp/index.jsp | 16 ---- .../src/main/webapp/login.jsp | 12 --- .../src/main/webapp/upload.jsp | 16 ---- .../jaxws/wsdl/employeeservicetopdown.wsdl | 42 ---------- .../com/baeldung/java/nio/selector/README.md | 2 - .../googlehttpclientguide/logging.properties | 10 --- .../baeldung/wicket/examples/HelloWorld.html | 52 ------------ .../examples/cafeaddress/CafeAddress.html | 15 ---- .../examples/helloworld/HelloWorld.html | 5 -- .../com/baeldung/activiti/security.rar | Bin 3760 -> 0 bytes .../main237/com/baeldung/datetime/README.md | 2 - out/production/main291/xml-bean-config.xml | 12 --- .../main30/com/baeldung/factorybean/README.md | 2 - .../main330/com/baeldung/.gitignore | 13 --- out/production/main330/com/baeldung/README.md | 2 - .../main330/com/baeldung/enums/README.md | 2 - .../main330/com/baeldung/networking/README.md | 5 -- .../com/baeldung/printscreen/README.md | 2 - out/production/main330/log4j.properties | 9 --- .../com/baeldung/produceimage/README.md | 3 - .../main96/com/baeldung/git/README.md | 2 - .../routing-in-play/views/index.scala.html | 20 ----- .../routing-in-play/views/main.scala.html | 23 ------ .../com/baeldung/cglib/proxy/README.md | 3 - out/test/test143/com/baeldung/java9/README.MD | 2 - .../test174/org/baeldung/hamcrest/README.md | 2 - .../com/baeldung/web/controller/README.md | 2 - .../test197/com/baeldung/java/nio2/README.md | 11 --- out/test/test237/META-INF/persistence.xml | 20 ----- .../test95/com/baeldung/hexToAscii/README.md | 2 - .../com/baeldung/java/conversion/README.md | 2 - .../org/baeldung/java/collections/README.md | 3 - .../test95/org/baeldung/java/lists/README.md | 2 - .../com/baeldung/applicationcontext/README.md | 3 - .../test98/com/baeldung/beanfactory/README.md | 2 - 50 files changed, 134 insertions(+), 548 deletions(-) create mode 100644 intelliJ/stackoverflow-plugin/resources/META-INF/plugin.xml create mode 100644 intelliJ/stackoverflow-plugin/resources/so-icon-16x16.png create mode 100644 intelliJ/stackoverflow-plugin/src/com/baeldung/intellij/stackoverflowplugin/AskQuestionAction.java create mode 100644 intelliJ/stackoverflow-plugin/src/com/baeldung/intellij/stackoverflowplugin/SearchAction.java delete mode 100644 out/production/generated-sources8/src.main.resources.reladomo.ReladomoClassList.xml.log delete mode 100644 out/production/introduction/views/index.scala.html delete mode 100644 out/production/introduction/views/main.scala.html delete mode 100644 out/production/main122/.gitignore delete mode 100644 out/production/main151/com/baeldung/.gitignore delete mode 100644 out/production/main151/com/baeldung/README.md delete mode 100644 out/production/main155/com/baeldung/git/README.md delete mode 100644 out/production/main173/log4j.properties delete mode 100644 out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/README.txt delete mode 100644 out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/pom.xml delete mode 100644 out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/WEB-INF/web.xml delete mode 100644 out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/index.jsp delete mode 100644 out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/login.jsp delete mode 100644 out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/upload.jsp delete mode 100644 out/production/main180/com/baeldung/jaxws/wsdl/employeeservicetopdown.wsdl delete mode 100644 out/production/main195/com/baeldung/java/nio/selector/README.md delete mode 100644 out/production/main216/com/baeldung/googlehttpclientguide/logging.properties delete mode 100644 out/production/main231/com/baeldung/wicket/examples/HelloWorld.html delete mode 100644 out/production/main231/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html delete mode 100644 out/production/main231/com/baeldung/wicket/examples/helloworld/HelloWorld.html delete mode 100644 out/production/main234/com/baeldung/activiti/security.rar delete mode 100644 out/production/main237/com/baeldung/datetime/README.md delete mode 100644 out/production/main291/xml-bean-config.xml delete mode 100644 out/production/main30/com/baeldung/factorybean/README.md delete mode 100644 out/production/main330/com/baeldung/.gitignore delete mode 100644 out/production/main330/com/baeldung/README.md delete mode 100644 out/production/main330/com/baeldung/enums/README.md delete mode 100644 out/production/main330/com/baeldung/networking/README.md delete mode 100644 out/production/main330/com/baeldung/printscreen/README.md delete mode 100644 out/production/main330/log4j.properties delete mode 100644 out/production/main351/com/baeldung/produceimage/README.md delete mode 100644 out/production/main96/com/baeldung/git/README.md delete mode 100644 out/production/routing-in-play/views/index.scala.html delete mode 100644 out/production/routing-in-play/views/main.scala.html delete mode 100644 out/test/test105/com/baeldung/cglib/proxy/README.md delete mode 100644 out/test/test143/com/baeldung/java9/README.MD delete mode 100644 out/test/test174/org/baeldung/hamcrest/README.md delete mode 100644 out/test/test191/com/baeldung/web/controller/README.md delete mode 100644 out/test/test197/com/baeldung/java/nio2/README.md delete mode 100644 out/test/test237/META-INF/persistence.xml delete mode 100644 out/test/test95/com/baeldung/hexToAscii/README.md delete mode 100644 out/test/test95/com/baeldung/java/conversion/README.md delete mode 100644 out/test/test95/org/baeldung/java/collections/README.md delete mode 100644 out/test/test95/org/baeldung/java/lists/README.md delete mode 100644 out/test/test98/com/baeldung/applicationcontext/README.md delete mode 100644 out/test/test98/com/baeldung/beanfactory/README.md diff --git a/intelliJ/stackoverflow-plugin/resources/META-INF/plugin.xml b/intelliJ/stackoverflow-plugin/resources/META-INF/plugin.xml new file mode 100644 index 0000000000..5931f10f05 --- /dev/null +++ b/intelliJ/stackoverflow-plugin/resources/META-INF/plugin.xml @@ -0,0 +1,62 @@ + + com.baeldung.intellij.stackoverflowplugin + Stack Overflow Plugin for IntelliJ + 1.0 + Baeldung + + + + +

  • 1.0 - Initial release
  • + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/intelliJ/stackoverflow-plugin/resources/so-icon-16x16.png b/intelliJ/stackoverflow-plugin/resources/so-icon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..fddbb6b8991dfb562ebeadd7a422763f07ebf4d8 GIT binary patch literal 454 zcmV;%0XhDOP)+ViBc$T<*pVv zgzE?iiCoa!3HOoR^_z>??5uE=c*!sCW9I*6-V@?4?Jdx7$-1J$62 z?u5pbY|`APu>+bcNZ-qiX69b2Egdrm$6!PVdFo6bZzoE350kciNiDGG4yL5<7Nziq zEU((nt$Vno!Bgu;VS+dVzc#3OR(v2oxO^RRD|v+Vd23B=rI=eDN9=%M(H~qPvR^uf w`L=0{)=uTwtcEh?H}(-aGD5vIC;$Ke literal 0 HcmV?d00001 diff --git a/intelliJ/stackoverflow-plugin/src/com/baeldung/intellij/stackoverflowplugin/AskQuestionAction.java b/intelliJ/stackoverflow-plugin/src/com/baeldung/intellij/stackoverflowplugin/AskQuestionAction.java new file mode 100644 index 0000000000..ee122fc2d8 --- /dev/null +++ b/intelliJ/stackoverflow-plugin/src/com/baeldung/intellij/stackoverflowplugin/AskQuestionAction.java @@ -0,0 +1,14 @@ +package com.baeldung.intellij.stackoverflowplugin; + +import com.intellij.ide.BrowserUtil; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; + +public class AskQuestionAction extends AnAction +{ + @Override + public void actionPerformed(AnActionEvent e) + { + BrowserUtil.browse("https://stackoverflow.com/questions/ask"); + } +} diff --git a/intelliJ/stackoverflow-plugin/src/com/baeldung/intellij/stackoverflowplugin/SearchAction.java b/intelliJ/stackoverflow-plugin/src/com/baeldung/intellij/stackoverflowplugin/SearchAction.java new file mode 100644 index 0000000000..c1f910c656 --- /dev/null +++ b/intelliJ/stackoverflow-plugin/src/com/baeldung/intellij/stackoverflowplugin/SearchAction.java @@ -0,0 +1,58 @@ +package com.baeldung.intellij.stackoverflowplugin; + +import com.intellij.ide.BrowserUtil; +import com.intellij.lang.Language; +import com.intellij.openapi.actionSystem.ActionManager; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.editor.CaretModel; +import com.intellij.openapi.editor.Editor; +import com.intellij.psi.PsiFile; + +public class SearchAction extends AnAction +{ + /** + * Convert selected text to a URL friendly string. + * @param e + */ + @Override + public void actionPerformed(AnActionEvent e) + { + final Editor editor = e.getRequiredData(CommonDataKeys.EDITOR); + CaretModel caretModel = editor.getCaretModel(); + + // For searches from the editor, we should also get file type information + // to help add scope to the search using the Stack overflow search syntax. + // + // https://stackoverflow.com/help/searching + + String languageTag = ""; + PsiFile file = e.getData(CommonDataKeys.PSI_FILE); + if(file != null) + { + Language lang = e.getData(CommonDataKeys.PSI_FILE).getLanguage(); + languageTag = "+[" + lang.getDisplayName().toLowerCase() + "]"; + } + + // The update method below is only called periodically so need + // to be careful to check for selected text + if(caretModel.getCurrentCaret().hasSelection()) + { + String query = caretModel.getCurrentCaret().getSelectedText().replace(' ', '+') + languageTag; + BrowserUtil.browse("https://stackoverflow.com/search?q=" + query); + } + } + + /** + * Only make this action visible when text is selected. + * @param e + */ + @Override + public void update(AnActionEvent e) + { + final Editor editor = e.getRequiredData(CommonDataKeys.EDITOR); + CaretModel caretModel = editor.getCaretModel(); + e.getPresentation().setEnabledAndVisible(caretModel.getCurrentCaret().hasSelection()); + } +} diff --git a/out/production/generated-sources8/src.main.resources.reladomo.ReladomoClassList.xml.log b/out/production/generated-sources8/src.main.resources.reladomo.ReladomoClassList.xml.log deleted file mode 100644 index 0bd4e29a45..0000000000 --- a/out/production/generated-sources8/src.main.resources.reladomo.ReladomoClassList.xml.log +++ /dev/null @@ -1,2 +0,0 @@ -f5a6ba3b942a82fcbfb72e61502d5c30 -9201deea diff --git a/out/production/introduction/views/index.scala.html b/out/production/introduction/views/index.scala.html deleted file mode 100644 index 4539f5a10b..0000000000 --- a/out/production/introduction/views/index.scala.html +++ /dev/null @@ -1,20 +0,0 @@ -@* - * This template takes a single argument, a String containing a - * message to display. - *@ -@(message: String) - -@* - * Call the `main` template with two arguments. The first - * argument is a `String` with the title of the page, the second - * argument is an `Html` object containing the body of the page. - *@ -@main("Welcome to Play") { - - @* - * Get an `Html` object by calling the built-in Play welcome - * template and passing a `String` message. - *@ - @play20.welcome(message, style = "Java") - -} diff --git a/out/production/introduction/views/main.scala.html b/out/production/introduction/views/main.scala.html deleted file mode 100644 index 9414f4be6e..0000000000 --- a/out/production/introduction/views/main.scala.html +++ /dev/null @@ -1,23 +0,0 @@ -@* - * This template is called from the `index` template. This template - * handles the rendering of the page header and body tags. It takes - * two arguments, a `String` for the title of the page and an `Html` - * object to insert into the body of the page. - *@ -@(title: String)(content: Html) - - - - - @* Here's where we render the page title `String`. *@ - @title - - - - - - @* And here's where we render the `Html` object containing - * the page content. *@ - @content - - diff --git a/out/production/main122/.gitignore b/out/production/main122/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/out/production/main122/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear \ No newline at end of file diff --git a/out/production/main151/com/baeldung/.gitignore b/out/production/main151/com/baeldung/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/out/production/main151/com/baeldung/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear \ No newline at end of file diff --git a/out/production/main151/com/baeldung/README.md b/out/production/main151/com/baeldung/README.md deleted file mode 100644 index 51809b2882..0000000000 --- a/out/production/main151/com/baeldung/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [SHA-256 Hashing in Java](http://www.baeldung.com/sha-256-hashing-java) diff --git a/out/production/main155/com/baeldung/git/README.md b/out/production/main155/com/baeldung/git/README.md deleted file mode 100644 index 7e6a597c28..0000000000 --- a/out/production/main155/com/baeldung/git/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Injecting Git Information Into Spring](http://www.baeldung.com/spring-git-information) diff --git a/out/production/main173/log4j.properties b/out/production/main173/log4j.properties deleted file mode 100644 index 5fe42d854c..0000000000 --- a/out/production/main173/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=DEBUG, A1 - -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n diff --git a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/README.txt b/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/README.txt deleted file mode 100644 index bffe24e485..0000000000 --- a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/README.txt +++ /dev/null @@ -1,76 +0,0 @@ -About the application ---------------------- -This application demonstrates the usage of JavaEE Web Annotations. - - -Contents of the application ---------------------------- -1. AccountServlet.java - Demonstrates the @WebServlet and @ServletSecurity annotation. - -NOTES: @WebServlet annotation designates the AccountServlet class as a Servlet component. - The usage of its parameters 'urlPatterns' & 'initParams' can be observed. - An initialization parameter 'type' is being set to denote the type of the bank account. - - @ServletSecurity annotation imposes security constraints on the AccountServlet based on - the tomcat-users.xml. -   - This code assumes that your tomcat-users.xml looks as follows: - - - - - - - -   -N.B : To see @ServletSecurity annotation in action, please uncomment the annotation code - for @ServletSecurity. - - -2. BankAppServletContextListener.java - Demonstrates the @WebListener annotation for denoting a class as a ServletContextListener. - -NOTES: Sets a Servlet context attribute ATTR_DEFAULT_LANGUAGE to 'english' on web application start up, - which can then be used throughout the application. - - -3. LogInFilter.java - Demonstrates the @WebFilter annotation. - -NOTES: @WebFilter annotation designates the LogInFilter class as a Filter component. - It filters all requests to the bank account servlet and redirects them to - the login page. - -N.B : To see @WebFilter annotation in action, please uncomment the annotation code for @WebFilter. - - -4. UploadCustomerDocumentsServlet.java - Demonstrates the @MultipartConfig annotation. - -NOTES: @MultipartConfig anotation designates the UploadCustomerDocumentsServlet Servlet component, - to handle multipart/form-data requests. - To see it in action, deploy the web application an access the url: http://:/JavaEEAnnotationsSample/upload.jsp - Once you upload a file from here, it will get uploaded to D:/custDocs (assuming such a folder exists). - - -5. index.jsp - This is the welcome page. - -NOTES: You can enter a deposit amount here and click on the 'Deposit' button to see the AccountServlet in action. - -6. login.jsp - All requests to the AccountServlet are redirected to this page, if the LogInFilter is imposed. - -7. upload.jsp - Demonstrates the usage of handling multipart/form-data requests by the UploadCustomerDocumentsServlet. - - -Building and Running the application ------------------------------------- -To build the application: - -1. Open the project in eclipse -2. Right click on it in eclispe and choose Run As > Maven build -3. Give 'clean install' under Goals -4. This should build the WAR file of the application - -To run the application: - -1. Right click on the project -2. Run as > Run on Server -3. This will start you Tomcat server and deploy the application (Provided that you have configured Tomcat in your eclipse) -4. You should now be able to access the url : http://:/JavaEEAnnotationsSample diff --git a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/pom.xml b/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/pom.xml deleted file mode 100644 index 25f901459c..0000000000 --- a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - com.baeldung.javaeeannotations - JavaEEAnnotationsSample - 0.0.1-SNAPSHOT - war - JavaEEAnnotationsSample - JavaEEAnnotationsSample - - - - - javax.annotation - javax.annotation-api - ${annotation-api.version} - - - - javax.servlet - javax.servlet-api - ${servlet.version} - - - - javax.servlet.jsp - jsp-api - ${jsp.version} - - - - - - - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - src/main/webapp - SpringFieldConstructorInjection - false - - - - - JavaEEAnnotationsSample - - - - 1.3 - 3.1.0 - 2.1 - 2.4 - - \ No newline at end of file diff --git a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/WEB-INF/web.xml b/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index a92885ec11..0000000000 --- a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - BASIC - default - - diff --git a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/index.jsp b/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/index.jsp deleted file mode 100644 index c49dec859e..0000000000 --- a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/index.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -My Account - - -
    - Amount: -    - -
    - - \ No newline at end of file diff --git a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/login.jsp b/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/login.jsp deleted file mode 100644 index 6892cb0420..0000000000 --- a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/login.jsp +++ /dev/null @@ -1,12 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Login - - -Login Here... - - \ No newline at end of file diff --git a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/upload.jsp b/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/upload.jsp deleted file mode 100644 index 3601322ef0..0000000000 --- a/out/production/main180/com/baeldung/javaeeannotations/JavaEEAnnotationsSample/src/main/webapp/upload.jsp +++ /dev/null @@ -1,16 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> - - - - -Insert title here - - -
    - -
    - -
    - - \ No newline at end of file diff --git a/out/production/main180/com/baeldung/jaxws/wsdl/employeeservicetopdown.wsdl b/out/production/main180/com/baeldung/jaxws/wsdl/employeeservicetopdown.wsdl deleted file mode 100644 index 426717f90e..0000000000 --- a/out/production/main180/com/baeldung/jaxws/wsdl/employeeservicetopdown.wsdl +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/out/production/main195/com/baeldung/java/nio/selector/README.md b/out/production/main195/com/baeldung/java/nio/selector/README.md deleted file mode 100644 index b28aae1397..0000000000 --- a/out/production/main195/com/baeldung/java/nio/selector/README.md +++ /dev/null @@ -1,2 +0,0 @@ -###Relevant Articles: -- [Introduction to the Java NIO Selector](http://www.baeldung.com/java-nio-selector) diff --git a/out/production/main216/com/baeldung/googlehttpclientguide/logging.properties b/out/production/main216/com/baeldung/googlehttpclientguide/logging.properties deleted file mode 100644 index 02489378df..0000000000 --- a/out/production/main216/com/baeldung/googlehttpclientguide/logging.properties +++ /dev/null @@ -1,10 +0,0 @@ -# Properties file which configures the operation of the JDK logging facility. -# The system will look for this config file to be specified as a system property: -# -Djava.util.logging.config.file=${project_loc:dailymotion-simple-cmdline-sample}/logging.properties - -# Set up the console handler (uncomment "level" to show more fine-grained messages) -handlers = java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level = ALL - -# Set up logging of HTTP requests and responses (uncomment "level" to show) -com.google.api.client.http.level = ALL diff --git a/out/production/main231/com/baeldung/wicket/examples/HelloWorld.html b/out/production/main231/com/baeldung/wicket/examples/HelloWorld.html deleted file mode 100644 index 497e98e01a..0000000000 --- a/out/production/main231/com/baeldung/wicket/examples/HelloWorld.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - -Wicket Intro Examples - - - -
    -
    -
    -

    Wicket Introduction Examples:

    - - Hello World! -
    -
    - Cafes -
    -
    -
    -
    - - diff --git a/out/production/main231/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html b/out/production/main231/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html deleted file mode 100644 index c5ada2323d..0000000000 --- a/out/production/main231/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - -Cafes - - -
    - -

    - Address: address -

    -
    - - diff --git a/out/production/main231/com/baeldung/wicket/examples/helloworld/HelloWorld.html b/out/production/main231/com/baeldung/wicket/examples/helloworld/HelloWorld.html deleted file mode 100644 index c56d07fc10..0000000000 --- a/out/production/main231/com/baeldung/wicket/examples/helloworld/HelloWorld.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/out/production/main234/com/baeldung/activiti/security.rar b/out/production/main234/com/baeldung/activiti/security.rar deleted file mode 100644 index 38c4946168a456265f5999633bc8cb581a8360cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3760 zcmaLaXEdDK9tQBy38O{y=v@#!g~W(HMi54iG6thf%&5^xjuu^_cM?R68lsFEQ6{4X zQ6@UkMK9O6Ip?l*?p^EdPkZh4e)_N9^SpcOTcfyH$pF|mGynhu{9al2+_~Zm0EC19 zfHw&MKp5nA|J=RK1bkCk0>E|k2^tRbKq1_H%t0`BgeSrs@#Gl_;cEZnuVc`&XU+(i zwL1doD(-0QX${yW-;W``N!vf5$j%aQc5`l}RZuzn{suLr1nm#9K!)myzL-0D%`ti1 zY4kc^--ylq4`5M*S+TrW{Deyu;19`nA5$B4)^?_+!GS*?+L4m_Nh<&aVhe_Xd9!Tr zw_yn{v`nMJKKq+M>AsezTVP{5^nDWVr9cGQxSVu?#EyljXpaaCWvtPY%zoRghL4rK zFn$*#q9Y77@9#eDQ1~fM$zkMRd#Q;F-yMF18}b|&dve3@HvHZGA;9)l!%O|NwXGb( z=vSAUGobuUwwE&;eZ^oWjy8m|0P0+XYkVtmT3Uz}EvL7B`ZGY>Se+yc@FMpA|Gt)oZY zZlH5DvvQdHoG9yy_3>Zl)ysVDl*Ckt>y}wnyvYz zD~(}d4(eN}>Z;+j;cN%W3EbH<^33{GOY*UfoNA>=sx-MVQ^eylh127?02<7B6eJ;v zB= zvYdguYM({sU*CfA@~%`V1Lm#(B@!6sB(aS%C<#Md#dWj}tsNTln1s9k@Y<0%i(H)c$-$)g#A3tPVsLriD?xFWiKgjN zlMJkNI5PDlAHE7R^z%Q2&M0tU5LXjY0q|bsZuQUHr7h%D-)#6ZcbxwS`xT|0|<_o+Z!geB`8E0EDsySDWYp8 zjK9aWNlIC)K!80n`-#J27tfA781z&9$EMq3coKx?GYg9OLtpib@OaggwC}@e z=_=-3KdW){pwNZ#C6f(tn+PwdM~&q+zEbw8?db4q_ex?3bWS2nUa(5!@e3_ zvi35OtU9Cxl?5arbC-7d5F}*zX8S-)=lJ!}F=Gr2_fAO8LyrSn{jFr^p)D3wd(G}5 ztwY%nr^A`6`lD%CAdLEX6)auQIapY?E4rY^JZwk5as3E~3qop7>Dav0;6Tx|;eKU1 zlAJ&J?h+Hq6JeK79`-1COS}0R;w|3-&YgPdMhH*hO0N~C(aI#~q)bokC=*A!89PzV z=u{hq^e5hfzk0J(8lNmhMg|b@amilxd)QjU4Z30m0$g5&P~lHzbZ+4`{r?Uk`#+ie zUFcU?v_shc)#cYkB!Q{_F&3IDs~KdZ)MS;nP-9iE8l)Eo@)DSE%Z<%7#3l0Qoi;O0 zJe5m?s|%>Dc(>KdHB<1!FVmRq^mGg|YN;ftPqyMNL)j}mnXKq37JYVK#Fe|m8aT=$ zie@yFYV_sp_l}Do!pq7LpW66-iPF$h3c0*HkmfQ;*jMIB|Cp7A7_sc%Q_S_C9_Hf4 zzLIU}&)GD@VLjN@CYmwqZW&o#Oh14_sQM#JSsJCjzugB~RS$>e*}`}h5{@bVz~kf^ z&LzyYe(d|m@dQbd3Hrmq+y&$pU6)2~;Ze+S?rO6*V%cohM3O76SW_Y<&b|@?ghV=R zoX`ebh(bd0USw9Me_B|hs<#PI6SCvUhso7GEnfj_x?PW8@>^ub%~HWlo!ZH#0?f0r zVqT?I8bnLqw>t?l_GhHfM=jB@HRNMR#~V$?9x(UYM$x=rTj7u$Op1a`-6~N~Hum3v zcDAw{usTba+??NKvtz_kBh`v++ar|eptmAN8ravyB8X+vzL3#n-SN~O0#erc4}?y@ zJ@3St##Q!S+_s9#bWIb(`}8$lEY}##OqY$n>rgCv9NjWo9q6m-S0>NI{dtWk7NMhe ziiM8FB?W?7{MsXo*htF6>yKd-MNUWaFFF#qi!3^yvyHq#LdM^}uQ-W3#msI8eGjB%6~Lw{Utf>4IAyo`>zfUnuNMrKH!x3?z# zaW}S$UJrjnGk<7#NfsA(Kra=^u*ku~u%i>+U7a!!ozEIYwY$c$>2o%D9Ud>$FHt2; zi>{!481Y)RkEU@)~@@*+pYZGx9|M=jhP4ESS8c$E(+8*%6+B~G6AWt3sA`~#=JxBav|es>62P7 zh}H_TqXktoBQ#C7U5bj$h4r=CU_HW8$@NA*FZl2sC6zvH(R3awJx?Nyif5gP&E7^h zK!m8R&v?2h+tMSRvj}#gm4$Rvg^bNv{>U-nShM1}AT*CME?vLVlm-Ch5Dk3TjT{sb z_=4>*U)8)G%NF`3Geop&X+J6e6REfrCapsPO==`Z^4$+USd_>-wZ+;|^;raUnhs4p zr~Gv%bWDIfJhN#!a{}Tnupt>i;@7}5-DDDlatS4iaT)zI&BmOA<{Ez@S8EwbGrh7( zFL-wyytHNk`^GA-BAg{V{({E2(4g$o8IJK||Eh{_ZoRuh+ORxSVc(r{HROQ6*FIHY zU+v`)f6>b~A-jUwC3IbFHXa?E;*#2eoo1OeTT}zk7}N0|rGcMXG6(7d!AGRh1@W@2 z8je^PtpVYp@7E(i#+?@AN29t95g(VOYl-pPpngNpfW;xkXqD02M3ax0={_4T{w{_E zWqR7+^H7~-C5cKy!s%S3mbmTg7#~_bhPsxN0Tqe6<;gyMAmEL-q$J(iCM$5!s0iAM zzE^r#M{kg@$JbW2+RgSHcYZ2d=DTN`i*N3=5N>6r;Y`{xxU#Mdpd$hRC@8P2&&6~; z|9uq}{D0OB(Qwp1sBaeqCR4HeMSbN@>dz3bw<&6w&C1*HMdOb0SJV^AESF_Q>Rt&p z&B>%e)1MVgMa!F|t|M($g5@Icc>Jy6d6n(F2vrXH2M;-@JRb1b6J{0!P`rmz5QjCgdd)EGr-*kBI-5JQH55| z5u{Jb#FQl*z=!<6p?eZTq3uAT&FH!$BR3FFm3exGu1ZU^Y-?Rkc=J-XDEM`c@m^>C z=VIK~8!TljY_2HX!?(qXn^z5-o}n6)9?4x!IK6zUHd>}(7T&Ih zkGQB3z}$|WMH}OY22^tIFw+2iu%Q{5lDO4P87`Z~eDrAXk;|Wp4v!6f4;BJxGLWrf> zGe+%{C>6`iMrS^Xh1eCb$6*lr4v7wbVRmPa&=IE11e70=Gd~eyX2t zpt>wF(Cp4AlUk~7qP>G4ptJj2oY>WS;P<-vp8x=4RmNb3+vEV+tNq{aOu#nLSMN?m JUw{%B;9rQ$_E`V` diff --git a/out/production/main237/com/baeldung/datetime/README.md b/out/production/main237/com/baeldung/datetime/README.md deleted file mode 100644 index 1e4adbb612..0000000000 --- a/out/production/main237/com/baeldung/datetime/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) diff --git a/out/production/main291/xml-bean-config.xml b/out/production/main291/xml-bean-config.xml deleted file mode 100644 index 3b880bbd70..0000000000 --- a/out/production/main291/xml-bean-config.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/out/production/main30/com/baeldung/factorybean/README.md b/out/production/main30/com/baeldung/factorybean/README.md deleted file mode 100644 index 13f9f379e0..0000000000 --- a/out/production/main30/com/baeldung/factorybean/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [How to use the Spring FactoryBean?](http://www.baeldung.com/spring-factorybean) diff --git a/out/production/main330/com/baeldung/.gitignore b/out/production/main330/com/baeldung/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/out/production/main330/com/baeldung/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear \ No newline at end of file diff --git a/out/production/main330/com/baeldung/README.md b/out/production/main330/com/baeldung/README.md deleted file mode 100644 index 51809b2882..0000000000 --- a/out/production/main330/com/baeldung/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [SHA-256 Hashing in Java](http://www.baeldung.com/sha-256-hashing-java) diff --git a/out/production/main330/com/baeldung/enums/README.md b/out/production/main330/com/baeldung/enums/README.md deleted file mode 100644 index 6ccfa725f5..0000000000 --- a/out/production/main330/com/baeldung/enums/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [A Guide to Java Enums](http://www.baeldung.com/a-guide-to-java-enums) diff --git a/out/production/main330/com/baeldung/networking/README.md b/out/production/main330/com/baeldung/networking/README.md deleted file mode 100644 index b9e827f085..0000000000 --- a/out/production/main330/com/baeldung/networking/README.md +++ /dev/null @@ -1,5 +0,0 @@ -### Relevant Articles: -- [A Guide To UDP In Java](http://www.baeldung.com/udp-in-java) -- [A Guide To HTTP Cookies In Java](http://www.baeldung.com/cookies-java) -- [A Guide to the Java URL](http://www.baeldung.com/java-url) -- [Working with Network Interfaces in Java](http://www.baeldung.com/java-network-interfaces) diff --git a/out/production/main330/com/baeldung/printscreen/README.md b/out/production/main330/com/baeldung/printscreen/README.md deleted file mode 100644 index 7b3b40c102..0000000000 --- a/out/production/main330/com/baeldung/printscreen/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) diff --git a/out/production/main330/log4j.properties b/out/production/main330/log4j.properties deleted file mode 100644 index 5fe42d854c..0000000000 --- a/out/production/main330/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=DEBUG, A1 - -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n diff --git a/out/production/main351/com/baeldung/produceimage/README.md b/out/production/main351/com/baeldung/produceimage/README.md deleted file mode 100644 index acd546598d..0000000000 --- a/out/production/main351/com/baeldung/produceimage/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant articles - -- [Returning an Image or a File with Spring](http://www.baeldung.com/spring-controller-return-image-file) diff --git a/out/production/main96/com/baeldung/git/README.md b/out/production/main96/com/baeldung/git/README.md deleted file mode 100644 index 7e6a597c28..0000000000 --- a/out/production/main96/com/baeldung/git/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Injecting Git Information Into Spring](http://www.baeldung.com/spring-git-information) diff --git a/out/production/routing-in-play/views/index.scala.html b/out/production/routing-in-play/views/index.scala.html deleted file mode 100644 index 4539f5a10b..0000000000 --- a/out/production/routing-in-play/views/index.scala.html +++ /dev/null @@ -1,20 +0,0 @@ -@* - * This template takes a single argument, a String containing a - * message to display. - *@ -@(message: String) - -@* - * Call the `main` template with two arguments. The first - * argument is a `String` with the title of the page, the second - * argument is an `Html` object containing the body of the page. - *@ -@main("Welcome to Play") { - - @* - * Get an `Html` object by calling the built-in Play welcome - * template and passing a `String` message. - *@ - @play20.welcome(message, style = "Java") - -} diff --git a/out/production/routing-in-play/views/main.scala.html b/out/production/routing-in-play/views/main.scala.html deleted file mode 100644 index 9414f4be6e..0000000000 --- a/out/production/routing-in-play/views/main.scala.html +++ /dev/null @@ -1,23 +0,0 @@ -@* - * This template is called from the `index` template. This template - * handles the rendering of the page header and body tags. It takes - * two arguments, a `String` for the title of the page and an `Html` - * object to insert into the body of the page. - *@ -@(title: String)(content: Html) - - - - - @* Here's where we render the page title `String`. *@ - @title - - - - - - @* And here's where we render the `Html` object containing - * the page content. *@ - @content - - diff --git a/out/test/test105/com/baeldung/cglib/proxy/README.md b/out/test/test105/com/baeldung/cglib/proxy/README.md deleted file mode 100644 index abeabc6162..0000000000 --- a/out/test/test105/com/baeldung/cglib/proxy/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant articles - -- [Introduction to cglib](http://www.baeldung.com/cglib) diff --git a/out/test/test143/com/baeldung/java9/README.MD b/out/test/test143/com/baeldung/java9/README.MD deleted file mode 100644 index 2f44a2336b..0000000000 --- a/out/test/test143/com/baeldung/java9/README.MD +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Artiles: -- [Filtering a Stream of Optionals in Java](http://www.baeldung.com/java-filter-stream-of-optional) diff --git a/out/test/test174/org/baeldung/hamcrest/README.md b/out/test/test174/org/baeldung/hamcrest/README.md deleted file mode 100644 index 7266ecda3a..0000000000 --- a/out/test/test174/org/baeldung/hamcrest/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Testing with Hamcrest](http://www.baeldung.com/java-junit-hamcrest-guide) diff --git a/out/test/test191/com/baeldung/web/controller/README.md b/out/test/test191/com/baeldung/web/controller/README.md deleted file mode 100644 index 9923962dde..0000000000 --- a/out/test/test191/com/baeldung/web/controller/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [WebAppConfiguration in Spring Tests](http://www.baeldung.com/spring-webappconfiguration) diff --git a/out/test/test197/com/baeldung/java/nio2/README.md b/out/test/test197/com/baeldung/java/nio2/README.md deleted file mode 100644 index 569be82d27..0000000000 --- a/out/test/test197/com/baeldung/java/nio2/README.md +++ /dev/null @@ -1,11 +0,0 @@ -### Relevant Articles: -- [Introduction to the Java NIO2 File API](http://www.baeldung.com/java-nio-2-file-api) -- [Java NIO2 Path API](http://www.baeldung.com/java-nio-2-path) -- [A Guide To NIO2 Asynchronous File Channel](http://www.baeldung.com/java-nio2-async-file-channel) -- [Guide to Selenium with JUnit / TestNG](http://www.baeldung.com/java-selenium-with-junit-and-testng) -- [A Guide to NIO2 Asynchronous Socket Channel](http://www.baeldung.com/java-nio2-async-socket-channel) -- [A Guide To NIO2 FileVisitor](http://www.baeldung.com/java-nio2-file-visitor) -- [A Guide To NIO2 File Attribute APIs](http://www.baeldung.com/java-nio2-file-attribute) -- [How to use the Spring FactoryBean?](http://www.baeldung.com/spring-factorybean) -- [A Guide to WatchService in Java NIO2](http://www.baeldung.com/java-nio2-watchservice) -- [Guide to Java NIO2 Asynchronous Channel APIs](http://www.baeldung.com/java-nio-2-async-channels) diff --git a/out/test/test237/META-INF/persistence.xml b/out/test/test237/META-INF/persistence.xml deleted file mode 100644 index 922aedbc39..0000000000 --- a/out/test/test237/META-INF/persistence.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - org.baeldung.persistence.model.Foo - org.baeldung.persistence.model.Bar - - - - - - - - - - - - - diff --git a/out/test/test95/com/baeldung/hexToAscii/README.md b/out/test/test95/com/baeldung/hexToAscii/README.md deleted file mode 100644 index c6d5826333..0000000000 --- a/out/test/test95/com/baeldung/hexToAscii/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Convert Hex to ASCII in Java](http://www.baeldung.com/java-convert-hex-to-ascii) diff --git a/out/test/test95/com/baeldung/java/conversion/README.md b/out/test/test95/com/baeldung/java/conversion/README.md deleted file mode 100644 index 7c81180249..0000000000 --- a/out/test/test95/com/baeldung/java/conversion/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Relevant Articles: -- [Java String Conversions](http://www.baeldung.com/java-string-conversions) diff --git a/out/test/test95/org/baeldung/java/collections/README.md b/out/test/test95/org/baeldung/java/collections/README.md deleted file mode 100644 index 317d81fae7..0000000000 --- a/out/test/test95/org/baeldung/java/collections/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: -- [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) -- [Introduction to Java Servlets](http://www.baeldung.com/intro-to-servlets) diff --git a/out/test/test95/org/baeldung/java/lists/README.md b/out/test/test95/org/baeldung/java/lists/README.md deleted file mode 100644 index 2a1e8aeeaa..0000000000 --- a/out/test/test95/org/baeldung/java/lists/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality) diff --git a/out/test/test98/com/baeldung/applicationcontext/README.md b/out/test/test98/com/baeldung/applicationcontext/README.md deleted file mode 100644 index 211007e0cf..0000000000 --- a/out/test/test98/com/baeldung/applicationcontext/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: -- [Introduction to Java Servlets](http://www.baeldung.com/intro-to-servlets) -- [Intro to the Spring ClassPathXmlApplicationContext](http://www.baeldung.com/spring-classpathxmlapplicationcontext) diff --git a/out/test/test98/com/baeldung/beanfactory/README.md b/out/test/test98/com/baeldung/beanfactory/README.md deleted file mode 100644 index cff20a184b..0000000000 --- a/out/test/test98/com/baeldung/beanfactory/README.md +++ /dev/null @@ -1,2 +0,0 @@ -### Relevant Articles: -- [Guide to the Spring BeanFactory](http://www.baeldung.com/spring-beanfactory) From c309516e4b6f2f1e3fdb9db9099f7d1d706473d8 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 23 Aug 2018 00:20:00 +0530 Subject: [PATCH 268/298] BAEL-8398 Upgrade vulnerable dependencies in tutorials project -Upgraded vulnerable dependencies in spring-security-react, jhipster-monolithic and gateway-app modules -Fixed compilation in gateway-app module --- .../gateway-app/package.json | 2 +- ...t.java => UserServiceIntegrationTest.java} | 0 ....java => UserResourceIntegrationTest.java} | 0 jhipster/jhipster-monolithic/package.json | 2 +- .../WEB-INF/view/react/package-lock.json | 1148 +---------------- 5 files changed, 55 insertions(+), 1097 deletions(-) rename jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/{UserServiceIntIntegrationTest.java => UserServiceIntegrationTest.java} (100%) rename jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/{UserResourceIntIntegrationTest.java => UserResourceIntegrationTest.java} (100%) diff --git a/jhipster/jhipster-microservice/gateway-app/package.json b/jhipster/jhipster-microservice/gateway-app/package.json index ece70314ab..abdff9ffe3 100644 --- a/jhipster/jhipster-microservice/gateway-app/package.json +++ b/jhipster/jhipster-microservice/gateway-app/package.json @@ -49,7 +49,7 @@ "karma-phantomjs-launcher": "1.0.2", "karma-script-launcher": "1.0.0", "lazypipe": "1.0.1", - "lodash": "4.15.0", + "lodash": "4.17.10", "main-bower-files": "2.13.1", "map-stream": "0.0.6", "phantomjs-prebuilt": "2.1.12", diff --git a/jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/UserServiceIntIntegrationTest.java b/jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/UserServiceIntegrationTest.java similarity index 100% rename from jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/UserServiceIntIntegrationTest.java rename to jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/UserServiceIntegrationTest.java diff --git a/jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/UserResourceIntIntegrationTest.java b/jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/UserResourceIntegrationTest.java similarity index 100% rename from jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/UserResourceIntIntegrationTest.java rename to jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/UserResourceIntegrationTest.java diff --git a/jhipster/jhipster-monolithic/package.json b/jhipster/jhipster-monolithic/package.json index 40bbd28799..5f72047fb3 100644 --- a/jhipster/jhipster-monolithic/package.json +++ b/jhipster/jhipster-monolithic/package.json @@ -64,7 +64,7 @@ "karma-sourcemap-loader": "0.3.7", "karma-webpack": "2.0.2", "lazypipe": "1.0.1", - "lodash": "4.17.4", + "lodash": "4.17.10", "map-stream": "0.0.6", "phantomjs-prebuilt": "2.1.14", "protractor": "5.1.1", diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json b/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json index 89b9d1a6ed..46f3a86c20 100644 --- a/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json +++ b/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json @@ -9,15 +9,6 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=" }, - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, "acorn": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", @@ -132,11 +123,6 @@ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==" }, - "ansi-html": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", - "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=" - }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -283,11 +269,6 @@ "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=" }, - "array-flatten": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.1.tgz", - "integrity": "sha1-Qmu52oQJDBg42BLIFQryCoMx4pY=" - }, "array-includes": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", @@ -1312,11 +1293,6 @@ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" }, - "batch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", - "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=" - }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -1346,48 +1322,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - } - } - }, - "bonjour": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz", - "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", - "requires": { - "array-flatten": "^2.1.0", - "deep-equal": "^1.0.1", - "dns-equal": "^1.0.0", - "dns-txt": "^2.0.2", - "multicast-dns": "^6.0.1", - "multicast-dns-service-types": "^1.1.0" - } - }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -1576,11 +1510,6 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==" }, - "buffer-indexof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", - "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==" - }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", @@ -1596,11 +1525,6 @@ "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -2012,42 +1936,6 @@ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" }, - "compressible": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.14.tgz", - "integrity": "sha1-MmxfUH+7BV9UEWeCuWmoG2einac=", - "requires": { - "mime-db": ">= 1.34.0 < 2" - }, - "dependencies": { - "mime-db": { - "version": "1.34.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.34.0.tgz", - "integrity": "sha1-RS0Oz/XDA0am3B5kseruDTcZ/5o=" - } - } - }, - "compression": { - "version": "1.7.2", - "resolved": "http://registry.npmjs.org/compression/-/compression-1.7.2.tgz", - "integrity": "sha1-qv+81qr4VLROuygDU9WtFlH1mmk=", - "requires": { - "accepts": "~1.3.4", - "bytes": "3.0.0", - "compressible": "~2.0.13", - "debug": "2.6.9", - "on-headers": "~1.0.1", - "safe-buffer": "5.1.1", - "vary": "~1.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - } - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2077,11 +1965,6 @@ "xdg-basedir": "^3.0.0" } }, - "connect-history-api-fallback": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz", - "integrity": "sha1-sGhzk0vF40T+9hGhlqb6rgruAVo=" - }, "console-browserify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", @@ -2100,16 +1983,6 @@ "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=" }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, "content-type-parser": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", @@ -2120,16 +1993,6 @@ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=" }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -2514,11 +2377,6 @@ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, - "deep-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", - "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" - }, "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -2614,11 +2472,6 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, "des.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", @@ -2628,11 +2481,6 @@ "minimalistic-assert": "^1.0.0" } }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, "detect-indent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", @@ -2641,11 +2489,6 @@ "repeating": "^2.0.0" } }, - "detect-node": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.3.tgz", - "integrity": "sha1-ogM8CcyOFY03dI+951B4Mr1s4Sc=" - }, "detect-port-alt": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/detect-port-alt/-/detect-port-alt-1.1.6.tgz", @@ -2670,28 +2513,6 @@ "randombytes": "^2.0.0" } }, - "dns-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", - "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=" - }, - "dns-packet": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz", - "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", - "requires": { - "ip": "^1.1.0", - "safe-buffer": "^5.0.1" - } - }, - "dns-txt": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz", - "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", - "requires": { - "buffer-indexof": "^1.0.0" - } - }, "doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", @@ -2803,11 +2624,6 @@ "jsbn": "~0.1.0" } }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, "electron-to-chromium": { "version": "1.3.50", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.50.tgz", @@ -2837,11 +2653,6 @@ "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=" }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, "encoding": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", @@ -2974,11 +2785,6 @@ "es6-symbol": "^3.1.1" } }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -3332,11 +3138,6 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, "event-emitter": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", @@ -3346,24 +3147,11 @@ "es5-ext": "~0.10.14" } }, - "eventemitter3": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", - "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" - }, "events": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" }, - "eventsource": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-0.1.6.tgz", - "integrity": "sha1-Cs7ehJ7X3RzMMsgRuxG5RNTykjI=", - "requires": { - "original": ">=0.0.5" - } - }, "evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", @@ -3481,65 +3269,6 @@ "homedir-polyfill": "^1.0.1" } }, - "express": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - } - } - }, "extend": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", @@ -3669,14 +3398,6 @@ "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz", "integrity": "sha1-0eJkOzipTXWDtHkGDmxK/8lAcfg=" }, - "faye-websocket": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.1.tgz", - "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", - "requires": { - "websocket-driver": ">=0.5.1" - } - }, "fb-watchman": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", @@ -3765,20 +3486,6 @@ } } }, - "finalhandler": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - } - }, "find-cache-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", @@ -3813,24 +3520,6 @@ "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=" }, - "follow-redirects": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.0.tgz", - "integrity": "sha512-fdrt472/9qQ6Kgjvb935ig6vJCuofpBUD14f9Vb+SLlm7xIe4Qva5gey8EKtv8lp7ahE1wilg3xL1znpVGtZIA==", - "requires": { - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - } - } - }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -3864,11 +3553,6 @@ "mime-types": "^2.1.12" } }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -3877,11 +3561,6 @@ "map-cache": "^0.2.2" } }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, "fs-extra": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", @@ -3914,7 +3593,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3932,11 +3612,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3949,15 +3631,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4060,7 +3745,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4070,6 +3756,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4082,17 +3769,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4109,6 +3799,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4181,7 +3872,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4191,6 +3883,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4266,7 +3959,8 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4296,6 +3990,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4313,6 +4008,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4351,11 +4047,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.2", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -4511,11 +4209,6 @@ "duplexer": "^0.1.1" } }, - "handle-thing": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", - "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=" - }, "handlebars": { "version": "4.0.11", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", @@ -4692,17 +4385,6 @@ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.1.tgz", "integrity": "sha512-Ba4+0M4YvIDUUsprMjhVTU1yN9F2/LJSAl69ZpzaLT4l4j5mwTS6jqqW9Ojvj6lKz/veqPzpJBqGbXspOb533A==" }, - "hpack.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", - "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", - "requires": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - } - }, "html-comment-regex": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.1.tgz", @@ -4716,11 +4398,6 @@ "whatwg-encoding": "^1.0.1" } }, - "html-entities": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz", - "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=" - }, "html-minifier": { "version": "3.5.17", "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.17.tgz", @@ -4810,152 +4487,6 @@ } } }, - "http-deceiver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", - "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=" - }, - "http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "http-parser-js": { - "version": "0.4.13", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.13.tgz", - "integrity": "sha1-O9bW/ebjFyyTNMOzO2wZPYD+ETc=" - }, - "http-proxy": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", - "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", - "requires": { - "eventemitter3": "^3.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - } - }, - "http-proxy-middleware": { - "version": "0.17.4", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.17.4.tgz", - "integrity": "sha1-ZC6ISIUdZvCdTxJJEoRtuutBuDM=", - "requires": { - "http-proxy": "^1.16.2", - "is-glob": "^3.1.0", - "lodash": "^4.17.2", - "micromatch": "^2.3.11" - }, - "dependencies": { - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "requires": { - "is-extglob": "^1.0.0" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" - } - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "requires": { - "is-extglob": "^2.1.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "^1.1.5" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "requires": { - "is-extglob": "^1.0.0" - } - } - } - } - } - }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -5007,15 +4538,6 @@ "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=" }, - "import-local": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-0.1.1.tgz", - "integrity": "sha1-sReVcqrNwRxqkQCftDDbyrX2aKg=", - "requires": { - "pkg-dir": "^2.0.0", - "resolve-cwd": "^2.0.0" - } - }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -5104,14 +4626,6 @@ } } }, - "internal-ip": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-1.2.0.tgz", - "integrity": "sha1-rp+/k7mEh4eF1QqN4bNWlWBYz1w=", - "requires": { - "meow": "^3.3.0" - } - }, "interpret": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", @@ -5130,16 +4644,6 @@ "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, - "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" - }, - "ipaddr.js": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", - "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" - }, "is-absolute-url": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", @@ -6237,11 +5741,6 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=" - }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", @@ -6276,11 +5775,6 @@ "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=" }, - "killable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.0.tgz", - "integrity": "sha1-2ouEvUfeU5WHj5XWTQLyRJ/gXms=" - }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", @@ -6468,11 +5962,6 @@ "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" }, - "loglevel": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", - "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=" - }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -6574,11 +6063,6 @@ "inherits": "^2.0.1" } }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, "mem": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", @@ -6625,16 +6109,6 @@ "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz", "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=" }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -6742,20 +6216,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, - "multicast-dns": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz", - "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", - "requires": { - "dns-packet": "^1.3.1", - "thunky": "^1.0.2" - } - }, - "multicast-dns-service-types": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", - "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=" - }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -6790,11 +6250,6 @@ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, "neo-async": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.1.tgz", @@ -6822,11 +6277,6 @@ "is-stream": "^1.0.1" } }, - "node-forge": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz", - "integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ==" - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -7019,24 +6469,6 @@ "isobject": "^3.0.1" } }, - "obuf": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "on-headers": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", - "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=" - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -7090,14 +6522,6 @@ "wordwrap": "~1.0.0" } }, - "original": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/original/-/original-1.0.1.tgz", - "integrity": "sha512-IEvtB5vM5ULvwnqMxWBLxkS13JIEXbakizMSo3yoPNPCIWzg8TG3Usn/UhXoZFM/m+FuEA20KdzPSFq/0rS+UA==", - "requires": { - "url-parse": "~1.4.0" - } - }, "os-browserify": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", @@ -7217,11 +6641,6 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=" }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", @@ -7335,23 +6754,6 @@ "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==" }, - "portfinder": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.13.tgz", - "integrity": "sha1-uzLs2HwnEErm7kS1o8y/Drsa7ek=", - "requires": { - "async": "^1.5.2", - "debug": "^2.2.0", - "mkdirp": "0.5.x" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" - } - } - }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -8576,15 +7978,6 @@ "object-assign": "^4.1.1" } }, - "proxy-addr": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", - "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.6.0" - } - }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -8646,11 +8039,6 @@ "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" }, - "querystringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.0.0.tgz", - "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==" - }, "raf": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.0.tgz", @@ -8693,50 +8081,6 @@ "safe-buffer": "^5.1.0" } }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" - } - } - }, "rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -8786,9 +8130,19 @@ "react-error-overlay": "^4.0.0", "recursive-readdir": "2.2.1", "shell-quote": "1.6.1", - "sockjs-client": "1.1.4", "strip-ansi": "3.0.1", "text-table": "0.2.0" + }, + "dependencies": { + "sockjs-client": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.1.5.tgz", + "integrity": "sha1-G7fA9yIsQPQq3xT0RCy9Eml3GoM=", + "requires": { + "debug": "^2.6.6", + "inherits": "^2.0.1" + } + } } }, "react-dom": { @@ -8848,7 +8202,6 @@ "sw-precache-webpack-plugin": "0.11.4", "url-loader": "0.6.2", "webpack": "3.8.1", - "webpack-dev-server": "2.9.4", "webpack-manifest-plugin": "1.3.2", "whatwg-fetch": "2.0.3" }, @@ -8880,6 +8233,18 @@ "asap": "~2.0.3" } }, + "webpack-dev-server": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.1.5.tgz", + "integrity": "sha512-LVHg+EPwZLHIlfvokSTgtJqO/vI5CQi89fASb5JEDtVMDjY0yuIEqPPdMiKaBJIB/Ab7v/UN/sYZ7WsZvntQKw==", + "requires": { + "array-includes": "^3.0.3", + "chokidar": "^2.0.0", + "opn": "^5.1.0", + "strip-ansi": "^3.0.0", + "supports-color": "^5.1.0" + } + }, "whatwg-fetch": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", @@ -9206,11 +8571,6 @@ "resolve-from": "^1.0.0" } }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" - }, "resolve": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.6.0.tgz", @@ -9219,21 +8579,6 @@ "path-parse": "^1.0.5" } }, - "resolve-cwd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", - "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", - "requires": { - "resolve-from": "^3.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" - } - } - }, "resolve-dir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", @@ -9381,19 +8726,6 @@ "ajv": "^5.0.0" } }, - "select-hose": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", - "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=" - }, - "selfsigned": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.3.tgz", - "integrity": "sha512-vmZenZ+8Al3NLHkWnhBQ0x6BkML1eCP2xEi3JE+f3D9wW9fipD9NNJHYtE9XJM4TsPaHGZJIamrSI6MTg1dU2Q==", - "requires": { - "node-forge": "0.7.5" - } - }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", @@ -9407,58 +8739,6 @@ "semver": "^5.0.3" } }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "dependencies": { - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - } - } - }, - "serve-index": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", - "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", - "requires": { - "accepts": "~1.3.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - } - }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, "serviceworker-cache-polyfill": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/serviceworker-cache-polyfill/-/serviceworker-cache-polyfill-4.0.0.tgz", @@ -9500,11 +8780,6 @@ "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -9663,43 +8938,6 @@ } } }, - "sockjs": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.18.tgz", - "integrity": "sha1-2bKJMWyn33dZXvKZ4HXw+TfrQgc=", - "requires": { - "faye-websocket": "^0.10.0", - "uuid": "^2.0.2" - }, - "dependencies": { - "faye-websocket": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", - "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", - "requires": { - "websocket-driver": ">=0.5.1" - } - }, - "uuid": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", - "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=" - } - } - }, - "sockjs-client": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.1.4.tgz", - "integrity": "sha1-W6vjhrd15M8U51IJEUUmVAFsixI=", - "requires": { - "debug": "^2.6.6", - "eventsource": "0.1.6", - "faye-websocket": "~0.11.0", - "inherits": "^2.0.1", - "json3": "^3.3.2", - "url-parse": "^1.1.8" - } - }, "sort-keys": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", @@ -9778,33 +9016,6 @@ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==" }, - "spdy": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/spdy/-/spdy-3.4.7.tgz", - "integrity": "sha1-Qv9B7OXMD5mjpsKKq7c/XDsDrLw=", - "requires": { - "debug": "^2.6.8", - "handle-thing": "^1.2.5", - "http-deceiver": "^1.2.7", - "safe-buffer": "^5.0.1", - "select-hose": "^2.0.0", - "spdy-transport": "^2.0.18" - } - }, - "spdy-transport": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-2.1.0.tgz", - "integrity": "sha512-bpUeGpZcmZ692rrTiqf9/2EUakI6/kXX1Rpe0ib/DyOzbiexVfXkw6GnvI9hVGvIwVaUhkaBojjCZwLNRGQg1g==", - "requires": { - "debug": "^2.6.8", - "detect-node": "^2.0.3", - "hpack.js": "^2.1.6", - "obuf": "^1.1.1", - "readable-stream": "^2.2.9", - "safe-buffer": "^5.0.1", - "wbuf": "^1.7.2" - } - }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -9853,11 +9064,6 @@ } } }, - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - }, "stream-browserify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", @@ -10116,16 +9322,6 @@ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, - "thunky": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.0.2.tgz", - "integrity": "sha1-qGLgGOP7HqLsP85dVWBc9X8kc3E=" - }, - "time-stamp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-2.0.0.tgz", - "integrity": "sha1-lcakRTDhW6jW9KPsuMOj+sRto1c=" - }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", @@ -10263,15 +9459,6 @@ "prelude-ls": "~1.1.2" } }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -10397,11 +9584,6 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -10526,15 +9708,6 @@ "schema-utils": "^0.3.0" } }, - "url-parse": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.1.tgz", - "integrity": "sha512-x95Td74QcvICAA0+qERaVkRpTGKyBHHYdwL2LXZm5t/gBtCB9KQSO/0zQgSTYEV1p0WcvSg79TLNPSvd5IDJMQ==", - "requires": { - "querystringify": "^2.0.0", - "requires-port": "^1.0.0" - } - }, "url-parse-lax": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", @@ -10569,11 +9742,6 @@ "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", "integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw=" }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", @@ -10588,11 +9756,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, "vendors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.2.tgz", @@ -10639,14 +9802,6 @@ "neo-async": "^2.5.0" } }, - "wbuf": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", - "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", - "requires": { - "minimalistic-assert": "^1.0.0" - } - }, "webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", @@ -10827,189 +9982,6 @@ } } }, - "webpack-dev-middleware": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.12.2.tgz", - "integrity": "sha512-FCrqPy1yy/sN6U/SaEZcHKRXGlqU0DUaEBL45jkUYoB8foVb6wCnbIJ1HKIx+qUFTW+3JpVcCJCxZ8VATL4e+A==", - "requires": { - "memory-fs": "~0.4.1", - "mime": "^1.5.0", - "path-is-absolute": "^1.0.0", - "range-parser": "^1.0.3", - "time-stamp": "^2.0.0" - } - }, - "webpack-dev-server": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.9.4.tgz", - "integrity": "sha512-thrqC0EQEoSjXeYgP6pUXcUCZ+LNrKsDPn+mItLnn5VyyNZOJKd06hUP5vqkYwL8nWWXsii0loSF9NHNccT6ow==", - "requires": { - "ansi-html": "0.0.7", - "array-includes": "^3.0.3", - "bonjour": "^3.5.0", - "chokidar": "^1.6.0", - "compression": "^1.5.2", - "connect-history-api-fallback": "^1.3.0", - "debug": "^3.1.0", - "del": "^3.0.0", - "express": "^4.13.3", - "html-entities": "^1.2.0", - "http-proxy-middleware": "~0.17.4", - "import-local": "^0.1.1", - "internal-ip": "1.2.0", - "ip": "^1.1.5", - "killable": "^1.0.0", - "loglevel": "^1.4.1", - "opn": "^5.1.0", - "portfinder": "^1.0.9", - "selfsigned": "^1.9.1", - "serve-index": "^1.7.2", - "sockjs": "0.3.18", - "sockjs-client": "1.1.4", - "spdy": "^3.4.1", - "strip-ansi": "^3.0.1", - "supports-color": "^4.2.1", - "webpack-dev-middleware": "^1.11.0", - "yargs": "^6.6.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" - }, - "chokidar": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", - "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", - "requires": { - "anymatch": "^1.3.0", - "async-each": "^1.0.0", - "fsevents": "^1.0.0", - "glob-parent": "^2.0.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^2.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0" - } - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "del": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", - "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", - "requires": { - "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" - } - }, - "globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - } - } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "requires": { - "has-flag": "^2.0.0" - } - }, - "yargs": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz", - "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", - "requires": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^4.2.0" - } - }, - "yargs-parser": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz", - "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", - "requires": { - "camelcase": "^3.0.0" - } - } - } - }, "webpack-manifest-plugin": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/webpack-manifest-plugin/-/webpack-manifest-plugin-1.3.2.tgz", @@ -11050,20 +10022,6 @@ "source-map": "~0.6.1" } }, - "websocket-driver": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", - "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", - "requires": { - "http-parser-js": ">=0.4.0", - "websocket-extensions": ">=0.1.1" - } - }, - "websocket-extensions": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz", - "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==" - }, "whatwg-encoding": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", From cf6e74e631ba674384a6d121256c7f7c24041fb9 Mon Sep 17 00:00:00 2001 From: cdjole Date: Wed, 22 Aug 2018 21:46:47 +0200 Subject: [PATCH 269/298] Single regex example added (#5036) --- .../StringContainingCharactersUnitTest.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java index 75548f4d73..3303ebffbe 100644 --- a/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java @@ -11,6 +11,8 @@ public class StringContainingCharactersUnitTest { private static final Pattern[] inputRegexes = new Pattern[4]; + private static final String regex = "^(?=.*?\\p{Lu})(?=.*?[\\p{L}&&[^\\p{Lu}]])(?=.*?\\d)" + "(?=.*?[`~!@#$%^&*()\\-_=+\\\\\\|\\[{\\]};:'\",<.>/?]).*$"; + static { inputRegexes[0] = Pattern.compile(".*[A-Z].*"); inputRegexes[1] = Pattern.compile(".*[a-z].*"); @@ -95,4 +97,25 @@ public class StringContainingCharactersUnitTest { invalidInput = "b3;"; assertFalse(checkString(invalidInput)); } + + @Test + public void givenSingleRegex_whenMatchingCorrectString_thenMatches() { + String validInput = "Ab3;"; + assertTrue(Pattern.compile(regex).matcher(validInput).matches()); + } + + @Test + public void givenSingleRegex_whenMatchingWrongStrings_thenNotMatching() { + String invalidInput = "Ab3"; + assertFalse(Pattern.compile(regex).matcher(invalidInput).matches()); + + invalidInput = "Ab;"; + assertFalse(Pattern.compile(regex).matcher(invalidInput).matches()); + + invalidInput = "A3;"; + assertFalse(Pattern.compile(regex).matcher(invalidInput).matches()); + + invalidInput = "b3;"; + assertFalse(Pattern.compile(regex).matcher(invalidInput).matches()); + } } From 4a58fc96e63fd8618f3be13acbbad844b07b7b23 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 23 Aug 2018 01:17:08 +0530 Subject: [PATCH 270/298] BAEL-8398 Upgrade vulnerable dependencies in tutorials project (#5035) -Upgraded vulnerable dependencies in spring-security-react, jhipster-monolithic and gateway-app modules -Fixed compilation in gateway-app module --- .../gateway-app/package.json | 2 +- ...t.java => UserServiceIntegrationTest.java} | 0 ....java => UserResourceIntegrationTest.java} | 0 jhipster/jhipster-monolithic/package.json | 2 +- .../WEB-INF/view/react/package-lock.json | 1148 +---------------- 5 files changed, 55 insertions(+), 1097 deletions(-) rename jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/{UserServiceIntIntegrationTest.java => UserServiceIntegrationTest.java} (100%) rename jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/{UserResourceIntIntegrationTest.java => UserResourceIntegrationTest.java} (100%) diff --git a/jhipster/jhipster-microservice/gateway-app/package.json b/jhipster/jhipster-microservice/gateway-app/package.json index ece70314ab..abdff9ffe3 100644 --- a/jhipster/jhipster-microservice/gateway-app/package.json +++ b/jhipster/jhipster-microservice/gateway-app/package.json @@ -49,7 +49,7 @@ "karma-phantomjs-launcher": "1.0.2", "karma-script-launcher": "1.0.0", "lazypipe": "1.0.1", - "lodash": "4.15.0", + "lodash": "4.17.10", "main-bower-files": "2.13.1", "map-stream": "0.0.6", "phantomjs-prebuilt": "2.1.12", diff --git a/jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/UserServiceIntIntegrationTest.java b/jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/UserServiceIntegrationTest.java similarity index 100% rename from jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/UserServiceIntIntegrationTest.java rename to jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/service/UserServiceIntegrationTest.java diff --git a/jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/UserResourceIntIntegrationTest.java b/jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/UserResourceIntegrationTest.java similarity index 100% rename from jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/UserResourceIntIntegrationTest.java rename to jhipster/jhipster-microservice/gateway-app/src/test/java/com/gateway/web/rest/UserResourceIntegrationTest.java diff --git a/jhipster/jhipster-monolithic/package.json b/jhipster/jhipster-monolithic/package.json index 40bbd28799..5f72047fb3 100644 --- a/jhipster/jhipster-monolithic/package.json +++ b/jhipster/jhipster-monolithic/package.json @@ -64,7 +64,7 @@ "karma-sourcemap-loader": "0.3.7", "karma-webpack": "2.0.2", "lazypipe": "1.0.1", - "lodash": "4.17.4", + "lodash": "4.17.10", "map-stream": "0.0.6", "phantomjs-prebuilt": "2.1.14", "protractor": "5.1.1", diff --git a/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json b/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json index 89b9d1a6ed..46f3a86c20 100644 --- a/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json +++ b/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json @@ -9,15 +9,6 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=" }, - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, "acorn": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", @@ -132,11 +123,6 @@ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==" }, - "ansi-html": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", - "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=" - }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -283,11 +269,6 @@ "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=" }, - "array-flatten": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.1.tgz", - "integrity": "sha1-Qmu52oQJDBg42BLIFQryCoMx4pY=" - }, "array-includes": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", @@ -1312,11 +1293,6 @@ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==" }, - "batch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", - "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=" - }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -1346,48 +1322,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, - "body-parser": { - "version": "1.18.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.1", - "http-errors": "~1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "~2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "~1.6.15" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - } - } - }, - "bonjour": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz", - "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", - "requires": { - "array-flatten": "^2.1.0", - "deep-equal": "^1.0.1", - "dns-equal": "^1.0.0", - "dns-txt": "^2.0.2", - "multicast-dns": "^6.0.1", - "multicast-dns-service-types": "^1.1.0" - } - }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -1576,11 +1510,6 @@ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==" }, - "buffer-indexof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", - "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==" - }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", @@ -1596,11 +1525,6 @@ "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -2012,42 +1936,6 @@ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=" }, - "compressible": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.14.tgz", - "integrity": "sha1-MmxfUH+7BV9UEWeCuWmoG2einac=", - "requires": { - "mime-db": ">= 1.34.0 < 2" - }, - "dependencies": { - "mime-db": { - "version": "1.34.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.34.0.tgz", - "integrity": "sha1-RS0Oz/XDA0am3B5kseruDTcZ/5o=" - } - } - }, - "compression": { - "version": "1.7.2", - "resolved": "http://registry.npmjs.org/compression/-/compression-1.7.2.tgz", - "integrity": "sha1-qv+81qr4VLROuygDU9WtFlH1mmk=", - "requires": { - "accepts": "~1.3.4", - "bytes": "3.0.0", - "compressible": "~2.0.13", - "debug": "2.6.9", - "on-headers": "~1.0.1", - "safe-buffer": "5.1.1", - "vary": "~1.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - } - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2077,11 +1965,6 @@ "xdg-basedir": "^3.0.0" } }, - "connect-history-api-fallback": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz", - "integrity": "sha1-sGhzk0vF40T+9hGhlqb6rgruAVo=" - }, "console-browserify": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", @@ -2100,16 +1983,6 @@ "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=" }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, "content-type-parser": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", @@ -2120,16 +1993,6 @@ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=" }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -2514,11 +2377,6 @@ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, - "deep-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", - "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=" - }, "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -2614,11 +2472,6 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, "des.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", @@ -2628,11 +2481,6 @@ "minimalistic-assert": "^1.0.0" } }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, "detect-indent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", @@ -2641,11 +2489,6 @@ "repeating": "^2.0.0" } }, - "detect-node": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.3.tgz", - "integrity": "sha1-ogM8CcyOFY03dI+951B4Mr1s4Sc=" - }, "detect-port-alt": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/detect-port-alt/-/detect-port-alt-1.1.6.tgz", @@ -2670,28 +2513,6 @@ "randombytes": "^2.0.0" } }, - "dns-equal": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", - "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=" - }, - "dns-packet": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz", - "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", - "requires": { - "ip": "^1.1.0", - "safe-buffer": "^5.0.1" - } - }, - "dns-txt": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz", - "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", - "requires": { - "buffer-indexof": "^1.0.0" - } - }, "doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", @@ -2803,11 +2624,6 @@ "jsbn": "~0.1.0" } }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, "electron-to-chromium": { "version": "1.3.50", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.50.tgz", @@ -2837,11 +2653,6 @@ "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=" }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, "encoding": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", @@ -2974,11 +2785,6 @@ "es6-symbol": "^3.1.1" } }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -3332,11 +3138,6 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, "event-emitter": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", @@ -3346,24 +3147,11 @@ "es5-ext": "~0.10.14" } }, - "eventemitter3": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", - "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" - }, "events": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" }, - "eventsource": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-0.1.6.tgz", - "integrity": "sha1-Cs7ehJ7X3RzMMsgRuxG5RNTykjI=", - "requires": { - "original": ">=0.0.5" - } - }, "evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", @@ -3481,65 +3269,6 @@ "homedir-polyfill": "^1.0.1" } }, - "express": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz", - "integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=", - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.3", - "qs": "6.5.1", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "qs": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", - "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" - }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" - } - } - }, "extend": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", @@ -3669,14 +3398,6 @@ "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz", "integrity": "sha1-0eJkOzipTXWDtHkGDmxK/8lAcfg=" }, - "faye-websocket": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.1.tgz", - "integrity": "sha1-8O/hjE9W5PQK/H4Gxxn9XuYYjzg=", - "requires": { - "websocket-driver": ">=0.5.1" - } - }, "fb-watchman": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.0.tgz", @@ -3765,20 +3486,6 @@ } } }, - "finalhandler": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - } - }, "find-cache-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", @@ -3813,24 +3520,6 @@ "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=" }, - "follow-redirects": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.0.tgz", - "integrity": "sha512-fdrt472/9qQ6Kgjvb935ig6vJCuofpBUD14f9Vb+SLlm7xIe4Qva5gey8EKtv8lp7ahE1wilg3xL1znpVGtZIA==", - "requires": { - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - } - } - }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -3864,11 +3553,6 @@ "mime-types": "^2.1.12" } }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -3877,11 +3561,6 @@ "map-cache": "^0.2.2" } }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, "fs-extra": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz", @@ -3914,7 +3593,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3932,11 +3612,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3949,15 +3631,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -4060,7 +3745,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -4070,6 +3756,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4082,17 +3769,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4109,6 +3799,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -4181,7 +3872,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -4191,6 +3883,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -4266,7 +3959,8 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4296,6 +3990,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4313,6 +4008,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4351,11 +4047,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.2", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -4511,11 +4209,6 @@ "duplexer": "^0.1.1" } }, - "handle-thing": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", - "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=" - }, "handlebars": { "version": "4.0.11", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", @@ -4692,17 +4385,6 @@ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.1.tgz", "integrity": "sha512-Ba4+0M4YvIDUUsprMjhVTU1yN9F2/LJSAl69ZpzaLT4l4j5mwTS6jqqW9Ojvj6lKz/veqPzpJBqGbXspOb533A==" }, - "hpack.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", - "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", - "requires": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - } - }, "html-comment-regex": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.1.tgz", @@ -4716,11 +4398,6 @@ "whatwg-encoding": "^1.0.1" } }, - "html-entities": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz", - "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=" - }, "html-minifier": { "version": "3.5.17", "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.17.tgz", @@ -4810,152 +4487,6 @@ } } }, - "http-deceiver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", - "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=" - }, - "http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "http-parser-js": { - "version": "0.4.13", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.13.tgz", - "integrity": "sha1-O9bW/ebjFyyTNMOzO2wZPYD+ETc=" - }, - "http-proxy": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", - "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", - "requires": { - "eventemitter3": "^3.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - } - }, - "http-proxy-middleware": { - "version": "0.17.4", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.17.4.tgz", - "integrity": "sha1-ZC6ISIUdZvCdTxJJEoRtuutBuDM=", - "requires": { - "http-proxy": "^1.16.2", - "is-glob": "^3.1.0", - "lodash": "^4.17.2", - "micromatch": "^2.3.11" - }, - "dependencies": { - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "requires": { - "arr-flatten": "^1.0.1" - } - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "requires": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" - } - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "requires": { - "is-posix-bracket": "^0.1.0" - } - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "requires": { - "is-extglob": "^1.0.0" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" - } - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "requires": { - "is-extglob": "^2.1.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "requires": { - "is-buffer": "^1.1.5" - } - }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "requires": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - }, - "dependencies": { - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "requires": { - "is-extglob": "^1.0.0" - } - } - } - } - } - }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -5007,15 +4538,6 @@ "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=" }, - "import-local": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-0.1.1.tgz", - "integrity": "sha1-sReVcqrNwRxqkQCftDDbyrX2aKg=", - "requires": { - "pkg-dir": "^2.0.0", - "resolve-cwd": "^2.0.0" - } - }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -5104,14 +4626,6 @@ } } }, - "internal-ip": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-1.2.0.tgz", - "integrity": "sha1-rp+/k7mEh4eF1QqN4bNWlWBYz1w=", - "requires": { - "meow": "^3.3.0" - } - }, "interpret": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", @@ -5130,16 +4644,6 @@ "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, - "ip": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" - }, - "ipaddr.js": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", - "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=" - }, "is-absolute-url": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", @@ -6237,11 +5741,6 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=" - }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", @@ -6276,11 +5775,6 @@ "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=" }, - "killable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.0.tgz", - "integrity": "sha1-2ouEvUfeU5WHj5XWTQLyRJ/gXms=" - }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", @@ -6468,11 +5962,6 @@ "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" }, - "loglevel": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.1.tgz", - "integrity": "sha1-4PyVEztu8nbNyIh82vJKpvFW+Po=" - }, "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", @@ -6574,11 +6063,6 @@ "inherits": "^2.0.1" } }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, "mem": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", @@ -6625,16 +6109,6 @@ "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz", "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=" }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -6742,20 +6216,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, - "multicast-dns": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz", - "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", - "requires": { - "dns-packet": "^1.3.1", - "thunky": "^1.0.2" - } - }, - "multicast-dns-service-types": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", - "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=" - }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -6790,11 +6250,6 @@ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=" }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, "neo-async": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.1.tgz", @@ -6822,11 +6277,6 @@ "is-stream": "^1.0.1" } }, - "node-forge": { - "version": "0.7.5", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.5.tgz", - "integrity": "sha512-MmbQJ2MTESTjt3Gi/3yG1wGpIMhUfcIypUCGtTizFR9IiccFwxSpfp0vtIZlkFclEqERemxfnSdZEMR9VqqEFQ==" - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -7019,24 +6469,6 @@ "isobject": "^3.0.1" } }, - "obuf": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "on-headers": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.1.tgz", - "integrity": "sha1-ko9dD0cNSTQmUepnlLCFfBAGk/c=" - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -7090,14 +6522,6 @@ "wordwrap": "~1.0.0" } }, - "original": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/original/-/original-1.0.1.tgz", - "integrity": "sha512-IEvtB5vM5ULvwnqMxWBLxkS13JIEXbakizMSo3yoPNPCIWzg8TG3Usn/UhXoZFM/m+FuEA20KdzPSFq/0rS+UA==", - "requires": { - "url-parse": "~1.4.0" - } - }, "os-browserify": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", @@ -7217,11 +6641,6 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-1.5.1.tgz", "integrity": "sha1-m387DeMr543CQBsXVzzK8Pb1nZQ=" }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", @@ -7335,23 +6754,6 @@ "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==" }, - "portfinder": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.13.tgz", - "integrity": "sha1-uzLs2HwnEErm7kS1o8y/Drsa7ek=", - "requires": { - "async": "^1.5.2", - "debug": "^2.2.0", - "mkdirp": "0.5.x" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" - } - } - }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -8576,15 +7978,6 @@ "object-assign": "^4.1.1" } }, - "proxy-addr": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", - "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.6.0" - } - }, "prr": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", @@ -8646,11 +8039,6 @@ "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=" }, - "querystringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.0.0.tgz", - "integrity": "sha512-eTPo5t/4bgaMNZxyjWx6N2a6AuE0mq51KWvpc7nU/MAqixcI6v6KrGUKES0HaomdnolQBBXU/++X6/QQ9KL4tw==" - }, "raf": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.0.tgz", @@ -8693,50 +8081,6 @@ "safe-buffer": "^5.1.0" } }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - }, - "dependencies": { - "depd": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", - "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" - }, - "http-errors": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": ">= 1.3.1 < 2" - } - }, - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" - }, - "setprototypeof": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", - "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" - } - } - }, "rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -8786,9 +8130,19 @@ "react-error-overlay": "^4.0.0", "recursive-readdir": "2.2.1", "shell-quote": "1.6.1", - "sockjs-client": "1.1.4", "strip-ansi": "3.0.1", "text-table": "0.2.0" + }, + "dependencies": { + "sockjs-client": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.1.5.tgz", + "integrity": "sha1-G7fA9yIsQPQq3xT0RCy9Eml3GoM=", + "requires": { + "debug": "^2.6.6", + "inherits": "^2.0.1" + } + } } }, "react-dom": { @@ -8848,7 +8202,6 @@ "sw-precache-webpack-plugin": "0.11.4", "url-loader": "0.6.2", "webpack": "3.8.1", - "webpack-dev-server": "2.9.4", "webpack-manifest-plugin": "1.3.2", "whatwg-fetch": "2.0.3" }, @@ -8880,6 +8233,18 @@ "asap": "~2.0.3" } }, + "webpack-dev-server": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.1.5.tgz", + "integrity": "sha512-LVHg+EPwZLHIlfvokSTgtJqO/vI5CQi89fASb5JEDtVMDjY0yuIEqPPdMiKaBJIB/Ab7v/UN/sYZ7WsZvntQKw==", + "requires": { + "array-includes": "^3.0.3", + "chokidar": "^2.0.0", + "opn": "^5.1.0", + "strip-ansi": "^3.0.0", + "supports-color": "^5.1.0" + } + }, "whatwg-fetch": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", @@ -9206,11 +8571,6 @@ "resolve-from": "^1.0.0" } }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" - }, "resolve": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.6.0.tgz", @@ -9219,21 +8579,6 @@ "path-parse": "^1.0.5" } }, - "resolve-cwd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", - "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", - "requires": { - "resolve-from": "^3.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=" - } - } - }, "resolve-dir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", @@ -9381,19 +8726,6 @@ "ajv": "^5.0.0" } }, - "select-hose": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", - "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=" - }, - "selfsigned": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.3.tgz", - "integrity": "sha512-vmZenZ+8Al3NLHkWnhBQ0x6BkML1eCP2xEi3JE+f3D9wW9fipD9NNJHYtE9XJM4TsPaHGZJIamrSI6MTg1dU2Q==", - "requires": { - "node-forge": "0.7.5" - } - }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", @@ -9407,58 +8739,6 @@ "semver": "^5.0.3" } }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "dependencies": { - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - } - } - }, - "serve-index": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", - "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", - "requires": { - "accepts": "~1.3.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - } - }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, "serviceworker-cache-polyfill": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/serviceworker-cache-polyfill/-/serviceworker-cache-polyfill-4.0.0.tgz", @@ -9500,11 +8780,6 @@ "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -9663,43 +8938,6 @@ } } }, - "sockjs": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.18.tgz", - "integrity": "sha1-2bKJMWyn33dZXvKZ4HXw+TfrQgc=", - "requires": { - "faye-websocket": "^0.10.0", - "uuid": "^2.0.2" - }, - "dependencies": { - "faye-websocket": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", - "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", - "requires": { - "websocket-driver": ">=0.5.1" - } - }, - "uuid": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", - "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=" - } - } - }, - "sockjs-client": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.1.4.tgz", - "integrity": "sha1-W6vjhrd15M8U51IJEUUmVAFsixI=", - "requires": { - "debug": "^2.6.6", - "eventsource": "0.1.6", - "faye-websocket": "~0.11.0", - "inherits": "^2.0.1", - "json3": "^3.3.2", - "url-parse": "^1.1.8" - } - }, "sort-keys": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", @@ -9778,33 +9016,6 @@ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==" }, - "spdy": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/spdy/-/spdy-3.4.7.tgz", - "integrity": "sha1-Qv9B7OXMD5mjpsKKq7c/XDsDrLw=", - "requires": { - "debug": "^2.6.8", - "handle-thing": "^1.2.5", - "http-deceiver": "^1.2.7", - "safe-buffer": "^5.0.1", - "select-hose": "^2.0.0", - "spdy-transport": "^2.0.18" - } - }, - "spdy-transport": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-2.1.0.tgz", - "integrity": "sha512-bpUeGpZcmZ692rrTiqf9/2EUakI6/kXX1Rpe0ib/DyOzbiexVfXkw6GnvI9hVGvIwVaUhkaBojjCZwLNRGQg1g==", - "requires": { - "debug": "^2.6.8", - "detect-node": "^2.0.3", - "hpack.js": "^2.1.6", - "obuf": "^1.1.1", - "readable-stream": "^2.2.9", - "safe-buffer": "^5.0.1", - "wbuf": "^1.7.2" - } - }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -9853,11 +9064,6 @@ } } }, - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - }, "stream-browserify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", @@ -10116,16 +9322,6 @@ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, - "thunky": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.0.2.tgz", - "integrity": "sha1-qGLgGOP7HqLsP85dVWBc9X8kc3E=" - }, - "time-stamp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-2.0.0.tgz", - "integrity": "sha1-lcakRTDhW6jW9KPsuMOj+sRto1c=" - }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", @@ -10263,15 +9459,6 @@ "prelude-ls": "~1.1.2" } }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -10397,11 +9584,6 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -10526,15 +9708,6 @@ "schema-utils": "^0.3.0" } }, - "url-parse": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.1.tgz", - "integrity": "sha512-x95Td74QcvICAA0+qERaVkRpTGKyBHHYdwL2LXZm5t/gBtCB9KQSO/0zQgSTYEV1p0WcvSg79TLNPSvd5IDJMQ==", - "requires": { - "querystringify": "^2.0.0", - "requires-port": "^1.0.0" - } - }, "url-parse-lax": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", @@ -10569,11 +9742,6 @@ "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", "integrity": "sha1-ihagXURWV6Oupe7MWxKk+lN5dyw=" }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", @@ -10588,11 +9756,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, "vendors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.2.tgz", @@ -10639,14 +9802,6 @@ "neo-async": "^2.5.0" } }, - "wbuf": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", - "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", - "requires": { - "minimalistic-assert": "^1.0.0" - } - }, "webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", @@ -10827,189 +9982,6 @@ } } }, - "webpack-dev-middleware": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-1.12.2.tgz", - "integrity": "sha512-FCrqPy1yy/sN6U/SaEZcHKRXGlqU0DUaEBL45jkUYoB8foVb6wCnbIJ1HKIx+qUFTW+3JpVcCJCxZ8VATL4e+A==", - "requires": { - "memory-fs": "~0.4.1", - "mime": "^1.5.0", - "path-is-absolute": "^1.0.0", - "range-parser": "^1.0.3", - "time-stamp": "^2.0.0" - } - }, - "webpack-dev-server": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-2.9.4.tgz", - "integrity": "sha512-thrqC0EQEoSjXeYgP6pUXcUCZ+LNrKsDPn+mItLnn5VyyNZOJKd06hUP5vqkYwL8nWWXsii0loSF9NHNccT6ow==", - "requires": { - "ansi-html": "0.0.7", - "array-includes": "^3.0.3", - "bonjour": "^3.5.0", - "chokidar": "^1.6.0", - "compression": "^1.5.2", - "connect-history-api-fallback": "^1.3.0", - "debug": "^3.1.0", - "del": "^3.0.0", - "express": "^4.13.3", - "html-entities": "^1.2.0", - "http-proxy-middleware": "~0.17.4", - "import-local": "^0.1.1", - "internal-ip": "1.2.0", - "ip": "^1.1.5", - "killable": "^1.0.0", - "loglevel": "^1.4.1", - "opn": "^5.1.0", - "portfinder": "^1.0.9", - "selfsigned": "^1.9.1", - "serve-index": "^1.7.2", - "sockjs": "0.3.18", - "sockjs-client": "1.1.4", - "spdy": "^3.4.1", - "strip-ansi": "^3.0.1", - "supports-color": "^4.2.1", - "webpack-dev-middleware": "^1.11.0", - "yargs": "^6.6.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz", - "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" - }, - "chokidar": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", - "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", - "requires": { - "anymatch": "^1.3.0", - "async-each": "^1.0.0", - "fsevents": "^1.0.0", - "glob-parent": "^2.0.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^2.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0" - } - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, - "del": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", - "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", - "requires": { - "globby": "^6.1.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "p-map": "^1.1.1", - "pify": "^3.0.0", - "rimraf": "^2.2.8" - } - }, - "globby": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", - "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - } - } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "requires": { - "has-flag": "^2.0.0" - } - }, - "yargs": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-6.6.0.tgz", - "integrity": "sha1-eC7CHvQDNF+DCoCMo9UTr1YGUgg=", - "requires": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "os-locale": "^1.4.0", - "read-pkg-up": "^1.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^1.0.2", - "which-module": "^1.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^4.2.0" - } - }, - "yargs-parser": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-4.2.1.tgz", - "integrity": "sha1-KczqwNxPA8bIe0qfIX3RjJ90hxw=", - "requires": { - "camelcase": "^3.0.0" - } - } - } - }, "webpack-manifest-plugin": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/webpack-manifest-plugin/-/webpack-manifest-plugin-1.3.2.tgz", @@ -11050,20 +10022,6 @@ "source-map": "~0.6.1" } }, - "websocket-driver": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", - "integrity": "sha1-DK+dLXVdk67gSdS90NP+LMoqJOs=", - "requires": { - "http-parser-js": ">=0.4.0", - "websocket-extensions": ">=0.1.1" - } - }, - "websocket-extensions": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz", - "integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==" - }, "whatwg-encoding": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", From e77e8c002500d50c21b27f12eaae73fa20adef6c Mon Sep 17 00:00:00 2001 From: cdjole Date: Wed, 22 Aug 2018 23:31:47 +0200 Subject: [PATCH 271/298] Bael 2139 update (#5037) * code formatted * Regex optimized. --- .../StringContainingCharactersUnitTest.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java b/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java index 3303ebffbe..be79103e6b 100644 --- a/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java +++ b/java-strings/src/test/java/com/baeldung/string/StringContainingCharactersUnitTest.java @@ -11,7 +11,7 @@ public class StringContainingCharactersUnitTest { private static final Pattern[] inputRegexes = new Pattern[4]; - private static final String regex = "^(?=.*?\\p{Lu})(?=.*?[\\p{L}&&[^\\p{Lu}]])(?=.*?\\d)" + "(?=.*?[`~!@#$%^&*()\\-_=+\\\\\\|\\[{\\]};:'\",<.>/?]).*$"; + private static final String regex = "^(?=.*?\\p{Lu})(?=.*?\\p{Ll})(?=.*?\\d)(?=.*?[`~!@#$%^&*()\\-_=+\\\\|\\[{\\]};:'\",<.>/?]).*$"; static { inputRegexes[0] = Pattern.compile(".*[A-Z].*"); @@ -101,21 +101,36 @@ public class StringContainingCharactersUnitTest { @Test public void givenSingleRegex_whenMatchingCorrectString_thenMatches() { String validInput = "Ab3;"; - assertTrue(Pattern.compile(regex).matcher(validInput).matches()); + assertTrue(Pattern + .compile(regex) + .matcher(validInput) + .matches()); } @Test public void givenSingleRegex_whenMatchingWrongStrings_thenNotMatching() { String invalidInput = "Ab3"; - assertFalse(Pattern.compile(regex).matcher(invalidInput).matches()); + assertFalse(Pattern + .compile(regex) + .matcher(invalidInput) + .matches()); invalidInput = "Ab;"; - assertFalse(Pattern.compile(regex).matcher(invalidInput).matches()); + assertFalse(Pattern + .compile(regex) + .matcher(invalidInput) + .matches()); invalidInput = "A3;"; - assertFalse(Pattern.compile(regex).matcher(invalidInput).matches()); + assertFalse(Pattern + .compile(regex) + .matcher(invalidInput) + .matches()); invalidInput = "b3;"; - assertFalse(Pattern.compile(regex).matcher(invalidInput).matches()); + assertFalse(Pattern + .compile(regex) + .matcher(invalidInput) + .matches()); } } From 2639324919453df76b689b7cc2fc85fc66a4005c Mon Sep 17 00:00:00 2001 From: Sam Millington Date: Thu, 23 Aug 2018 15:49:31 +0100 Subject: [PATCH 272/298] BAEL-2033 Stream Ordering (#4965) --- testing-modules/streams-ordering/pom.xml | 34 ++++ .../src/test/java/StreamsOrderingTest.java | 148 ++++++++++++++++++ .../test/java/benchmarking/TestBenchmark.java | 97 ++++++++++++ 3 files changed, 279 insertions(+) create mode 100644 testing-modules/streams-ordering/pom.xml create mode 100644 testing-modules/streams-ordering/src/test/java/StreamsOrderingTest.java create mode 100644 testing-modules/streams-ordering/src/test/java/benchmarking/TestBenchmark.java diff --git a/testing-modules/streams-ordering/pom.xml b/testing-modules/streams-ordering/pom.xml new file mode 100644 index 0000000000..99d08e19be --- /dev/null +++ b/testing-modules/streams-ordering/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + + com.baeldung + StreamsOrdering + 1.0-SNAPSHOT + + + + junit + junit + 4.12 + test + + + + + org.openjdk.jmh + jmh-core + 1.21 + + + + org.openjdk.jmh + jmh-generator-annprocess + 1.21 + provided + + + + \ No newline at end of file diff --git a/testing-modules/streams-ordering/src/test/java/StreamsOrderingTest.java b/testing-modules/streams-ordering/src/test/java/StreamsOrderingTest.java new file mode 100644 index 0000000000..b657911780 --- /dev/null +++ b/testing-modules/streams-ordering/src/test/java/StreamsOrderingTest.java @@ -0,0 +1,148 @@ +import org.junit.Before; +import org.junit.Test; + +import java.util.*; +import java.util.function.Function; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static org.junit.Assert.assertEquals; + + +public class StreamsOrderingTest { + + Logger logger = Logger.getLogger( StreamsOrderingTest.class.getName()); + + @Before + public void setUp() throws Exception { + logger.setLevel(Level.ALL); + } + + @Test + public void givenTwoCollections_whenStreamed_thenCheckOutputDifferent(){ + + List list = Arrays.asList("B", "A", "C", "D", "F"); + Set set = new TreeSet<>(Arrays.asList("B", "A", "C", "D", "F")); + + Object[] listOutput = list.stream().toArray(); + Object[] setOutput = set.stream().toArray(); + + assertEquals("[B, A, C, D, F]", Arrays.toString(listOutput)); + assertEquals("[A, B, C, D, F]", Arrays.toString(setOutput)); + + } + + @Test + public void givenTwoCollections_whenStreamedInParallel_thenCheckOutputDifferent(){ + + List list = Arrays.asList("B", "A", "C", "D", "F"); + Set set = new TreeSet<>(Arrays.asList("B", "A", "C", "D", "F")); + + Object[] listOutput = list.stream().parallel().toArray(); + Object[] setOutput = set.stream().parallel().toArray(); + + assertEquals("[B, A, C, D, F]", Arrays.toString(listOutput)); + assertEquals("[A, B, C, D, F]", Arrays.toString(setOutput)); + + } + + + + @Test + public void givenOrderedInput_whenUnorderedAndOrderedCompared_thenCheckUnorderedOutputChanges(){ + Set set = new TreeSet<>( + Arrays.asList(-9, -5, -4, -2, 1, 2, 4, 5, 7, 9, 12, 13, 16, 29, 23, 34, 57, 68, 90, 102, 230)); + + Object[] orderedArray = set.stream() + .parallel() + .limit(5) + .toArray(); + Object[] unorderedArray = set.stream() + .unordered() + .parallel() + .limit(5) + .toArray(); + + logger.info(Arrays.toString(orderedArray)); + logger.info(Arrays.toString(unorderedArray)); + } + + + @Test + public void givenUnsortedStreamInput_whenStreamSorted_thenCheckOrderChanged(){ + + List list = Arrays.asList(-3,10,-4,1,3); + + Object[] listOutput = list.stream().toArray(); + Object[] listOutputSorted = list.stream().sorted().toArray(); + + assertEquals("[-3, 10, -4, 1, 3]", Arrays.toString(listOutput)); + assertEquals("[-4, -3, 1, 3, 10]", Arrays.toString(listOutputSorted)); + + } + + @Test + public void givenUnsortedStreamInput_whenStreamDistinct_thenShowTimeTaken(){ + long start, end; + start = System.currentTimeMillis(); + IntStream.range(1,1_000_000).unordered().parallel().distinct().toArray(); + end = System.currentTimeMillis(); + System.out.println(String.format("Time taken when unordered: %d ms", (end - start))); + } + + + @Test + public void givenSameCollection_whenStreamTerminated_thenCheckEachVsEachOrdered(){ + + List list = Arrays.asList("B", "A", "C", "D", "F"); + + list.stream().parallel().forEach(e -> logger.log(Level.INFO, e)); + list.stream().parallel().forEachOrdered(e -> logger.log(Level.INFO, e)); + + } + + @Test + public void givenSameCollection_whenStreamCollected_thenCheckOutput(){ + + List list = Arrays.asList("B", "A", "C", "D", "F"); + + List collectionList = list.stream().parallel().collect(Collectors.toList()); + Set collectionSet = list.stream().parallel().collect(Collectors.toCollection(TreeSet::new)); + + assertEquals("[B, A, C, D, F]", collectionList.toString()); + assertEquals("[A, B, C, D, F]", collectionSet.toString()); + + } + + + @Test + public void givenListIterationOrder_whenStreamCollectedToMap_thenCeckOrderChanged() { + List list = Arrays.asList("A", "BB", "CCC"); + + Map hashMap = list.stream().collect(Collectors.toMap(Function.identity(), String::length)); + + Object[] keySet = hashMap.keySet().toArray(); + + assertEquals("[BB, A, CCC]", Arrays.toString(keySet)); + + } + + @Test + public void givenListIteration_whenStreamCollectedtoHashMap_thenCheckOrderMaintained() { + List list = Arrays.asList("A", "BB", "CCC", "CCC"); + + Map linkedHashMap = list.stream().collect(Collectors.toMap( + Function.identity(), + String::length, + (u, v) -> u, + LinkedHashMap::new + )); + + Object[] keySet = linkedHashMap.keySet().toArray(); + + assertEquals("[A, BB, CCC]", Arrays.toString(keySet)); + } + +} diff --git a/testing-modules/streams-ordering/src/test/java/benchmarking/TestBenchmark.java b/testing-modules/streams-ordering/src/test/java/benchmarking/TestBenchmark.java new file mode 100644 index 0000000000..a3e99e6465 --- /dev/null +++ b/testing-modules/streams-ordering/src/test/java/benchmarking/TestBenchmark.java @@ -0,0 +1,97 @@ +package benchmarking; + +import org.junit.Test; +import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.infra.Blackhole; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; +import org.openjdk.jmh.runner.options.TimeValue; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + + +public class TestBenchmark +{ + + @Test + public void + launchBenchmark() throws Exception { + + Options opt = new OptionsBuilder() + // Specify which benchmarks to run. + // You can be more specific if you'd like to run only one benchmark per test. + .include(this.getClass().getName() + ".*") + // Set the following options as needed + .mode (Mode.AverageTime) + .timeUnit(TimeUnit.MICROSECONDS) + .warmupTime(TimeValue.seconds(1)) + .warmupIterations(2) + .measurementTime(TimeValue.seconds(1)) + .measurementIterations(2) + .threads(2) + .forks(1) + .shouldFailOnError(true) + .shouldDoGC(true) + //.jvmArgs("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining") + //.addProfiler(WinPerfAsmProfiler.class) + .build(); + + new Runner(opt).run(); + + + } + + @Benchmark + public void givenOrderedStreamInput_whenStreamFiltered_showOpsPerMS(){ + IntStream.range(1, 100_000_000).parallel().filter(i -> i % 10 == 0).toArray(); + } + + @Benchmark + public void givenUnorderedStreamInput_whenStreamFiltered_showOpsPerMS(){ + IntStream.range(1,100_000_000).unordered().parallel().filter(i -> i % 10 == 0).toArray(); + } + + @Benchmark + public void givenUnorderedStreamInput_whenStreamDistinct_showOpsPerMS(){ + IntStream.range(1, 1_000_000).unordered().parallel().distinct().toArray(); + } + + @Benchmark + public void givenOrderedStreamInput_whenStreamDistinct_showOpsPerMS() { + //section 5.1. + IntStream.range(1, 1_000_000).parallel().distinct().toArray(); + } + + + // The JMH samples are the best documentation for how to use it + // http://hg.openjdk.java.net/code-tools/jmh/file/tip/jmh-samples/src/main/java/org/openjdk/jmh/samples/ + @State(Scope.Thread) + public static class BenchmarkState + { + List list; + + @Setup(Level.Trial) public void + initialize() { + + Random rand = new Random(); + + list = new ArrayList<>(); + for (int i = 0; i < 1000; i++) + list.add (rand.nextInt()); + } + } + + @Benchmark public void + benchmark1 (BenchmarkState state, Blackhole bh) { + + List list = state.list; + + for (int i = 0; i < 1000; i++) + bh.consume (list.get (i)); + } +} \ No newline at end of file From bab3a724c60a34aad792e3498ff3b852c782980e Mon Sep 17 00:00:00 2001 From: amit2103 Date: Wed, 22 Aug 2018 23:56:27 +0530 Subject: [PATCH 273/298] [BAEL-8434] - Moved java stream articles to java-streams module --- core-java-8/README.md | 10 -- core-java-8/pom.xml | 6 - java-streams/.gitignore | 26 ++++ java-streams/README.md | 15 +++ java-streams/pom.xml | 120 ++++++++++++++++++ .../com/baeldung/java_8_features/Detail.java | 0 .../com/baeldung/stream/InfiniteStreams.java | 0 .../com/baeldung/stream/PrimitiveStreams.java | 0 .../java/com/baeldung/stream/Product.java | 0 .../java/com/baeldung/stream/StreamApi.java | 0 .../com/baeldung/stream/StreamIndices.java | 0 java-streams/src/main/resources/logback.xml | 13 ++ .../IterableStreamConversionUnitTest.java | 0 .../java8/Java8FindAnyFindFirstUnitTest.java | 0 .../java8/Java8StreamApiUnitTest.java | 0 .../baeldung/java8/Java8StreamsUnitTest.java | 0 .../stream/InfiniteStreamUnitTest.java | 0 .../stream/PrimitiveStreamsUnitTest.java | 0 .../baeldung/stream/StreamAddUnitTest.java | 0 .../baeldung/stream/StreamApiUnitTest.java | 0 .../stream/StreamIndicesUnitTest.java | 0 .../stream/StreamToImmutableUnitTest.java | 0 .../stream/SupplierStreamUnitTest.java | 0 .../MyImmutableListCollector.java | 0 java-streams/src/test/resources/.gitignore | 13 ++ pom.xml | 2 + 26 files changed, 189 insertions(+), 16 deletions(-) create mode 100644 java-streams/.gitignore create mode 100644 java-streams/README.md create mode 100644 java-streams/pom.xml rename {core-java-8 => java-streams}/src/main/java/com/baeldung/java_8_features/Detail.java (100%) rename {core-java-8 => java-streams}/src/main/java/com/baeldung/stream/InfiniteStreams.java (100%) rename {core-java-8 => java-streams}/src/main/java/com/baeldung/stream/PrimitiveStreams.java (100%) rename {core-java-8 => java-streams}/src/main/java/com/baeldung/stream/Product.java (100%) rename {core-java-8 => java-streams}/src/main/java/com/baeldung/stream/StreamApi.java (100%) rename {core-java-8 => java-streams}/src/main/java/com/baeldung/stream/StreamIndices.java (100%) create mode 100644 java-streams/src/main/resources/logback.xml rename {core-java-8 => java-streams}/src/test/java/com/baeldung/java/conversion/IterableStreamConversionUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/java8/Java8FindAnyFindFirstUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/stream/InfiniteStreamUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/stream/StreamAddUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/stream/StreamApiUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/stream/StreamIndicesUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/stream/StreamToImmutableUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/stream/SupplierStreamUnitTest.java (100%) rename {core-java-8 => java-streams}/src/test/java/com/baeldung/stream/mycollectors/MyImmutableListCollector.java (100%) create mode 100644 java-streams/src/test/resources/.gitignore diff --git a/core-java-8/README.md b/core-java-8/README.md index e0cd0e7c0a..c94ae36003 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -9,15 +9,10 @@ - [Java 8 New Features](http://www.baeldung.com/java-8-new-features) - [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips) - [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator) -- [Java 8 Streams Advanced](http://www.baeldung.com/java-8-streams) -- [Introduction to Java 8 Streams](http://www.baeldung.com/java-8-streams-introduction) - [Guide to Java 8 groupingBy Collector](http://www.baeldung.com/java-groupingby-collector) - [Strategy Design Pattern in Java 8](http://www.baeldung.com/java-strategy-pattern) -- [Java 8 and Infinite Streams](http://www.baeldung.com/java-inifinite-streams) - [Exceptions in Java 8 Lambda Expressions](http://www.baeldung.com/java-lambda-exceptions) -- [Java 8 Stream findFirst() vs. findAny()](http://www.baeldung.com/java-stream-findfirst-vs-findany) - [Guide to Java 8 Comparator.comparing()](http://www.baeldung.com/java-8-comparator-comparing) -- [How to Get the Last Element of a Stream in Java?](http://www.baeldung.com/java-stream-last-element) - [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) - [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api) - [Guide To Java 8 Optional](http://www.baeldung.com/java-optional) @@ -27,15 +22,10 @@ - [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) - [Java Base64 Encoding and Decoding](http://www.baeldung.com/java-base64-encode-and-decode) - [The Difference Between map() and flatMap()](http://www.baeldung.com/java-difference-map-and-flatmap) -- [Merging Streams in Java](http://www.baeldung.com/java-merge-streams) -- [“Stream has already been operated upon or closed” Exception in Java](http://www.baeldung.com/java-stream-operated-upon-or-closed-exception) - [Display All Time Zones With GMT And UTC in Java](http://www.baeldung.com/java-time-zones) - [Copy a File with Java](http://www.baeldung.com/java-copy-file) - [Static and Default Methods in Interfaces in Java](http://www.baeldung.com/java-static-default-methods) -- [Iterable to Stream in Java](http://www.baeldung.com/java-iterable-to-stream) -- [How to Iterate Over a Stream With Indices](http://www.baeldung.com/java-stream-indices) - [Efficient Word Frequency Calculator in Java](http://www.baeldung.com/java-word-frequency) -- [Primitive Type Streams in Java 8](http://www.baeldung.com/java-8-primitive-streams) - [Fail-Safe Iterator vs Fail-Fast Iterator](http://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator) - [Shuffling Collections In Java](http://www.baeldung.com/java-shuffle-collection) - [Introduction to Spliterator in Java](http://www.baeldung.com/java-spliterator) diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml index ad37cdd7e8..fa0d79e405 100644 --- a/core-java-8/pom.xml +++ b/core-java-8/pom.xml @@ -89,11 +89,6 @@ vavr ${vavr.version}
    - - one.util - streamex - ${streamex.version} - joda-time joda-time @@ -177,7 +172,6 @@ 1.16.12 0.9.0 1.13 - 0.6.5 2.10 3.6.1 diff --git a/java-streams/.gitignore b/java-streams/.gitignore new file mode 100644 index 0000000000..3de4cc647e --- /dev/null +++ b/java-streams/.gitignore @@ -0,0 +1,26 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +*.txt +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/java-streams/README.md b/java-streams/README.md new file mode 100644 index 0000000000..9015e30d85 --- /dev/null +++ b/java-streams/README.md @@ -0,0 +1,15 @@ +========= + +## Java Streams Cookbooks and Examples + +### Relevant Articles: +- [Java 8 Streams Advanced](http://www.baeldung.com/java-8-streams) +- [Introduction to Java 8 Streams](http://www.baeldung.com/java-8-streams-introduction) +- [Java 8 and Infinite Streams](http://www.baeldung.com/java-inifinite-streams) +- [Java 8 Stream findFirst() vs. findAny()](http://www.baeldung.com/java-stream-findfirst-vs-findany) +- [How to Get the Last Element of a Stream in Java?](http://www.baeldung.com/java-stream-last-element) +- [Merging Streams in Java](http://www.baeldung.com/java-merge-streams) +- [”Stream has already been operated upon or closed” Exception in Java](http://www.baeldung.com/java-stream-operated-upon-or-closed-exception) +- [Iterable to Stream in Java](http://www.baeldung.com/java-iterable-to-stream) +- [How to Iterate Over a Stream With Indices](http://www.baeldung.com/java-stream-indices) +- [Primitive Type Streams in Java 8](http://www.baeldung.com/java-8-primitive-streams) diff --git a/java-streams/pom.xml b/java-streams/pom.xml new file mode 100644 index 0000000000..351c33ecc0 --- /dev/null +++ b/java-streams/pom.xml @@ -0,0 +1,120 @@ + + 4.0.0 + com.baeldung + java-streams + 0.1.0-SNAPSHOT + jar + java-streams + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + log4j + log4j + ${log4j.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + org.assertj + assertj-core + ${assertj.version} + test + + + com.codepoetics + protonpack + ${protonpack.version} + + + io.vavr + vavr + ${vavr.version} + + + one.util + streamex + ${streamex.version} + + + org.aspectj + aspectjrt + ${asspectj.version} + + + org.aspectj + aspectjweaver + ${asspectj.version} + + + + + java-streams + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + -parameters + + + + + + + + 3.5 + 1.16.12 + 0.9.0 + 1.13 + 0.6.5 + 2.10 + + 3.6.1 + 1.8.9 + + diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Detail.java b/java-streams/src/main/java/com/baeldung/java_8_features/Detail.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/java_8_features/Detail.java rename to java-streams/src/main/java/com/baeldung/java_8_features/Detail.java diff --git a/core-java-8/src/main/java/com/baeldung/stream/InfiniteStreams.java b/java-streams/src/main/java/com/baeldung/stream/InfiniteStreams.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/stream/InfiniteStreams.java rename to java-streams/src/main/java/com/baeldung/stream/InfiniteStreams.java diff --git a/core-java-8/src/main/java/com/baeldung/stream/PrimitiveStreams.java b/java-streams/src/main/java/com/baeldung/stream/PrimitiveStreams.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/stream/PrimitiveStreams.java rename to java-streams/src/main/java/com/baeldung/stream/PrimitiveStreams.java diff --git a/core-java-8/src/main/java/com/baeldung/stream/Product.java b/java-streams/src/main/java/com/baeldung/stream/Product.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/stream/Product.java rename to java-streams/src/main/java/com/baeldung/stream/Product.java diff --git a/core-java-8/src/main/java/com/baeldung/stream/StreamApi.java b/java-streams/src/main/java/com/baeldung/stream/StreamApi.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/stream/StreamApi.java rename to java-streams/src/main/java/com/baeldung/stream/StreamApi.java diff --git a/core-java-8/src/main/java/com/baeldung/stream/StreamIndices.java b/java-streams/src/main/java/com/baeldung/stream/StreamIndices.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/stream/StreamIndices.java rename to java-streams/src/main/java/com/baeldung/stream/StreamIndices.java diff --git a/java-streams/src/main/resources/logback.xml b/java-streams/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-streams/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-java-8/src/test/java/com/baeldung/java/conversion/IterableStreamConversionUnitTest.java b/java-streams/src/test/java/com/baeldung/java/conversion/IterableStreamConversionUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java/conversion/IterableStreamConversionUnitTest.java rename to java-streams/src/test/java/com/baeldung/java/conversion/IterableStreamConversionUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8FindAnyFindFirstUnitTest.java b/java-streams/src/test/java/com/baeldung/java8/Java8FindAnyFindFirstUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java8/Java8FindAnyFindFirstUnitTest.java rename to java-streams/src/test/java/com/baeldung/java8/Java8FindAnyFindFirstUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java b/java-streams/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java rename to java-streams/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java b/java-streams/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java rename to java-streams/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stream/InfiniteStreamUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/InfiniteStreamUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/stream/InfiniteStreamUnitTest.java rename to java-streams/src/test/java/com/baeldung/stream/InfiniteStreamUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java rename to java-streams/src/test/java/com/baeldung/stream/PrimitiveStreamsUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stream/StreamAddUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/StreamAddUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/stream/StreamAddUnitTest.java rename to java-streams/src/test/java/com/baeldung/stream/StreamAddUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stream/StreamApiUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/StreamApiUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/stream/StreamApiUnitTest.java rename to java-streams/src/test/java/com/baeldung/stream/StreamApiUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stream/StreamIndicesUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/StreamIndicesUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/stream/StreamIndicesUnitTest.java rename to java-streams/src/test/java/com/baeldung/stream/StreamIndicesUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stream/StreamToImmutableUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/StreamToImmutableUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/stream/StreamToImmutableUnitTest.java rename to java-streams/src/test/java/com/baeldung/stream/StreamToImmutableUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stream/SupplierStreamUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/SupplierStreamUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/stream/SupplierStreamUnitTest.java rename to java-streams/src/test/java/com/baeldung/stream/SupplierStreamUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/stream/mycollectors/MyImmutableListCollector.java b/java-streams/src/test/java/com/baeldung/stream/mycollectors/MyImmutableListCollector.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/stream/mycollectors/MyImmutableListCollector.java rename to java-streams/src/test/java/com/baeldung/stream/mycollectors/MyImmutableListCollector.java diff --git a/java-streams/src/test/resources/.gitignore b/java-streams/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/java-streams/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/pom.xml b/pom.xml index 080c288987..7ff1aa7d47 100644 --- a/pom.xml +++ b/pom.xml @@ -348,6 +348,7 @@ core-java-collections core-java-io core-java-8 + java-streams core-java-persistence core-kotlin core-groovy @@ -902,6 +903,7 @@ core-java-collections core-java-io core-java-8 + java-streams core-groovy couchbase From d618b78782cb05e6ed9b16e63d788a80e155d042 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Thu, 23 Aug 2018 21:02:08 +0530 Subject: [PATCH 274/298] [BAEL-8434] - Removed Merging streams article from java-streams module README --- java-streams/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/java-streams/README.md b/java-streams/README.md index 9015e30d85..4bfcabb7cf 100644 --- a/java-streams/README.md +++ b/java-streams/README.md @@ -8,7 +8,6 @@ - [Java 8 and Infinite Streams](http://www.baeldung.com/java-inifinite-streams) - [Java 8 Stream findFirst() vs. findAny()](http://www.baeldung.com/java-stream-findfirst-vs-findany) - [How to Get the Last Element of a Stream in Java?](http://www.baeldung.com/java-stream-last-element) -- [Merging Streams in Java](http://www.baeldung.com/java-merge-streams) - [”Stream has already been operated upon or closed” Exception in Java](http://www.baeldung.com/java-stream-operated-upon-or-closed-exception) - [Iterable to Stream in Java](http://www.baeldung.com/java-iterable-to-stream) - [How to Iterate Over a Stream With Indices](http://www.baeldung.com/java-stream-indices) From b8ae8ace4af9093b66348c21822667bfe14cb751 Mon Sep 17 00:00:00 2001 From: kartiksingla Date: Thu, 23 Aug 2018 21:44:01 +0530 Subject: [PATCH 275/298] [BAEL-2141] - How to check if a string contains all the letters of the alphabet? --- .../string/EnglishAlphabetLetters.java | 35 +++++++++++++++++++ .../string/EnglishAlphabetLettersTest.java | 20 +++++++++++ 2 files changed, 55 insertions(+) create mode 100644 algorithms/src/main/java/com/baeldung/algorithms/string/EnglishAlphabetLetters.java create mode 100644 algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersTest.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/string/EnglishAlphabetLetters.java b/algorithms/src/main/java/com/baeldung/algorithms/string/EnglishAlphabetLetters.java new file mode 100644 index 0000000000..2dd1fdcb75 --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/string/EnglishAlphabetLetters.java @@ -0,0 +1,35 @@ +package com.baeldung.algorithms.string; + +public class EnglishAlphabetLetters { + + public static boolean checkStringForAllTheLetters(String input) { + boolean[] visited = new boolean[26]; + + int index = 0; + + for (int id = 0; id < input.length(); id++) { + if ('a' <= input.charAt(id) && input.charAt(id) <= 'z') { + index = input.charAt(id) - 'a'; + } else if ('A' <= input.charAt(id) && input.charAt(id) <= 'Z') { + index = input.charAt(id) - 'A'; + } + visited[index] = true; + } + + for (int id = 0; id < 26; id++) { + if (!visited[id]) { + return false; + } + } + return true; + } + + public static boolean checkStringForAllLetterUsingStream(String input) { + long c = input.toLowerCase().chars().filter(ch -> ch >= 'a' && ch <= 'z').distinct().count(); + return c == 26; + } + + public static void main(String[] args) { + checkStringForAllLetterUsingStream("intit"); + } +} \ No newline at end of file diff --git a/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersTest.java b/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersTest.java new file mode 100644 index 0000000000..54335c62d2 --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersTest.java @@ -0,0 +1,20 @@ +package com.baeldung.algorithms.string; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class EnglishAlphabetLettersTest { + + @Test + void givenString_whenContainsAllCharacter_thenTrue() { + String input = "Farmer jack realized that big yellow quilts were expensive"; + Assertions.assertTrue(EnglishAlphabetLetters.checkStringForAllTheLetters(input)); + } + + @Test + void givenString_whenContainsAllCharacter_thenUsingStreamExpectTrue() { + String input = "Farmer jack realized that big yellow quilts were expensive"; + Assertions.assertTrue(EnglishAlphabetLetters.checkStringForAllLetterUsingStream(input)); + } + +} From 002760a3be31c29ca5bccfcb2a50cffa277c07d9 Mon Sep 17 00:00:00 2001 From: kartiksingla Date: Thu, 23 Aug 2018 21:58:37 +0530 Subject: [PATCH 276/298] Fixed Unit test case file name for [BAEL-2141] --- ...phabetLettersTest.java => EnglishAlphabetLettersUnitTest.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename algorithms/src/test/java/com/baeldung/algorithms/string/{EnglishAlphabetLettersTest.java => EnglishAlphabetLettersUnitTest.java} (100%) diff --git a/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersTest.java b/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java similarity index 100% rename from algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java From 1846a1e441ba0e06117956a71c21dd4747ceda71 Mon Sep 17 00:00:00 2001 From: kartiksingla Date: Thu, 23 Aug 2018 22:04:38 +0530 Subject: [PATCH 277/298] Fixed Unit test case file name for [BAEL-2141] --- .../algorithms/string/EnglishAlphabetLettersUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java index 54335c62d2..54863cddc8 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/string/EnglishAlphabetLettersUnitTest.java @@ -3,7 +3,7 @@ package com.baeldung.algorithms.string; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -public class EnglishAlphabetLettersTest { +public class EnglishAlphabetLettersUnitTest { @Test void givenString_whenContainsAllCharacter_thenTrue() { From 9b343be45ecb36315a5187c94a7350a9a2a2eab5 Mon Sep 17 00:00:00 2001 From: Kacper Date: Fri, 24 Aug 2018 13:18:30 +0200 Subject: [PATCH 278/298] BAEL-2122 Optional or else throw (#5047) * Throw and throws in Java * BAEL-2122 | throw exception in optional * BAEL-2122 | optional orelsethrow --- .../baeldung/throwsexception/PersonRepository.java | 2 +- .../throwsexception/PersonRepositoryUnitTest.java | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java b/core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java index 5fcbeb3d5f..a3e69b7f6f 100644 --- a/core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java +++ b/core-java/src/main/java/com/baeldung/throwsexception/PersonRepository.java @@ -8,7 +8,7 @@ public class PersonRepository { @Nullable public String findNameById(String id) { - return id == null ? null : "example-name"; + return id == null ? null : "Name"; } public List findAll() throws SQLException { diff --git a/core-java/src/test/java/com/baeldung/throwsexception/PersonRepositoryUnitTest.java b/core-java/src/test/java/com/baeldung/throwsexception/PersonRepositoryUnitTest.java index 6294d40090..0d1859fb1a 100644 --- a/core-java/src/test/java/com/baeldung/throwsexception/PersonRepositoryUnitTest.java +++ b/core-java/src/test/java/com/baeldung/throwsexception/PersonRepositoryUnitTest.java @@ -4,6 +4,7 @@ import org.junit.Test; import java.util.Optional; +import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -29,4 +30,14 @@ public class PersonRepositoryUnitTest { .orElseThrow(Exception::new)); } + @Test + public void whenIdIsNonNull_thenShouldReturnNameUpperCase() throws Exception { + String name = Optional + .ofNullable(personRepository.findNameById("id")) + .map(String::toUpperCase) + .orElseThrow(Exception::new); + + assertEquals("NAME", name); + } + } \ No newline at end of file From 3bd1ed4ecec4022ca69cf518c09fb2c0f27ebf12 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 25 Aug 2018 17:44:06 +0530 Subject: [PATCH 279/298] [BAEL-8456] - Moved Java Date articles into a new module - 'java-dates' --- core-java-8/README.md | 4 - core-java-9/README.md | 2 - core-java/README.md | 4 - java-dates/.gitignore | 26 +++++ java-dates/README.md | 16 +++ java-dates/pom.xml | 103 ++++++++++++++++++ .../com/baeldung/date/DateWithoutTime.java | 0 .../com/baeldung/datetime/AddHoursToDate.java | 0 .../main/java/com/baeldung/datetime/README.md | 0 .../com/baeldung/datetime/UseDuration.java | 0 .../com/baeldung/datetime/UseLocalDate.java | 0 .../baeldung/datetime/UseLocalDateTime.java | 0 .../com/baeldung/datetime/UseLocalTime.java | 0 .../java/com/baeldung/datetime/UsePeriod.java | 0 .../com/baeldung/datetime/UseToInstant.java | 0 .../baeldung/datetime/UseZonedDateTime.java | 0 .../datetime/DateToLocalDateConverter.java | 0 .../DateToLocalDateTimeConverter.java | 0 .../LocalDateTimeToDateConverter.java | 0 .../datetime/LocalDateToDateConverter.java | 0 .../java/com/baeldung/java9/time/TimeApi.java | 0 .../regexp/datepattern/DateMatcher.java | 0 .../datepattern/FormattedDateMatcher.java | 0 .../regexp/datepattern/RangedDateMatcher.java | 0 .../gregorian/February29thMatcher.java | 0 .../gregorian/FebruaryGeneralMatcher.java | 0 .../gregorian/GregorianDateMatcher.java | 0 .../gregorian/MonthsOf30DaysMatcher.java | 0 .../gregorian/MonthsOf31DaysMatcher.java | 0 .../optmization/OptimizedMatcher.java | 0 .../CustomTemporalAdjuster.java | 0 java-dates/src/main/resources/logback.xml | 13 +++ .../com/baeldung/date/DateDiffUnitTest.java | 0 .../date/DateWithoutTimeUnitTest.java | 0 .../baeldung/date/StringToDateUnitTest.java | 0 .../baeldung/dateapi/ConversionExample.java | 0 .../dateapi/JavaDurationUnitTest.java | 0 .../baeldung/dateapi/JavaPeriodUnitTest.java | 0 .../dateapi/JavaUtilTimeUnitTest.java | 0 .../datetime/AddHoursToDateUnitTest.java | 0 .../datetime/UseLocalDateTimeUnitTest.java | 0 .../datetime/UseLocalDateUnitTest.java | 0 .../datetime/UseLocalTimeUnitTest.java | 0 .../baeldung/datetime/UsePeriodUnitTest.java | 0 .../datetime/UseTimeZoneUnitTest.java | 0 .../datetime/UseZonedDateTimeUnitTest.java | 0 .../DaylightSavingTimeExamplesUnitTest.java | 0 ...ghtSavingTimeJavaTimeExamplesUnitTest.java | 0 .../DateToLocalDateConverterUnitTest.java | 2 +- .../DateToLocalDateTimeConverterUnitTest.java | 2 +- .../LocalDateTimeToDateConverterUnitTest.java | 2 +- .../LocalDateToDateConverterUnitTest.java | 2 +- .../baeldung/java9/time/TimeApiUnitTest.java | 4 +- .../baeldung/jodatime/JodaTimeUnitTest.java | 0 .../FormattedDateMatcherUnitTest.java | 0 .../RangedDateMatcherUnitTest.java | 0 .../February29thMatcherUnitTest.java | 0 .../FebruaryGeneralMatcherUnitTest.java | 0 .../GregorianDateMatcherUnitTest.java | 0 .../MonthsOf30DaysMatcherUnitTest.java | 0 .../MonthsOf31DaysMatcherUnitTest.java | 0 .../testhelper/GregorianDateTestHelper.java | 0 .../CustomTemporalAdjusterUnitTest.java | 0 .../TemporalAdjustersUnitTest.java | 0 java-dates/src/test/resources/.gitignore | 13 +++ libraries/README.md | 1 - libraries/pom.xml | 11 -- 67 files changed, 177 insertions(+), 28 deletions(-) create mode 100644 java-dates/.gitignore create mode 100644 java-dates/README.md create mode 100644 java-dates/pom.xml rename {core-java => java-dates}/src/main/java/com/baeldung/date/DateWithoutTime.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/AddHoursToDate.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/README.md (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/UseDuration.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/UseLocalDate.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/UseLocalDateTime.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/UseLocalTime.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/UsePeriod.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/UseToInstant.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/UseZonedDateTime.java (100%) rename {core-java-9 => java-dates}/src/main/java/com/baeldung/java9/datetime/DateToLocalDateConverter.java (100%) rename {core-java-9 => java-dates}/src/main/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverter.java (100%) rename {core-java-9 => java-dates}/src/main/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverter.java (100%) rename {core-java-9 => java-dates}/src/main/java/com/baeldung/java9/datetime/LocalDateToDateConverter.java (100%) rename {core-java-9 => java-dates}/src/main/java/com/baeldung/java9/time/TimeApi.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/regexp/datepattern/DateMatcher.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/regexp/datepattern/FormattedDateMatcher.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/regexp/datepattern/RangedDateMatcher.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcher.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcher.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcher.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcher.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcher.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/regexp/datepattern/optmization/OptimizedMatcher.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java (100%) create mode 100644 java-dates/src/main/resources/logback.xml rename {libraries => java-dates}/src/test/java/com/baeldung/date/DateDiffUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/date/DateWithoutTimeUnitTest.java (100%) rename {libraries => java-dates}/src/test/java/com/baeldung/date/StringToDateUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/dateapi/ConversionExample.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/dateapi/JavaDurationUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/dateapi/JavaPeriodUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/datetime/AddHoursToDateUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/datetime/UseTimeZoneUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/dst/DaylightSavingTimeExamplesUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/dst/DaylightSavingTimeJavaTimeExamplesUnitTest.java (100%) rename core-java-9/src/test/java/com/baeldung/java9/datetime/DateToLocalDateConverterTest.java => java-dates/src/test/java/com/baeldung/java9/datetime/DateToLocalDateConverterUnitTest.java (98%) rename core-java-9/src/test/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverterTest.java => java-dates/src/test/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverterUnitTest.java (98%) rename core-java-9/src/test/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverterTest.java => java-dates/src/test/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverterUnitTest.java (97%) rename core-java-9/src/test/java/com/baeldung/java9/datetime/LocalDateToDateConverterTest.java => java-dates/src/test/java/com/baeldung/java9/datetime/LocalDateToDateConverterUnitTest.java (96%) rename core-java-9/src/test/java/com/baeldung/java9/time/TimeApiTest.java => java-dates/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java (96%) rename {libraries => java-dates}/src/test/java/com/baeldung/jodatime/JodaTimeUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/regexp/datepattern/FormattedDateMatcherUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/regexp/datepattern/RangedDateMatcherUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcherUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcherUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcherUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcherUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcherUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/regexp/datepattern/gregorian/testhelper/GregorianDateTestHelper.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/temporaladjusters/TemporalAdjustersUnitTest.java (100%) create mode 100644 java-dates/src/test/resources/.gitignore diff --git a/core-java-8/README.md b/core-java-8/README.md index c94ae36003..5c740bcba8 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -13,12 +13,8 @@ - [Strategy Design Pattern in Java 8](http://www.baeldung.com/java-strategy-pattern) - [Exceptions in Java 8 Lambda Expressions](http://www.baeldung.com/java-lambda-exceptions) - [Guide to Java 8 Comparator.comparing()](http://www.baeldung.com/java-8-comparator-comparing) -- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) -- [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api) - [Guide To Java 8 Optional](http://www.baeldung.com/java-optional) - [Guide to the Java 8 forEach](http://www.baeldung.com/foreach-java) -- [Get the Current Date, Time and Timestamp in Java 8](http://www.baeldung.com/current-date-time-and-timestamp-in-java-8) -- [TemporalAdjuster in Java](http://www.baeldung.com/java-temporal-adjuster) - [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) - [Java Base64 Encoding and Decoding](http://www.baeldung.com/java-base64-encode-and-decode) - [The Difference Between map() and flatMap()](http://www.baeldung.com/java-difference-map-and-flatmap) diff --git a/core-java-9/README.md b/core-java-9/README.md index 8c869f56bb..6f10f432a6 100644 --- a/core-java-9/README.md +++ b/core-java-9/README.md @@ -15,9 +15,7 @@ - [Introduction to Project Jigsaw](http://www.baeldung.com/project-jigsaw-java-modularity) - [Java 9 Optional API Additions](http://www.baeldung.com/java-9-optional) - [Java 9 Reactive Streams](http://www.baeldung.com/java-9-reactive-streams) -- [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates) - [Java 9 java.util.Objects Additions](http://www.baeldung.com/java-9-objects-new) -- [Convert Date to LocalDate or LocalDateTime and Back](http://www.baeldung.com/java-date-to-localdate-and-localdatetime) - [Java 9 Variable Handles Demistyfied](http://www.baeldung.com/java-variable-handles) - [Exploring the New HTTP Client in Java 9](http://www.baeldung.com/java-9-http-client) - [Method Handles in Java](http://www.baeldung.com/java-method-handles) diff --git a/core-java/README.md b/core-java/README.md index 4914d04dbd..4586d2add9 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -47,7 +47,6 @@ - [How to Get a Name of a Method Being Executed?](http://www.baeldung.com/java-name-of-executing-method) - [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) - [How to Copy an Array in Java](http://www.baeldung.com/java-array-copy) -- [Period and Duration in Java](http://www.baeldung.com/java-period-duration) - [Converting a Stack Trace to a String in Java](http://www.baeldung.com/java-stacktrace-to-string) - [Java Double Brace Initialization](http://www.baeldung.com/java-double-brace-initialization) - [The StackOverflowError in Java](http://www.baeldung.com/java-stack-overflow-error) @@ -75,7 +74,6 @@ - [A Guide to Java Initialization](http://www.baeldung.com/java-initialization) - [Implementing a Binary Tree in Java](http://www.baeldung.com/java-binary-tree) - [A Guide to ThreadLocalRandom in Java](http://www.baeldung.com/java-thread-local-random) -- [RegEx for matching Date Pattern in Java](http://www.baeldung.com/java-date-regular-expressions) - [Nested Classes in Java](http://www.baeldung.com/java-nested-classes) - [A Guide to Java Loops](http://www.baeldung.com/java-loops) - [Varargs in Java](http://www.baeldung.com/java-varargs) @@ -96,7 +94,6 @@ - [A Practical Guide to DecimalFormat](http://www.baeldung.com/java-decimalformat) - [How to Detect the OS Using Java](http://www.baeldung.com/java-detect-os) - [ASCII Art in Java](http://www.baeldung.com/ascii-art-in-java) -- [Handling Daylight Savings Time in Java](http://www.baeldung.com/java-daylight-savings) - [Inheritance and Composition (Is-a vs Has-a relationship) in Java](http://www.baeldung.com/java-inheritance-composition) - [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) - [The "final" Keyword in Java](http://www.baeldung.com/java-final) @@ -136,7 +133,6 @@ - [Jagged Arrays In Java](http://www.baeldung.com/java-jagged-arrays) - [Importance of Main Manifest Attribute in a Self-Executing JAR](http://www.baeldung.com/java-jar-executable-manifest-main-class) - [Extracting Year, Month and Day from Date in Java](http://www.baeldung.com/java-year-month-day) -- [Get Date Without Time in Java](http://www.baeldung.com/java-date-without-time) - [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension) - [Immutable Objects in Java](http://www.baeldung.com/java-immutable-object) - [Console I/O in Java](http://www.baeldung.com/java-console-input-output) diff --git a/java-dates/.gitignore b/java-dates/.gitignore new file mode 100644 index 0000000000..3de4cc647e --- /dev/null +++ b/java-dates/.gitignore @@ -0,0 +1,26 @@ +*.class + +0.* + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* +.resourceCache + +# Packaged files # +*.jar +*.war +*.ear + +# Files generated by integration tests +*.txt +backup-pom.xml +/bin/ +/temp + +#IntelliJ specific +.idea/ +*.iml \ No newline at end of file diff --git a/java-dates/README.md b/java-dates/README.md new file mode 100644 index 0000000000..58b95224ba --- /dev/null +++ b/java-dates/README.md @@ -0,0 +1,16 @@ +========= + +## Java Dates Cookbooks and Examples + +### Relevant Articles: +- [TemporalAdjuster in Java](http://www.baeldung.com/java-temporal-adjuster) +- [Handling Daylight Savings Time in Java](http://www.baeldung.com/java-daylight-savings) +- [Period and Duration in Java](http://www.baeldung.com/java-period-duration) +- [Difference Between Two Dates in Java](http://www.baeldung.com/java-date-difference) +- [RegEx for matching Date Pattern in Java](http://www.baeldung.com/java-date-regular-expressions) +- [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api) +- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) +- [Get the Current Date, Time and Timestamp in Java 8](http://www.baeldung.com/current-date-time-and-timestamp-in-java-8) +- [Get Date Without Time in Java](http://www.baeldung.com/java-date-without-time) +- [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates) +- [Convert Date to LocalDate or LocalDateTime and Back](http://www.baeldung.com/java-date-to-localdate-and-localdatetime) \ No newline at end of file diff --git a/java-dates/pom.xml b/java-dates/pom.xml new file mode 100644 index 0000000000..877dd615a8 --- /dev/null +++ b/java-dates/pom.xml @@ -0,0 +1,103 @@ + + 4.0.0 + com.baeldung + java-dates + 0.1.0-SNAPSHOT + jar + java-dates + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + log4j + log4j + ${log4j.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + org.assertj + assertj-core + ${assertj.version} + test + + + joda-time + joda-time + ${joda-time.version} + + + com.darwinsys + hirondelle-date4j + RELEASE + test + + + + + java-dates + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + prepare-package + + copy-dependencies + + + ${project.build.directory}/libs + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + + + 3.5 + 1.16.12 + 2.10 + + 3.6.1 + 9 + 9 + + diff --git a/core-java/src/main/java/com/baeldung/date/DateWithoutTime.java b/java-dates/src/main/java/com/baeldung/date/DateWithoutTime.java similarity index 100% rename from core-java/src/main/java/com/baeldung/date/DateWithoutTime.java rename to java-dates/src/main/java/com/baeldung/date/DateWithoutTime.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/AddHoursToDate.java b/java-dates/src/main/java/com/baeldung/datetime/AddHoursToDate.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/AddHoursToDate.java rename to java-dates/src/main/java/com/baeldung/datetime/AddHoursToDate.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/README.md b/java-dates/src/main/java/com/baeldung/datetime/README.md similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/README.md rename to java-dates/src/main/java/com/baeldung/datetime/README.md diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseDuration.java b/java-dates/src/main/java/com/baeldung/datetime/UseDuration.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/UseDuration.java rename to java-dates/src/main/java/com/baeldung/datetime/UseDuration.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDate.java b/java-dates/src/main/java/com/baeldung/datetime/UseLocalDate.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/UseLocalDate.java rename to java-dates/src/main/java/com/baeldung/datetime/UseLocalDate.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java b/java-dates/src/main/java/com/baeldung/datetime/UseLocalDateTime.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java rename to java-dates/src/main/java/com/baeldung/datetime/UseLocalDateTime.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalTime.java b/java-dates/src/main/java/com/baeldung/datetime/UseLocalTime.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/UseLocalTime.java rename to java-dates/src/main/java/com/baeldung/datetime/UseLocalTime.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UsePeriod.java b/java-dates/src/main/java/com/baeldung/datetime/UsePeriod.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/UsePeriod.java rename to java-dates/src/main/java/com/baeldung/datetime/UsePeriod.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseToInstant.java b/java-dates/src/main/java/com/baeldung/datetime/UseToInstant.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/UseToInstant.java rename to java-dates/src/main/java/com/baeldung/datetime/UseToInstant.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseZonedDateTime.java b/java-dates/src/main/java/com/baeldung/datetime/UseZonedDateTime.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/UseZonedDateTime.java rename to java-dates/src/main/java/com/baeldung/datetime/UseZonedDateTime.java diff --git a/core-java-9/src/main/java/com/baeldung/java9/datetime/DateToLocalDateConverter.java b/java-dates/src/main/java/com/baeldung/java9/datetime/DateToLocalDateConverter.java similarity index 100% rename from core-java-9/src/main/java/com/baeldung/java9/datetime/DateToLocalDateConverter.java rename to java-dates/src/main/java/com/baeldung/java9/datetime/DateToLocalDateConverter.java diff --git a/core-java-9/src/main/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverter.java b/java-dates/src/main/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverter.java similarity index 100% rename from core-java-9/src/main/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverter.java rename to java-dates/src/main/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverter.java diff --git a/core-java-9/src/main/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverter.java b/java-dates/src/main/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverter.java similarity index 100% rename from core-java-9/src/main/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverter.java rename to java-dates/src/main/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverter.java diff --git a/core-java-9/src/main/java/com/baeldung/java9/datetime/LocalDateToDateConverter.java b/java-dates/src/main/java/com/baeldung/java9/datetime/LocalDateToDateConverter.java similarity index 100% rename from core-java-9/src/main/java/com/baeldung/java9/datetime/LocalDateToDateConverter.java rename to java-dates/src/main/java/com/baeldung/java9/datetime/LocalDateToDateConverter.java diff --git a/core-java-9/src/main/java/com/baeldung/java9/time/TimeApi.java b/java-dates/src/main/java/com/baeldung/java9/time/TimeApi.java similarity index 100% rename from core-java-9/src/main/java/com/baeldung/java9/time/TimeApi.java rename to java-dates/src/main/java/com/baeldung/java9/time/TimeApi.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/DateMatcher.java b/java-dates/src/main/java/com/baeldung/regexp/datepattern/DateMatcher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/regexp/datepattern/DateMatcher.java rename to java-dates/src/main/java/com/baeldung/regexp/datepattern/DateMatcher.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/FormattedDateMatcher.java b/java-dates/src/main/java/com/baeldung/regexp/datepattern/FormattedDateMatcher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/regexp/datepattern/FormattedDateMatcher.java rename to java-dates/src/main/java/com/baeldung/regexp/datepattern/FormattedDateMatcher.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/RangedDateMatcher.java b/java-dates/src/main/java/com/baeldung/regexp/datepattern/RangedDateMatcher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/regexp/datepattern/RangedDateMatcher.java rename to java-dates/src/main/java/com/baeldung/regexp/datepattern/RangedDateMatcher.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcher.java b/java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcher.java rename to java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcher.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcher.java b/java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcher.java rename to java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcher.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcher.java b/java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcher.java rename to java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcher.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcher.java b/java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcher.java rename to java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcher.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcher.java b/java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcher.java rename to java-dates/src/main/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcher.java diff --git a/core-java/src/main/java/com/baeldung/regexp/datepattern/optmization/OptimizedMatcher.java b/java-dates/src/main/java/com/baeldung/regexp/datepattern/optmization/OptimizedMatcher.java similarity index 100% rename from core-java/src/main/java/com/baeldung/regexp/datepattern/optmization/OptimizedMatcher.java rename to java-dates/src/main/java/com/baeldung/regexp/datepattern/optmization/OptimizedMatcher.java diff --git a/core-java-8/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java b/java-dates/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java rename to java-dates/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java diff --git a/java-dates/src/main/resources/logback.xml b/java-dates/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-dates/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/date/DateDiffUnitTest.java b/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/date/DateDiffUnitTest.java rename to java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/date/DateWithoutTimeUnitTest.java b/java-dates/src/test/java/com/baeldung/date/DateWithoutTimeUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/date/DateWithoutTimeUnitTest.java rename to java-dates/src/test/java/com/baeldung/date/DateWithoutTimeUnitTest.java diff --git a/libraries/src/test/java/com/baeldung/date/StringToDateUnitTest.java b/java-dates/src/test/java/com/baeldung/date/StringToDateUnitTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/date/StringToDateUnitTest.java rename to java-dates/src/test/java/com/baeldung/date/StringToDateUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/dateapi/ConversionExample.java b/java-dates/src/test/java/com/baeldung/dateapi/ConversionExample.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/dateapi/ConversionExample.java rename to java-dates/src/test/java/com/baeldung/dateapi/ConversionExample.java diff --git a/core-java-8/src/test/java/com/baeldung/dateapi/JavaDurationUnitTest.java b/java-dates/src/test/java/com/baeldung/dateapi/JavaDurationUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/dateapi/JavaDurationUnitTest.java rename to java-dates/src/test/java/com/baeldung/dateapi/JavaDurationUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/dateapi/JavaPeriodUnitTest.java b/java-dates/src/test/java/com/baeldung/dateapi/JavaPeriodUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/dateapi/JavaPeriodUnitTest.java rename to java-dates/src/test/java/com/baeldung/dateapi/JavaPeriodUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java b/java-dates/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java rename to java-dates/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/datetime/AddHoursToDateUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/AddHoursToDateUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/datetime/AddHoursToDateUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/AddHoursToDateUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseTimeZoneUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/UseTimeZoneUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/datetime/UseTimeZoneUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/UseTimeZoneUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/dst/DaylightSavingTimeExamplesUnitTest.java b/java-dates/src/test/java/com/baeldung/dst/DaylightSavingTimeExamplesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/dst/DaylightSavingTimeExamplesUnitTest.java rename to java-dates/src/test/java/com/baeldung/dst/DaylightSavingTimeExamplesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/dst/DaylightSavingTimeJavaTimeExamplesUnitTest.java b/java-dates/src/test/java/com/baeldung/dst/DaylightSavingTimeJavaTimeExamplesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/dst/DaylightSavingTimeJavaTimeExamplesUnitTest.java rename to java-dates/src/test/java/com/baeldung/dst/DaylightSavingTimeJavaTimeExamplesUnitTest.java diff --git a/core-java-9/src/test/java/com/baeldung/java9/datetime/DateToLocalDateConverterTest.java b/java-dates/src/test/java/com/baeldung/java9/datetime/DateToLocalDateConverterUnitTest.java similarity index 98% rename from core-java-9/src/test/java/com/baeldung/java9/datetime/DateToLocalDateConverterTest.java rename to java-dates/src/test/java/com/baeldung/java9/datetime/DateToLocalDateConverterUnitTest.java index ab69bba359..f7f07500f1 100644 --- a/core-java-9/src/test/java/com/baeldung/java9/datetime/DateToLocalDateConverterTest.java +++ b/java-dates/src/test/java/com/baeldung/java9/datetime/DateToLocalDateConverterUnitTest.java @@ -20,7 +20,7 @@ import com.baeldung.java9.datetime.DateToLocalDateConverter; * @author abialas * */ -public class DateToLocalDateConverterTest { +public class DateToLocalDateConverterUnitTest { @Test public void shouldReturn10thNovember2010WhenConvertViaInstant() { diff --git a/core-java-9/src/test/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverterTest.java b/java-dates/src/test/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverterUnitTest.java similarity index 98% rename from core-java-9/src/test/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverterTest.java rename to java-dates/src/test/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverterUnitTest.java index 97c70ee5ac..9ad29ea673 100644 --- a/core-java-9/src/test/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverterTest.java +++ b/java-dates/src/test/java/com/baeldung/java9/datetime/DateToLocalDateTimeConverterUnitTest.java @@ -20,7 +20,7 @@ import com.baeldung.java9.datetime.DateToLocalDateTimeConverter; * @author abialas * */ -public class DateToLocalDateTimeConverterTest { +public class DateToLocalDateTimeConverterUnitTest { @Test public void shouldReturn10thNovember2010time8hour20minWhenConvertViaInstant() { diff --git a/core-java-9/src/test/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverterTest.java b/java-dates/src/test/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverterUnitTest.java similarity index 97% rename from core-java-9/src/test/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverterTest.java rename to java-dates/src/test/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverterUnitTest.java index 2c6898381f..e5a541c546 100644 --- a/core-java-9/src/test/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverterTest.java +++ b/java-dates/src/test/java/com/baeldung/java9/datetime/LocalDateTimeToDateConverterUnitTest.java @@ -18,7 +18,7 @@ import org.junit.Test; * @author abialas * */ -public class LocalDateTimeToDateConverterTest { +public class LocalDateTimeToDateConverterUnitTest { @Test public void shouldReturn10thNovember2010time8hour20minWhenConvertViaInstant() { diff --git a/core-java-9/src/test/java/com/baeldung/java9/datetime/LocalDateToDateConverterTest.java b/java-dates/src/test/java/com/baeldung/java9/datetime/LocalDateToDateConverterUnitTest.java similarity index 96% rename from core-java-9/src/test/java/com/baeldung/java9/datetime/LocalDateToDateConverterTest.java rename to java-dates/src/test/java/com/baeldung/java9/datetime/LocalDateToDateConverterUnitTest.java index 7f20d5d2d2..4e4dd20f2f 100644 --- a/core-java-9/src/test/java/com/baeldung/java9/datetime/LocalDateToDateConverterTest.java +++ b/java-dates/src/test/java/com/baeldung/java9/datetime/LocalDateToDateConverterUnitTest.java @@ -18,7 +18,7 @@ import org.junit.Test; * @author abialas * */ -public class LocalDateToDateConverterTest { +public class LocalDateToDateConverterUnitTest { @Test public void shouldReturn10thNovember2010WhenConvertViaInstant() { diff --git a/core-java-9/src/test/java/com/baeldung/java9/time/TimeApiTest.java b/java-dates/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java similarity index 96% rename from core-java-9/src/test/java/com/baeldung/java9/time/TimeApiTest.java rename to java-dates/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java index a024db19a8..acf9a376f2 100644 --- a/core-java-9/src/test/java/com/baeldung/java9/time/TimeApiTest.java +++ b/java-dates/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java @@ -8,7 +8,7 @@ import java.util.List; import static org.junit.Assert.assertEquals; import org.junit.Test; -public class TimeApiTest { +public class TimeApiUnitTest { @Test public void givenGetDatesBetweenWithUsingJava7_WhenStartEndDate_thenDatesList() { @@ -18,7 +18,7 @@ public class TimeApiTest { Date endDate = endCalendar.getTime(); List dates = TimeApi.getDatesBetweenUsingJava7(startDate, endDate); - assertEquals(dates.size(), 2); + assertEquals(dates.size(), 3); Calendar calendar = Calendar.getInstance(); Date date1 = calendar.getTime(); diff --git a/libraries/src/test/java/com/baeldung/jodatime/JodaTimeUnitTest.java b/java-dates/src/test/java/com/baeldung/jodatime/JodaTimeUnitTest.java similarity index 100% rename from libraries/src/test/java/com/baeldung/jodatime/JodaTimeUnitTest.java rename to java-dates/src/test/java/com/baeldung/jodatime/JodaTimeUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/regexp/datepattern/FormattedDateMatcherUnitTest.java b/java-dates/src/test/java/com/baeldung/regexp/datepattern/FormattedDateMatcherUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/regexp/datepattern/FormattedDateMatcherUnitTest.java rename to java-dates/src/test/java/com/baeldung/regexp/datepattern/FormattedDateMatcherUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/regexp/datepattern/RangedDateMatcherUnitTest.java b/java-dates/src/test/java/com/baeldung/regexp/datepattern/RangedDateMatcherUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/regexp/datepattern/RangedDateMatcherUnitTest.java rename to java-dates/src/test/java/com/baeldung/regexp/datepattern/RangedDateMatcherUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcherUnitTest.java b/java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcherUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcherUnitTest.java rename to java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/February29thMatcherUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcherUnitTest.java b/java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcherUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcherUnitTest.java rename to java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/FebruaryGeneralMatcherUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcherUnitTest.java b/java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcherUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcherUnitTest.java rename to java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/GregorianDateMatcherUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcherUnitTest.java b/java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcherUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcherUnitTest.java rename to java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf30DaysMatcherUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcherUnitTest.java b/java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcherUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcherUnitTest.java rename to java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/MonthsOf31DaysMatcherUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/testhelper/GregorianDateTestHelper.java b/java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/testhelper/GregorianDateTestHelper.java similarity index 100% rename from core-java/src/test/java/com/baeldung/regexp/datepattern/gregorian/testhelper/GregorianDateTestHelper.java rename to java-dates/src/test/java/com/baeldung/regexp/datepattern/gregorian/testhelper/GregorianDateTestHelper.java diff --git a/core-java-8/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterUnitTest.java b/java-dates/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterUnitTest.java rename to java-dates/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/temporaladjusters/TemporalAdjustersUnitTest.java b/java-dates/src/test/java/com/baeldung/temporaladjusters/TemporalAdjustersUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/temporaladjusters/TemporalAdjustersUnitTest.java rename to java-dates/src/test/java/com/baeldung/temporaladjusters/TemporalAdjustersUnitTest.java diff --git a/java-dates/src/test/resources/.gitignore b/java-dates/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/java-dates/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/libraries/README.md b/libraries/README.md index aed808420e..aad3a644ad 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -35,7 +35,6 @@ - [Introduction to Eclipse Collections](http://www.baeldung.com/eclipse-collections) - [DistinctBy in Java Stream API](http://www.baeldung.com/java-streams-distinct-by) - [Introduction to Apache Commons CSV](http://www.baeldung.com/apache-commons-csv) -- [Difference Between Two Dates in Java](http://www.baeldung.com/java-date-difference) - [Introduction to NoException](http://www.baeldung.com/no-exception) - [Apache Commons IO](http://www.baeldung.com/apache-commons-io) - [Introduction to Conflict-Free Replicated Data Types](http://www.baeldung.com/java-conflict-free-replicated-data-types) diff --git a/libraries/pom.xml b/libraries/pom.xml index 7402d88ef3..6b1f842aeb 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -481,17 +481,6 @@ logging-interceptor ${logging-interceptor.version} - - com.darwinsys - hirondelle-date4j - RELEASE - test - - - joda-time - joda-time - ${joda-time.version} - com.darwinsys hirondelle-date4j From 1613d216563fa0ab5fe8b5f915b37e5b396b832c Mon Sep 17 00:00:00 2001 From: DOHA Date: Sat, 25 Aug 2018 20:16:30 +0300 Subject: [PATCH 280/298] lucene analyzers --- lucene/pom.xml | 8 +- .../baeldung/lucene/InMemoryLuceneIndex.java | 6 +- .../com/baeldung/lucene/MyCustomAnalyzer.java | 26 ++++ .../lucene/LuceneAnalyzerIntegrationTest.java | 147 ++++++++++++++++++ 4 files changed, 183 insertions(+), 4 deletions(-) create mode 100644 lucene/src/main/java/com/baeldung/lucene/MyCustomAnalyzer.java create mode 100644 lucene/src/test/java/com/baeldung/lucene/LuceneAnalyzerIntegrationTest.java diff --git a/lucene/pom.xml b/lucene/pom.xml index a3960f6059..f427cfd8a7 100644 --- a/lucene/pom.xml +++ b/lucene/pom.xml @@ -23,6 +23,12 @@ lucene-queryparser ${lucene.version} + + org.apache.lucene + lucene-analyzers-common + ${lucene.version} + + @@ -32,7 +38,7 @@ 1.0.0.Final 1.16.10.0 - 7.1.0 + 7.4.0 \ No newline at end of file diff --git a/lucene/src/main/java/com/baeldung/lucene/InMemoryLuceneIndex.java b/lucene/src/main/java/com/baeldung/lucene/InMemoryLuceneIndex.java index 97b1ec7b5d..8a31d3cb5b 100644 --- a/lucene/src/main/java/com/baeldung/lucene/InMemoryLuceneIndex.java +++ b/lucene/src/main/java/com/baeldung/lucene/InMemoryLuceneIndex.java @@ -4,7 +4,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.SortedDocValuesField; @@ -27,9 +27,9 @@ import org.apache.lucene.util.BytesRef; public class InMemoryLuceneIndex { private Directory memoryIndex; - private StandardAnalyzer analyzer; + private Analyzer analyzer; - public InMemoryLuceneIndex(Directory memoryIndex, StandardAnalyzer analyzer) { + public InMemoryLuceneIndex(Directory memoryIndex, Analyzer analyzer) { super(); this.memoryIndex = memoryIndex; this.analyzer = analyzer; diff --git a/lucene/src/main/java/com/baeldung/lucene/MyCustomAnalyzer.java b/lucene/src/main/java/com/baeldung/lucene/MyCustomAnalyzer.java new file mode 100644 index 0000000000..609e2d09d3 --- /dev/null +++ b/lucene/src/main/java/com/baeldung/lucene/MyCustomAnalyzer.java @@ -0,0 +1,26 @@ +package com.baeldung.lucene; + +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.LowerCaseFilter; +import org.apache.lucene.analysis.StopFilter; +import org.apache.lucene.analysis.TokenStream; +import org.apache.lucene.analysis.en.PorterStemFilter; +import org.apache.lucene.analysis.miscellaneous.CapitalizationFilter; +import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis.standard.StandardFilter; +import org.apache.lucene.analysis.standard.StandardTokenizer; + +public class MyCustomAnalyzer extends Analyzer{ + + @Override + protected TokenStreamComponents createComponents(String fieldName) { + final StandardTokenizer src = new StandardTokenizer(); + TokenStream result = new StandardFilter(src); + result = new LowerCaseFilter(result); + result = new StopFilter(result, StandardAnalyzer.STOP_WORDS_SET); + result = new PorterStemFilter(result); + result = new CapitalizationFilter(result); + return new TokenStreamComponents(src, result); + } + +} diff --git a/lucene/src/test/java/com/baeldung/lucene/LuceneAnalyzerIntegrationTest.java b/lucene/src/test/java/com/baeldung/lucene/LuceneAnalyzerIntegrationTest.java new file mode 100644 index 0000000000..28a87bba8c --- /dev/null +++ b/lucene/src/test/java/com/baeldung/lucene/LuceneAnalyzerIntegrationTest.java @@ -0,0 +1,147 @@ +package com.baeldung.lucene; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.collection.IsIterableContainingInOrder.contains; +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.TokenStream; +import org.apache.lucene.analysis.core.KeywordAnalyzer; +import org.apache.lucene.analysis.core.SimpleAnalyzer; +import org.apache.lucene.analysis.core.StopAnalyzer; +import org.apache.lucene.analysis.core.WhitespaceAnalyzer; +import org.apache.lucene.analysis.custom.CustomAnalyzer; +import org.apache.lucene.analysis.en.EnglishAnalyzer; +import org.apache.lucene.analysis.miscellaneous.PerFieldAnalyzerWrapper; +import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; +import org.apache.lucene.document.Document; +import org.apache.lucene.index.Term; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.store.RAMDirectory; +import org.junit.Test; + +public class LuceneAnalyzerIntegrationTest { + + private static final String SAMPLE_TEXT = "This is baeldung.com Lucene Analyzers test"; + private static final String FIELD_NAME = "sampleName"; + + @Test + public void whenUseStandardAnalyzer_thenAnalyzed() throws IOException { + List result = analyze(SAMPLE_TEXT, new StandardAnalyzer()); + + assertThat(result, contains("baeldung.com", "lucene", "analyzers", "test")); + } + + @Test + public void whenUseStopAnalyzer_thenAnalyzed() throws IOException { + List result = analyze(SAMPLE_TEXT, new StopAnalyzer()); + + assertThat(result, contains("baeldung", "com", "lucene", "analyzers", "test")); + } + + @Test + public void whenUseSimpleAnalyzer_thenAnalyzed() throws IOException { + List result = analyze(SAMPLE_TEXT, new SimpleAnalyzer()); + + assertThat(result, contains("this", "is", "baeldung", "com", "lucene", "analyzers", "test")); + } + + @Test + public void whenUseWhiteSpaceAnalyzer_thenAnalyzed() throws IOException { + List result = analyze(SAMPLE_TEXT, new WhitespaceAnalyzer()); + + assertThat(result, contains("This", "is", "baeldung.com", "Lucene", "Analyzers", "test")); + } + + @Test + public void whenUseKeywordAnalyzer_thenAnalyzed() throws IOException { + List result = analyze(SAMPLE_TEXT, new KeywordAnalyzer()); + + assertThat(result, contains("This is baeldung.com Lucene Analyzers test")); + } + + @Test + public void whenUseEnglishAnalyzer_thenAnalyzed() throws IOException { + List result = analyze(SAMPLE_TEXT, new EnglishAnalyzer()); + + assertThat(result, contains("baeldung.com", "lucen", "analyz", "test")); + } + + @Test + public void whenUseCustomAnalyzerBuilder_thenAnalyzed() throws IOException { + Analyzer analyzer = CustomAnalyzer.builder() + .withTokenizer("standard") + .addTokenFilter("lowercase") + .addTokenFilter("stop") + .addTokenFilter("porterstem") + .addTokenFilter("capitalization") + .build(); + List result = analyze(SAMPLE_TEXT, analyzer); + + assertThat(result, contains("Baeldung.com", "Lucen", "Analyz", "Test")); + } + + @Test + public void whenUseCustomAnalyzer_thenAnalyzed() throws IOException { + List result = analyze(SAMPLE_TEXT, new MyCustomAnalyzer()); + + assertThat(result, contains("Baeldung.com", "Lucen", "Analyz", "Test")); + } + + // ================= usage example + + @Test + public void givenTermQuery_whenUseCustomAnalyzer_thenCorrect() { + InMemoryLuceneIndex luceneIndex = new InMemoryLuceneIndex(new RAMDirectory(), new MyCustomAnalyzer()); + luceneIndex.indexDocument("introduction", "introduction to lucene"); + luceneIndex.indexDocument("analyzers", "guide to lucene analyzers"); + Query query = new TermQuery(new Term("body", "Introduct")); + + List documents = luceneIndex.searchIndex(query); + assertEquals(1, documents.size()); + } + + @Test + public void givenTermQuery_whenUsePerFieldAnalyzerWrapper_thenCorrect() { + Map analyzerMap = new HashMap<>(); + analyzerMap.put("title", new MyCustomAnalyzer()); + analyzerMap.put("body", new EnglishAnalyzer()); + + PerFieldAnalyzerWrapper wrapper = + new PerFieldAnalyzerWrapper(new StandardAnalyzer(), analyzerMap); + InMemoryLuceneIndex luceneIndex = new InMemoryLuceneIndex(new RAMDirectory(), wrapper); + luceneIndex.indexDocument("introduction", "introduction to lucene"); + luceneIndex.indexDocument("analyzers", "guide to lucene analyzers"); + + Query query = new TermQuery(new Term("body", "introduct")); + List documents = luceneIndex.searchIndex(query); + assertEquals(1, documents.size()); + + query = new TermQuery(new Term("title", "Introduct")); + + documents = luceneIndex.searchIndex(query); + assertEquals(1, documents.size()); + } + + // =================================================================== + + public List analyze(String text, Analyzer analyzer) throws IOException { + List result = new ArrayList(); + TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, text); + CharTermAttribute attr = tokenStream.addAttribute(CharTermAttribute.class); + tokenStream.reset(); + while (tokenStream.incrementToken()) { + result.add(attr.toString()); + } + return result; + } + +} From aa8afa5b6e9cb06655e3fd7eab2e55cad0b483ec Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 25 Aug 2018 20:36:12 +0300 Subject: [PATCH 281/298] fix package, fix get random node --- .../java/com/baeldung/algorithms/mcts/montecarlo/State.java | 2 +- .../src/main/java/com/baeldung/algorithms/mcts/tree/Node.java | 2 +- .../algorithms/AntColonyOptimizationLongRunningUnitTest.java | 2 +- .../algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java | 2 +- .../algorithms/DijkstraAlgorithmLongRunningUnitTest.java | 2 +- .../baeldung}/algorithms/HillClimbingAlgorithmUnitTest.java | 2 +- .../baeldung}/algorithms/MiddleElementLookupUnitTest.java | 2 +- .../algorithms/RtFiniteStateMachineLongRunningUnitTest.java | 2 +- .../algorithms/SimulatedAnnealingLongRunningUnitTest.java | 2 +- .../baeldung}/algorithms/StringSearchAlgorithmsUnitTest.java | 2 +- .../baeldung}/algorithms/binarysearch/BinarySearchUnitTest.java | 2 +- .../java/{ => com/baeldung}/algorithms/mcts/MCTSUnitTest.java | 2 +- .../{ => com/baeldung}/algorithms/minimax/MinimaxUnitTest.java | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/AntColonyOptimizationLongRunningUnitTest.java (94%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java (92%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/DijkstraAlgorithmLongRunningUnitTest.java (98%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/HillClimbingAlgorithmUnitTest.java (98%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/MiddleElementLookupUnitTest.java (99%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/RtFiniteStateMachineLongRunningUnitTest.java (98%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/SimulatedAnnealingLongRunningUnitTest.java (90%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/StringSearchAlgorithmsUnitTest.java (94%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/binarysearch/BinarySearchUnitTest.java (95%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/mcts/MCTSUnitTest.java (98%) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/minimax/MinimaxUnitTest.java (95%) diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java b/algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java index d855f775a8..5d4b265500 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java +++ b/algorithms/src/main/java/com/baeldung/algorithms/mcts/montecarlo/State.java @@ -87,7 +87,7 @@ public class State { void randomPlay() { List availablePositions = this.board.getEmptyPositions(); int totalPossibilities = availablePositions.size(); - int selectRandom = (int) (Math.random() * ((totalPossibilities - 1) + 1)); + int selectRandom = (int) (Math.random() * totalPossibilities); this.board.performMove(this.playerNo, availablePositions.get(selectRandom)); } diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java b/algorithms/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java index 20f9e992b5..0ad6510e50 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java +++ b/algorithms/src/main/java/com/baeldung/algorithms/mcts/tree/Node.java @@ -65,7 +65,7 @@ public class Node { public Node getRandomChildNode() { int noOfPossibleMoves = this.childArray.size(); - int selectRandom = (int) (Math.random() * ((noOfPossibleMoves - 1) + 1)); + int selectRandom = (int) (Math.random() * noOfPossibleMoves); return this.childArray.get(selectRandom); } diff --git a/algorithms/src/test/java/algorithms/AntColonyOptimizationLongRunningUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/AntColonyOptimizationLongRunningUnitTest.java similarity index 94% rename from algorithms/src/test/java/algorithms/AntColonyOptimizationLongRunningUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/AntColonyOptimizationLongRunningUnitTest.java index b0218ae23e..2ac7adc3aa 100644 --- a/algorithms/src/test/java/algorithms/AntColonyOptimizationLongRunningUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/AntColonyOptimizationLongRunningUnitTest.java @@ -1,4 +1,4 @@ -package algorithms; +package com.baeldung.algorithms; import org.junit.Assert; import org.junit.Test; diff --git a/algorithms/src/test/java/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java similarity index 92% rename from algorithms/src/test/java/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java index fa8ecdee77..e819da4b36 100644 --- a/algorithms/src/test/java/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/BinaryGeneticAlgorithmLongRunningUnitTest.java @@ -1,4 +1,4 @@ -package algorithms; +package com.baeldung.algorithms; import org.junit.Assert; import org.junit.Test; diff --git a/algorithms/src/test/java/algorithms/DijkstraAlgorithmLongRunningUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/DijkstraAlgorithmLongRunningUnitTest.java similarity index 98% rename from algorithms/src/test/java/algorithms/DijkstraAlgorithmLongRunningUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/DijkstraAlgorithmLongRunningUnitTest.java index 68386278fc..bbc4d4f398 100644 --- a/algorithms/src/test/java/algorithms/DijkstraAlgorithmLongRunningUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/DijkstraAlgorithmLongRunningUnitTest.java @@ -1,4 +1,4 @@ -package algorithms; +package com.baeldung.algorithms; import org.junit.Test; diff --git a/algorithms/src/test/java/algorithms/HillClimbingAlgorithmUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/HillClimbingAlgorithmUnitTest.java similarity index 98% rename from algorithms/src/test/java/algorithms/HillClimbingAlgorithmUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/HillClimbingAlgorithmUnitTest.java index e4746b521c..e817d195b3 100644 --- a/algorithms/src/test/java/algorithms/HillClimbingAlgorithmUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/HillClimbingAlgorithmUnitTest.java @@ -1,4 +1,4 @@ -package algorithms; +package com.baeldung.algorithms; import com.baeldung.algorithms.hillclimbing.HillClimbing; import com.baeldung.algorithms.hillclimbing.State; diff --git a/algorithms/src/test/java/algorithms/MiddleElementLookupUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/MiddleElementLookupUnitTest.java similarity index 99% rename from algorithms/src/test/java/algorithms/MiddleElementLookupUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/MiddleElementLookupUnitTest.java index 01f9ca2f76..2cda0ccb36 100644 --- a/algorithms/src/test/java/algorithms/MiddleElementLookupUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/MiddleElementLookupUnitTest.java @@ -1,4 +1,4 @@ -package algorithms; +package com.baeldung.algorithms; import com.baeldung.algorithms.middleelementlookup.MiddleElementLookup; import com.baeldung.algorithms.middleelementlookup.Node; diff --git a/algorithms/src/test/java/algorithms/RtFiniteStateMachineLongRunningUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/RtFiniteStateMachineLongRunningUnitTest.java similarity index 98% rename from algorithms/src/test/java/algorithms/RtFiniteStateMachineLongRunningUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/RtFiniteStateMachineLongRunningUnitTest.java index 99e962773f..fddccfcd9f 100644 --- a/algorithms/src/test/java/algorithms/RtFiniteStateMachineLongRunningUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/RtFiniteStateMachineLongRunningUnitTest.java @@ -1,4 +1,4 @@ -package algorithms; +package com.baeldung.algorithms; import com.baeldung.algorithms.automata.*; import org.junit.Test; diff --git a/algorithms/src/test/java/algorithms/SimulatedAnnealingLongRunningUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/SimulatedAnnealingLongRunningUnitTest.java similarity index 90% rename from algorithms/src/test/java/algorithms/SimulatedAnnealingLongRunningUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/SimulatedAnnealingLongRunningUnitTest.java index 6ee129ece9..2ce7d75e43 100644 --- a/algorithms/src/test/java/algorithms/SimulatedAnnealingLongRunningUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/SimulatedAnnealingLongRunningUnitTest.java @@ -1,4 +1,4 @@ -package algorithms; +package com.baeldung.algorithms; import org.junit.Assert; import org.junit.Test; diff --git a/algorithms/src/test/java/algorithms/StringSearchAlgorithmsUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java similarity index 94% rename from algorithms/src/test/java/algorithms/StringSearchAlgorithmsUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java index c98a8a53f3..dfe015aad2 100755 --- a/algorithms/src/test/java/algorithms/StringSearchAlgorithmsUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/StringSearchAlgorithmsUnitTest.java @@ -1,4 +1,4 @@ -package algorithms; +package com.baeldung.algorithms; import org.junit.Assert; diff --git a/algorithms/src/test/java/algorithms/binarysearch/BinarySearchUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java similarity index 95% rename from algorithms/src/test/java/algorithms/binarysearch/BinarySearchUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java index 74db4236b9..826682d373 100644 --- a/algorithms/src/test/java/algorithms/binarysearch/BinarySearchUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/binarysearch/BinarySearchUnitTest.java @@ -1,4 +1,4 @@ -package algorithms.binarysearch; +package com.baeldung.algorithms.binarysearch; import java.util.Arrays; import java.util.List; diff --git a/algorithms/src/test/java/algorithms/mcts/MCTSUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java similarity index 98% rename from algorithms/src/test/java/algorithms/mcts/MCTSUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java index edbf21390d..59afed65de 100644 --- a/algorithms/src/test/java/algorithms/mcts/MCTSUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/mcts/MCTSUnitTest.java @@ -1,4 +1,4 @@ -package algorithms.mcts; +package com.baeldung.algorithms.mcts; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/algorithms/src/test/java/algorithms/minimax/MinimaxUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/minimax/MinimaxUnitTest.java similarity index 95% rename from algorithms/src/test/java/algorithms/minimax/MinimaxUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/minimax/MinimaxUnitTest.java index c07975bca0..59f0fcf053 100644 --- a/algorithms/src/test/java/algorithms/minimax/MinimaxUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/minimax/MinimaxUnitTest.java @@ -1,4 +1,4 @@ -package algorithms.minimax; +package com.baeldung.algorithms.minimax; import org.junit.Before; import org.junit.Test; From e0e6fbad2bc6994035d7ab7844e406b7bc323899 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 25 Aug 2018 21:37:48 +0300 Subject: [PATCH 282/298] update neo4j --- persistence-modules/spring-data-neo4j/pom.xml | 35 ++++++------------- .../MovieDatabaseNeo4jConfiguration.java | 6 ++-- .../MovieDatabaseNeo4jTestConfiguration.java | 16 +++++---- .../spring/data/neo4j/domain/Car.java | 5 +-- .../spring/data/neo4j/domain/Movie.java | 6 ++-- .../spring/data/neo4j/domain/Person.java | 6 ++-- .../spring/data/neo4j/domain/Role.java | 7 ++-- .../MovieRepository.java | 6 ++-- .../neo4j/repository/PersonRepository.java | 9 +++++ .../neo4j/repostory/PersonRepository.java | 9 ----- .../data/neo4j/services/MovieService.java | 3 +- .../com/baeldung/neo4j/Neo4jOgmLiveTest.java | 4 +-- .../neo4j/MovieRepositoryIntegrationTest.java | 9 ++--- 13 files changed, 59 insertions(+), 62 deletions(-) rename persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/{repostory => repository}/MovieRepository.java (78%) create mode 100644 persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repository/PersonRepository.java delete mode 100644 persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repostory/PersonRepository.java diff --git a/persistence-modules/spring-data-neo4j/pom.xml b/persistence-modules/spring-data-neo4j/pom.xml index 923d877fd7..bd7d783646 100644 --- a/persistence-modules/spring-data-neo4j/pom.xml +++ b/persistence-modules/spring-data-neo4j/pom.xml @@ -37,18 +37,6 @@ org.springframework.data spring-data-neo4j ${spring-data-neo4j.version} - - - commons-logging - commons-logging - - - - - org.springframework.data - spring-data-neo4j - ${spring-data-neo4j.version} - test-jar com.voodoodyne.jackson.jsog @@ -86,6 +74,11 @@ ${neo4j-ogm.version} test + + org.neo4j + neo4j-ogm-embedded-driver + ${neo4j-ogm.version} + org.neo4j.test neo4j-harness @@ -96,23 +89,17 @@ org.springframework spring-test ${spring-test.version} - - - commons-logging - commons-logging - - - 1.1.1 - 3.1.0 - 4.1.6.RELEASE + 1.6.2 + 3.4.6 + 5.0.1.RELEASE 1.1 - 1.5.13.RELEASE - 4.3.17.RELEASE - 2.1.1 + 2.0.1.RELEASE + 5.0.1.RELEASE + 3.1.2 diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/config/MovieDatabaseNeo4jConfiguration.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/config/MovieDatabaseNeo4jConfiguration.java index 344282d665..9bbc571aee 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/config/MovieDatabaseNeo4jConfiguration.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/config/MovieDatabaseNeo4jConfiguration.java @@ -1,5 +1,6 @@ package com.baeldung.spring.data.neo4j.config; +import org.neo4j.ogm.config.Configuration.Builder; import org.neo4j.ogm.session.SessionFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -8,15 +9,14 @@ import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; @ComponentScan(basePackages = { "com.baeldung.spring.data.neo4j.services" }) @Configuration -@EnableNeo4jRepositories(basePackages = "com.baeldung.spring.data.neo4j.repostory") +@EnableNeo4jRepositories(basePackages = "com.baeldung.spring.data.neo4j.repository") public class MovieDatabaseNeo4jConfiguration { public static final String URL = System.getenv("NEO4J_URL") != null ? System.getenv("NEO4J_URL") : "http://neo4j:movies@localhost:7474"; @Bean public org.neo4j.ogm.config.Configuration getConfiguration() { - org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration(); - config.driverConfiguration().setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver").setURI(URL); + org.neo4j.ogm.config.Configuration config = new Builder().uri(URL).build(); return config; } diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/config/MovieDatabaseNeo4jTestConfiguration.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/config/MovieDatabaseNeo4jTestConfiguration.java index fda478e5be..a4cbe4b809 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/config/MovieDatabaseNeo4jTestConfiguration.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/config/MovieDatabaseNeo4jTestConfiguration.java @@ -1,26 +1,25 @@ package com.baeldung.spring.data.neo4j.config; +import org.neo4j.ogm.config.Configuration.Builder; import org.neo4j.ogm.session.SessionFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; -import org.springframework.data.neo4j.config.Neo4jConfiguration; import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; +import org.springframework.data.neo4j.transaction.Neo4jTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @EnableTransactionManagement @ComponentScan(basePackages = { "com.baeldung.spring.data.neo4j.services" }) -@EnableNeo4jRepositories(basePackages = "com.baeldung.spring.data.neo4j.repostory") +@EnableNeo4jRepositories(basePackages = "com.baeldung.spring.data.neo4j.repository") @Profile({ "embedded", "test" }) -public class MovieDatabaseNeo4jTestConfiguration extends Neo4jConfiguration { +public class MovieDatabaseNeo4jTestConfiguration { @Bean public org.neo4j.ogm.config.Configuration getConfiguration() { - final org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration(); - config.driverConfiguration() - .setDriverClassName("org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver"); + org.neo4j.ogm.config.Configuration config = new Builder().build(); return config; } @@ -28,5 +27,10 @@ public class MovieDatabaseNeo4jTestConfiguration extends Neo4jConfiguration { public SessionFactory getSessionFactory() { return new SessionFactory(getConfiguration(), "com.baeldung.spring.data.neo4j.domain"); } + + @Bean + public Neo4jTransactionManager transactionManager() { + return new Neo4jTransactionManager(getSessionFactory()); + } } diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Car.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Car.java index f2325a334f..ede56bd02e 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Car.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Car.java @@ -1,12 +1,13 @@ package com.baeldung.spring.data.neo4j.domain; -import org.neo4j.ogm.annotation.GraphId; +import org.neo4j.ogm.annotation.GeneratedValue; +import org.neo4j.ogm.annotation.Id; import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.Relationship; @NodeEntity public class Car { - @GraphId + @Id @GeneratedValue private Long id; private String make; diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Movie.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Movie.java index 029754c0fc..288a261597 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Movie.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Movie.java @@ -2,7 +2,9 @@ package com.baeldung.spring.data.neo4j.domain; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.voodoodyne.jackson.jsog.JSOGGenerator; -import org.neo4j.ogm.annotation.GraphId; + +import org.neo4j.ogm.annotation.GeneratedValue; +import org.neo4j.ogm.annotation.Id; import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.Relationship; @@ -13,7 +15,7 @@ import java.util.List; @NodeEntity public class Movie { - @GraphId + @Id @GeneratedValue Long id; private String title; diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Person.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Person.java index dc5a850f29..10add9ad44 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Person.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Person.java @@ -2,7 +2,9 @@ package com.baeldung.spring.data.neo4j.domain; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.voodoodyne.jackson.jsog.JSOGGenerator; -import org.neo4j.ogm.annotation.GraphId; + +import org.neo4j.ogm.annotation.GeneratedValue; +import org.neo4j.ogm.annotation.Id; import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.Relationship; @@ -11,7 +13,7 @@ import java.util.List; @JsonIdentityInfo(generator = JSOGGenerator.class) @NodeEntity public class Person { - @GraphId + @Id @GeneratedValue Long id; private String name; diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Role.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Role.java index 40dabb054b..b0aed6026e 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Role.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Role.java @@ -3,7 +3,8 @@ package com.baeldung.spring.data.neo4j.domain; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.voodoodyne.jackson.jsog.JSOGGenerator; import org.neo4j.ogm.annotation.EndNode; -import org.neo4j.ogm.annotation.GraphId; +import org.neo4j.ogm.annotation.GeneratedValue; +import org.neo4j.ogm.annotation.Id; import org.neo4j.ogm.annotation.RelationshipEntity; import org.neo4j.ogm.annotation.StartNode; @@ -12,8 +13,8 @@ import java.util.Collection; @JsonIdentityInfo(generator = JSOGGenerator.class) @RelationshipEntity(type = "ACTED_IN") public class Role { - @GraphId - Long id; + @Id @GeneratedValue + Long id; private Collection roles; @StartNode private Person person; diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repostory/MovieRepository.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repository/MovieRepository.java similarity index 78% rename from persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repostory/MovieRepository.java rename to persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repository/MovieRepository.java index afb82551e7..dde946ea73 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repostory/MovieRepository.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repository/MovieRepository.java @@ -1,8 +1,8 @@ -package com.baeldung.spring.data.neo4j.repostory; +package com.baeldung.spring.data.neo4j.repository; import com.baeldung.spring.data.neo4j.domain.Movie; import org.springframework.data.neo4j.annotation.Query; -import org.springframework.data.neo4j.repository.GraphRepository; +import org.springframework.data.neo4j.repository.Neo4jRepository; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @@ -11,7 +11,7 @@ import java.util.List; import java.util.Map; @Repository -public interface MovieRepository extends GraphRepository { +public interface MovieRepository extends Neo4jRepository { Movie findByTitle(@Param("title") String title); diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repository/PersonRepository.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repository/PersonRepository.java new file mode 100644 index 0000000000..22094d26b6 --- /dev/null +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repository/PersonRepository.java @@ -0,0 +1,9 @@ +package com.baeldung.spring.data.neo4j.repository; + +import com.baeldung.spring.data.neo4j.domain.Person; +import org.springframework.data.neo4j.repository.Neo4jRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface PersonRepository extends Neo4jRepository { +} diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repostory/PersonRepository.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repostory/PersonRepository.java deleted file mode 100644 index 4ac40ef75b..0000000000 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/repostory/PersonRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.spring.data.neo4j.repostory; - -import com.baeldung.spring.data.neo4j.domain.Person; -import org.springframework.data.neo4j.repository.GraphRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface PersonRepository extends GraphRepository { -} diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/services/MovieService.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/services/MovieService.java index ae1f6eb8e5..086bf48bfa 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/services/MovieService.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/services/MovieService.java @@ -1,10 +1,11 @@ package com.baeldung.spring.data.neo4j.services; -import com.baeldung.spring.data.neo4j.repostory.MovieRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.baeldung.spring.data.neo4j.repository.MovieRepository; + import java.util.*; @Service diff --git a/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/neo4j/Neo4jOgmLiveTest.java b/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/neo4j/Neo4jOgmLiveTest.java index 06b31667dd..1724361324 100644 --- a/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/neo4j/Neo4jOgmLiveTest.java +++ b/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/neo4j/Neo4jOgmLiveTest.java @@ -12,14 +12,12 @@ import org.neo4j.ogm.session.SessionFactory; import com.baeldung.spring.data.neo4j.domain.Car; import com.baeldung.spring.data.neo4j.domain.Company; -import org.neo4j.ogm.transaction.Transaction; public class Neo4jOgmLiveTest { @Test public void testOgm() { - Configuration conf = new Configuration(); - conf.driverConfiguration().setDriverClassName("org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver"); + Configuration conf =new Configuration.Builder().build(); SessionFactory factory = new SessionFactory(conf, "com.baeldung.spring.data.neo4j.domain"); Session session = factory.openSession(); diff --git a/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/spring/data/neo4j/MovieRepositoryIntegrationTest.java b/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/spring/data/neo4j/MovieRepositoryIntegrationTest.java index 95bc38aafc..3d9215f32f 100644 --- a/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/spring/data/neo4j/MovieRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/spring/data/neo4j/MovieRepositoryIntegrationTest.java @@ -4,8 +4,9 @@ import com.baeldung.spring.data.neo4j.config.MovieDatabaseNeo4jTestConfiguration import com.baeldung.spring.data.neo4j.domain.Movie; import com.baeldung.spring.data.neo4j.domain.Person; import com.baeldung.spring.data.neo4j.domain.Role; -import com.baeldung.spring.data.neo4j.repostory.MovieRepository; -import com.baeldung.spring.data.neo4j.repostory.PersonRepository; +import com.baeldung.spring.data.neo4j.repository.MovieRepository; +import com.baeldung.spring.data.neo4j.repository.PersonRepository; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -50,10 +51,10 @@ public class MovieRepositoryIntegrationTest { Role charlie = new Role(); charlie.setMovie(italianJob); charlie.setPerson(mark); - Collection roleNames = new HashSet(); + Collection roleNames = new HashSet<>(); roleNames.add("Charlie Croker"); charlie.setRoles(roleNames); - List roles = new ArrayList(); + List roles = new ArrayList<>(); roles.add(charlie); italianJob.setRoles(roles); movieRepository.save(italianJob); From badc8c60d20cae866cf7964b9270010194b5057e Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 25 Aug 2018 21:46:01 +0300 Subject: [PATCH 283/298] fix formatting --- .../main/java/com/baeldung/spring/data/neo4j/domain/Car.java | 2 +- .../main/java/com/baeldung/spring/data/neo4j/domain/Movie.java | 2 +- .../main/java/com/baeldung/spring/data/neo4j/domain/Person.java | 2 +- .../main/java/com/baeldung/spring/data/neo4j/domain/Role.java | 2 +- .../src/test/java/com/baeldung/neo4j/Neo4jOgmLiveTest.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Car.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Car.java index ede56bd02e..455407a92b 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Car.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Car.java @@ -7,7 +7,7 @@ import org.neo4j.ogm.annotation.Relationship; @NodeEntity public class Car { - @Id @GeneratedValue + @Id @GeneratedValue private Long id; private String make; diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Movie.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Movie.java index 288a261597..996a661b07 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Movie.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Movie.java @@ -15,7 +15,7 @@ import java.util.List; @NodeEntity public class Movie { - @Id @GeneratedValue + @Id @GeneratedValue Long id; private String title; diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Person.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Person.java index 10add9ad44..453ca1c3f3 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Person.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Person.java @@ -13,7 +13,7 @@ import java.util.List; @JsonIdentityInfo(generator = JSOGGenerator.class) @NodeEntity public class Person { - @Id @GeneratedValue + @Id @GeneratedValue Long id; private String name; diff --git a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Role.java b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Role.java index b0aed6026e..5a18837dae 100644 --- a/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Role.java +++ b/persistence-modules/spring-data-neo4j/src/main/java/com/baeldung/spring/data/neo4j/domain/Role.java @@ -13,7 +13,7 @@ import java.util.Collection; @JsonIdentityInfo(generator = JSOGGenerator.class) @RelationshipEntity(type = "ACTED_IN") public class Role { - @Id @GeneratedValue + @Id @GeneratedValue Long id; private Collection roles; @StartNode diff --git a/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/neo4j/Neo4jOgmLiveTest.java b/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/neo4j/Neo4jOgmLiveTest.java index 1724361324..96e5e76402 100644 --- a/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/neo4j/Neo4jOgmLiveTest.java +++ b/persistence-modules/spring-data-neo4j/src/test/java/com/baeldung/neo4j/Neo4jOgmLiveTest.java @@ -17,7 +17,7 @@ public class Neo4jOgmLiveTest { @Test public void testOgm() { - Configuration conf =new Configuration.Builder().build(); + Configuration conf = new Configuration.Builder().build(); SessionFactory factory = new SessionFactory(conf, "com.baeldung.spring.data.neo4j.domain"); Session session = factory.openSession(); From c5e1d6f0ef56244f75677b0fc5466d1db422a41a Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 26 Aug 2018 00:49:30 +0530 Subject: [PATCH 284/298] [BAEL-8456] - Moved more articles into 'java-dates' module --- core-java-8/README.md | 6 ------ core-java/README.md | 3 --- java-dates/README.md | 10 +++++++++- .../datetime/DateExtractYearMonthDayIntegerValues.java | 0 .../LocalDateExtractYearMonthDayIntegerValues.java | 0 .../LocalDateTimeExtractYearMonthDayIntegerValues.java | 0 ...OffsetDateTimeExtractYearMonthDayIntegerValues.java | 0 .../ZonedDateTimeExtractYearMonthDayIntegerValues.java | 0 .../com/baeldung/datetime/modify/DateIncrementer.java | 0 .../gregorian/calendar/GregorianCalendarExample.java | 0 .../com/baeldung/timezonedisplay/TimezoneDisplay.java | 0 .../baeldung/timezonedisplay/TimezoneDisplayApp.java | 0 .../baeldung/timezonedisplay/TimezoneDisplayJava7.java | 0 .../timezonedisplay/TimezoneDisplayJava7App.java | 0 .../DateExtractYearMonthDayIntegerValuesUnitTest.java | 0 ...alDateExtractYearMonthDayIntegerValuesUnitTest.java | 0 ...teTimeExtractYearMonthDayIntegerValuesUnitTest.java | 0 ...teTimeExtractYearMonthDayIntegerValuesUnitTest.java | 0 ...teTimeExtractYearMonthDayIntegerValuesUnitTest.java | 0 .../datetime/modify/DateIncrementerUnitTest.java | 0 .../gregorian/calendar/GregorianCalendarTester.java | 0 .../java/com/baeldung/java9/time/TimeApiUnitTest.java | 2 +- .../java/com/baeldung/time/ElapsedTimeUnitTest.java | 0 23 files changed, 10 insertions(+), 11 deletions(-) rename {core-java => java-dates}/src/main/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValues.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValues.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValues.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValues.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValues.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/datetime/modify/DateIncrementer.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/gregorian/calendar/GregorianCalendarExample.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplay.java (100%) rename {core-java-8 => java-dates}/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayApp.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7.java (100%) rename {core-java => java-dates}/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7App.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValuesUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValuesUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValuesUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValuesUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValuesUnitTest.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/datetime/modify/DateIncrementerUnitTest.java (100%) rename {core-java => java-dates}/src/test/java/com/baeldung/gregorian/calendar/GregorianCalendarTester.java (100%) rename {core-java-8 => java-dates}/src/test/java/com/baeldung/time/ElapsedTimeUnitTest.java (100%) diff --git a/core-java-8/README.md b/core-java-8/README.md index 5c740bcba8..4d463482fb 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -18,7 +18,6 @@ - [Finding Max/Min of a List or Collection](http://www.baeldung.com/java-collection-min-max) - [Java Base64 Encoding and Decoding](http://www.baeldung.com/java-base64-encode-and-decode) - [The Difference Between map() and flatMap()](http://www.baeldung.com/java-difference-map-and-flatmap) -- [Display All Time Zones With GMT And UTC in Java](http://www.baeldung.com/java-time-zones) - [Copy a File with Java](http://www.baeldung.com/java-copy-file) - [Static and Default Methods in Interfaces in Java](http://www.baeldung.com/java-static-default-methods) - [Efficient Word Frequency Calculator in Java](http://www.baeldung.com/java-word-frequency) @@ -30,15 +29,10 @@ - [Finding Min/Max in an Array with Java](http://www.baeldung.com/java-array-min-max) - [Internationalization and Localization in Java 8](http://www.baeldung.com/java-8-localization) - [How to Find an Element in a List with Java](http://www.baeldung.com/find-list-element-java) -- [Measure Elapsed Time in Java](http://www.baeldung.com/java-measure-elapsed-time) - [Java Optional – orElse() vs orElseGet()](http://www.baeldung.com/java-optional-or-else-vs-or-else-get) - [An Introduction to Java.util.Hashtable Class](http://www.baeldung.com/java-hash-table) - [Method Parameter Reflection in Java](http://www.baeldung.com/java-parameter-reflection) - [Java 8 Unsigned Arithmetic Support](http://www.baeldung.com/java-unsigned-arithmetic) -- [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end) - [Generalized Target-Type Inference in Java](http://www.baeldung.com/java-generalized-target-type-inference) -- [Calculate Age in Java](http://www.baeldung.com/java-get-age) - [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another) -- [Increment Date in Java](http://www.baeldung.com/java-increment-date) -- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date) - [Overriding System Time for Testing in Java](http://www.baeldung.com/java-override-system-time) diff --git a/core-java/README.md b/core-java/README.md index 4586d2add9..e74f6cf815 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -107,7 +107,6 @@ - [Find Sum and Average in a Java Array](http://www.baeldung.com/java-array-sum-average) - [Java List UnsupportedOperationException](http://www.baeldung.com/java-list-unsupported-operation-exception) - [Type Erasure in Java Explained](http://www.baeldung.com/java-type-erasure) -- [Display All Time Zones With GMT And UTC in Java](http://www.baeldung.com/java-time-zones) - [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) - [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality) - [Sending Emails with Java](http://www.baeldung.com/java-email) @@ -132,13 +131,11 @@ - [Guide to the this Java Keyword](http://www.baeldung.com/java-this) - [Jagged Arrays In Java](http://www.baeldung.com/java-jagged-arrays) - [Importance of Main Manifest Attribute in a Self-Executing JAR](http://www.baeldung.com/java-jar-executable-manifest-main-class) -- [Extracting Year, Month and Day from Date in Java](http://www.baeldung.com/java-year-month-day) - [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension) - [Immutable Objects in Java](http://www.baeldung.com/java-immutable-object) - [Console I/O in Java](http://www.baeldung.com/java-console-input-output) - [Guide to the java.util.Arrays Class](http://www.baeldung.com/java-util-arrays) - [Create a Custom Exception in Java](http://www.baeldung.com/java-new-custom-exception) -- [Guide to java.util.GregorianCalendar](http://www.baeldung.com/java-gregorian-calendar) - [Java Global Exception Handler](http://www.baeldung.com/java-global-exception-handler) - [Encrypting and Decrypting Files in Java](http://www.baeldung.com/java-cipher-input-output-stream) - [How to Get the Size of an Object in Java](http://www.baeldung.com/java-size-of-object) diff --git a/java-dates/README.md b/java-dates/README.md index 58b95224ba..54843f90ee 100644 --- a/java-dates/README.md +++ b/java-dates/README.md @@ -13,4 +13,12 @@ - [Get the Current Date, Time and Timestamp in Java 8](http://www.baeldung.com/current-date-time-and-timestamp-in-java-8) - [Get Date Without Time in Java](http://www.baeldung.com/java-date-without-time) - [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates) -- [Convert Date to LocalDate or LocalDateTime and Back](http://www.baeldung.com/java-date-to-localdate-and-localdatetime) \ No newline at end of file +- [Convert Date to LocalDate or LocalDateTime and Back](http://www.baeldung.com/java-date-to-localdate-and-localdatetime) +- [Display All Time Zones With GMT And UTC in Java](http://www.baeldung.com/java-time-zones) +- [Extracting Year, Month and Day from Date in Java](http://www.baeldung.com/java-year-month-day) +- [Guide to java.util.GregorianCalendar](http://www.baeldung.com/java-gregorian-calendar) +- [Measure Elapsed Time in Java](http://www.baeldung.com/java-measure-elapsed-time) +- [How to Get the Start and the End of a Day using Java](http://www.baeldung.com/java-day-start-end) +- [Calculate Age in Java](http://www.baeldung.com/java-get-age) +- [Increment Date in Java](http://www.baeldung.com/java-increment-date) +- [Add Hours To a Date In Java](http://www.baeldung.com/java-add-hours-date) \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValues.java b/java-dates/src/main/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValues.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValues.java rename to java-dates/src/main/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValues.java diff --git a/core-java/src/main/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValues.java b/java-dates/src/main/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValues.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValues.java rename to java-dates/src/main/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValues.java diff --git a/core-java/src/main/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValues.java b/java-dates/src/main/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValues.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValues.java rename to java-dates/src/main/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValues.java diff --git a/core-java/src/main/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValues.java b/java-dates/src/main/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValues.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValues.java rename to java-dates/src/main/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValues.java diff --git a/core-java/src/main/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValues.java b/java-dates/src/main/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValues.java similarity index 100% rename from core-java/src/main/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValues.java rename to java-dates/src/main/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValues.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/modify/DateIncrementer.java b/java-dates/src/main/java/com/baeldung/datetime/modify/DateIncrementer.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/datetime/modify/DateIncrementer.java rename to java-dates/src/main/java/com/baeldung/datetime/modify/DateIncrementer.java diff --git a/core-java/src/main/java/com/baeldung/gregorian/calendar/GregorianCalendarExample.java b/java-dates/src/main/java/com/baeldung/gregorian/calendar/GregorianCalendarExample.java similarity index 100% rename from core-java/src/main/java/com/baeldung/gregorian/calendar/GregorianCalendarExample.java rename to java-dates/src/main/java/com/baeldung/gregorian/calendar/GregorianCalendarExample.java diff --git a/core-java-8/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplay.java b/java-dates/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplay.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplay.java rename to java-dates/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplay.java diff --git a/core-java-8/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayApp.java b/java-dates/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayApp.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayApp.java rename to java-dates/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayApp.java diff --git a/core-java/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7.java b/java-dates/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7.java similarity index 100% rename from core-java/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7.java rename to java-dates/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7.java diff --git a/core-java/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7App.java b/java-dates/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7App.java similarity index 100% rename from core-java/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7App.java rename to java-dates/src/main/java/com/baeldung/timezonedisplay/TimezoneDisplayJava7App.java diff --git a/core-java/src/test/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValuesUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValuesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValuesUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/DateExtractYearMonthDayIntegerValuesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValuesUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValuesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValuesUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/LocalDateExtractYearMonthDayIntegerValuesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValuesUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValuesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValuesUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/LocalDateTimeExtractYearMonthDayIntegerValuesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValuesUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValuesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValuesUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/OffsetDateTimeExtractYearMonthDayIntegerValuesUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValuesUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValuesUnitTest.java similarity index 100% rename from core-java/src/test/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValuesUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/ZonedDateTimeExtractYearMonthDayIntegerValuesUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/datetime/modify/DateIncrementerUnitTest.java b/java-dates/src/test/java/com/baeldung/datetime/modify/DateIncrementerUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/datetime/modify/DateIncrementerUnitTest.java rename to java-dates/src/test/java/com/baeldung/datetime/modify/DateIncrementerUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/gregorian/calendar/GregorianCalendarTester.java b/java-dates/src/test/java/com/baeldung/gregorian/calendar/GregorianCalendarTester.java similarity index 100% rename from core-java/src/test/java/com/baeldung/gregorian/calendar/GregorianCalendarTester.java rename to java-dates/src/test/java/com/baeldung/gregorian/calendar/GregorianCalendarTester.java diff --git a/java-dates/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java b/java-dates/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java index acf9a376f2..8813870c2b 100644 --- a/java-dates/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java +++ b/java-dates/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java @@ -18,7 +18,7 @@ public class TimeApiUnitTest { Date endDate = endCalendar.getTime(); List dates = TimeApi.getDatesBetweenUsingJava7(startDate, endDate); - assertEquals(dates.size(), 3); + assertEquals(dates.size(), 2); Calendar calendar = Calendar.getInstance(); Date date1 = calendar.getTime(); diff --git a/core-java-8/src/test/java/com/baeldung/time/ElapsedTimeUnitTest.java b/java-dates/src/test/java/com/baeldung/time/ElapsedTimeUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/time/ElapsedTimeUnitTest.java rename to java-dates/src/test/java/com/baeldung/time/ElapsedTimeUnitTest.java From 206b70328c397345e0b23e0f51420d2183a92cb4 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Sun, 26 Aug 2018 01:06:17 +0530 Subject: [PATCH 285/298] BAEL-8142 create parent for kotlin projects -Added new kotlin parent -> parent-kotlin -Added dependency of other kotlin projects on parent-kotlin --- core-kotlin/pom.xml | 314 +++++------------- parent-kotlin/.classpath | 26 ++ parent-kotlin/.project | 28 ++ .../org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 5 + .../.settings/org.eclipse.m2e.core.prefs | 4 + .../org.springframework.ide.eclipse.prefs | 2 + parent-kotlin/pom.xml | 194 +++++++++++ pom.xml | 7 +- spring-mvc-kotlin/pom.xml | 189 +++++------ spring-reactive-kotlin/pom.xml | 42 +-- 11 files changed, 422 insertions(+), 391 deletions(-) create mode 100644 parent-kotlin/.classpath create mode 100644 parent-kotlin/.project create mode 100644 parent-kotlin/.settings/org.eclipse.core.resources.prefs create mode 100644 parent-kotlin/.settings/org.eclipse.jdt.core.prefs create mode 100644 parent-kotlin/.settings/org.eclipse.m2e.core.prefs create mode 100644 parent-kotlin/.settings/org.springframework.ide.eclipse.prefs create mode 100644 parent-kotlin/pom.xml diff --git a/core-kotlin/pom.xml b/core-kotlin/pom.xml index a86359c02f..1c5818b6aa 100644 --- a/core-kotlin/pom.xml +++ b/core-kotlin/pom.xml @@ -1,243 +1,85 @@ - 4.0.0 - core-kotlin - 1.0-SNAPSHOT - jar + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + core-kotlin + jar - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - + + com.baeldung + parent-kotlin + 1.0.0-SNAPSHOT + ../parent-kotlin + - - - jcenter - http://jcenter.bintray.com - - - kotlin-ktor - https://dl.bintray.com/kotlin/ktor/ - - + + + org.jetbrains.spek + spek-api + 1.1.5 + test + + + org.jetbrains.spek + spek-subject-extension + 1.1.5 + test + + + org.jetbrains.spek + spek-junit-platform-engine + 1.1.5 + test + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + khttp + khttp + ${khttp.version} + + + com.nhaarman + mockito-kotlin + ${mockito-kotlin.version} + test + + + com.github.salomonbrys.kodein + kodein + ${kodein.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + com.beust + klaxon + ${klaxon.version} + + - - - org.apache.commons - commons-math3 - ${commons-math3.version} - - - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test - - - org.jetbrains.kotlin - kotlin-stdlib - ${kotlin-stdlib.version} - - - org.jetbrains.kotlin - kotlin-stdlib-jdk8 - ${kotlin-stdlib.version} - - - khttp - khttp - ${khttp.version} - - - org.jetbrains.kotlin - kotlin-test-junit - ${kotlin-test-junit.version} - test - - - org.jetbrains.kotlin - kotlin-reflect - ${kotlin-reflect.version} - - - org.jetbrains.kotlinx - kotlinx-coroutines-core - ${kotlinx.version} - - - org.jetbrains.spek - spek-api - 1.1.5 - test - - - org.jetbrains.spek - spek-subject-extension - 1.1.5 - test - - - org.jetbrains.spek - spek-junit-platform-engine - 1.1.5 - test - - - com.nhaarman - mockito-kotlin - ${mockito-kotlin.version} - test - - - com.github.salomonbrys.kodein - kodein - ${kodein.version} - - - org.assertj - assertj-core - ${assertj.version} - test - - - com.beust - klaxon - ${klaxon.version} - - - io.ktor - ktor-server-netty - ${ktor.io.version} - - - io.ktor - ktor-gson - ${ktor.io.version} - - - ch.qos.logback - logback-classic - 1.2.1 - test - - - - - - - org.jetbrains.kotlin - kotlin-maven-plugin - ${kotlin-maven-plugin.version} - - - compile - - compile - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/main/java - - - - - test-compile - - test-compile - - - - ${project.basedir}/src/test/kotlin - ${project.basedir}/src/test/java - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${java.version} - ${java.version} - - - - - default-compile - none - - - - default-testCompile - none - - - java-compile - compile - - compile - - - - java-test-compile - test-compile - - testCompile - - - - - - maven-failsafe-plugin - ${maven-failsafe-plugin.version} - - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.version} - - - - - junit5 - - integration-test - verify - - - - **/*Test5.java - - - - - - - - - - UTF-8 - 1.2.60 - 1.2.60 - 1.2.60 - 1.2.60 - 0.22.5 - 0.9.2 - 1.5.0 - 4.1.0 - 3.0.4 - 0.1.0 - 3.6.1 - 1.1.1 - 5.2.0 - 3.10.0 - + + 1.5.0 + 4.1.0 + 3.0.4 + 0.1.0 + 3.6.1 + 1.1.1 + 5.2.0 + 3.10.0 + \ No newline at end of file diff --git a/parent-kotlin/.classpath b/parent-kotlin/.classpath new file mode 100644 index 0000000000..61f3bb94aa --- /dev/null +++ b/parent-kotlin/.classpath @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/parent-kotlin/.project b/parent-kotlin/.project new file mode 100644 index 0000000000..c263e961e6 --- /dev/null +++ b/parent-kotlin/.project @@ -0,0 +1,28 @@ + + + parent-kotlin + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + org.springframework.ide.eclipse.boot.validation.springbootbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/parent-kotlin/.settings/org.eclipse.core.resources.prefs b/parent-kotlin/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000..4824b80263 --- /dev/null +++ b/parent-kotlin/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/parent-kotlin/.settings/org.eclipse.jdt.core.prefs b/parent-kotlin/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..d59e09c909 --- /dev/null +++ b/parent-kotlin/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/parent-kotlin/.settings/org.eclipse.m2e.core.prefs b/parent-kotlin/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000..14b697b7bb --- /dev/null +++ b/parent-kotlin/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/parent-kotlin/.settings/org.springframework.ide.eclipse.prefs b/parent-kotlin/.settings/org.springframework.ide.eclipse.prefs new file mode 100644 index 0000000000..e587c651c5 --- /dev/null +++ b/parent-kotlin/.settings/org.springframework.ide.eclipse.prefs @@ -0,0 +1,2 @@ +boot.validation.initialized=true +eclipse.preferences.version=1 diff --git a/parent-kotlin/pom.xml b/parent-kotlin/pom.xml new file mode 100644 index 0000000000..7fd18e4fa4 --- /dev/null +++ b/parent-kotlin/pom.xml @@ -0,0 +1,194 @@ + + + 4.0.0 + parent-kotlin + pom + parent-kotlin + Parent for all kotlin modules + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + jcenter + http://jcenter.bintray.com + + + kotlin-ktor + https://dl.bintray.com/kotlin/ktor/ + + + + + + + org.springframework.boot + spring-boot-dependencies + 2.0.1.RELEASE + pom + import + + + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + + + + org.jetbrains.kotlinx + kotlinx-coroutines-core + ${kotlinx.version} + + + + io.ktor + ktor-server-netty + ${ktor.io.version} + + + io.ktor + ktor-gson + ${ktor.io.version} + + + + org.jetbrains.kotlin + kotlin-test-junit + ${kotlin.version} + test + + + + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + ${java.version} + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + ${java.version} + + + + + + spring + + + + + org.jetbrains.kotlin + kotlin-maven-allopen + ${kotlin.version} + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + + + + default-compile + none + + + + default-testCompile + none + + + java-compile + compile + + compile + + + + java-test-compile + test-compile + + testCompile + + + + + + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + org.junit.platform + junit-platform-surefire-provider + ${junit.platform.version} + + + + + junit5 + + integration-test + verify + + + + **/*Test5.java + + + + + + + + + + 1.2.61 + 0.25.0 + 0.9.3 + 3.11.0 + 1.2.0 + + diff --git a/pom.xml b/pom.xml index 080c288987..f9eda6780f 100644 --- a/pom.xml +++ b/pom.xml @@ -321,6 +321,7 @@ parent-spring-4 parent-spring-5 parent-java + parent-kotlin asm atomix apache-cayenne @@ -637,7 +638,7 @@ parent-spring-4 parent-spring-5 parent-java - + parent-kotlin + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + org.junit.platform + junit-platform-launcher + ${junit-platform.version} + test + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + com.h2database + h2 + + + org.springframework.boot + spring-boot-starter + + + com.google.guava + guava + ${guava.version} + + + org.springframework + spring-websocket + + + org.springframework + spring-messaging + + + + + + spring-boot-client + + + src/main/resources + true + + + + + + + org.apache.maven.plugins + maven-war-plugin + + + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + + + + + + + + + autoconfiguration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + **/*IntegrationTest.java + **/*IntTest.java + + + **/AutoconfigurationTest.java + + + + + + + json + + + + + + + + + + 18.0 + 1.2.0 + 2.2.4 + + + \ No newline at end of file diff --git a/spring-boot-client/src/main/java/org/baeldung/boot/Application.java b/spring-boot-client/src/main/java/org/baeldung/boot/Application.java new file mode 100644 index 0000000000..c1b6558b26 --- /dev/null +++ b/spring-boot-client/src/main/java/org/baeldung/boot/Application.java @@ -0,0 +1,14 @@ +package org.baeldung.boot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContext; + +@SpringBootApplication +public class Application { + private static ApplicationContext applicationContext; + + public static void main(String[] args) { + applicationContext = SpringApplication.run(Application.class, args); + } +} diff --git a/spring-boot/src/main/java/org/baeldung/boot/client/Details.java b/spring-boot-client/src/main/java/org/baeldung/boot/client/Details.java similarity index 100% rename from spring-boot/src/main/java/org/baeldung/boot/client/Details.java rename to spring-boot-client/src/main/java/org/baeldung/boot/client/Details.java diff --git a/spring-boot/src/main/java/org/baeldung/boot/client/DetailsServiceClient.java b/spring-boot-client/src/main/java/org/baeldung/boot/client/DetailsServiceClient.java similarity index 100% rename from spring-boot/src/main/java/org/baeldung/boot/client/DetailsServiceClient.java rename to spring-boot-client/src/main/java/org/baeldung/boot/client/DetailsServiceClient.java diff --git a/spring-boot/src/main/java/org/baeldung/websocket/client/Message.java b/spring-boot-client/src/main/java/org/baeldung/websocket/client/Message.java similarity index 100% rename from spring-boot/src/main/java/org/baeldung/websocket/client/Message.java rename to spring-boot-client/src/main/java/org/baeldung/websocket/client/Message.java diff --git a/spring-boot/src/main/java/org/baeldung/websocket/client/MyStompSessionHandler.java b/spring-boot-client/src/main/java/org/baeldung/websocket/client/MyStompSessionHandler.java similarity index 100% rename from spring-boot/src/main/java/org/baeldung/websocket/client/MyStompSessionHandler.java rename to spring-boot-client/src/main/java/org/baeldung/websocket/client/MyStompSessionHandler.java diff --git a/spring-boot/src/main/java/org/baeldung/websocket/client/StompClient.java b/spring-boot-client/src/main/java/org/baeldung/websocket/client/StompClient.java similarity index 100% rename from spring-boot/src/main/java/org/baeldung/websocket/client/StompClient.java rename to spring-boot-client/src/main/java/org/baeldung/websocket/client/StompClient.java diff --git a/spring-boot-client/src/main/resources/logback.xml b/spring-boot-client/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/spring-boot-client/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java b/spring-boot-client/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java similarity index 100% rename from spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java rename to spring-boot-client/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java diff --git a/spring-boot/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java b/spring-boot-client/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java similarity index 91% rename from spring-boot/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java rename to spring-boot-client/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java index 37fc202e8a..71fb330663 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java +++ b/spring-boot-client/src/test/java/org/baeldung/boot/client/DetailsServiceClientIntegrationTest.java @@ -1,23 +1,24 @@ package org.baeldung.boot.client; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.client.RestClientTest; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.client.MockRestServiceServer; - import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; -import org.baeldung.boot.client.Details; -import org.baeldung.boot.client.DetailsServiceClient; +import org.baeldung.boot.Application; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.client.RestClientTest; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.client.MockRestServiceServer; + +import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) @RestClientTest(DetailsServiceClient.class) public class DetailsServiceClientIntegrationTest { diff --git a/spring-boot/README.MD b/spring-boot/README.MD index 6892278f09..5d1170b905 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -3,7 +3,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: -- [Quick Guide to @RestClientTest in Spring Boot](http://www.baeldung.com/restclienttest-in-spring-boot) - [A Guide to Spring in Eclipse STS](http://www.baeldung.com/eclipse-sts-spring) - [The @ServletComponentScan Annotation in Spring Boot](http://www.baeldung.com/spring-servletcomponentscan) - [Intro to Building an Application with Spring Boot](http://www.baeldung.com/intro-to-spring-boot) @@ -18,7 +17,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Testing in Spring Boot](http://www.baeldung.com/spring-boot-testing) - [Guide to @ConfigurationProperties in Spring Boot](http://www.baeldung.com/configuration-properties-in-spring-boot) - [How to Get All Spring-Managed Beans?](http://www.baeldung.com/spring-show-all-beans) -- [A Java Client for a WebSockets API](http://www.baeldung.com/websockets-api-java-spring-client) - [Spring Boot and Togglz Aspect](http://www.baeldung.com/spring-togglz) - [Getting Started with GraphQL and Spring Boot](http://www.baeldung.com/spring-graphql) - [Guide to Spring Type Conversions](http://www.baeldung.com/spring-type-conversions) diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index 0667a24416..50859f674c 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -117,16 +117,6 @@ provided - - org.springframework - spring-websocket - - - - org.springframework - spring-messaging - - org.togglz togglz-spring-boot-starter From 7bb5fb6176f754c8b8c50626f99c90a40a93a419 Mon Sep 17 00:00:00 2001 From: xamcross Date: Sun, 26 Aug 2018 15:22:07 +0300 Subject: [PATCH 288/298] BAEL-2051 Spring Autowiring of Generic Types (#4921) --- .../annotation/CarQualifier.java | 15 +++++++ .../app/CustomConfiguration.java | 39 +++++++++++++++++++ .../dependencyinjectiontypes/model/Car.java | 25 ++++++++++++ .../model/CarHandler.java | 26 +++++++++++++ .../model/Motorcycle.java | 25 ++++++++++++ .../model/Vehicle.java | 28 +++++++++++++ 6 files changed, 158 insertions(+) create mode 100644 spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/annotation/CarQualifier.java create mode 100644 spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/app/CustomConfiguration.java create mode 100644 spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Car.java create mode 100644 spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/CarHandler.java create mode 100644 spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Motorcycle.java create mode 100644 spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Vehicle.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/annotation/CarQualifier.java b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/annotation/CarQualifier.java new file mode 100644 index 0000000000..cd7f81c0fb --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/annotation/CarQualifier.java @@ -0,0 +1,15 @@ +package com.baeldung.dependencyinjectiontypes.annotation; + +import org.springframework.beans.factory.annotation.Qualifier; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.FIELD, ElementType.METHOD, + ElementType.TYPE, ElementType.PARAMETER}) +@Retention(RetentionPolicy.RUNTIME) +@Qualifier +public @interface CarQualifier { +} diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/app/CustomConfiguration.java b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/app/CustomConfiguration.java new file mode 100644 index 0000000000..841a8d4656 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/app/CustomConfiguration.java @@ -0,0 +1,39 @@ +package com.baeldung.dependencyinjectiontypes.app; + +import com.baeldung.dependencyinjectiontypes.annotation.CarQualifier; +import com.baeldung.dependencyinjectiontypes.model.Car; +import com.baeldung.dependencyinjectiontypes.model.CarHandler; +import com.baeldung.dependencyinjectiontypes.model.Motorcycle; +import com.baeldung.dependencyinjectiontypes.model.Vehicle; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@ComponentScan("com.baeldung.dependencyinjectiontypes.model") +public class CustomConfiguration { + @Bean + @CarQualifier + public Car getMercedes() { + return new Car("E280", "Mercedes", "Diesel"); + } + + public static void main(String[] args) throws NoSuchFieldException { + ConfigurableApplicationContext context = SpringApplication.run(CustomConfiguration.class, args); + CarHandler carHandler = context.getBean(CarHandler.class); + carHandler.getVehicles().forEach(System.out::println); + } + + @Bean + @CarQualifier + public Car getBmw() { + return new Car("M5", "BMW", "Petrol"); + } + + @Bean + public Motorcycle getSuzuki() { + return new Motorcycle("Yamaguchi", "Suzuki", true); + } +} diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Car.java b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Car.java new file mode 100644 index 0000000000..a09d89248b --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Car.java @@ -0,0 +1,25 @@ +package com.baeldung.dependencyinjectiontypes.model; + +public class Car extends Vehicle { + private String engineType; + + public Car(String name, String manufacturer, String engineType) { + super(name, manufacturer); + this.engineType = engineType; + } + + public String getEngineType() { + return engineType; + } + + public void setEngineType(String engineType) { + this.engineType = engineType; + } + + @Override + public String toString() { + return "Car{" + + "engineType='" + engineType + '\'' + + '}'; + } +} diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/CarHandler.java b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/CarHandler.java new file mode 100644 index 0000000000..f5d581ef0a --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/CarHandler.java @@ -0,0 +1,26 @@ +package com.baeldung.dependencyinjectiontypes.model; + +import com.baeldung.dependencyinjectiontypes.annotation.CarQualifier; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ResolvableType; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class CarHandler { + + @Autowired + @CarQualifier + private List vehicles; + + public List getVehicles() throws NoSuchFieldException { + ResolvableType vehiclesType = ResolvableType.forField(getClass().getDeclaredField("vehicles")); + System.out.println(vehiclesType); + ResolvableType type = vehiclesType.getGeneric(); + System.out.println(type); + Class aClass = type.resolve(); + System.out.println(aClass); + return this.vehicles; + } +} diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Motorcycle.java b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Motorcycle.java new file mode 100644 index 0000000000..ce5e97fb6d --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Motorcycle.java @@ -0,0 +1,25 @@ +package com.baeldung.dependencyinjectiontypes.model; + +public class Motorcycle extends Vehicle { + private boolean twoWheeler; + + public Motorcycle(String name, String manufacturer, boolean twoWheeler) { + super(name, manufacturer); + this.twoWheeler = true; + } + + public boolean isTwoWheeler() { + return twoWheeler; + } + + public void setTwoWheeler(boolean twoWheeler) { + this.twoWheeler = twoWheeler; + } + + @Override + public String toString() { + return "Motorcycle{" + + "twoWheeler=" + twoWheeler + + '}'; + } +} diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Vehicle.java b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Vehicle.java new file mode 100644 index 0000000000..cb3dca764e --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Vehicle.java @@ -0,0 +1,28 @@ +package com.baeldung.dependencyinjectiontypes.model; + +public abstract class Vehicle { + private String name; + private String manufacturer; + + + public Vehicle(String name, String manufacturer) { + this.name = name; + this.manufacturer = manufacturer; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getManufacturer() { + return manufacturer; + } + + public void setManufacturer(String manufacturer) { + this.manufacturer = manufacturer; + } +} \ No newline at end of file From b97fd5f2d469d04060b66466e6674fe00b7b44a2 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Sun, 26 Aug 2018 19:27:32 +0530 Subject: [PATCH 289/298] BAEL-8142 create parent for kotlin projects - Removed eclipse classpath, project and prefs files --- parent-kotlin/.classpath | 26 ----------------- parent-kotlin/.project | 28 ------------------- .../org.eclipse.core.resources.prefs | 2 -- .../.settings/org.eclipse.jdt.core.prefs | 5 ---- .../.settings/org.eclipse.m2e.core.prefs | 4 --- .../org.springframework.ide.eclipse.prefs | 2 -- 6 files changed, 67 deletions(-) delete mode 100644 parent-kotlin/.classpath delete mode 100644 parent-kotlin/.project delete mode 100644 parent-kotlin/.settings/org.eclipse.core.resources.prefs delete mode 100644 parent-kotlin/.settings/org.eclipse.jdt.core.prefs delete mode 100644 parent-kotlin/.settings/org.eclipse.m2e.core.prefs delete mode 100644 parent-kotlin/.settings/org.springframework.ide.eclipse.prefs diff --git a/parent-kotlin/.classpath b/parent-kotlin/.classpath deleted file mode 100644 index 61f3bb94aa..0000000000 --- a/parent-kotlin/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/parent-kotlin/.project b/parent-kotlin/.project deleted file mode 100644 index c263e961e6..0000000000 --- a/parent-kotlin/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - parent-kotlin - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - org.springframework.ide.eclipse.boot.validation.springbootbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - diff --git a/parent-kotlin/.settings/org.eclipse.core.resources.prefs b/parent-kotlin/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4824b80263..0000000000 --- a/parent-kotlin/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/parent-kotlin/.settings/org.eclipse.jdt.core.prefs b/parent-kotlin/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index d59e09c909..0000000000 --- a/parent-kotlin/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/parent-kotlin/.settings/org.eclipse.m2e.core.prefs b/parent-kotlin/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index 14b697b7bb..0000000000 --- a/parent-kotlin/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/parent-kotlin/.settings/org.springframework.ide.eclipse.prefs b/parent-kotlin/.settings/org.springframework.ide.eclipse.prefs deleted file mode 100644 index e587c651c5..0000000000 --- a/parent-kotlin/.settings/org.springframework.ide.eclipse.prefs +++ /dev/null @@ -1,2 +0,0 @@ -boot.validation.initialized=true -eclipse.preferences.version=1 From 39f9392a0a0aff6ff5dcb266a177e23a15ea1612 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 26 Aug 2018 23:24:46 +0530 Subject: [PATCH 290/298] [BAEL-8496] - Moved articles to their own spring-resttemplate module --- pom.xml | 3 + spring-rest-full/README.md | 1 - spring-rest-simple/README.md | 1 - .../client/RestTemplateBasicLiveTest.java | 64 ---- spring-rest/README.md | 2 - .../client/TestRestTemplateBasicLiveTest.java | 117 ------- spring-resttemplate/.gitignore | 13 + spring-resttemplate/README.md | 10 + spring-resttemplate/pom.xml | 297 ++++++++++++++++++ .../CustomClientHttpRequestInterceptor.java | 0 .../CustomRestTemplateCustomizer.java | 0 .../configuration/HelloController.java | 0 .../RestTemplateConfigurationApplication.java | 0 .../configuration/SpringConfig.java | 0 .../main/java/org/baeldung/web/dto/Foo.java | 45 +++ .../web/exception/NotFoundException.java | 0 .../RestTemplateResponseErrorHandler.java | 0 .../main/java/org/baeldung/web/model/Bar.java | 0 .../web/service/BarConsumerService.java | 0 .../src/main/resources/application.properties | 2 + .../src/main/resources/logback.xml | 23 ++ .../test/java/org/baeldung/client/Consts.java | 5 + .../client/RestTemplateBasicLiveTest.java | 0 .../client/TestRestTemplateBasicLiveTest.java | 0 ...teResponseErrorHandlerIntegrationTest.java | 0 .../src/test/resources/.gitignore | 13 + 26 files changed, 411 insertions(+), 185 deletions(-) delete mode 100644 spring-rest-simple/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java delete mode 100644 spring-rest/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java create mode 100644 spring-resttemplate/.gitignore create mode 100644 spring-resttemplate/README.md create mode 100644 spring-resttemplate/pom.xml rename {spring-rest => spring-resttemplate}/src/main/java/org/baeldung/resttemplate/configuration/CustomClientHttpRequestInterceptor.java (100%) rename {spring-rest => spring-resttemplate}/src/main/java/org/baeldung/resttemplate/configuration/CustomRestTemplateCustomizer.java (100%) rename {spring-rest => spring-resttemplate}/src/main/java/org/baeldung/resttemplate/configuration/HelloController.java (100%) rename {spring-rest => spring-resttemplate}/src/main/java/org/baeldung/resttemplate/configuration/RestTemplateConfigurationApplication.java (100%) rename {spring-rest => spring-resttemplate}/src/main/java/org/baeldung/resttemplate/configuration/SpringConfig.java (100%) create mode 100644 spring-resttemplate/src/main/java/org/baeldung/web/dto/Foo.java rename {spring-rest-simple => spring-resttemplate}/src/main/java/org/baeldung/web/exception/NotFoundException.java (100%) rename {spring-rest-simple => spring-resttemplate}/src/main/java/org/baeldung/web/handler/RestTemplateResponseErrorHandler.java (100%) rename {spring-rest-simple => spring-resttemplate}/src/main/java/org/baeldung/web/model/Bar.java (100%) rename {spring-rest-simple => spring-resttemplate}/src/main/java/org/baeldung/web/service/BarConsumerService.java (100%) create mode 100644 spring-resttemplate/src/main/resources/application.properties create mode 100644 spring-resttemplate/src/main/resources/logback.xml create mode 100644 spring-resttemplate/src/test/java/org/baeldung/client/Consts.java rename {spring-rest => spring-resttemplate}/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java (100%) rename {spring-rest-simple => spring-resttemplate}/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java (100%) rename {spring-rest-simple => spring-resttemplate}/src/test/java/org/baeldung/web/handler/RestTemplateResponseErrorHandlerIntegrationTest.java (100%) create mode 100644 spring-resttemplate/src/test/resources/.gitignore diff --git a/pom.xml b/pom.xml index b50522fe75..78fb4e2f45 100644 --- a/pom.xml +++ b/pom.xml @@ -517,6 +517,7 @@ spring-rest-full spring-rest-query-language spring-rest + spring-resttemplate spring-rest-simple spring-security-acl spring-security-cache-control @@ -786,6 +787,7 @@ spring-rest-full spring-rest-query-language spring-rest + spring-resttemplate spring-rest-simple spring-reactive-kotlin @@ -1055,6 +1057,7 @@ spring-rest-full spring-rest-query-language spring-rest + spring-resttemplate spring-rest-simple spring-security-acl spring-security-cache-control diff --git a/spring-rest-full/README.md b/spring-rest-full/README.md index 0dd25b276b..b8fef9cb82 100644 --- a/spring-rest-full/README.md +++ b/spring-rest-full/README.md @@ -16,7 +16,6 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com - [Introduction to Spring Data JPA](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) - [Project Configuration with Spring](http://www.baeldung.com/project-configuration-with-spring) - [Metrics for your Spring REST API](http://www.baeldung.com/spring-rest-api-metrics) -- [Spring RestTemplate Tutorial](http://www.baeldung.com/rest-template) - [Bootstrap a Web Application with Spring 4](http://www.baeldung.com/bootstraping-a-web-application-with-spring-and-java-based-configuration) - [Build a REST API with Spring 4 and Java Config](http://www.baeldung.com/building-a-restful-web-service-with-spring-and-java-based-configuration) - [Error Handling for REST with Spring](http://www.baeldung.com/exception-handling-for-rest-with-spring) diff --git a/spring-rest-simple/README.md b/spring-rest-simple/README.md index ae853ba787..57d6f50887 100644 --- a/spring-rest-simple/README.md +++ b/spring-rest-simple/README.md @@ -6,5 +6,4 @@ - [Spring RequestMapping](http://www.baeldung.com/spring-requestmapping) - [ETags for REST with Spring](http://www.baeldung.com/etags-for-rest-with-spring) - [Spring and Apache FileUpload](http://www.baeldung.com/spring-apache-file-upload) -- [Spring RestTemplate Error Handling](http://www.baeldung.com/spring-rest-template-error-handling) - [Test a REST API with curl](http://www.baeldung.com/curl-rest) diff --git a/spring-rest-simple/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java b/spring-rest-simple/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java deleted file mode 100644 index 40e93f2d89..0000000000 --- a/spring-rest-simple/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.baeldung.client; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.MatcherAssert.assertThat; - -import java.io.IOException; - -import org.baeldung.web.dto.Foo; -import org.junit.Before; -import org.junit.Test; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestTemplate; - -public class RestTemplateBasicLiveTest { - - private RestTemplate restTemplate; - - private static final String fooResourceUrl = String.format("http://localhost:%d/spring-rest/foos", 8082); - - @Before - public void beforeTest() { - restTemplate = new RestTemplate(); - } - - // GET - - @Test - public void givenResourceUrl_whenSendGetForRequestEntity_thenStatusOk() throws IOException { - final ResponseEntity response = restTemplate.getForEntity(fooResourceUrl + "/1", String.class); - - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); - } - - @Test - public void givenResourceUrl_whenRetrievingResource_thenCorrect() throws IOException { - final Foo foo = restTemplate.getForObject(fooResourceUrl + "/1", Foo.class); - - assertThat(foo.getName(), notNullValue()); - assertThat(foo.getId(), is(1L)); - } - - // PUT - - @Test - public void givenFooService_whenPutObject_thenUpdatedObjectIsReturned() { - final HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - final Foo foo = new Foo(1, "newName"); - final String resourceUrl = fooResourceUrl + "/1"; - final HttpEntity requestUpdate = new HttpEntity<>(foo, headers); - final ResponseEntity response = restTemplate.exchange(resourceUrl, HttpMethod.PUT, requestUpdate, Foo.class); - - assertThat(foo.getName(), is(response.getBody() - .getName())); - } - -} diff --git a/spring-rest/README.md b/spring-rest/README.md index 6ef86ad015..d449a4d92a 100644 --- a/spring-rest/README.md +++ b/spring-rest/README.md @@ -14,7 +14,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Introduction to FindBugs](http://www.baeldung.com/intro-to-findbugs) - [A Custom Media Type for a Spring REST API](http://www.baeldung.com/spring-rest-custom-media-type) - [HTTP PUT vs HTTP PATCH in a REST API](http://www.baeldung.com/http-put-patch-difference-spring) -- [Exploring the Spring Boot TestRestTemplate](http://www.baeldung.com/spring-boot-testresttemplate) - [Spring – Log Incoming Requests](http://www.baeldung.com/spring-http-logging) - [RequestBody and ResponseBody Annotations](http://www.baeldung.com/requestbody-and-responsebody-annotations) - [Introduction to CheckStyle](http://www.baeldung.com/checkstyle-java) @@ -22,6 +21,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Guide to DeferredResult in Spring](http://www.baeldung.com/spring-deferred-result) - [Spring Custom Property Editor](http://www.baeldung.com/spring-mvc-custom-property-editor) - [Using the Spring RestTemplate Interceptor](http://www.baeldung.com/spring-rest-template-interceptor) -- [Configure a RestTemplate with RestTemplateBuilder](http://www.baeldung.com/spring-rest-template-builder) - [Get and Post Lists of Objects with RestTemplate](http://www.baeldung.com/spring-rest-template-list) - [How to Set a Header on a Response with Spring 5](http://www.baeldung.com/spring-response-header) diff --git a/spring-rest/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java b/spring-rest/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java deleted file mode 100644 index a8a71c7d73..0000000000 --- a/spring-rest/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.baeldung.client; - -import okhttp3.Request; -import okhttp3.RequestBody; -import org.junit.Before; -import org.junit.Test; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.boot.web.client.RestTemplateBuilder; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestTemplate; - -import static org.baeldung.client.Consts.APPLICATION_PORT; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertTrue; - -public class TestRestTemplateBasicLiveTest { - - private RestTemplateBuilder restTemplate; - private static final String FOO_RESOURCE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest/foos"; - private static final String URL_SECURED_BY_AUTHENTICATION = "http://httpbin.org/basic-auth/user/passwd"; - private static final String BASE_URL = "http://localhost:" + APPLICATION_PORT + "/spring-rest"; - - @Before - public void beforeTest() { - restTemplate = new RestTemplateBuilder(); - } - - // GET - @Test - public void givenTestRestTemplate_whenSendGetForEntity_thenStatusOk() { - TestRestTemplate testRestTemplate = new TestRestTemplate(); - ResponseEntity response = testRestTemplate.getForEntity(FOO_RESOURCE_URL + "/1", String.class); - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); - } - - @Test - public void givenRestTemplateWrapper_whenSendGetForEntity_thenStatusOk() { - TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplate); - ResponseEntity response = testRestTemplate.getForEntity(FOO_RESOURCE_URL + "/1", String.class); - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); - } - - @Test - public void givenRestTemplateBuilderWrapper_whenSendGetForEntity_thenStatusOk() { - RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder(); - restTemplateBuilder.build(); - TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplateBuilder); - ResponseEntity response = testRestTemplate.getForEntity(FOO_RESOURCE_URL + "/1", String.class); - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); - } - - @Test - public void givenRestTemplateWrapperWithCredentials_whenSendGetForEntity_thenStatusOk() { - TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplate, "user", "passwd"); - ResponseEntity response = testRestTemplate.getForEntity(URL_SECURED_BY_AUTHENTICATION, - String.class); - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); - } - - @Test - public void givenTestRestTemplateWithCredentials_whenSendGetForEntity_thenStatusOk() { - TestRestTemplate testRestTemplate = new TestRestTemplate("user", "passwd"); - ResponseEntity response = testRestTemplate.getForEntity(URL_SECURED_BY_AUTHENTICATION, - String.class); - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); - } - - @Test - public void givenTestRestTemplateWithBasicAuth_whenSendGetForEntity_thenStatusOk() { - TestRestTemplate testRestTemplate = new TestRestTemplate(); - ResponseEntity response = testRestTemplate.withBasicAuth("user", "passwd"). - getForEntity(URL_SECURED_BY_AUTHENTICATION, String.class); - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); - } - - @Test - public void givenTestRestTemplateWithCredentialsAndEnabledCookies_whenSendGetForEntity_thenStatusOk() { - TestRestTemplate testRestTemplate = new TestRestTemplate("user", "passwd", TestRestTemplate. - HttpClientOption.ENABLE_COOKIES); - ResponseEntity response = testRestTemplate.getForEntity(URL_SECURED_BY_AUTHENTICATION, - String.class); - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); - } - - // HEAD - @Test - public void givenFooService_whenCallHeadForHeaders_thenReceiveAllHeaders() { - TestRestTemplate testRestTemplate = new TestRestTemplate(); - final HttpHeaders httpHeaders = testRestTemplate.headForHeaders(FOO_RESOURCE_URL); - assertTrue(httpHeaders.getContentType().includes(MediaType.APPLICATION_JSON)); - } - - // POST - @Test - public void givenService_whenPostForObject_thenCreatedObjectIsReturned() { - TestRestTemplate testRestTemplate = new TestRestTemplate("user", "passwd"); - final RequestBody body = RequestBody.create(okhttp3.MediaType.parse("text/html; charset=utf-8"), - "{\"id\":1,\"name\":\"Jim\"}"); - final Request request = new Request.Builder().url(BASE_URL + "/users/detail").post(body).build(); - testRestTemplate.postForObject(URL_SECURED_BY_AUTHENTICATION, request, String.class); - } - - // PUT - @Test - public void givenService_whenPutForObject_thenCreatedObjectIsReturned() { - TestRestTemplate testRestTemplate = new TestRestTemplate("user", "passwd"); - final RequestBody body = RequestBody.create(okhttp3.MediaType.parse("text/html; charset=utf-8"), - "{\"id\":1,\"name\":\"Jim\"}"); - final Request request = new Request.Builder().url(BASE_URL + "/users/detail").post(body).build(); - testRestTemplate.put(URL_SECURED_BY_AUTHENTICATION, request, String.class); - } - -} diff --git a/spring-resttemplate/.gitignore b/spring-resttemplate/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/spring-resttemplate/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/spring-resttemplate/README.md b/spring-resttemplate/README.md new file mode 100644 index 0000000000..bf8c56e6ec --- /dev/null +++ b/spring-resttemplate/README.md @@ -0,0 +1,10 @@ +## Spring REST Example Project + +### The Course +The "REST With Spring" Classes: http://bit.ly/restwithspring + +### Relevant Articles: +- [Spring RestTemplate Tutorial](http://www.baeldung.com/rest-template) +- [Exploring the Spring Boot TestRestTemplate](http://www.baeldung.com/spring-boot-testresttemplate) +- [Spring RestTemplate Error Handling](http://www.baeldung.com/spring-rest-template-error-handling) +- [Configure a RestTemplate with RestTemplateBuilder](http://www.baeldung.com/spring-rest-template-builder) \ No newline at end of file diff --git a/spring-resttemplate/pom.xml b/spring-resttemplate/pom.xml new file mode 100644 index 0000000000..481104372a --- /dev/null +++ b/spring-resttemplate/pom.xml @@ -0,0 +1,297 @@ + + 4.0.0 + com.baeldung + spring-resttemplate + 0.1-SNAPSHOT + spring-resttemplate + war + + + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 + + + + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-devtools + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.springframework + spring-web + + + commons-logging + commons-logging + + + + + org.springframework + spring-webmvc + + + org.springframework + spring-oxm + + + + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + com.thoughtworks.xstream + xstream + ${xstream.version} + + + + + + com.google.guava + guava + ${guava.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + + + + org.slf4j + slf4j-api + + + ch.qos.logback + logback-classic + + + + org.slf4j + jcl-over-slf4j + + + + + + + com.squareup.okhttp3 + okhttp + ${com.squareup.okhttp3.version} + + + + + + junit + junit + test + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + org.mockito + mockito-core + test + + + org.springframework + spring-test + + + + + spring-resttemplate + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-war-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + 3 + true + + **/*IntegrationTest.java + **/*IntTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java + **/JdbcTest.java + **/*LiveTest.java + + + + + org.codehaus.cargo + cargo-maven2-plugin + ${cargo-maven2-plugin.version} + + + + tomcat8x + embedded + + + + + + + 8082 + + + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + none + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + + + + + live + + + + org.codehaus.cargo + cargo-maven2-plugin + + + start-server + pre-integration-test + + start + + + + stop-server + post-integration-test + + stop + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + none + + + **/*LiveTest.java + + + cargo + + + + + + + + + + + + + 3.5 + 1.4.9 + + + 20.0 + + + 1.6.0 + 3.0.4 + + + 3.4.1 + + + diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/configuration/CustomClientHttpRequestInterceptor.java b/spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/CustomClientHttpRequestInterceptor.java similarity index 100% rename from spring-rest/src/main/java/org/baeldung/resttemplate/configuration/CustomClientHttpRequestInterceptor.java rename to spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/CustomClientHttpRequestInterceptor.java diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/configuration/CustomRestTemplateCustomizer.java b/spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/CustomRestTemplateCustomizer.java similarity index 100% rename from spring-rest/src/main/java/org/baeldung/resttemplate/configuration/CustomRestTemplateCustomizer.java rename to spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/CustomRestTemplateCustomizer.java diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/configuration/HelloController.java b/spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/HelloController.java similarity index 100% rename from spring-rest/src/main/java/org/baeldung/resttemplate/configuration/HelloController.java rename to spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/HelloController.java diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/configuration/RestTemplateConfigurationApplication.java b/spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/RestTemplateConfigurationApplication.java similarity index 100% rename from spring-rest/src/main/java/org/baeldung/resttemplate/configuration/RestTemplateConfigurationApplication.java rename to spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/RestTemplateConfigurationApplication.java diff --git a/spring-rest/src/main/java/org/baeldung/resttemplate/configuration/SpringConfig.java b/spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/SpringConfig.java similarity index 100% rename from spring-rest/src/main/java/org/baeldung/resttemplate/configuration/SpringConfig.java rename to spring-resttemplate/src/main/java/org/baeldung/resttemplate/configuration/SpringConfig.java diff --git a/spring-resttemplate/src/main/java/org/baeldung/web/dto/Foo.java b/spring-resttemplate/src/main/java/org/baeldung/web/dto/Foo.java new file mode 100644 index 0000000000..240b368b50 --- /dev/null +++ b/spring-resttemplate/src/main/java/org/baeldung/web/dto/Foo.java @@ -0,0 +1,45 @@ +package org.baeldung.web.dto; + +import com.thoughtworks.xstream.annotations.XStreamAlias; + +@XStreamAlias("Foo") +public class Foo { + private long id; + private String name; + + public Foo() { + super(); + } + + public Foo(final String name) { + super(); + + this.name = name; + } + + public Foo(final long id, final String name) { + super(); + + this.id = id; + this.name = name; + } + + // API + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + +} \ No newline at end of file diff --git a/spring-rest-simple/src/main/java/org/baeldung/web/exception/NotFoundException.java b/spring-resttemplate/src/main/java/org/baeldung/web/exception/NotFoundException.java similarity index 100% rename from spring-rest-simple/src/main/java/org/baeldung/web/exception/NotFoundException.java rename to spring-resttemplate/src/main/java/org/baeldung/web/exception/NotFoundException.java diff --git a/spring-rest-simple/src/main/java/org/baeldung/web/handler/RestTemplateResponseErrorHandler.java b/spring-resttemplate/src/main/java/org/baeldung/web/handler/RestTemplateResponseErrorHandler.java similarity index 100% rename from spring-rest-simple/src/main/java/org/baeldung/web/handler/RestTemplateResponseErrorHandler.java rename to spring-resttemplate/src/main/java/org/baeldung/web/handler/RestTemplateResponseErrorHandler.java diff --git a/spring-rest-simple/src/main/java/org/baeldung/web/model/Bar.java b/spring-resttemplate/src/main/java/org/baeldung/web/model/Bar.java similarity index 100% rename from spring-rest-simple/src/main/java/org/baeldung/web/model/Bar.java rename to spring-resttemplate/src/main/java/org/baeldung/web/model/Bar.java diff --git a/spring-rest-simple/src/main/java/org/baeldung/web/service/BarConsumerService.java b/spring-resttemplate/src/main/java/org/baeldung/web/service/BarConsumerService.java similarity index 100% rename from spring-rest-simple/src/main/java/org/baeldung/web/service/BarConsumerService.java rename to spring-resttemplate/src/main/java/org/baeldung/web/service/BarConsumerService.java diff --git a/spring-resttemplate/src/main/resources/application.properties b/spring-resttemplate/src/main/resources/application.properties new file mode 100644 index 0000000000..1a26e3ad99 --- /dev/null +++ b/spring-resttemplate/src/main/resources/application.properties @@ -0,0 +1,2 @@ +server.port=8082 +server.servlet.context-path=/spring-rest \ No newline at end of file diff --git a/spring-resttemplate/src/main/resources/logback.xml b/spring-resttemplate/src/main/resources/logback.xml new file mode 100644 index 0000000000..9f48d36486 --- /dev/null +++ b/spring-resttemplate/src/main/resources/logback.xml @@ -0,0 +1,23 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-resttemplate/src/test/java/org/baeldung/client/Consts.java b/spring-resttemplate/src/test/java/org/baeldung/client/Consts.java new file mode 100644 index 0000000000..b40561d9c3 --- /dev/null +++ b/spring-resttemplate/src/test/java/org/baeldung/client/Consts.java @@ -0,0 +1,5 @@ +package org.baeldung.client; + +public interface Consts { + int APPLICATION_PORT = 8082; +} diff --git a/spring-rest/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java b/spring-resttemplate/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java similarity index 100% rename from spring-rest/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java rename to spring-resttemplate/src/test/java/org/baeldung/client/RestTemplateBasicLiveTest.java diff --git a/spring-rest-simple/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java b/spring-resttemplate/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java similarity index 100% rename from spring-rest-simple/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java rename to spring-resttemplate/src/test/java/org/baeldung/client/TestRestTemplateBasicLiveTest.java diff --git a/spring-rest-simple/src/test/java/org/baeldung/web/handler/RestTemplateResponseErrorHandlerIntegrationTest.java b/spring-resttemplate/src/test/java/org/baeldung/web/handler/RestTemplateResponseErrorHandlerIntegrationTest.java similarity index 100% rename from spring-rest-simple/src/test/java/org/baeldung/web/handler/RestTemplateResponseErrorHandlerIntegrationTest.java rename to spring-resttemplate/src/test/java/org/baeldung/web/handler/RestTemplateResponseErrorHandlerIntegrationTest.java diff --git a/spring-resttemplate/src/test/resources/.gitignore b/spring-resttemplate/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/spring-resttemplate/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file From 89e8d66def195e53f1263039cd635275d420b270 Mon Sep 17 00:00:00 2001 From: Andrey Shcherbakov Date: Sun, 26 Aug 2018 20:45:37 +0200 Subject: [PATCH 291/298] Java Primitives versus Objects (#4946) * Add code for the article 'Java Primitives versus Objects' * Use JMH for benchmarking the primitive and wrapper classes * Uncomment the benchmarks and remove unused class * Add Long/long to the benchmark * Remove assertions from the benchmarks * Add the java docs --- .../baeldung/primitive/BenchmarkRunner.java | 23 +++++++ .../primitive/BooleanPrimitiveLookup.java | 45 ++++++++++++++ .../primitive/BooleanWrapperLookup.java | 45 ++++++++++++++ .../primitive/BytePrimitiveLookup.java | 46 ++++++++++++++ .../baeldung/primitive/ByteWrapperLookup.java | 46 ++++++++++++++ .../primitive/CharPrimitiveLookup.java | 46 ++++++++++++++ .../primitive/CharacterWrapperLookup.java | 46 ++++++++++++++ .../primitive/DoublePrimitiveLookup.java | 42 +++++++++++++ .../primitive/DoubleWrapperLookup.java | 45 ++++++++++++++ .../primitive/FloatPrimitiveLookup.java | 42 +++++++++++++ .../primitive/FloatWrapperLookup.java | 43 ++++++++++++++ .../primitive/IntPrimitiveLookup.java | 45 ++++++++++++++ .../primitive/IntegerWrapperLookup.java | 45 ++++++++++++++ .../primitive/LongPrimitiveLookup.java | 42 +++++++++++++ .../baeldung/primitive/LongWrapperLookup.java | 45 ++++++++++++++ .../java/com/baeldung/primitive/Lookup.java | 56 ++++++++++++++++++ .../primitive/ShortPrimitiveLookup.java | 45 ++++++++++++++ .../primitive/ShortWrapperLookup.java | 46 ++++++++++++++ out/production/main/com/baeldung/.gitignore | 13 ++++ out/production/main/com/baeldung/README.md | 2 + .../main/com/baeldung/enums/README.md | 2 + .../main/com/baeldung/networking/README.md | 5 ++ .../main/com/baeldung/objectsize/MANIFEST.MF | 1 + .../main/com/baeldung/printscreen/README.md | 2 + out/production/main/javac-args/arguments | 2 + out/production/main/javac-args/options | 2 + out/production/main/javac-args/types | 1 + out/production/main/javac-args/xlint-ops | 3 + out/production/main/log4j.properties | 9 +++ .../main1/com/baeldung/datetime/README.md | 2 + .../test/com/baeldung/hexToAscii/README.md | 2 + .../com/baeldung/java/conversion/README.md | 2 + .../test/com/baeldung/stringisnumeric.zip | Bin 0 -> 3227 bytes 33 files changed, 841 insertions(+) create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/BenchmarkRunner.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/BooleanPrimitiveLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/BooleanWrapperLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/BytePrimitiveLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/ByteWrapperLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/CharPrimitiveLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/CharacterWrapperLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/DoublePrimitiveLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/DoubleWrapperLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/FloatPrimitiveLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/FloatWrapperLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/IntPrimitiveLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/IntegerWrapperLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/LongPrimitiveLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/LongWrapperLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/Lookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/ShortPrimitiveLookup.java create mode 100644 core-java-8/src/main/java/com/baeldung/primitive/ShortWrapperLookup.java create mode 100644 out/production/main/com/baeldung/.gitignore create mode 100644 out/production/main/com/baeldung/README.md create mode 100644 out/production/main/com/baeldung/enums/README.md create mode 100644 out/production/main/com/baeldung/networking/README.md create mode 100644 out/production/main/com/baeldung/objectsize/MANIFEST.MF create mode 100644 out/production/main/com/baeldung/printscreen/README.md create mode 100644 out/production/main/javac-args/arguments create mode 100644 out/production/main/javac-args/options create mode 100644 out/production/main/javac-args/types create mode 100644 out/production/main/javac-args/xlint-ops create mode 100644 out/production/main/log4j.properties create mode 100644 out/production/main1/com/baeldung/datetime/README.md create mode 100644 out/test/test/com/baeldung/hexToAscii/README.md create mode 100644 out/test/test/com/baeldung/java/conversion/README.md create mode 100644 out/test/test/com/baeldung/stringisnumeric.zip diff --git a/core-java-8/src/main/java/com/baeldung/primitive/BenchmarkRunner.java b/core-java-8/src/main/java/com/baeldung/primitive/BenchmarkRunner.java new file mode 100644 index 0000000000..2513ec0d03 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/BenchmarkRunner.java @@ -0,0 +1,23 @@ +package com.baeldung.primitive; + +public class BenchmarkRunner { + + public static void main(String[] args) throws Exception { + new IntPrimitiveLookup().run(); + new IntegerWrapperLookup().run(); + new FloatPrimitiveLookup().run(); + new FloatWrapperLookup().run(); + new DoublePrimitiveLookup().run(); + new DoubleWrapperLookup().run(); + new ShortPrimitiveLookup().run(); + new ShortWrapperLookup().run(); + new BooleanPrimitiveLookup().run(); + new BooleanWrapperLookup().run(); + new CharPrimitiveLookup().run(); + new CharacterWrapperLookup().run(); + new BytePrimitiveLookup().run(); + new ByteWrapperLookup().run(); + new LongPrimitiveLookup().run(); + new LongWrapperLookup().run(); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/BooleanPrimitiveLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/BooleanPrimitiveLookup.java new file mode 100644 index 0000000000..2ad698eba4 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/BooleanPrimitiveLookup.java @@ -0,0 +1,45 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class BooleanPrimitiveLookup extends Lookup { + + private boolean[] elements; + private final boolean pivot = false; + + @Setup + @Override + public void prepare() { + elements = new boolean[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = true; + } + elements[s - 1] = pivot; + } + + @TearDown + @Override + public void clean() { + elements = null; + } + + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + while (pivot != elements[index]) { + index++; + } + return index; + } + + @Override + public String getSimpleClassName() { + return BooleanPrimitiveLookup.class.getSimpleName(); + } + + + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/BooleanWrapperLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/BooleanWrapperLookup.java new file mode 100644 index 0000000000..8d996739a8 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/BooleanWrapperLookup.java @@ -0,0 +1,45 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class BooleanWrapperLookup extends Lookup { + private Boolean[] elements; + private final boolean pivot = false; + + @Override + @Setup + public void prepare() { + elements = new Boolean[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = true; + } + elements[s - 1] = pivot; + } + + @Override + @TearDown + public void clean() { + elements = null; + } + + @Override + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + Boolean pivotWrapper = pivot; + while (!pivotWrapper.equals(elements[index])) { + index++; + } + return index; + + } + + @Override + public String getSimpleClassName() { + return BooleanWrapperLookup.class.getSimpleName(); + } + + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/BytePrimitiveLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/BytePrimitiveLookup.java new file mode 100644 index 0000000000..73eda5cf5b --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/BytePrimitiveLookup.java @@ -0,0 +1,46 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class BytePrimitiveLookup extends Lookup { + + private byte[] elements; + private final byte pivot = 2; + + @Setup + @Override + public void prepare() { + byte common = 1; + elements = new byte[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @TearDown + @Override + public void clean() { + elements = null; + } + + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + while (pivot != elements[index]) { + index++; + } + return index; + } + + @Override + public String getSimpleClassName() { + return BytePrimitiveLookup.class.getSimpleName(); + } + + + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/ByteWrapperLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/ByteWrapperLookup.java new file mode 100644 index 0000000000..23e02315a6 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/ByteWrapperLookup.java @@ -0,0 +1,46 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class ByteWrapperLookup extends Lookup { + private Byte[] elements; + private final byte pivot = 2; + + @Override + @Setup + public void prepare() { + byte common = 1; + elements = new Byte[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @Override + @TearDown + public void clean() { + elements = null; + } + + @Override + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + Byte pivotWrapper = pivot; + while (!pivotWrapper.equals(elements[index])) { + index++; + } + return index; + + } + + @Override + public String getSimpleClassName() { + return ByteWrapperLookup.class.getSimpleName(); + } + + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/CharPrimitiveLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/CharPrimitiveLookup.java new file mode 100644 index 0000000000..a6d4be6206 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/CharPrimitiveLookup.java @@ -0,0 +1,46 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class CharPrimitiveLookup extends Lookup { + + private char[] elements; + private final char pivot = 'b'; + + @Setup + @Override + public void prepare() { + char common = 'a'; + elements = new char[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @TearDown + @Override + public void clean() { + elements = null; + } + + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + while (pivot != elements[index]) { + index++; + } + return index; + } + + @Override + public String getSimpleClassName() { + return CharPrimitiveLookup.class.getSimpleName(); + } + + + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/CharacterWrapperLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/CharacterWrapperLookup.java new file mode 100644 index 0000000000..9509b4a156 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/CharacterWrapperLookup.java @@ -0,0 +1,46 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class CharacterWrapperLookup extends Lookup { + private Character[] elements; + private final char pivot = 'b'; + + @Override + @Setup + public void prepare() { + char common = 'a'; + elements = new Character[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @Override + @TearDown + public void clean() { + elements = null; + } + + @Override + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + Character pivotWrapper = pivot; + while (!pivotWrapper.equals(elements[index])) { + index++; + } + return index; + + } + + @Override + public String getSimpleClassName() { + return CharacterWrapperLookup.class.getSimpleName(); + } + + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/DoublePrimitiveLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/DoublePrimitiveLookup.java new file mode 100644 index 0000000000..f95515a02d --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/DoublePrimitiveLookup.java @@ -0,0 +1,42 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class DoublePrimitiveLookup extends Lookup { + private double[] elements; + private final double pivot = 2; + + @Setup + @Override + public void prepare() { + double common = 1; + elements = new double[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @TearDown + @Override + public void clean() { + elements = null; + } + + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + while (pivot != elements[index]) { + index++; + } + return index; + } + + @Override + public String getSimpleClassName() { + return DoublePrimitiveLookup.class.getSimpleName(); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/DoubleWrapperLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/DoubleWrapperLookup.java new file mode 100644 index 0000000000..671c2ccc29 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/DoubleWrapperLookup.java @@ -0,0 +1,45 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class DoubleWrapperLookup extends Lookup { + private Double[] elements; + private final double pivot = 2d; + + @Override + @Setup + public void prepare() { + double common = 1; + elements = new Double[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @Override + @TearDown + public void clean() { + elements = null; + } + + @Override + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + Double pivotWrapper = pivot; + while (!pivotWrapper.equals(elements[index])) { + index++; + } + return index; + + } + + @Override + public String getSimpleClassName() { + return DoubleWrapperLookup.class.getSimpleName(); + } + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/FloatPrimitiveLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/FloatPrimitiveLookup.java new file mode 100644 index 0000000000..26b58f0053 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/FloatPrimitiveLookup.java @@ -0,0 +1,42 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class FloatPrimitiveLookup extends Lookup { + private float[] elements; + private final float pivot = 2; + + @Setup + @Override + public void prepare() { + int common = 1; + elements = new float[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @TearDown + @Override + public void clean() { + elements = null; + } + + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + while (pivot != elements[index]) { + index++; + } + return index; + } + + @Override + public String getSimpleClassName() { + return FloatPrimitiveLookup.class.getSimpleName(); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/FloatWrapperLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/FloatWrapperLookup.java new file mode 100644 index 0000000000..8e75eae3e3 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/FloatWrapperLookup.java @@ -0,0 +1,43 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class FloatWrapperLookup extends Lookup { + private Float[] elements; + private final float pivot = 2; + + @Override + @Setup + public void prepare() { + float common = 1; + elements = new Float[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @Override + @TearDown + public void clean() { + elements = null; + } + + @Override + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + Float pivotWrapper = pivot; + while (!pivotWrapper.equals(elements[index])) { + index++; + } + return index; + } + + @Override + public String getSimpleClassName() { + return FloatWrapperLookup.class.getSimpleName(); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/IntPrimitiveLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/IntPrimitiveLookup.java new file mode 100644 index 0000000000..551163dba2 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/IntPrimitiveLookup.java @@ -0,0 +1,45 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class IntPrimitiveLookup extends Lookup { + + private int[] elements; + private final int pivot = 2; + + @Setup + @Override + public void prepare() { + int common = 1; + elements = new int[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @TearDown + @Override + public void clean() { + elements = null; + } + + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + while (pivot != elements[index]) { + index++; + } + return index; + } + + @Override + public String getSimpleClassName() { + return IntPrimitiveLookup.class.getSimpleName(); + } + + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/IntegerWrapperLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/IntegerWrapperLookup.java new file mode 100644 index 0000000000..f39fb80a0b --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/IntegerWrapperLookup.java @@ -0,0 +1,45 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class IntegerWrapperLookup extends Lookup { + private Integer[] elements; + private final int pivot = 2; + + @Override + @Setup + public void prepare() { + int common = 1; + elements = new Integer[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @Override + @TearDown + public void clean() { + elements = null; + } + + @Override + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + Integer pivotWrapper = pivot; + while (!pivotWrapper.equals(elements[index])) { + index++; + } + return index; + + } + + @Override + public String getSimpleClassName() { + return IntegerWrapperLookup.class.getSimpleName(); + } + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/LongPrimitiveLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/LongPrimitiveLookup.java new file mode 100644 index 0000000000..2f414577da --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/LongPrimitiveLookup.java @@ -0,0 +1,42 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class LongPrimitiveLookup extends Lookup { + private long[] elements; + private final long pivot = 2; + + @Setup + @Override + public void prepare() { + long common = 1; + elements = new long[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @TearDown + @Override + public void clean() { + elements = null; + } + + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + while (pivot != elements[index]) { + index++; + } + return index; + } + + @Override + public String getSimpleClassName() { + return LongPrimitiveLookup.class.getSimpleName(); + } +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/LongWrapperLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/LongWrapperLookup.java new file mode 100644 index 0000000000..692a9fd15c --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/LongWrapperLookup.java @@ -0,0 +1,45 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class LongWrapperLookup extends Lookup{ + private Long[] elements; + private final long pivot = 2; + + @Override + @Setup + public void prepare() { + long common = 1; + elements = new Long[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @Override + @TearDown + public void clean() { + elements = null; + } + + @Override + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + Long pivotWrapper = pivot; + while (!pivotWrapper.equals(elements[index])) { + index++; + } + return index; + + } + + @Override + public String getSimpleClassName() { + return LongWrapperLookup.class.getSimpleName(); + } + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/Lookup.java b/core-java-8/src/main/java/com/baeldung/primitive/Lookup.java new file mode 100644 index 0000000000..3dc7b7655e --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/Lookup.java @@ -0,0 +1,56 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.results.RunResult; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.RunnerException; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import java.util.Collection; + +/** + * An abstract class that is to be extended by the classes that + * perform lookup in the arrays either of Java primitive types or their wrappers. + */ +public abstract class Lookup { + /** + * the array size + */ + final protected int s = 50000000; + + /** + * Initialize the array: fill in the array with the same + * elements except for the last one. + */ + abstract public void prepare(); + + /** + * Free the array's reference. + */ + abstract public void clean(); + + /** + * Find the position of the element that is different from the others. + * By construction, it is the last array element. + * + * @return array's last element index + */ + abstract public int findPosition(); + + /** + * Get the name of the class that extends this one. It is needed in order + * to set up the benchmark. + * + * @return + */ + abstract public String getSimpleClassName(); + + Collection run() throws RunnerException { + Options opt = new OptionsBuilder() + .include(getSimpleClassName()) + .forks(1) + .build(); + return new Runner(opt).run(); + } + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/ShortPrimitiveLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/ShortPrimitiveLookup.java new file mode 100644 index 0000000000..2d2ffbd67b --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/ShortPrimitiveLookup.java @@ -0,0 +1,45 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class ShortPrimitiveLookup extends Lookup { + + private short[] elements; + private final short pivot = 2; + + @Setup + @Override + public void prepare() { + short common = 1; + elements = new short[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @TearDown + @Override + public void clean() { + elements = null; + } + + + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + while (pivot != elements[index]) { + index++; + } + return index; + } + + @Override + public String getSimpleClassName() { + return ShortPrimitiveLookup.class.getSimpleName(); + } + + +} diff --git a/core-java-8/src/main/java/com/baeldung/primitive/ShortWrapperLookup.java b/core-java-8/src/main/java/com/baeldung/primitive/ShortWrapperLookup.java new file mode 100644 index 0000000000..1c1cd4a345 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/primitive/ShortWrapperLookup.java @@ -0,0 +1,46 @@ +package com.baeldung.primitive; + +import org.openjdk.jmh.annotations.*; + +@State(Scope.Thread) +public class ShortWrapperLookup extends Lookup { + private Short[] elements; + private final short pivot = 2; + + @Override + @Setup + public void prepare() { + short common = 1; + elements = new Short[s]; + for (int i = 0; i < s - 1; i++) { + elements[i] = common; + } + elements[s - 1] = pivot; + } + + @Override + @TearDown + public void clean() { + elements = null; + } + + @Override + @Benchmark + @BenchmarkMode(Mode.AverageTime) + public int findPosition() { + int index = 0; + Short pivotWrapper = pivot; + while (!pivotWrapper.equals(elements[index])) { + index++; + } + return index; + + } + + @Override + public String getSimpleClassName() { + return ShortWrapperLookup.class.getSimpleName(); + } + + +} diff --git a/out/production/main/com/baeldung/.gitignore b/out/production/main/com/baeldung/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/out/production/main/com/baeldung/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/out/production/main/com/baeldung/README.md b/out/production/main/com/baeldung/README.md new file mode 100644 index 0000000000..51809b2882 --- /dev/null +++ b/out/production/main/com/baeldung/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [SHA-256 Hashing in Java](http://www.baeldung.com/sha-256-hashing-java) diff --git a/out/production/main/com/baeldung/enums/README.md b/out/production/main/com/baeldung/enums/README.md new file mode 100644 index 0000000000..6ccfa725f5 --- /dev/null +++ b/out/production/main/com/baeldung/enums/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [A Guide to Java Enums](http://www.baeldung.com/a-guide-to-java-enums) diff --git a/out/production/main/com/baeldung/networking/README.md b/out/production/main/com/baeldung/networking/README.md new file mode 100644 index 0000000000..b9e827f085 --- /dev/null +++ b/out/production/main/com/baeldung/networking/README.md @@ -0,0 +1,5 @@ +### Relevant Articles: +- [A Guide To UDP In Java](http://www.baeldung.com/udp-in-java) +- [A Guide To HTTP Cookies In Java](http://www.baeldung.com/cookies-java) +- [A Guide to the Java URL](http://www.baeldung.com/java-url) +- [Working with Network Interfaces in Java](http://www.baeldung.com/java-network-interfaces) diff --git a/out/production/main/com/baeldung/objectsize/MANIFEST.MF b/out/production/main/com/baeldung/objectsize/MANIFEST.MF new file mode 100644 index 0000000000..b814f624d0 --- /dev/null +++ b/out/production/main/com/baeldung/objectsize/MANIFEST.MF @@ -0,0 +1 @@ +Premain-class: com.baeldung.objectsize.InstrumentationAgent diff --git a/out/production/main/com/baeldung/printscreen/README.md b/out/production/main/com/baeldung/printscreen/README.md new file mode 100644 index 0000000000..7b3b40c102 --- /dev/null +++ b/out/production/main/com/baeldung/printscreen/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) diff --git a/out/production/main/javac-args/arguments b/out/production/main/javac-args/arguments new file mode 100644 index 0000000000..51639800a7 --- /dev/null +++ b/out/production/main/javac-args/arguments @@ -0,0 +1,2 @@ +-d javac-target -verbose +com/baeldung/javac/Data.java \ No newline at end of file diff --git a/out/production/main/javac-args/options b/out/production/main/javac-args/options new file mode 100644 index 0000000000..f02f2344ff --- /dev/null +++ b/out/production/main/javac-args/options @@ -0,0 +1,2 @@ +-d javac-target +-verbose \ No newline at end of file diff --git a/out/production/main/javac-args/types b/out/production/main/javac-args/types new file mode 100644 index 0000000000..ef2d861f84 --- /dev/null +++ b/out/production/main/javac-args/types @@ -0,0 +1 @@ +com/baeldung/javac/Data.java \ No newline at end of file diff --git a/out/production/main/javac-args/xlint-ops b/out/production/main/javac-args/xlint-ops new file mode 100644 index 0000000000..cdccbc0cce --- /dev/null +++ b/out/production/main/javac-args/xlint-ops @@ -0,0 +1,3 @@ +-d javac-target +-Xlint:rawtypes,unchecked,static,cast,serial,fallthrough +com/baeldung/javac/Data.java \ No newline at end of file diff --git a/out/production/main/log4j.properties b/out/production/main/log4j.properties new file mode 100644 index 0000000000..5fe42d854c --- /dev/null +++ b/out/production/main/log4j.properties @@ -0,0 +1,9 @@ +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n diff --git a/out/production/main1/com/baeldung/datetime/README.md b/out/production/main1/com/baeldung/datetime/README.md new file mode 100644 index 0000000000..1e4adbb612 --- /dev/null +++ b/out/production/main1/com/baeldung/datetime/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) diff --git a/out/test/test/com/baeldung/hexToAscii/README.md b/out/test/test/com/baeldung/hexToAscii/README.md new file mode 100644 index 0000000000..c6d5826333 --- /dev/null +++ b/out/test/test/com/baeldung/hexToAscii/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Convert Hex to ASCII in Java](http://www.baeldung.com/java-convert-hex-to-ascii) diff --git a/out/test/test/com/baeldung/java/conversion/README.md b/out/test/test/com/baeldung/java/conversion/README.md new file mode 100644 index 0000000000..7c81180249 --- /dev/null +++ b/out/test/test/com/baeldung/java/conversion/README.md @@ -0,0 +1,2 @@ +Relevant Articles: +- [Java String Conversions](http://www.baeldung.com/java-string-conversions) diff --git a/out/test/test/com/baeldung/stringisnumeric.zip b/out/test/test/com/baeldung/stringisnumeric.zip new file mode 100644 index 0000000000000000000000000000000000000000..b8a7b9b35a09fea091423fe1c08e771d6be48112 GIT binary patch literal 3227 zcmb7`3p|r;AIFE8Q#sT~iO3?$jHZaC7KOJ* zaw>Ajnb{*sN(|9UdG7V*(~9?fdar#x`|rL#*S-Ju{{61&fBg|wTwo}OHSRgxvi|nt z`qk&N1KdqG_QbNzKv>uDt^NjGc^=ySm$o9%`v@T?&+2AZwIeizN0te6c_{1Z@4cN(MNL$2~mO{t>34e+Fg4dh^c zmAlykHVhA)D&DR-aQ1%rdb1 z<{xhfi8NNB3GdHJIVtX#AGVl`q#ZK!QPev?do6Jr6G^^#O6aSg?zN%`hkef%3SS&7 z7?4P>TgsU0Kbuu&-hIaXWi5A4 zjgpB=-F}P#TTl|QIA5qzuzUHY(e(hz!W;Q#){r#r6>k5D%ohthKb(mGoOyC(gQ_Ut z%z3~WwRM~U{BXwN?FcweKMTLZcr1p1arVUiWKV9AzDJ#^aQz$cWl3X&;9Jh<1LttO z(8nY}{~lkIpd&?2BKN%@nO@D@amgw}K{`3GivDOpOZYlMc5}(NXr9(W;rQ!2u={eI z9u+pO7-5J_KnXE^yXNlW9v*_m?nBXW-8*C8%sRQo?w3q^*a&Lc`g6j@AoIzyhzQE{ zN=VN%&B@-~YL_TBEZNGZV3fPVvwJ?BDH6rB>g8{qa2MH*=Z)0cEiMt5;W`MJ7oj!fA9@zrVMI{@0Uo_J)kaugbM-YyRXB57_xXi~DcAn#h%KHJ8 z7df~GAb`pj0hJH@lgbDT-fykQ?YbaG6+R-q%O}1F{(|d zcrHnhyi!e-+?Kf)CpK{PW932=*_AhP&+myRJFmLCVFDjWF40(O zhurj+K)P9n;+Ik-;r<>f@{fgfyHw6?_FM7g5Ll3IPHSPIw+_V6ko#tIgQe2WfBBO7 zWzAoSpX=dxrd{Pb5XoQrJaz=bCgrsjaYheLKd_*x zOSC>-to1q^)0lQJc;+mKCJPtu2@!biwcn_}0WKymQ@l4vlL{^nlbDi|)Y^6Knrk+! z>rqdbfIYsl%0{a#vn2(I4$`gaB)&jWmSlvQJ60lgw$+;ld($&%K0ns+B%t^u(i2W~ zK=E`g5J+Pk#cjWx0^h5}_fl@_i*fm-U?f+2N2)@j-$>60+Mh_>pnf6##5TKP64}bA zr%_XEuuI%kLJJw1_26jzz#LOnUU9Rzd0u4gM=5%0oX|B(VUyNP%CE>ByYIE;!Q0;{ zWkTv(7ea()sj7nfX$Rm4g{?B@^7q-IiyZymXZ7Y&AGJ?-klV}CDyA|V8zf_$+)7|m zmKw56@t$;U^Kk}!_h{*D1nTlmOT}h}_wbXNd6Oih^)py$F62}VEzrC6t!^GMVvBis zMi707L9YGtvs#+g1E6fTCNk3~uY)@K#0)_n(J7H|`Ho(VN9kxf(OL6ANhYS^q_+li zp=JnN@fmkMr&eU6p(-IF|=lUufN7J)HG?D_OX3d=!X$?=v&r13NmgP07m2jM(qDhBYs-^xk=STgH6LH!jiW9xj{CpGvfqfoh4^csJqsRxgkf(K^*l@Gv3^T?!Pk$`gIF|JGDLo)@ z0jU#0#i56qur0&70t?DYa2)HNH`>m%OapiwbP)q-*n(gxeUR zudi?7WNCXjxne4dXqsZLs^53gVW+BB~erU z0-=iwUkIhhPC`q1b;xKL57)~We%Y)~jKJ-e_0ZzwPNDXgxy;}h-Jlwv5^-?qgZ^7T zBnMc+8m!KUHGb`m_(9U&?sI^|LE+8i;_2g^9IMd|cZrY;T>r?hUJtdJf%QNCe@Dfh zzr8}th&}%*2YddtodSFQMqnZS`i8&JH?Tuce83|l;H3);hHtP(c8IkHDLaHRuoM0# z#Ja~SJ3~b7o=dFUSS;gV8e3#%SbOZSGem*cGW^3K#15cWaR|(E;@uyzg)@Cg7M7vy7I{SAPt7WDuC literal 0 HcmV?d00001 From 565a11620b93ad9d0b7b0c09f30a282008cfc879 Mon Sep 17 00:00:00 2001 From: xamcross Date: Mon, 27 Aug 2018 00:19:42 +0300 Subject: [PATCH 292/298] BAEL-2070 (#5064) * BAEL-2070 UnsatisfiedDependencyException example app * [BAEL-8456] - Moved Java Date articles into a new module - 'java-dates' * BAEL-2070 Refactoring; Replaced field injection with constructor injection * fix package, fix get random node * update neo4j * fix formatting * [BAEL-8456] - Moved more articles into 'java-dates' module * BAEL-2070 Small indentation fix --- .../exception/app/CustomConfiguration.java | 13 +++++++++++++ .../exception/app/PurchaseDeptService.java | 13 +++++++++++++ .../exception/repository/DressRepository.java | 9 +++++++++ .../exception/repository/InventoryRepository.java | 7 +++++++ .../exception/repository/ShoeRepository.java | 7 +++++++ 5 files changed, 49 insertions(+) create mode 100644 spring-core/src/main/java/com/baeldung/dependency/exception/app/CustomConfiguration.java create mode 100644 spring-core/src/main/java/com/baeldung/dependency/exception/app/PurchaseDeptService.java create mode 100644 spring-core/src/main/java/com/baeldung/dependency/exception/repository/DressRepository.java create mode 100644 spring-core/src/main/java/com/baeldung/dependency/exception/repository/InventoryRepository.java create mode 100644 spring-core/src/main/java/com/baeldung/dependency/exception/repository/ShoeRepository.java diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/app/CustomConfiguration.java b/spring-core/src/main/java/com/baeldung/dependency/exception/app/CustomConfiguration.java new file mode 100644 index 0000000000..4366cb617a --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependency/exception/app/CustomConfiguration.java @@ -0,0 +1,13 @@ +package com.baeldung.dependency.exception.app; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +@SpringBootApplication +@ComponentScan(basePackages = "com.baeldung.dependency.exception") +public class CustomConfiguration { + public static void main(String[] args) { + SpringApplication.run(CustomConfiguration.class, args); + } +} diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/app/PurchaseDeptService.java b/spring-core/src/main/java/com/baeldung/dependency/exception/app/PurchaseDeptService.java new file mode 100644 index 0000000000..1e6fad63aa --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependency/exception/app/PurchaseDeptService.java @@ -0,0 +1,13 @@ +package com.baeldung.dependency.exception.app; + +import com.baeldung.dependency.exception.repository.InventoryRepository; +import org.springframework.stereotype.Service; + +@Service +public class PurchaseDeptService { + private InventoryRepository repository; + + public PurchaseDeptService(InventoryRepository repository) { + this.repository = repository; + } +} \ No newline at end of file diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/repository/DressRepository.java b/spring-core/src/main/java/com/baeldung/dependency/exception/repository/DressRepository.java new file mode 100644 index 0000000000..4a6c836143 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependency/exception/repository/DressRepository.java @@ -0,0 +1,9 @@ +package com.baeldung.dependency.exception.repository; + +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Repository; + +@Primary +@Repository +public class DressRepository implements InventoryRepository { +} diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/repository/InventoryRepository.java b/spring-core/src/main/java/com/baeldung/dependency/exception/repository/InventoryRepository.java new file mode 100644 index 0000000000..ccb2ad9c32 --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependency/exception/repository/InventoryRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.dependency.exception.repository; + +import org.springframework.stereotype.Repository; + +@Repository +public interface InventoryRepository { +} diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/repository/ShoeRepository.java b/spring-core/src/main/java/com/baeldung/dependency/exception/repository/ShoeRepository.java new file mode 100644 index 0000000000..60495914cd --- /dev/null +++ b/spring-core/src/main/java/com/baeldung/dependency/exception/repository/ShoeRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.dependency.exception.repository; + +import org.springframework.stereotype.Repository; + +@Repository +public class ShoeRepository implements InventoryRepository { +} From 813bc3249fd4013756d7c7b10af3cc88707fb8dd Mon Sep 17 00:00:00 2001 From: chandra Date: Sun, 26 Aug 2018 22:07:55 -0400 Subject: [PATCH 293/298] BAEL-1829 - Overview of Apache Crunch --- libraries-data/README.md | 1 + libraries-data/pom.xml | 67 +++++++++++++- .../src/main/assembly/hadoop-job.xml | 28 ++++++ .../com/baeldung/crunch/StopWordFilter.java | 25 ++++++ .../com/baeldung/crunch/ToUpperCaseFn.java | 11 +++ .../crunch/ToUpperCaseWithCounterFn.java | 20 +++++ .../java/com/baeldung/crunch/Tokenizer.java | 23 +++++ .../java/com/baeldung/crunch/WordCount.java | 62 +++++++++++++ .../baeldung/crunch/MemPipelineUnitTest.java | 89 +++++++++++++++++++ .../crunch/StopWordFilterUnitTest.java | 41 +++++++++ .../crunch/ToUpperCaseFnUnitTest.java | 21 +++++ .../ToUpperCaseWithCounterFnUnitTest.java | 31 +++++++ .../baeldung/crunch/TokenizerUnitTest.java | 27 ++++++ .../src/test/resources/crunch/input.txt | 21 +++++ 14 files changed, 466 insertions(+), 1 deletion(-) create mode 100644 libraries-data/src/main/assembly/hadoop-job.xml create mode 100644 libraries-data/src/main/java/com/baeldung/crunch/StopWordFilter.java create mode 100644 libraries-data/src/main/java/com/baeldung/crunch/ToUpperCaseFn.java create mode 100644 libraries-data/src/main/java/com/baeldung/crunch/ToUpperCaseWithCounterFn.java create mode 100644 libraries-data/src/main/java/com/baeldung/crunch/Tokenizer.java create mode 100644 libraries-data/src/main/java/com/baeldung/crunch/WordCount.java create mode 100644 libraries-data/src/test/java/com/baeldung/crunch/MemPipelineUnitTest.java create mode 100644 libraries-data/src/test/java/com/baeldung/crunch/StopWordFilterUnitTest.java create mode 100644 libraries-data/src/test/java/com/baeldung/crunch/ToUpperCaseFnUnitTest.java create mode 100644 libraries-data/src/test/java/com/baeldung/crunch/ToUpperCaseWithCounterFnUnitTest.java create mode 100644 libraries-data/src/test/java/com/baeldung/crunch/TokenizerUnitTest.java create mode 100644 libraries-data/src/test/resources/crunch/input.txt diff --git a/libraries-data/README.md b/libraries-data/README.md index fbe49e9f74..15dacdfed8 100644 --- a/libraries-data/README.md +++ b/libraries-data/README.md @@ -10,3 +10,4 @@ - [A Guide to Apache Ignite](http://www.baeldung.com/apache-ignite) - [Apache Ignite with Spring Data](http://www.baeldung.com/apache-ignite-spring-data) - [Guide to JMapper](https://github.com/eugenp/tutorials/tree/master/libraries-data) +- [A Guide to Apache Crunch](https://github.com/eugenp/tutorials/tree/master/libraries-data) diff --git a/libraries-data/pom.xml b/libraries-data/pom.xml index e5e8fd5551..707b646874 100644 --- a/libraries-data/pom.xml +++ b/libraries-data/pom.xml @@ -147,6 +147,44 @@ jmapper-core ${jmapper.version} + + + + org.apache.crunch + crunch-core + ${org.apache.crunch.crunch-core.version} + + + org.apache.hadoop + hadoop-client + ${org.apache.hadoop.hadoop-client} + provided + + + + commons-cli + commons-cli + 1.2 + provided + + + commons-io + commons-io + 2.1 + provided + + + commons-httpclient + commons-httpclient + 3.0.1 + provided + + + commons-codec + commons-codec + + + @@ -252,6 +290,31 @@ + + org.apache.maven.plugins + maven-assembly-plugin + 2.3 + + + src/main/assembly/hadoop-job.xml + + + + com.baeldung.crunch.WordCount + + + + + + make-assembly + package + + single + + + + + @@ -282,7 +345,9 @@ 5.0.2 5.0.0-release 5.0.4 - 1.6.0.1 + 1.6.0.1 + 0.15.0 + 2.2.0 diff --git a/libraries-data/src/main/assembly/hadoop-job.xml b/libraries-data/src/main/assembly/hadoop-job.xml new file mode 100644 index 0000000000..1917e1e5a3 --- /dev/null +++ b/libraries-data/src/main/assembly/hadoop-job.xml @@ -0,0 +1,28 @@ + + + + + job + + jar + + false + + + false + runtime + lib + + ${groupId}:${artifactId} + + + + true + + ${groupId}:${artifactId} + + + + diff --git a/libraries-data/src/main/java/com/baeldung/crunch/StopWordFilter.java b/libraries-data/src/main/java/com/baeldung/crunch/StopWordFilter.java new file mode 100644 index 0000000000..bdd606e179 --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/crunch/StopWordFilter.java @@ -0,0 +1,25 @@ +package com.baeldung.crunch; + +import java.util.Set; + +import org.apache.crunch.FilterFn; + +import com.google.common.collect.ImmutableSet; + +/** + * A filter that removes known stop words. + */ +public class StopWordFilter extends FilterFn { + + // English stop words, borrowed from Lucene. + private static final Set STOP_WORDS = ImmutableSet + .copyOf(new String[] { "a", "and", "are", "as", "at", "be", "but", "by", + "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", + "or", "s", "such", "t", "that", "the", "their", "then", "there", + "these", "they", "this", "to", "was", "will", "with" }); + + @Override + public boolean accept(String word) { + return !STOP_WORDS.contains(word); + } +} diff --git a/libraries-data/src/main/java/com/baeldung/crunch/ToUpperCaseFn.java b/libraries-data/src/main/java/com/baeldung/crunch/ToUpperCaseFn.java new file mode 100644 index 0000000000..a277883ad3 --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/crunch/ToUpperCaseFn.java @@ -0,0 +1,11 @@ +package com.baeldung.crunch; + +import org.apache.crunch.MapFn; + +public class ToUpperCaseFn extends MapFn { + + @Override + public String map(String input) { + return input != null ? input.toUpperCase() : input; + } +} diff --git a/libraries-data/src/main/java/com/baeldung/crunch/ToUpperCaseWithCounterFn.java b/libraries-data/src/main/java/com/baeldung/crunch/ToUpperCaseWithCounterFn.java new file mode 100644 index 0000000000..f753f98866 --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/crunch/ToUpperCaseWithCounterFn.java @@ -0,0 +1,20 @@ +package com.baeldung.crunch; + +import org.apache.crunch.MapFn; + +@SuppressWarnings("serial") +public class ToUpperCaseWithCounterFn extends MapFn { + + @Override + public String map(String input) { + if (input == null) { + return input; + } else { + String output = input.toUpperCase(); + if (!input.equals(output)) { + increment("UpperCase", "modified"); + } + return output; + } + } +} diff --git a/libraries-data/src/main/java/com/baeldung/crunch/Tokenizer.java b/libraries-data/src/main/java/com/baeldung/crunch/Tokenizer.java new file mode 100644 index 0000000000..9523634be1 --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/crunch/Tokenizer.java @@ -0,0 +1,23 @@ +package com.baeldung.crunch; + +import org.apache.crunch.DoFn; +import org.apache.crunch.Emitter; + +import com.google.common.base.Splitter; + +/** + * Splits a line of text, filtering known stop words. + */ +public class Tokenizer extends DoFn { + private static final Splitter SPLITTER = Splitter + .onPattern("\\s+") + .omitEmptyStrings(); + + @Override + public void process(String line, + Emitter emitter) { + for (String word : SPLITTER.split(line)) { + emitter.emit(word); + } + } +} diff --git a/libraries-data/src/main/java/com/baeldung/crunch/WordCount.java b/libraries-data/src/main/java/com/baeldung/crunch/WordCount.java new file mode 100644 index 0000000000..c49abec68a --- /dev/null +++ b/libraries-data/src/main/java/com/baeldung/crunch/WordCount.java @@ -0,0 +1,62 @@ +package com.baeldung.crunch; + +import org.apache.crunch.PCollection; +import org.apache.crunch.PTable; +import org.apache.crunch.Pipeline; +import org.apache.crunch.PipelineResult; +import org.apache.crunch.impl.mr.MRPipeline; +import org.apache.crunch.types.writable.Writables; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.conf.Configured; +import org.apache.hadoop.util.GenericOptionsParser; +import org.apache.hadoop.util.Tool; +import org.apache.hadoop.util.ToolRunner; + +/** + * A word count example for Apache Crunch, based on Crunch's example projects. + */ +public class WordCount extends Configured implements Tool { + + public static void main(String[] args) throws Exception { + ToolRunner.run(new Configuration(), new WordCount(), args); + } + + public int run(String[] args) throws Exception { + + if (args.length != 2) { + System.err.println("Usage: hadoop jar crunch-1.0.0-SNAPSHOT-job.jar" + " [generic options] input output"); + System.err.println(); + GenericOptionsParser.printGenericCommandUsage(System.err); + return 1; + } + + String inputPath = args[0]; + String outputPath = args[1]; + + // Create an object to coordinate pipeline creation and execution. + Pipeline pipeline = new MRPipeline(WordCount.class, getConf()); + + // Reference a given text file as a collection of Strings. + PCollection lines = pipeline.readTextFile(inputPath); + + // Define a function that splits each line in a PCollection of Strings into + // a PCollection made up of the individual words in the file. + // The second argument sets the serialization format. + PCollection words = lines.parallelDo(new Tokenizer(), Writables.strings()); + + // Take the collection of words and remove known stop words. + PCollection noStopWords = words.filter(new StopWordFilter()); + + // The count method applies a series of Crunch primitives and returns + // a map of the unique words in the input PCollection to their counts. + PTable counts = noStopWords.count(); + + // Instruct the pipeline to write the resulting counts to a text file. + pipeline.writeTextFile(counts, outputPath); + + // Execute the pipeline as a MapReduce. + PipelineResult result = pipeline.done(); + + return result.succeeded() ? 0 : 1; + } +} diff --git a/libraries-data/src/test/java/com/baeldung/crunch/MemPipelineUnitTest.java b/libraries-data/src/test/java/com/baeldung/crunch/MemPipelineUnitTest.java new file mode 100644 index 0000000000..3ee2bb6836 --- /dev/null +++ b/libraries-data/src/test/java/com/baeldung/crunch/MemPipelineUnitTest.java @@ -0,0 +1,89 @@ +package com.baeldung.crunch; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertIterableEquals; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Calendar; + +import org.apache.crunch.PCollection; +import org.apache.crunch.Pipeline; +import org.apache.crunch.Source; +import org.apache.crunch.Target; +import org.apache.crunch.impl.mem.MemPipeline; +import org.apache.crunch.io.From; +import org.apache.crunch.io.To; +import org.junit.Ignore; +import org.junit.Test; + +public class MemPipelineUnitTest { + + private static final String INPUT_FILE_PATH = "src/test/resources/crunch/input.txt"; + + @Test + public void givenPipeLineAndSource_whenSourceRead_thenExpectedNumberOfRecordsRead() { + Pipeline pipeline = MemPipeline.getInstance(); + Source source = From.textFile(INPUT_FILE_PATH); + + PCollection lines = pipeline.read(source); + + assertEquals(21, lines.asCollection() + .getValue() + .size()); + } + + @Test + public void givenPipeLine_whenTextFileRead_thenExpectedNumberOfRecordsRead() { + Pipeline pipeline = MemPipeline.getInstance(); + + PCollection lines = pipeline.readTextFile(INPUT_FILE_PATH); + + assertEquals(21, lines.asCollection() + .getValue() + .size()); + } + + private String createOutputPath() throws IOException { + Path path = Files.createTempDirectory("test"); + final String outputFilePath = path.toString() + File.separatorChar + + "output.text"; + return outputFilePath; + } + + @Test + @Ignore("Requires Hadoop binaries") + public void givenCollection_whenWriteCalled_fileWrittenSuccessfully() + throws IOException { + PCollection inputStrings = MemPipeline.collectionOf("Hello", + "Apache", "Crunch", Calendar.getInstance() + .toString()); + final String outputFilePath = createOutputPath(); + Target target = To.textFile(outputFilePath); + + inputStrings.write(target); + + Pipeline pipeline = MemPipeline.getInstance(); + PCollection lines = pipeline.readTextFile(outputFilePath); + assertIterableEquals(inputStrings.materialize(), lines.materialize()); + } + + @Test + @Ignore("Requires Hadoop binaries") + public void givenPipeLine_whenWriteTextFileCalled_fileWrittenSuccessfully() + throws IOException { + Pipeline pipeline = MemPipeline.getInstance(); + PCollection inputStrings = MemPipeline.collectionOf("Hello", + "Apache", "Crunch", Calendar.getInstance() + .toString()); + final String outputFilePath = createOutputPath(); + + pipeline.writeTextFile(inputStrings, outputFilePath); + + PCollection lines = pipeline.readTextFile(outputFilePath); + assertIterableEquals(inputStrings.materialize(), lines.materialize()); + } + +} diff --git a/libraries-data/src/test/java/com/baeldung/crunch/StopWordFilterUnitTest.java b/libraries-data/src/test/java/com/baeldung/crunch/StopWordFilterUnitTest.java new file mode 100644 index 0000000000..fffefc2bfb --- /dev/null +++ b/libraries-data/src/test/java/com/baeldung/crunch/StopWordFilterUnitTest.java @@ -0,0 +1,41 @@ +package com.baeldung.crunch; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.crunch.FilterFn; +import org.apache.crunch.PCollection; +import org.apache.crunch.impl.mem.MemPipeline; +import org.junit.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +public class StopWordFilterUnitTest { + + @Test + public void givenFilter_whenStopWordPassed_thenFalseReturned() { + FilterFn filter = new StopWordFilter(); + + assertFalse(filter.accept("the")); + } + + @Test + public void givenFilter_whenNonStopWordPassed_thenTrueReturned() { + FilterFn filter = new StopWordFilter(); + + assertTrue(filter.accept("Hello")); + } + + @Test + public void givenWordCollection_whenFiltered_thenStopWordsRemoved() { + PCollection words = MemPipeline.collectionOf("This", "is", "a", + "test", "sentence"); + + PCollection noStopWords = words.filter(new StopWordFilter()); + + assertEquals(ImmutableList.of("This", "test", "sentence"), + Lists.newArrayList(noStopWords.materialize())); + } +} diff --git a/libraries-data/src/test/java/com/baeldung/crunch/ToUpperCaseFnUnitTest.java b/libraries-data/src/test/java/com/baeldung/crunch/ToUpperCaseFnUnitTest.java new file mode 100644 index 0000000000..09fb9fba85 --- /dev/null +++ b/libraries-data/src/test/java/com/baeldung/crunch/ToUpperCaseFnUnitTest.java @@ -0,0 +1,21 @@ +package com.baeldung.crunch; + +import static org.junit.Assert.assertEquals; + +import org.apache.crunch.impl.mem.emit.InMemoryEmitter; +import org.junit.Test; + +import com.google.common.collect.ImmutableList; + +public class ToUpperCaseFnUnitTest { + + @Test + public void givenString_whenToUpperCaseFnCalled_UpperCaseStringReturned() { + InMemoryEmitter emitter = new InMemoryEmitter(); + + new ToUpperCaseFn().process("input", emitter); + + assertEquals(ImmutableList.of("INPUT"), emitter.getOutput()); + } + +} diff --git a/libraries-data/src/test/java/com/baeldung/crunch/ToUpperCaseWithCounterFnUnitTest.java b/libraries-data/src/test/java/com/baeldung/crunch/ToUpperCaseWithCounterFnUnitTest.java new file mode 100644 index 0000000000..76294d273d --- /dev/null +++ b/libraries-data/src/test/java/com/baeldung/crunch/ToUpperCaseWithCounterFnUnitTest.java @@ -0,0 +1,31 @@ +package com.baeldung.crunch; + +import static org.junit.Assert.assertEquals; + +import org.apache.crunch.PCollection; +import org.apache.crunch.impl.mem.MemPipeline; +import org.apache.crunch.types.writable.Writables; +import org.junit.Before; +import org.junit.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; + +public class ToUpperCaseWithCounterFnUnitTest { + + @Before + public void setUp() throws Exception { + MemPipeline.clearCounters(); + } + + @Test + public void whenFunctionCalled_counterIncementendForChangedValues() { + PCollection inputStrings = MemPipeline.collectionOf("This", "is", "a", "TEST", "string"); + PCollection upperCaseStrings = inputStrings.parallelDo(new ToUpperCaseWithCounterFn(), Writables.strings()); + + assertEquals(ImmutableList.of("THIS", "IS", "A", "TEST", "STRING"), Lists.newArrayList(upperCaseStrings.materialize())); + assertEquals(4L, MemPipeline.getCounters() + .findCounter("UpperCase", "modified") + .getValue()); + } +} diff --git a/libraries-data/src/test/java/com/baeldung/crunch/TokenizerUnitTest.java b/libraries-data/src/test/java/com/baeldung/crunch/TokenizerUnitTest.java new file mode 100644 index 0000000000..1e85826d17 --- /dev/null +++ b/libraries-data/src/test/java/com/baeldung/crunch/TokenizerUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.crunch; + +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import org.apache.crunch.Emitter; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class TokenizerUnitTest { + @Mock + private Emitter emitter; + + @Test + public void givenTokenizer_whenLineProcessed_thenOnlyExpectedWordsEmitted() { + Tokenizer splitter = new Tokenizer(); + + splitter.process(" hello world ", emitter); + + verify(emitter).emit("hello"); + verify(emitter).emit("world"); + verifyNoMoreInteractions(emitter); + } +} diff --git a/libraries-data/src/test/resources/crunch/input.txt b/libraries-data/src/test/resources/crunch/input.txt new file mode 100644 index 0000000000..cb78ea5351 --- /dev/null +++ b/libraries-data/src/test/resources/crunch/input.txt @@ -0,0 +1,21 @@ +An an valley indeed so no wonder future nature vanity. Debating all she mistaken indulged believed provided declared. He many kept on draw lain song as same. Whether at dearest certain spirits is entered in to. Rich fine bred real use too many good. She compliment unaffected expression favourable any. Unknown chiefly showing to conduct no. Hung as love evil able to post at as. + + + +Is he staying arrival address earnest. To preference considered it themselves inquietude collecting estimating. View park for why gay knew face. Next than near to four so hand. Times so do he downs me would. Witty abode party her found quiet law. They door four bed fail now have. + +Tolerably earnestly middleton extremely distrusts she boy now not. Add and offered prepare how cordial two promise. Greatly who affixed suppose but enquire compact prepare all put. Added forth chief trees but rooms think may. Wicket do manner others seemed enable rather in. Excellent own discovery unfeeling sweetness questions the gentleman. Chapter shyness matters mr parlors if mention thought. + +Extended kindness trifling remember he confined outlived if. Assistance sentiments yet unpleasing say. Open they an busy they my such high. An active dinner wishes at unable hardly no talked on. Immediate him her resolving his favourite. Wished denote abroad at branch at. + +Village did removed enjoyed explain nor ham saw calling talking. Securing as informed declared or margaret. Joy horrible moreover man feelings own shy. Request norland neither mistake for yet. Between the for morning assured country believe. On even feet time have an no at. Relation so in confined smallest children unpacked delicate. Why sir end believe uncivil respect. Always get adieus nature day course for common. My little garret repair to desire he esteem. + +You vexed shy mirth now noise. Talked him people valley add use her depend letter. Allowance too applauded now way something recommend. Mrs age men and trees jokes fancy. Gay pretended engrossed eagerness continued ten. Admitting day him contained unfeeling attention mrs out. + +Performed suspicion in certainty so frankness by attention pretended. Newspaper or in tolerably education enjoyment. Extremity excellent certainty discourse sincerity no he so resembled. Joy house worse arise total boy but. Elderly up chicken do at feeling is. Like seen drew no make fond at on rent. Behaviour extremely her explained situation yet september gentleman are who. Is thought or pointed hearing he. + +If wandered relation no surprise of screened doubtful. Overcame no insisted ye of trifling husbands. Might am order hours on found. Or dissimilar companions friendship impossible at diminution. Did yourself carriage learning she man its replying. Sister piqued living her you enable mrs off spirit really. Parish oppose repair is me misery. Quick may saw style after money mrs. + +Effects present letters inquiry no an removed or friends. Desire behind latter me though in. Supposing shameless am he engrossed up additions. My possible peculiar together to. Desire so better am cannot he up before points. Remember mistaken opinions it pleasure of debating. Court front maids forty if aware their at. Chicken use are pressed removed. + +To sorry world an at do spoil along. Incommode he depending do frankness remainder to. Edward day almost active him friend thirty piqued. People as period twenty my extent as. Set was better abroad ham plenty secure had horses. Admiration has sir decisively excellence say everything inhabiting acceptance. Sooner settle add put you sudden him. From 500b733518a48d807ce25a5030e6c0adb3fcd9b8 Mon Sep 17 00:00:00 2001 From: Chandra Prakash Date: Sun, 26 Aug 2018 22:38:57 -0400 Subject: [PATCH 294/298] Update pom.xml --- libraries-data/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries-data/pom.xml b/libraries-data/pom.xml index 707b646874..2b83328295 100644 --- a/libraries-data/pom.xml +++ b/libraries-data/pom.xml @@ -347,7 +347,7 @@ 5.0.4 1.6.0.1 0.15.0 - 2.2.0 + 2.2.0 From 2041d4f10aedcd5897893c345f9ab10d272b2346 Mon Sep 17 00:00:00 2001 From: Chandra Prakash Date: Sun, 26 Aug 2018 22:51:41 -0400 Subject: [PATCH 295/298] Update README.md --- libraries-data/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries-data/README.md b/libraries-data/README.md index 15dacdfed8..74697f7c13 100644 --- a/libraries-data/README.md +++ b/libraries-data/README.md @@ -9,5 +9,5 @@ - [Introduction to JCache](http://www.baeldung.com/jcache) - [A Guide to Apache Ignite](http://www.baeldung.com/apache-ignite) - [Apache Ignite with Spring Data](http://www.baeldung.com/apache-ignite-spring-data) -- [Guide to JMapper](https://github.com/eugenp/tutorials/tree/master/libraries-data) -- [A Guide to Apache Crunch](https://github.com/eugenp/tutorials/tree/master/libraries-data) +- [Guide to JMapper](https://www.baeldung.com/jmapper) +- [A Guide to Apache Crunch]https://www.baeldung.com/crunch) From 198610a90adfbf706aa322f69c203c0a599a561f Mon Sep 17 00:00:00 2001 From: Chandra Prakash Date: Sun, 26 Aug 2018 22:52:39 -0400 Subject: [PATCH 296/298] Update README.md --- libraries-data/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries-data/README.md b/libraries-data/README.md index 74697f7c13..32d34f63be 100644 --- a/libraries-data/README.md +++ b/libraries-data/README.md @@ -10,4 +10,4 @@ - [A Guide to Apache Ignite](http://www.baeldung.com/apache-ignite) - [Apache Ignite with Spring Data](http://www.baeldung.com/apache-ignite-spring-data) - [Guide to JMapper](https://www.baeldung.com/jmapper) -- [A Guide to Apache Crunch]https://www.baeldung.com/crunch) +- [A Guide to Apache Crunch](https://www.baeldung.com/crunch) From 3ff20c353e475f04fa681c94c4ede26a701c9d5d Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Mon, 27 Aug 2018 14:07:09 +0530 Subject: [PATCH 297/298] BAEL-8497 Update "File to InputStream" article - Added new tests for data input stream and sequence input stream in JavaXToInputStreamUnitTest - Added new test resource anothersample.txt --- .../java/io/JavaXToInputStreamUnitTest.java | 24 +++++++++++++++++++ .../src/test/resources/anothersample.txt | 1 + 2 files changed, 25 insertions(+) create mode 100644 core-java-io/src/test/resources/anothersample.txt diff --git a/core-java-io/src/test/java/org/baeldung/java/io/JavaXToInputStreamUnitTest.java b/core-java-io/src/test/java/org/baeldung/java/io/JavaXToInputStreamUnitTest.java index 08a4c673cd..6604d75ed1 100644 --- a/core-java-io/src/test/java/org/baeldung/java/io/JavaXToInputStreamUnitTest.java +++ b/core-java-io/src/test/java/org/baeldung/java/io/JavaXToInputStreamUnitTest.java @@ -1,10 +1,12 @@ package org.baeldung.java.io; import java.io.ByteArrayInputStream; +import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.SequenceInputStream; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; @@ -74,6 +76,28 @@ public class JavaXToInputStreamUnitTest { IOUtils.closeQuietly(targetStream); } + @Test + public final void givenUsingPlainJava_whenConvertingFileToDataInputStream_thenCorrect() throws IOException { + final File initialFile = new File("src/test/resources/sample.txt"); + final InputStream targetStream = new DataInputStream(new FileInputStream(initialFile)); + + IOUtils.closeQuietly(targetStream); + } + + @Test + public final void givenUsingPlainJava_whenConvertingFileToSequenceInputStream_thenCorrect() throws IOException { + final File initialFile = new File("src/test/resources/sample.txt"); + final File anotherFile = new File("src/test/resources/anothersample.txt"); + final InputStream targetStream = new FileInputStream(initialFile); + final InputStream anotherTargetStream = new FileInputStream(anotherFile); + + InputStream sequenceTargetStream = new SequenceInputStream(targetStream, anotherTargetStream); + + IOUtils.closeQuietly(targetStream); + IOUtils.closeQuietly(anotherTargetStream); + IOUtils.closeQuietly(sequenceTargetStream); + } + @Test public final void givenUsingGuava_whenConvertingFileToInputStream_thenCorrect() throws IOException { final File initialFile = new File("src/test/resources/sample.txt"); diff --git a/core-java-io/src/test/resources/anothersample.txt b/core-java-io/src/test/resources/anothersample.txt new file mode 100644 index 0000000000..f06f18ce02 --- /dev/null +++ b/core-java-io/src/test/resources/anothersample.txt @@ -0,0 +1 @@ +...Continues \ No newline at end of file From ae287cb55f04bf988133292571cf3cd318736888 Mon Sep 17 00:00:00 2001 From: Siben Nayak Date: Mon, 27 Aug 2018 17:37:35 +0530 Subject: [PATCH 298/298] [BAEL-2032] Operate on an item in a Stream then remove it (#5086) * [BAEL-2032] Operate on an item in a Stream then remove it * [BAEL-2032] Refactored unit test * [BAEL-2032] Added a new test for filter and used logger * Stored the predicate in a separate variable --- .../baeldung/collection/StreamOperateAndRemoveUnitTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java b/core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java index 202fe00017..9f002c89a2 100644 --- a/core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java +++ b/core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java @@ -2,6 +2,7 @@ package com.baeldung.collection; import java.util.ArrayList; import java.util.List; +import java.util.function.Predicate; import java.util.stream.Collectors; import org.junit.Assert; @@ -35,8 +36,9 @@ public class StreamOperateAndRemoveUnitTest { @Test public void givenAListOf10Items_whenOperateAndRemoveQualifiedItemsUsingRemoveIf_thenListContains5Items() { - itemList.stream().filter(item -> item.isQualified()).forEach(item -> item.operate()); - itemList.removeIf(item -> item.isQualified()); + final Predicate isQualified = item -> item.isQualified(); + itemList.stream().filter(isQualified).forEach(item -> item.operate()); + itemList.removeIf(isQualified); Assert.assertEquals(5, itemList.size()); }