diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Baeldung.java b/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/CourseRepository.java similarity index 98% rename from apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Baeldung.java rename to apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/CourseRepository.java index 9dd63cf3ac..a2fd6be435 100644 --- a/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/Baeldung.java +++ b/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/CourseRepository.java @@ -9,7 +9,7 @@ import java.util.Map; @Path("baeldung") @Produces("text/xml") -public class Baeldung { +public class CourseRepository { private Map courses = new HashMap<>(); { @@ -69,4 +69,4 @@ public class Baeldung { } return null; } -} \ No newline at end of file +} diff --git a/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java b/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java index bb35bab3f8..d3ed2eb70e 100644 --- a/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java +++ b/apache-cxf/cxf-jaxrs-implementation/src/main/java/com/baeldung/cxf/jaxrs/implementation/RestfulServer.java @@ -7,8 +7,8 @@ import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider; public class RestfulServer { public static void main(String args[]) throws Exception { JAXRSServerFactoryBean factoryBean = new JAXRSServerFactoryBean(); - factoryBean.setResourceClasses(Baeldung.class); - factoryBean.setResourceProvider(new SingletonResourceProvider(new Baeldung())); + factoryBean.setResourceClasses(CourseRepository.class); + factoryBean.setResourceProvider(new SingletonResourceProvider(new CourseRepository())); factoryBean.setAddress("http://localhost:8080/"); Server server = factoryBean.create(); @@ -18,4 +18,4 @@ public class RestfulServer { server.destroy(); System.exit(0); } -} \ No newline at end of file +} diff --git a/apache-fop/pom.xml b/apache-fop/pom.xml index 658d567a90..949843a47e 100644 --- a/apache-fop/pom.xml +++ b/apache-fop/pom.xml @@ -97,6 +97,14 @@ 8.0.2 + + org.dbdoclet + herold + 6.1.0 + system + ${basedir}/src/test/resources/jars/herold.jar + + net.sf.jtidy jtidy @@ -132,7 +140,8 @@ ${maven-surefire-plugin.version} - **/*IntegrationTest.java + **/*IntegrationTest.java + **/*LiveTest.java @@ -141,6 +150,42 @@ + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + + + json + + + + + + + + 4.3.11.Final diff --git a/apache-fop/src/test/java/org/baeldung/java/ApacheFOPConvertHTMLTest.java b/apache-fop/src/test/java/org/baeldung/java/ApacheFOPConvertHTMLIntegrationTest.java similarity index 98% rename from apache-fop/src/test/java/org/baeldung/java/ApacheFOPConvertHTMLTest.java rename to apache-fop/src/test/java/org/baeldung/java/ApacheFOPConvertHTMLIntegrationTest.java index bde6868b39..99487c8fdf 100644 --- a/apache-fop/src/test/java/org/baeldung/java/ApacheFOPConvertHTMLTest.java +++ b/apache-fop/src/test/java/org/baeldung/java/ApacheFOPConvertHTMLIntegrationTest.java @@ -25,7 +25,7 @@ import org.junit.Test; import org.w3c.dom.Document; import org.w3c.tidy.Tidy; -public class ApacheFOPConvertHTMLTest { +public class ApacheFOPConvertHTMLIntegrationTest { private String inputFile = "src/test/resources/input.html"; private String style = "src/test/resources/xhtml2fo.xsl"; private String style1 = "src/test/resources/docbook-xsl/fo/docbook.xsl"; diff --git a/apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldTest.java b/apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldLiveTest.java similarity index 99% rename from apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldTest.java rename to apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldLiveTest.java index 5e3c2c472b..9e71cd9c16 100644 --- a/apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldTest.java +++ b/apache-fop/src/test/java/org/baeldung/java/ApacheFOPHeroldLiveTest.java @@ -30,7 +30,7 @@ import org.dbdoclet.trafo.script.Script; import org.junit.Test; import org.w3c.dom.Document; -public class ApacheFOPHeroldTest { +public class ApacheFOPHeroldLiveTest { private String[] inputUrls = {// @formatter:off "http://www.baeldung.com/2011/10/20/bootstraping-a-web-application-with-spring-3-1-and-java-based-configuration-part-1/", "http://www.baeldung.com/2011/10/25/building-a-restful-web-service-with-spring-3-1-and-java-based-configuration-part-2/", diff --git a/cdi/src/test/java/com/baeldung/test/TestInterceptor.java b/cdi/src/test/java/com/baeldung/test/InterceptorIntegrationTest.java similarity index 95% rename from cdi/src/test/java/com/baeldung/test/TestInterceptor.java rename to cdi/src/test/java/com/baeldung/test/InterceptorIntegrationTest.java index 3529a796d2..cca8cb7495 100644 --- a/cdi/src/test/java/com/baeldung/test/TestInterceptor.java +++ b/cdi/src/test/java/com/baeldung/test/InterceptorIntegrationTest.java @@ -10,7 +10,7 @@ import org.junit.Test; import com.baeldung.interceptor.AuditedInterceptor; import com.baeldung.service.SuperService; -public class TestInterceptor { +public class InterceptorIntegrationTest { Weld weld; WeldContainer container; diff --git a/cdi/src/test/java/com/baeldung/test/SpringInterceptorIntegrationTest.java b/cdi/src/test/java/com/baeldung/test/SpringInterceptorIntegrationTest.java index cffa2256ca..f711b0c8ce 100644 --- a/cdi/src/test/java/com/baeldung/test/SpringInterceptorIntegrationTest.java +++ b/cdi/src/test/java/com/baeldung/test/SpringInterceptorIntegrationTest.java @@ -23,12 +23,16 @@ public class SpringInterceptorIntegrationTest { @Autowired private List accumulator; + // + @Test public void givenService_whenServiceAndAspectExecuted_thenOk() { String code = "123456"; String result = springSuperService.getInfoFromService(code); + Assert.assertThat(accumulator.size(), is(2)); Assert.assertThat(accumulator.get(0), is("Call to getInfoFromService")); Assert.assertThat(accumulator.get(1), is("Method called successfully: getInfoFromService")); } + } diff --git a/core-java-8/README.md b/core-java-8/README.md deleted file mode 100644 index 7a25040823..0000000000 --- a/core-java-8/README.md +++ /dev/null @@ -1,19 +0,0 @@ -========= - -## Core Java 8 Cookbooks and Examples - -### Relevant Articles: -- [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) -- [Java – Directory Size](http://www.baeldung.com/java-folder-size) -- [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) -- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) -- [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 Thread Pools in Java](http://www.baeldung.com/thread-pool-java-and-guava) -- [Guide to Java 8 Collectors](http://www.baeldung.com/java-8-collectors) -- [The Java 8 Stream API Tutorial](http://www.baeldung.com/java-8-streams) -- [New Features in Java 8](http://www.baeldung.com/java-8-new-features) -- [Introduction to Java 8 Streams](http://www.baeldung.com/java-8-streams-introduction) -- [Guide to the Fork/Join Framework in Java](http://www.baeldung.com/java-fork-join) diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml deleted file mode 100644 index 22e3bab595..0000000000 --- a/core-java-8/pom.xml +++ /dev/null @@ -1,142 +0,0 @@ - - 4.0.0 - - com.baeldung - 1.0.0-SNAPSHOT - core-java8 - - core-java8 - - - - - - - commons-io - commons-io - 2.5 - - - - com.google.guava - guava - ${guava.version} - - - - org.apache.commons - commons-collections4 - 4.0 - - - - commons-codec - commons-codec - 1.10 - - - - org.apache.commons - commons-lang3 - 3.3.2 - - - - org.slf4j - slf4j-api - ${org.slf4j.version} - - - - - - org.hamcrest - hamcrest-library - ${org.hamcrest.version} - test - - - - junit - junit - ${junit.version} - test - - - - org.assertj - assertj-core - 3.5.1 - test - - - - org.mockito - mockito-core - ${mockito.version} - test - - - - - - core-java-8 - - - src/main/resources - true - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - 1.8 - 1.8 - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - - - - - - - UTF-8 - - - 1.7.13 - 1.0.13 - - - 5.1.3.Final - - - 19.0 - 3.4 - - - 1.3 - 4.12 - 1.10.19 - - - 3.5.1 - 2.6 - 2.19.1 - 2.7 - - - - \ No newline at end of file diff --git a/core-java-8/src/main/java/.gitignore b/core-java-8/src/main/java/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/core-java-8/src/main/java/.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/core-java-8/src/main/java/com/baeldung/enums/Pizza.java b/core-java-8/src/main/java/com/baeldung/enums/Pizza.java deleted file mode 100644 index 5bc2d9a9eb..0000000000 --- a/core-java-8/src/main/java/com/baeldung/enums/Pizza.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.baeldung.enums; - -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.List; -import java.util.stream.Collectors; - -public class Pizza { - - private static EnumSet deliveredPizzaStatuses = - EnumSet.of(PizzaStatusEnum.DELIVERED); - - private PizzaStatusEnum status; - - 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; - } - } - - public PizzaStatusEnum getStatus() { - return status; - } - - public void setStatus(PizzaStatusEnum status) { - this.status = status; - } - - public boolean isDeliverable() { - return this.status.isReady(); - } - - public void printTimeToDeliver() { - System.out.println("Time to delivery is " + this.getStatus().getTimeToDelivery() + " days"); - } - - public static List getAllUndeliveredPizzas(List input) { - return input.stream().filter((s) -> !deliveredPizzaStatuses.contains(s.getStatus())).collect(Collectors.toList()); - } - - public static EnumMap> groupPizzaByStatus(List pzList) { - return pzList.stream().collect( - Collectors.groupingBy(Pizza::getStatus, - () -> new EnumMap<>(PizzaStatusEnum.class), Collectors.toList())); - } - - public void deliver() { - if (isDeliverable()) { - PizzaDeliverySystemConfiguration.getInstance().getDeliveryStrategy().deliver(this); - this.setStatus(PizzaStatusEnum.DELIVERED); - } - } - -} \ No newline at end of file diff --git a/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java b/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java deleted file mode 100644 index ed65919387..0000000000 --- a/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.enums; - -public enum PizzaDeliveryStrategy { - EXPRESS { - @Override - public void deliver(Pizza pz) { - System.out.println("Pizza will be delivered in express mode"); - } - }, - NORMAL { - @Override - public void deliver(Pizza pz) { - System.out.println("Pizza will be delivered in normal mode"); - } - }; - - public abstract void deliver(Pizza pz); -} diff --git a/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java b/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java deleted file mode 100644 index 5ccff5e959..0000000000 --- a/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.enums; - - -public enum PizzaDeliverySystemConfiguration { - INSTANCE; - - PizzaDeliverySystemConfiguration() { - // Do the configuration initialization which - // involves overriding defaults like delivery strategy - } - - private PizzaDeliveryStrategy deliveryStrategy = PizzaDeliveryStrategy.NORMAL; - - public static PizzaDeliverySystemConfiguration getInstance() { - return INSTANCE; - } - - public PizzaDeliveryStrategy getDeliveryStrategy() { - return deliveryStrategy; - } - -} diff --git a/core-java-8/src/main/resources/compressed.zip b/core-java-8/src/main/resources/compressed.zip deleted file mode 100644 index 03f840ae2b..0000000000 Binary files a/core-java-8/src/main/resources/compressed.zip and /dev/null differ diff --git a/core-java-8/src/main/resources/logback.xml b/core-java-8/src/main/resources/logback.xml deleted file mode 100644 index eefdc7a337..0000000000 --- a/core-java-8/src/main/resources/logback.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - web - %date [%thread] %-5level %logger{36} - %message%n - - - - - - - - - - - \ No newline at end of file diff --git a/core-java-8/src/main/resources/unzipTest/test1.txt b/core-java-8/src/main/resources/unzipTest/test1.txt deleted file mode 100644 index c57eff55eb..0000000000 --- a/core-java-8/src/main/resources/unzipTest/test1.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World! \ No newline at end of file diff --git a/core-java-8/src/main/resources/zipTest/test1.txt b/core-java-8/src/main/resources/zipTest/test1.txt deleted file mode 100644 index c57eff55eb..0000000000 --- a/core-java-8/src/main/resources/zipTest/test1.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World! \ No newline at end of file diff --git a/core-java-8/src/main/resources/zipTest/test2.txt b/core-java-8/src/main/resources/zipTest/test2.txt deleted file mode 100644 index f0fb0f14d1..0000000000 --- a/core-java-8/src/main/resources/zipTest/test2.txt +++ /dev/null @@ -1 +0,0 @@ -My Name is John \ No newline at end of file diff --git a/core-java-8/src/main/resources/zipTest/testFolder/test3.txt b/core-java-8/src/main/resources/zipTest/testFolder/test3.txt deleted file mode 100644 index 882edb168e..0000000000 --- a/core-java-8/src/main/resources/zipTest/testFolder/test3.txt +++ /dev/null @@ -1 +0,0 @@ -My Name is Tom \ No newline at end of file diff --git a/core-java-8/src/main/resources/zipTest/testFolder/test4.txt b/core-java-8/src/main/resources/zipTest/testFolder/test4.txt deleted file mode 100644 index a78c3fadc8..0000000000 --- a/core-java-8/src/main/resources/zipTest/testFolder/test4.txt +++ /dev/null @@ -1 +0,0 @@ -My Name is Jane \ No newline at end of file diff --git a/core-java-8/src/test/resources/test.txt b/core-java-8/src/test/resources/test.txt deleted file mode 100644 index 652d70630f..0000000000 --- a/core-java-8/src/test/resources/test.txt +++ /dev/null @@ -1 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse facilisis neque sed turpis venenatis, non dignissim risus volutpat. \ No newline at end of file diff --git a/core-java/README.md b/core-java/README.md index 45071d54ea..48f0677461 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -24,4 +24,15 @@ - [Guide to Java 8’s Functional Interfaces](http://www.baeldung.com/java-8-functional-interfaces) - [Convert char to String in Java](http://www.baeldung.com/java-convert-char-to-string) - [Random List Element](http://www.baeldung.com/java-random-list-element) -- [Convert String to int or Integer in Java](http://www.baeldung.com/java-convert-string-to-int-or-integer) \ No newline at end of file +- [Convert String to int or Integer in Java](http://www.baeldung.com/java-convert-string-to-int-or-integer) +- [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) +- [Java – Directory Size](http://www.baeldung.com/java-folder-size) +- [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) +- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) +- [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 Thread Pools in Java](http://www.baeldung.com/thread-pool-java-and-guava) +- [Introduction to Java 8 Streams](http://www.baeldung.com/java-8-streams-introduction) +- [Guide to the Fork/Join Framework in Java](http://www.baeldung.com/java-fork-join) \ No newline at end of file diff --git a/core-java/pom.xml b/core-java/pom.xml index 75608b59ba..8b93e238eb 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -162,6 +162,8 @@ **/*IntegrationTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java @@ -277,6 +279,41 @@ + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + diff --git a/core-java-8/.gitignore b/core-java/src/main/java/com/baeldung/.gitignore similarity index 100% rename from core-java-8/.gitignore rename to core-java/src/main/java/com/baeldung/.gitignore diff --git a/core-java-8/src/main/java/com/baeldung/Adder.java b/core-java/src/main/java/com/baeldung/Adder.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/Adder.java rename to core-java/src/main/java/com/baeldung/Adder.java diff --git a/core-java-8/src/main/java/com/baeldung/AdderImpl.java b/core-java/src/main/java/com/baeldung/AdderImpl.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/AdderImpl.java rename to core-java/src/main/java/com/baeldung/AdderImpl.java diff --git a/core-java-8/src/main/java/com/baeldung/Bar.java b/core-java/src/main/java/com/baeldung/Bar.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/Bar.java rename to core-java/src/main/java/com/baeldung/Bar.java diff --git a/core-java-8/src/main/java/com/baeldung/Baz.java b/core-java/src/main/java/com/baeldung/Baz.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/Baz.java rename to core-java/src/main/java/com/baeldung/Baz.java diff --git a/core-java-8/src/main/java/com/baeldung/Foo.java b/core-java/src/main/java/com/baeldung/Foo.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/Foo.java rename to core-java/src/main/java/com/baeldung/Foo.java diff --git a/core-java-8/src/main/java/com/baeldung/FooExtended.java b/core-java/src/main/java/com/baeldung/FooExtended.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/FooExtended.java rename to core-java/src/main/java/com/baeldung/FooExtended.java diff --git a/core-java-8/src/main/java/com/baeldung/UseFoo.java b/core-java/src/main/java/com/baeldung/UseFoo.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/UseFoo.java rename to core-java/src/main/java/com/baeldung/UseFoo.java diff --git a/core-java-8/src/main/java/com/baeldung/datetime/README.md b/core-java/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 core-java/src/main/java/com/baeldung/datetime/README.md diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseDuration.java b/core-java/src/main/java/com/baeldung/datetime/UseDuration.java similarity index 74% rename from core-java-8/src/main/java/com/baeldung/datetime/UseDuration.java rename to core-java/src/main/java/com/baeldung/datetime/UseDuration.java index 125b6fbe38..31b45aab84 100644 --- a/core-java-8/src/main/java/com/baeldung/datetime/UseDuration.java +++ b/core-java/src/main/java/com/baeldung/datetime/UseDuration.java @@ -5,12 +5,12 @@ import java.time.LocalTime; import java.time.Period; public class UseDuration { - - public LocalTime modifyDates(LocalTime localTime,Duration duration){ + + public LocalTime modifyDates(LocalTime localTime, Duration duration) { return localTime.plus(duration); } - - public Duration getDifferenceBetweenDates(LocalTime localTime1,LocalTime localTime2){ + + public Duration getDifferenceBetweenDates(LocalTime localTime1, LocalTime localTime2) { return Duration.between(localTime1, localTime2); } } diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDate.java b/core-java/src/main/java/com/baeldung/datetime/UseLocalDate.java similarity index 67% rename from core-java-8/src/main/java/com/baeldung/datetime/UseLocalDate.java rename to core-java/src/main/java/com/baeldung/datetime/UseLocalDate.java index 47b1b3f67d..82f5745b3c 100644 --- a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDate.java +++ b/core-java/src/main/java/com/baeldung/datetime/UseLocalDate.java @@ -7,39 +7,39 @@ import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAdjusters; public class UseLocalDate { - - public LocalDate getLocalDateUsingFactoryOfMethod(int year, int month, int dayOfMonth){ + + public LocalDate getLocalDateUsingFactoryOfMethod(int year, int month, int dayOfMonth) { return LocalDate.of(year, month, dayOfMonth); } - - public LocalDate getLocalDateUsingParseMethod(String representation){ + + public LocalDate getLocalDateUsingParseMethod(String representation) { return LocalDate.parse(representation); } - - public LocalDate getLocalDateFromClock(){ + + public LocalDate getLocalDateFromClock() { LocalDate localDate = LocalDate.now(); return localDate; } - - public LocalDate getNextDay(LocalDate localDate){ + + public LocalDate getNextDay(LocalDate localDate) { return localDate.plusDays(1); } - - public LocalDate getPreviousDay(LocalDate localDate){ + + public LocalDate getPreviousDay(LocalDate localDate) { return localDate.minus(1, ChronoUnit.DAYS); } - - public DayOfWeek getDayOfWeek(LocalDate localDate){ + + public DayOfWeek getDayOfWeek(LocalDate localDate) { DayOfWeek day = localDate.getDayOfWeek(); return day; } - - public LocalDate getFirstDayOfMonth(){ + + public LocalDate getFirstDayOfMonth() { LocalDate firstDayOfMonth = LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()); return firstDayOfMonth; } - - public LocalDateTime getStartOfDay(LocalDate localDate){ + + public LocalDateTime getStartOfDay(LocalDate localDate) { LocalDateTime startofDay = localDate.atStartOfDay(); return startofDay; } diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java b/core-java/src/main/java/com/baeldung/datetime/UseLocalDateTime.java similarity index 87% rename from core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java rename to core-java/src/main/java/com/baeldung/datetime/UseLocalDateTime.java index 7aa1eaa276..7f39ac2f91 100644 --- a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java +++ b/core-java/src/main/java/com/baeldung/datetime/UseLocalDateTime.java @@ -3,8 +3,8 @@ package com.baeldung.datetime; import java.time.LocalDateTime; public class UseLocalDateTime { - - public LocalDateTime getLocalDateTimeUsingParseMethod(String representation){ + + public LocalDateTime getLocalDateTimeUsingParseMethod(String representation) { return LocalDateTime.parse(representation); } diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalTime.java b/core-java/src/main/java/com/baeldung/datetime/UseLocalTime.java similarity index 67% rename from core-java-8/src/main/java/com/baeldung/datetime/UseLocalTime.java rename to core-java/src/main/java/com/baeldung/datetime/UseLocalTime.java index e13fd10d6f..9bd8f9706c 100644 --- a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalTime.java +++ b/core-java/src/main/java/com/baeldung/datetime/UseLocalTime.java @@ -4,32 +4,32 @@ import java.time.LocalTime; import java.time.temporal.ChronoUnit; public class UseLocalTime { - - public LocalTime getLocalTimeUsingFactoryOfMethod(int hour, int min, int seconds){ + + public LocalTime getLocalTimeUsingFactoryOfMethod(int hour, int min, int seconds) { LocalTime localTime = LocalTime.of(hour, min, seconds); return localTime; } - - public LocalTime getLocalTimeUsingParseMethod(String timeRepresentation){ + + public LocalTime getLocalTimeUsingParseMethod(String timeRepresentation) { LocalTime localTime = LocalTime.parse(timeRepresentation); return localTime; } - - public LocalTime getLocalTimeFromClock(){ + + public LocalTime getLocalTimeFromClock() { LocalTime localTime = LocalTime.now(); return localTime; } - - public LocalTime addAnHour(LocalTime localTime){ - LocalTime newTime = localTime.plus(1,ChronoUnit.HOURS); + + public LocalTime addAnHour(LocalTime localTime) { + LocalTime newTime = localTime.plus(1, ChronoUnit.HOURS); return newTime; } - - public int getHourFromLocalTime(LocalTime localTime){ + + public int getHourFromLocalTime(LocalTime localTime) { return localTime.getHour(); } - - public LocalTime getLocalTimeWithMinuteSetToValue(LocalTime localTime, int minute){ + + public LocalTime getLocalTimeWithMinuteSetToValue(LocalTime localTime, int minute) { return localTime.withMinute(minute); } } diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UsePeriod.java b/core-java/src/main/java/com/baeldung/datetime/UsePeriod.java similarity index 73% rename from core-java-8/src/main/java/com/baeldung/datetime/UsePeriod.java rename to core-java/src/main/java/com/baeldung/datetime/UsePeriod.java index 326cfad650..5a42ef83b4 100644 --- a/core-java-8/src/main/java/com/baeldung/datetime/UsePeriod.java +++ b/core-java/src/main/java/com/baeldung/datetime/UsePeriod.java @@ -4,12 +4,12 @@ import java.time.LocalDate; import java.time.Period; public class UsePeriod { - - public LocalDate modifyDates(LocalDate localDate,Period period){ + + public LocalDate modifyDates(LocalDate localDate, Period period) { return localDate.plus(period); } - - public Period getDifferenceBetweenDates(LocalDate localDate1,LocalDate localDate2){ + + public Period getDifferenceBetweenDates(LocalDate localDate1, LocalDate localDate2) { return Period.between(localDate1, localDate2); } } diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseToInstant.java b/core-java/src/main/java/com/baeldung/datetime/UseToInstant.java similarity index 87% rename from core-java-8/src/main/java/com/baeldung/datetime/UseToInstant.java rename to core-java/src/main/java/com/baeldung/datetime/UseToInstant.java index 1ddb096cf6..94154ce5c0 100644 --- a/core-java-8/src/main/java/com/baeldung/datetime/UseToInstant.java +++ b/core-java/src/main/java/com/baeldung/datetime/UseToInstant.java @@ -6,13 +6,13 @@ import java.util.Calendar; import java.util.Date; public class UseToInstant { - - public LocalDateTime convertDateToLocalDate(Date date){ + + public LocalDateTime convertDateToLocalDate(Date date) { LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); return localDateTime; } - - public LocalDateTime convertDateToLocalDate(Calendar calendar){ + + public LocalDateTime convertDateToLocalDate(Calendar calendar) { LocalDateTime localDateTime = LocalDateTime.ofInstant(calendar.toInstant(), ZoneId.systemDefault()); return localDateTime; } diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseZonedDateTime.java b/core-java/src/main/java/com/baeldung/datetime/UseZonedDateTime.java similarity index 90% rename from core-java-8/src/main/java/com/baeldung/datetime/UseZonedDateTime.java rename to core-java/src/main/java/com/baeldung/datetime/UseZonedDateTime.java index 0369de9835..2d1b17484b 100644 --- a/core-java-8/src/main/java/com/baeldung/datetime/UseZonedDateTime.java +++ b/core-java/src/main/java/com/baeldung/datetime/UseZonedDateTime.java @@ -5,8 +5,8 @@ import java.time.ZoneId; import java.time.ZonedDateTime; public class UseZonedDateTime { - - public ZonedDateTime getZonedDateTime(LocalDateTime localDateTime,ZoneId zoneId){ + + public ZonedDateTime getZonedDateTime(LocalDateTime localDateTime, ZoneId zoneId) { ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, zoneId); return zonedDateTime; } diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java b/core-java/src/main/java/com/baeldung/doublecolon/Computer.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java rename to core-java/src/main/java/com/baeldung/doublecolon/Computer.java diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java b/core-java/src/main/java/com/baeldung/doublecolon/ComputerUtils.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java rename to core-java/src/main/java/com/baeldung/doublecolon/ComputerUtils.java diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java b/core-java/src/main/java/com/baeldung/doublecolon/MacbookPro.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java rename to core-java/src/main/java/com/baeldung/doublecolon/MacbookPro.java diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java b/core-java/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java rename to core-java/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java b/core-java/src/main/java/com/baeldung/doublecolon/function/TriFunction.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java rename to core-java/src/main/java/com/baeldung/doublecolon/function/TriFunction.java diff --git a/core-java/src/main/java/com/baeldung/enums/Pizza.java b/core-java/src/main/java/com/baeldung/enums/Pizza.java index 7742781081..bad134bf00 100644 --- a/core-java/src/main/java/com/baeldung/enums/Pizza.java +++ b/core-java/src/main/java/com/baeldung/enums/Pizza.java @@ -1,11 +1,5 @@ package com.baeldung.enums; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.commons.collections15.Predicate; - -import java.io.IOException; import java.util.EnumMap; import java.util.EnumSet; import java.util.List; @@ -13,13 +7,11 @@ import java.util.stream.Collectors; public class Pizza { - private static EnumSet undeliveredPizzaStatuses = - EnumSet.of(PizzaStatus.ORDERED, PizzaStatus.READY); + private static EnumSet deliveredPizzaStatuses = EnumSet.of(PizzaStatusEnum.DELIVERED); - private PizzaStatus status; + private PizzaStatusEnum status; - @JsonFormat(shape = JsonFormat.Shape.OBJECT) - public enum PizzaStatus { + public enum PizzaStatusEnum { ORDERED(5) { @Override public boolean isOrdered() { @@ -53,21 +45,20 @@ public class Pizza { return false; } - @JsonProperty("timeToDelivery") public int getTimeToDelivery() { return timeToDelivery; } - PizzaStatus(int timeToDelivery) { + PizzaStatusEnum(int timeToDelivery) { this.timeToDelivery = timeToDelivery; } } - public PizzaStatus getStatus() { + public PizzaStatusEnum getStatus() { return status; } - public void setStatus(PizzaStatus status) { + public void setStatus(PizzaStatusEnum status) { this.status = status; } @@ -80,31 +71,18 @@ public class Pizza { } public static List getAllUndeliveredPizzas(List input) { - return input.stream().filter( - (s) -> undeliveredPizzaStatuses.contains(s.getStatus())) - .collect(Collectors.toList()); + return input.stream().filter((s) -> !deliveredPizzaStatuses.contains(s.getStatus())).collect(Collectors.toList()); } - public static EnumMap> - groupPizzaByStatus(List pzList) { - return pzList.stream().collect( - Collectors.groupingBy(Pizza::getStatus, - () -> new EnumMap<>(PizzaStatus.class), Collectors.toList())); + public static EnumMap> groupPizzaByStatus(List pzList) { + return pzList.stream().collect(Collectors.groupingBy(Pizza::getStatus, () -> new EnumMap<>(PizzaStatusEnum.class), Collectors.toList())); } public void deliver() { if (isDeliverable()) { PizzaDeliverySystemConfiguration.getInstance().getDeliveryStrategy().deliver(this); - this.setStatus(PizzaStatus.DELIVERED); + this.setStatus(PizzaStatusEnum.DELIVERED); } } - public static String getJsonString(Pizza pz) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(pz); - } - - private static Predicate thatAreNotDelivered() { - return entry -> undeliveredPizzaStatuses.contains(entry.getStatus()); - } } \ No newline at end of file diff --git a/core-java-8/src/main/java/com/baeldung/enums/README.md b/core-java/src/main/java/com/baeldung/enums/README.md similarity index 100% rename from core-java-8/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-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java b/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java similarity index 94% rename from core-java-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java rename to core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java index f1ab2d8d09..ae79787570 100644 --- a/core-java-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java +++ b/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java @@ -30,8 +30,7 @@ public class CustomRecursiveAction extends RecursiveAction { private Collection createSubtasks() { - List subtasks = - new ArrayList<>(); + List subtasks = new ArrayList<>(); String partOne = workLoad.substring(0, workLoad.length() / 2); String partTwo = workLoad.substring(workLoad.length() / 2, workLoad.length()); diff --git a/core-java-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java b/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java similarity index 60% rename from core-java-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java rename to core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java index 5d4d97b805..af9805c33f 100644 --- a/core-java-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java +++ b/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java @@ -1,6 +1,5 @@ package com.baeldung.forkjoin; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -23,10 +22,7 @@ public class CustomRecursiveTask extends RecursiveTask { if (arr.length > THRESHOLD) { - return ForkJoinTask.invokeAll(createSubtasks()) - .stream() - .mapToInt(ForkJoinTask::join) - .sum(); + return ForkJoinTask.invokeAll(createSubtasks()).stream().mapToInt(ForkJoinTask::join).sum(); } else { return processing(arr); @@ -35,17 +31,12 @@ public class CustomRecursiveTask extends RecursiveTask { private Collection createSubtasks() { List dividedTasks = new ArrayList<>(); - dividedTasks.add(new CustomRecursiveTask( - Arrays.copyOfRange(arr, 0, arr.length / 2))); - dividedTasks.add(new CustomRecursiveTask( - Arrays.copyOfRange(arr, arr.length / 2, arr.length))); + dividedTasks.add(new CustomRecursiveTask(Arrays.copyOfRange(arr, 0, arr.length / 2))); + dividedTasks.add(new CustomRecursiveTask(Arrays.copyOfRange(arr, arr.length / 2, arr.length))); return dividedTasks; } private Integer processing(int[] arr) { - return Arrays.stream(arr) - .filter(a -> a > 10 && a < 27) - .map(a -> a * 10) - .sum(); + return Arrays.stream(arr).filter(a -> a > 10 && a < 27).map(a -> a * 10).sum(); } } diff --git a/core-java-8/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java b/core-java/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java similarity index 99% rename from core-java-8/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java rename to core-java/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java index 521616600f..fd24a6fc66 100644 --- a/core-java-8/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java +++ b/core-java/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java @@ -1,6 +1,5 @@ package com.baeldung.forkjoin.util; - import java.util.concurrent.ForkJoinPool; public class PoolUtil { diff --git a/core-java/src/main/java/com/baeldung/java/networking/cookies/PersistentCookieStore.java b/core-java/src/main/java/com/baeldung/java/networking/cookies/PersistentCookieStore.java new file mode 100644 index 0000000000..0d66406ac2 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/java/networking/cookies/PersistentCookieStore.java @@ -0,0 +1,56 @@ +package com.baeldung.java.networking.cookies; + +import java.net.*; +import java.util.List; + +public class PersistentCookieStore implements CookieStore, Runnable { + CookieStore store; + + public PersistentCookieStore() { + store = new CookieManager().getCookieStore(); + // deserialize cookies into store + Runtime.getRuntime().addShutdownHook(new Thread(this)); + } + + @Override + public void run() { + // serialize cookies to persistent storage + } + + @Override + public void add(URI uri, HttpCookie cookie) { + store.add(uri, cookie); + + } + + @Override + public List get(URI uri) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getCookies() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getURIs() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean remove(URI uri, HttpCookie cookie) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean removeAll() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/core-java/src/main/java/com/baeldung/java/networking/cookies/ProxyAcceptCookiePolicy.java b/core-java/src/main/java/com/baeldung/java/networking/cookies/ProxyAcceptCookiePolicy.java new file mode 100644 index 0000000000..6d6371bfe0 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/java/networking/cookies/ProxyAcceptCookiePolicy.java @@ -0,0 +1,26 @@ +package com.baeldung.java.networking.cookies; + +import java.net.*; + +public class ProxyAcceptCookiePolicy implements CookiePolicy { + String acceptedProxy; + + public ProxyAcceptCookiePolicy(String acceptedProxy) { + this.acceptedProxy = acceptedProxy; + } + + public boolean shouldAccept(URI uri, HttpCookie cookie) { + String host; + try { + host = InetAddress.getByName(uri.getHost()).getCanonicalHostName(); + } catch (UnknownHostException e) { + host = uri.getHost(); + } + + if (!HttpCookie.domainMatches(acceptedProxy, host)) { + return false; + } + + return CookiePolicy.ACCEPT_ORIGINAL_SERVER.shouldAccept(uri, cookie); + } +} diff --git a/core-java/src/main/java/com/baeldung/java/networking/udp/EchoClient.java b/core-java/src/main/java/com/baeldung/java/networking/udp/EchoClient.java new file mode 100644 index 0000000000..1fb9af3a9d --- /dev/null +++ b/core-java/src/main/java/com/baeldung/java/networking/udp/EchoClient.java @@ -0,0 +1,42 @@ +package com.baeldung.java.networking.udp; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; + +public class EchoClient { + private DatagramSocket socket; + private InetAddress address; + + private byte[] buf; + + public EchoClient() { + try { + socket = new DatagramSocket(); + address = InetAddress.getByName("localhost"); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + public String sendEcho(String msg) { + DatagramPacket packet = null; + try { + buf=msg.getBytes(); + packet = new DatagramPacket(buf, buf.length, address, 4445); + socket.send(packet); + packet = new DatagramPacket(buf, buf.length); + socket.receive(packet); + } catch (IOException e) { + e.printStackTrace(); + } + String received = new String(packet.getData(), 0, packet.getLength()); + return received; + } + + public void close() { + socket.close(); + } +} diff --git a/core-java/src/main/java/com/baeldung/java/networking/udp/EchoServer.java b/core-java/src/main/java/com/baeldung/java/networking/udp/EchoServer.java new file mode 100644 index 0000000000..900d330786 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/java/networking/udp/EchoServer.java @@ -0,0 +1,42 @@ +package com.baeldung.java.networking.udp; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; + +public class EchoServer extends Thread { + + protected DatagramSocket socket = null; + protected boolean running; + protected byte[] buf = new byte[256]; + + public EchoServer() throws IOException { + socket = new DatagramSocket(4445); + } + + public void run() { + running = true; + + while (running) { + try { + + DatagramPacket packet = new DatagramPacket(buf, buf.length); + socket.receive(packet); + InetAddress address = packet.getAddress(); + int port = packet.getPort(); + packet = new DatagramPacket(buf, buf.length, address, port); + String received = new String(packet.getData(), 0, packet.getLength()); + if (received.equals("end")) { + running = false; + continue; + } + socket.send(packet); + } catch (IOException e) { + e.printStackTrace(); + running = false; + } + } + socket.close(); + } +} diff --git a/core-java/src/main/java/com/baeldung/java/nio/selector/EchoServer.java b/core-java/src/main/java/com/baeldung/java/nio/selector/EchoServer.java index 285d4e51fc..1d4e01bbc3 100644 --- a/core-java/src/main/java/com/baeldung/java/nio/selector/EchoServer.java +++ b/core-java/src/main/java/com/baeldung/java/nio/selector/EchoServer.java @@ -1,21 +1,21 @@ package com.baeldung.java.nio.selector; -import java.io.File; -import java.io.IOException; -import java.net.InetSocketAddress; -import java.nio.ByteBuffer; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; -import java.util.Iterator; +import java.nio.channels.Selector; +import java.nio.channels.SelectionKey; +import java.nio.ByteBuffer; +import java.io.IOException; import java.util.Set; +import java.util.Iterator; +import java.net.InetSocketAddress; +import java.io.File; public class EchoServer { public static void main(String[] args) - throws IOException { + throws IOException { Selector selector = Selector.open(); ServerSocketChannel serverSocket = ServerSocketChannel.open(); serverSocket.bind(new InetSocketAddress("localhost", 5454)); @@ -49,6 +49,7 @@ public class EchoServer { } } + public static Process start() throws IOException, InterruptedException { String javaHome = System.getProperty("java.home"); String javaBin = javaHome + File.separator + "bin" + File.separator + "java"; @@ -59,4 +60,4 @@ public class EchoServer { return builder.start(); } -} \ No newline at end of file +} diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Address.java b/core-java/src/main/java/com/baeldung/java_8_features/Address.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/java_8_features/Address.java rename to core-java/src/main/java/com/baeldung/java_8_features/Address.java diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java b/core-java/src/main/java/com/baeldung/java_8_features/CustomException.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java rename to core-java/src/main/java/com/baeldung/java_8_features/CustomException.java diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Detail.java b/core-java/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 core-java/src/main/java/com/baeldung/java_8_features/Detail.java diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java b/core-java/src/main/java/com/baeldung/java_8_features/OptionalAddress.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java rename to core-java/src/main/java/com/baeldung/java_8_features/OptionalAddress.java diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java b/core-java/src/main/java/com/baeldung/java_8_features/OptionalUser.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java rename to core-java/src/main/java/com/baeldung/java_8_features/OptionalUser.java diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/User.java b/core-java/src/main/java/com/baeldung/java_8_features/User.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/java_8_features/User.java rename to core-java/src/main/java/com/baeldung/java_8_features/User.java diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java b/core-java/src/main/java/com/baeldung/java_8_features/Vehicle.java similarity index 89% rename from core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java rename to core-java/src/main/java/com/baeldung/java_8_features/Vehicle.java index 011173bcaf..045fc90590 100644 --- a/core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java +++ b/core-java/src/main/java/com/baeldung/java_8_features/Vehicle.java @@ -9,7 +9,7 @@ public interface Vehicle { } default long[] startPosition() { - return new long[]{23, 15}; + return new long[] { 23, 15 }; } default String getOverview() { diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java b/core-java/src/main/java/com/baeldung/java_8_features/VehicleImpl.java similarity index 63% rename from core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java rename to core-java/src/main/java/com/baeldung/java_8_features/VehicleImpl.java index 83e55f5f4d..64bec0246d 100644 --- a/core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java +++ b/core-java/src/main/java/com/baeldung/java_8_features/VehicleImpl.java @@ -1,9 +1,9 @@ package com.baeldung.java_8_features; -public class VehicleImpl implements Vehicle { +public class VehicleImpl implements Vehicle { @Override public void moveTo(long altitude, long longitude) { - //do nothing + // do nothing } } diff --git a/core-java/src/main/java/com/baeldung/printscreen/Screenshot.java b/core-java/src/main/java/com/baeldung/printscreen/Screenshot.java index 27fd84e374..7f87b47476 100644 --- a/core-java/src/main/java/com/baeldung/printscreen/Screenshot.java +++ b/core-java/src/main/java/com/baeldung/printscreen/Screenshot.java @@ -14,7 +14,6 @@ public class Screenshot { } public void getScreenshot(int timeToWait) throws Exception { - Thread.sleep(timeToWait); Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); Robot robot = new Robot(); BufferedImage img = robot.createScreenCapture(rectangle); diff --git a/core-java/src/main/java/com/baeldung/socket/EchoClient.java b/core-java/src/main/java/com/baeldung/socket/EchoClient.java index 1ddf752a03..570bd60b2d 100644 --- a/core-java/src/main/java/com/baeldung/socket/EchoClient.java +++ b/core-java/src/main/java/com/baeldung/socket/EchoClient.java @@ -4,39 +4,38 @@ import java.io.*; import java.net.*; public class EchoClient { - private Socket clientSocket; - private PrintWriter out; - private BufferedReader in; + private Socket clientSocket; + private PrintWriter out; + private BufferedReader in; - public void startConnection(String ip, int port) { - try { - clientSocket = new Socket(ip, port); - out = new PrintWriter(clientSocket.getOutputStream(), true); - in = new BufferedReader(new InputStreamReader( - clientSocket.getInputStream())); - } catch (IOException e) { - System.out.print(e); - } + public void startConnection(String ip, int port) { + try { + clientSocket = new Socket(ip, port); + out = new PrintWriter(clientSocket.getOutputStream(), true); + in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); + } catch (IOException e) { + System.out.print(e); + } - } + } - public String sendMessage(String msg) { - try { - out.println(msg); - return in.readLine(); - } catch (Exception e) { - return null; - } - } + public String sendMessage(String msg) { + try { + out.println(msg); + return in.readLine(); + } catch (Exception e) { + return null; + } + } - public void stopConnection() { - try { - in.close(); - out.close(); - clientSocket.close(); - } catch (IOException e) { - e.printStackTrace(); - } + public void stopConnection() { + try { + in.close(); + out.close(); + clientSocket.close(); + } catch (IOException e) { + e.printStackTrace(); + } - } + } } diff --git a/core-java/src/main/java/com/baeldung/socket/EchoMultiServer.java b/core-java/src/main/java/com/baeldung/socket/EchoMultiServer.java index 2ece1ceebe..b920967545 100644 --- a/core-java/src/main/java/com/baeldung/socket/EchoMultiServer.java +++ b/core-java/src/main/java/com/baeldung/socket/EchoMultiServer.java @@ -4,68 +4,67 @@ import java.net.*; import java.io.*; public class EchoMultiServer { - private ServerSocket serverSocket; + private ServerSocket serverSocket; - public void start(int port) { - try { - serverSocket = new ServerSocket(port); - while (true) - new EchoClientHandler(serverSocket.accept()).run(); + public void start(int port) { + try { + serverSocket = new ServerSocket(port); + while (true) + new EchoClientHandler(serverSocket.accept()).run(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - stop(); - } + } catch (IOException e) { + e.printStackTrace(); + } finally { + stop(); + } - } + } - public void stop() { - try { + public void stop() { + try { - serverSocket.close(); - } catch (IOException e) { - e.printStackTrace(); - } + serverSocket.close(); + } catch (IOException e) { + e.printStackTrace(); + } - } + } - private static class EchoClientHandler extends Thread { - private Socket clientSocket; - private PrintWriter out; - private BufferedReader in; + private static class EchoClientHandler extends Thread { + private Socket clientSocket; + private PrintWriter out; + private BufferedReader in; - public EchoClientHandler(Socket socket) { - this.clientSocket = socket; - } + public EchoClientHandler(Socket socket) { + this.clientSocket = socket; + } - public void run() { - try { - out = new PrintWriter(clientSocket.getOutputStream(), true); - in = new BufferedReader(new InputStreamReader( - clientSocket.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - if (".".equals(inputLine)) { - out.println("bye"); - break; - } - out.println(inputLine); - } + public void run() { + try { + out = new PrintWriter(clientSocket.getOutputStream(), true); + in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); + String inputLine; + while ((inputLine = in.readLine()) != null) { + if (".".equals(inputLine)) { + out.println("bye"); + break; + } + out.println(inputLine); + } - in.close(); - out.close(); - clientSocket.close(); + in.close(); + out.close(); + clientSocket.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } + } catch (IOException e) { + e.printStackTrace(); + } + } + } - public static void main(String[] args) { - EchoMultiServer server = new EchoMultiServer(); - server.start(5555); - } + public static void main(String[] args) { + EchoMultiServer server = new EchoMultiServer(); + server.start(5555); + } } diff --git a/core-java/src/main/java/com/baeldung/socket/EchoServer.java b/core-java/src/main/java/com/baeldung/socket/EchoServer.java index 3607afa7f5..dfd281d51c 100644 --- a/core-java/src/main/java/com/baeldung/socket/EchoServer.java +++ b/core-java/src/main/java/com/baeldung/socket/EchoServer.java @@ -4,47 +4,46 @@ import java.net.*; import java.io.*; public class EchoServer { - private ServerSocket serverSocket; - private Socket clientSocket; - private PrintWriter out; - private BufferedReader in; + private ServerSocket serverSocket; + private Socket clientSocket; + private PrintWriter out; + private BufferedReader in; - public void start(int port) { - try { - serverSocket = new ServerSocket(port); - clientSocket = serverSocket.accept(); - out = new PrintWriter(clientSocket.getOutputStream(), true); - in = new BufferedReader(new InputStreamReader( - clientSocket.getInputStream())); - String inputLine; - while ((inputLine = in.readLine()) != null) { - if (".".equals(inputLine)) { - out.println("good bye"); - break; - } - out.println(inputLine); - } - } catch (IOException e) { - e.printStackTrace(); - } + public void start(int port) { + try { + serverSocket = new ServerSocket(port); + clientSocket = serverSocket.accept(); + out = new PrintWriter(clientSocket.getOutputStream(), true); + in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); + String inputLine; + while ((inputLine = in.readLine()) != null) { + if (".".equals(inputLine)) { + out.println("good bye"); + break; + } + out.println(inputLine); + } + } catch (IOException e) { + e.printStackTrace(); + } - } + } - public void stop() { - try { - in.close(); - out.close(); - clientSocket.close(); - serverSocket.close(); - } catch (IOException e) { - e.printStackTrace(); - } + public void stop() { + try { + in.close(); + out.close(); + clientSocket.close(); + serverSocket.close(); + } catch (IOException e) { + e.printStackTrace(); + } - } + } - public static void main(String[] args) { - EchoServer server = new EchoServer(); - server.start(4444); - } + public static void main(String[] args) { + EchoServer server = new EchoServer(); + server.start(4444); + } } diff --git a/core-java/src/main/java/com/baeldung/socket/GreetClient.java b/core-java/src/main/java/com/baeldung/socket/GreetClient.java index 21959c7469..e6f14bb2b6 100644 --- a/core-java/src/main/java/com/baeldung/socket/GreetClient.java +++ b/core-java/src/main/java/com/baeldung/socket/GreetClient.java @@ -7,39 +7,38 @@ import java.io.PrintWriter; import java.net.Socket; public class GreetClient { - private Socket clientSocket; - private PrintWriter out; - private BufferedReader in; + private Socket clientSocket; + private PrintWriter out; + private BufferedReader in; - public void startConnection(String ip, int port) { - try { - clientSocket = new Socket(ip, port); - out = new PrintWriter(clientSocket.getOutputStream(), true); - in = new BufferedReader(new InputStreamReader( - clientSocket.getInputStream())); - } catch (IOException e) { - - } + public void startConnection(String ip, int port) { + try { + clientSocket = new Socket(ip, port); + out = new PrintWriter(clientSocket.getOutputStream(), true); + in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); + } catch (IOException e) { - } + } - public String sendMessage(String msg) { - try { - out.println(msg); - return in.readLine(); - } catch (Exception e) { - return null; - } - } + } - public void stopConnection() { - try { - in.close(); - out.close(); - clientSocket.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } + public String sendMessage(String msg) { + try { + out.println(msg); + return in.readLine(); + } catch (Exception e) { + return null; + } + } + + public void stopConnection() { + try { + in.close(); + out.close(); + clientSocket.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } } diff --git a/core-java/src/main/java/com/baeldung/socket/GreetServer.java b/core-java/src/main/java/com/baeldung/socket/GreetServer.java index 8bf675c7b9..05bc65a65e 100644 --- a/core-java/src/main/java/com/baeldung/socket/GreetServer.java +++ b/core-java/src/main/java/com/baeldung/socket/GreetServer.java @@ -4,44 +4,43 @@ import java.net.*; import java.io.*; public class GreetServer { - private ServerSocket serverSocket; - private Socket clientSocket; - private PrintWriter out; - private BufferedReader in; + private ServerSocket serverSocket; + private Socket clientSocket; + private PrintWriter out; + private BufferedReader in; + public void start(int port) { + try { + serverSocket = new ServerSocket(port); + clientSocket = serverSocket.accept(); + out = new PrintWriter(clientSocket.getOutputStream(), true); + in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); + String greeting = in.readLine(); + if ("hello server".equals(greeting)) + out.println("hello client"); + else + out.println("unrecognised greeting"); + } catch (IOException e) { + e.printStackTrace(); + } - public void start(int port) { - try { - serverSocket = new ServerSocket(port); - clientSocket = serverSocket.accept(); - out = new PrintWriter(clientSocket.getOutputStream(), true); - in = new BufferedReader(new InputStreamReader( - clientSocket.getInputStream())); - String greeting = in.readLine(); - if ("hello server".equals(greeting)) - out.println("hello client"); - else - out.println("unrecognised greeting"); - } catch (IOException e) { - e.printStackTrace(); - } + } - } + public void stop() { + try { + in.close(); + out.close(); + clientSocket.close(); + serverSocket.close(); + } catch (IOException e) { + e.printStackTrace(); + } - public void stop() { - try { - in.close(); - out.close(); - clientSocket.close(); - serverSocket.close(); - } catch (IOException e) { - e.printStackTrace(); - } + } - } - public static void main(String[] args) { - GreetServer server=new GreetServer(); - server.start(6666); - } + public static void main(String[] args) { + GreetServer server = new GreetServer(); + server.start(6666); + } } diff --git a/core-java-8/src/main/java/com/baeldung/streamApi/Product.java b/core-java/src/main/java/com/baeldung/streamApi/Product.java similarity index 99% rename from core-java-8/src/main/java/com/baeldung/streamApi/Product.java rename to core-java/src/main/java/com/baeldung/streamApi/Product.java index 18f3a61904..26b8bd6fed 100644 --- a/core-java-8/src/main/java/com/baeldung/streamApi/Product.java +++ b/core-java/src/main/java/com/baeldung/streamApi/Product.java @@ -44,7 +44,6 @@ public class Product { this.name = name; } - public static Stream streamOf(List list) { return (list == null || list.isEmpty()) ? Stream.empty() : list.stream(); } diff --git a/core-java-8/src/main/java/com/baeldung/threadpool/CountingTask.java b/core-java/src/main/java/com/baeldung/threadpool/CountingTask.java similarity index 66% rename from core-java-8/src/main/java/com/baeldung/threadpool/CountingTask.java rename to core-java/src/main/java/com/baeldung/threadpool/CountingTask.java index 05aa14c5ae..effdf54916 100644 --- a/core-java-8/src/main/java/com/baeldung/threadpool/CountingTask.java +++ b/core-java/src/main/java/com/baeldung/threadpool/CountingTask.java @@ -14,9 +14,7 @@ public class CountingTask extends RecursiveTask { @Override protected Integer compute() { - return node.value + node.children.stream() - .map(childNode -> new CountingTask(childNode).fork()) - .collect(Collectors.summingInt(ForkJoinTask::join)); + return node.value + node.children.stream().map(childNode -> new CountingTask(childNode).fork()).collect(Collectors.summingInt(ForkJoinTask::join)); } } diff --git a/core-java-8/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java b/core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java rename to core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java diff --git a/core-java-8/src/main/java/com/baeldung/threadpool/TreeNode.java b/core-java/src/main/java/com/baeldung/threadpool/TreeNode.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/threadpool/TreeNode.java rename to core-java/src/main/java/com/baeldung/threadpool/TreeNode.java diff --git a/core-java-8/src/main/java/com/baeldung/unzip/UnzipFile.java b/core-java/src/main/java/com/baeldung/unzip/UnzipFile.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/unzip/UnzipFile.java rename to core-java/src/main/java/com/baeldung/unzip/UnzipFile.java diff --git a/core-java-8/src/main/java/com/baeldung/zip/ZipDirectory.java b/core-java/src/main/java/com/baeldung/zip/ZipDirectory.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/zip/ZipDirectory.java rename to core-java/src/main/java/com/baeldung/zip/ZipDirectory.java diff --git a/core-java-8/src/main/java/com/baeldung/zip/ZipFile.java b/core-java/src/main/java/com/baeldung/zip/ZipFile.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/zip/ZipFile.java rename to core-java/src/main/java/com/baeldung/zip/ZipFile.java diff --git a/core-java-8/src/main/java/com/baeldung/zip/ZipMultipleFiles.java b/core-java/src/main/java/com/baeldung/zip/ZipMultipleFiles.java similarity index 100% rename from core-java-8/src/main/java/com/baeldung/zip/ZipMultipleFiles.java rename to core-java/src/main/java/com/baeldung/zip/ZipMultipleFiles.java diff --git a/core-java/src/main/java/org/baeldung/equalshashcode/entities/ComplexClass.java b/core-java/src/main/java/org/baeldung/equalshashcode/entities/ComplexClass.java index d4a6a0f42e..6329f41252 100644 --- a/core-java/src/main/java/org/baeldung/equalshashcode/entities/ComplexClass.java +++ b/core-java/src/main/java/org/baeldung/equalshashcode/entities/ComplexClass.java @@ -1,7 +1,5 @@ package org.baeldung.equalshashcode.entities; -import java.util.ArrayList; -import java.util.HashSet; import java.util.List; import java.util.Set; @@ -10,7 +8,7 @@ public class ComplexClass { private List genericList; private Set integerSet; - public ComplexClass(ArrayList genericArrayList, HashSet integerHashSet) { + public ComplexClass(List genericArrayList, Set integerHashSet) { super(); this.genericList = genericArrayList; this.integerSet = integerHashSet; diff --git a/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java b/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java index 2c52a17904..09344902b7 100644 --- a/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java +++ b/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java @@ -4,8 +4,8 @@ import javax.swing.JOptionPane; public class ExecutableMavenJar { - public static void main(String[] args) { - JOptionPane.showMessageDialog(null, "It worked!", "Executable Jar with Maven", 1); - } + public static void main(String[] args) { + JOptionPane.showMessageDialog(null, "It worked!", "Executable Jar with Maven", 1); + } } diff --git a/core-java-8/src/main/resources/dirCompressed.zip b/core-java/src/main/resources/dirCompressed.zip similarity index 100% rename from core-java-8/src/main/resources/dirCompressed.zip rename to core-java/src/main/resources/dirCompressed.zip diff --git a/core-java-8/src/main/resources/fileTest.txt b/core-java/src/main/resources/fileTest.txt similarity index 100% rename from core-java-8/src/main/resources/fileTest.txt rename to core-java/src/main/resources/fileTest.txt diff --git a/core-java-8/src/main/resources/multiCompressed.zip b/core-java/src/main/resources/multiCompressed.zip similarity index 100% rename from core-java-8/src/main/resources/multiCompressed.zip rename to core-java/src/main/resources/multiCompressed.zip diff --git a/core-java/src/main/resources/targetFile.tmp b/core-java/src/main/resources/targetFile.tmp new file mode 100644 index 0000000000..20f137b416 --- /dev/null +++ b/core-java/src/main/resources/targetFile.tmp @@ -0,0 +1,2 @@ +line 1 +a second line \ No newline at end of file diff --git a/core-java/src/test/java/com/baeldung/CharToStringTest.java b/core-java/src/test/java/com/baeldung/CharToStringUnitTest.java similarity index 87% rename from core-java/src/test/java/com/baeldung/CharToStringTest.java rename to core-java/src/test/java/com/baeldung/CharToStringUnitTest.java index d91016d104..78742e356d 100644 --- a/core-java/src/test/java/com/baeldung/CharToStringTest.java +++ b/core-java/src/test/java/com/baeldung/CharToStringUnitTest.java @@ -4,10 +4,10 @@ import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; -public class CharToStringTest { +public class CharToStringUnitTest { @Test - public void givenChar_whenCallingStringValueOf_shouldConvertToString(){ + public void givenChar_whenCallingStringValueOf_shouldConvertToString() { final char givenChar = 'x'; final String result = String.valueOf(givenChar); @@ -16,7 +16,7 @@ public class CharToStringTest { } @Test - public void givenChar_whenCallingToStringOnCharacter_shouldConvertToString(){ + public void givenChar_whenCallingToStringOnCharacter_shouldConvertToString() { final char givenChar = 'x'; final String result = Character.toString(givenChar); @@ -25,7 +25,7 @@ public class CharToStringTest { } @Test - public void givenChar_whenCallingCharacterConstructor_shouldConvertToString3(){ + public void givenChar_whenCallingCharacterConstructor_shouldConvertToString3() { final char givenChar = 'x'; final String result = new Character(givenChar).toString(); @@ -34,7 +34,7 @@ public class CharToStringTest { } @Test - public void givenChar_whenConcatenated_shouldConvertToString4(){ + public void givenChar_whenConcatenated_shouldConvertToString4() { final char givenChar = 'x'; final String result = givenChar + ""; @@ -43,7 +43,7 @@ public class CharToStringTest { } @Test - public void givenChar_whenFormated_shouldConvertToString5(){ + public void givenChar_whenFormated_shouldConvertToString5() { final char givenChar = 'x'; final String result = String.format("%c", givenChar); diff --git a/core-java/src/test/java/com/baeldung/RandomListElementTest.java b/core-java/src/test/java/com/baeldung/RandomListElementUnitTest.java similarity index 95% rename from core-java/src/test/java/com/baeldung/RandomListElementTest.java rename to core-java/src/test/java/com/baeldung/RandomListElementUnitTest.java index 1918c801dc..6ae7c40f4d 100644 --- a/core-java/src/test/java/com/baeldung/RandomListElementTest.java +++ b/core-java/src/test/java/com/baeldung/RandomListElementUnitTest.java @@ -6,7 +6,7 @@ import org.junit.Test; import java.util.*; import java.util.concurrent.ThreadLocalRandom; -public class RandomListElementTest { +public class RandomListElementUnitTest { @Test public void givenList_whenRandomIndexChosen_shouldReturnARandomElementUsingRandom() { @@ -20,7 +20,7 @@ public class RandomListElementTest { public void givenList_whenRandomIndexChosen_shouldReturnARandomElementUsingMathRandom() { List givenList = Lists.newArrayList(1, 2, 3); - givenList.get((int)(Math.random() * givenList.size())); + givenList.get((int) (Math.random() * givenList.size())); } @Test diff --git a/core-java/src/test/java/com/baeldung/StringToIntOrIntegerTest.java b/core-java/src/test/java/com/baeldung/StringToIntOrIntegerUnitTest.java similarity index 97% rename from core-java/src/test/java/com/baeldung/StringToIntOrIntegerTest.java rename to core-java/src/test/java/com/baeldung/StringToIntOrIntegerUnitTest.java index 6c1493d89b..a7ad0bf114 100644 --- a/core-java/src/test/java/com/baeldung/StringToIntOrIntegerTest.java +++ b/core-java/src/test/java/com/baeldung/StringToIntOrIntegerUnitTest.java @@ -1,11 +1,12 @@ package com.baeldung; -import com.google.common.primitives.Ints; -import org.junit.Test; - import static org.assertj.core.api.Assertions.assertThat; -public class StringToIntOrIntegerTest { +import org.junit.Test; + +import com.google.common.primitives.Ints; + +public class StringToIntOrIntegerUnitTest { @Test public void givenString_whenParsingInt_shouldConvertToInt() { @@ -16,7 +17,6 @@ public class StringToIntOrIntegerTest { assertThat(result).isEqualTo(42); } - @Test public void givenString_whenCallingIntegerValueOf_shouldConvertToInt() { String givenString = "42"; diff --git a/core-java/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java b/core-java/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java similarity index 54% rename from core-java/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java rename to core-java/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java index d94f72b685..dbddbe6c54 100644 --- a/core-java/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java +++ b/core-java/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java @@ -36,198 +36,143 @@ import static java.util.stream.Collectors.toSet; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class Java8CollectorsTest { +public class Java8CollectorsUnitTest { private final List givenList = Arrays.asList("a", "bb", "ccc", "dd"); @Test public void whenCollectingToList_shouldCollectToList() throws Exception { - final List result = givenList.stream() - .collect(toList()); + final List result = givenList.stream().collect(toList()); - assertThat(result) - .containsAll(givenList); + assertThat(result).containsAll(givenList); } @Test public void whenCollectingToList_shouldCollectToSet() throws Exception { - final Set result = givenList.stream() - .collect(toSet()); + final Set result = givenList.stream().collect(toSet()); - assertThat(result) - .containsAll(givenList); + assertThat(result).containsAll(givenList); } @Test public void whenCollectingToCollection_shouldCollectToCollection() throws Exception { - final List result = givenList.stream() - .collect(toCollection(LinkedList::new)); + final List result = givenList.stream().collect(toCollection(LinkedList::new)); - assertThat(result) - .containsAll(givenList) - .isInstanceOf(LinkedList.class); + assertThat(result).containsAll(givenList).isInstanceOf(LinkedList.class); } @Test public void whenCollectingToImmutableCollection_shouldThrowException() throws Exception { assertThatThrownBy(() -> { - givenList.stream() - .collect(toCollection(ImmutableList::of)); + givenList.stream().collect(toCollection(ImmutableList::of)); }).isInstanceOf(UnsupportedOperationException.class); } @Test public void whenCollectingToMap_shouldCollectToMap() throws Exception { - final Map result = givenList.stream() - .collect(toMap(Function.identity(), String::length)); + final Map result = givenList.stream().collect(toMap(Function.identity(), String::length)); - assertThat(result) - .containsEntry("a", 1) - .containsEntry("bb", 2) - .containsEntry("ccc", 3) - .containsEntry("dd", 2); + assertThat(result).containsEntry("a", 1).containsEntry("bb", 2).containsEntry("ccc", 3).containsEntry("dd", 2); } @Test public void whenCollectingToMap_shouldCollectToMapMerging() throws Exception { - final Map result = givenList.stream() - .collect(toMap(Function.identity(), String::length, (i1, i2) -> i1)); + final Map result = givenList.stream().collect(toMap(Function.identity(), String::length, (i1, i2) -> i1)); - assertThat(result) - .containsEntry("a", 1) - .containsEntry("bb", 2) - .containsEntry("ccc", 3) - .containsEntry("dd", 2); + assertThat(result).containsEntry("a", 1).containsEntry("bb", 2).containsEntry("ccc", 3).containsEntry("dd", 2); } @Test public void whenCollectingAndThen_shouldCollect() throws Exception { - final List result = givenList.stream() - .collect(collectingAndThen(toList(), ImmutableList::copyOf)); + final List result = givenList.stream().collect(collectingAndThen(toList(), ImmutableList::copyOf)); - assertThat(result) - .containsAll(givenList) - .isInstanceOf(ImmutableList.class); + assertThat(result).containsAll(givenList).isInstanceOf(ImmutableList.class); } @Test public void whenJoining_shouldJoin() throws Exception { - final String result = givenList.stream() - .collect(joining()); + final String result = givenList.stream().collect(joining()); - assertThat(result) - .isEqualTo("abbcccdd"); + assertThat(result).isEqualTo("abbcccdd"); } @Test public void whenJoiningWithSeparator_shouldJoinWithSeparator() throws Exception { - final String result = givenList.stream() - .collect(joining(" ")); + final String result = givenList.stream().collect(joining(" ")); - assertThat(result) - .isEqualTo("a bb ccc dd"); + assertThat(result).isEqualTo("a bb ccc dd"); } @Test public void whenJoiningWithSeparatorAndPrefixAndPostfix_shouldJoinWithSeparatorPrePost() throws Exception { - final String result = givenList.stream() - .collect(joining(" ", "PRE-", "-POST")); + final String result = givenList.stream().collect(joining(" ", "PRE-", "-POST")); - assertThat(result) - .isEqualTo("PRE-a bb ccc dd-POST"); + assertThat(result).isEqualTo("PRE-a bb ccc dd-POST"); } @Test public void whenPartitioningBy_shouldPartition() throws Exception { - final Map> result = givenList.stream() - .collect(partitioningBy(s -> s.length() > 2)); + final Map> result = givenList.stream().collect(partitioningBy(s -> s.length() > 2)); - assertThat(result) - .containsKeys(true, false) - .satisfies(booleanListMap -> { - assertThat(booleanListMap.get(true)) - .contains("ccc"); + assertThat(result).containsKeys(true, false).satisfies(booleanListMap -> { + assertThat(booleanListMap.get(true)).contains("ccc"); - assertThat(booleanListMap.get(false)) - .contains("a", "bb", "dd"); - }); + assertThat(booleanListMap.get(false)).contains("a", "bb", "dd"); + }); } @Test public void whenCounting_shouldCount() throws Exception { - final Long result = givenList.stream() - .collect(counting()); + final Long result = givenList.stream().collect(counting()); - assertThat(result) - .isEqualTo(4); + assertThat(result).isEqualTo(4); } @Test public void whenSummarizing_shouldSummarize() throws Exception { - final DoubleSummaryStatistics result = givenList.stream() - .collect(summarizingDouble(String::length)); + final DoubleSummaryStatistics result = givenList.stream().collect(summarizingDouble(String::length)); - assertThat(result.getAverage()) - .isEqualTo(2); - assertThat(result.getCount()) - .isEqualTo(4); - assertThat(result.getMax()) - .isEqualTo(3); - assertThat(result.getMin()) - .isEqualTo(1); - assertThat(result.getSum()) - .isEqualTo(8); + assertThat(result.getAverage()).isEqualTo(2); + assertThat(result.getCount()).isEqualTo(4); + assertThat(result.getMax()).isEqualTo(3); + assertThat(result.getMin()).isEqualTo(1); + assertThat(result.getSum()).isEqualTo(8); } @Test public void whenAveraging_shouldAverage() throws Exception { - final Double result = givenList.stream() - .collect(averagingDouble(String::length)); + final Double result = givenList.stream().collect(averagingDouble(String::length)); - assertThat(result) - .isEqualTo(2); + assertThat(result).isEqualTo(2); } @Test public void whenSumming_shouldSum() throws Exception { - final Double result = givenList.stream() - .collect(summingDouble(String::length)); + final Double result = givenList.stream().collect(summingDouble(String::length)); - assertThat(result) - .isEqualTo(8); + assertThat(result).isEqualTo(8); } @Test public void whenMaxingBy_shouldMaxBy() throws Exception { - final Optional result = givenList.stream() - .collect(maxBy(Comparator.naturalOrder())); + final Optional result = givenList.stream().collect(maxBy(Comparator.naturalOrder())); - assertThat(result) - .isPresent() - .hasValue("dd"); + assertThat(result).isPresent().hasValue("dd"); } @Test public void whenGroupingBy_shouldGroupBy() throws Exception { - final Map> result = givenList.stream() - .collect(groupingBy(String::length, toSet())); + final Map> result = givenList.stream().collect(groupingBy(String::length, toSet())); - assertThat(result) - .containsEntry(1, newHashSet("a")) - .containsEntry(2, newHashSet("bb", "dd")) - .containsEntry(3, newHashSet("ccc")); + assertThat(result).containsEntry(1, newHashSet("a")).containsEntry(2, newHashSet("bb", "dd")).containsEntry(3, newHashSet("ccc")); } - @Test public void whenCreatingCustomCollector_shouldCollect() throws Exception { - final ImmutableSet result = givenList.stream() - .collect(toImmutableSet()); + final ImmutableSet result = givenList.stream().collect(toImmutableSet()); - assertThat(result) - .isInstanceOf(ImmutableSet.class) - .contains("a", "bb", "ccc", "dd"); + assertThat(result).isInstanceOf(ImmutableSet.class).contains("a", "bb", "ccc", "dd"); } diff --git a/core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureTest.java b/core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureUnitTest.java similarity index 88% rename from core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureTest.java rename to core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureUnitTest.java index 5363a73afa..df12c3d79e 100644 --- a/core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureTest.java +++ b/core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureUnitTest.java @@ -1,24 +1,26 @@ package com.baeldung.completablefuture; -import java.util.concurrent.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.stream.Collectors; import java.util.stream.Stream; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class CompletableFutureTest { +public class CompletableFutureUnitTest { @Test public void whenRunningCompletableFutureAsynchronously_thenGetMethodWaitsForResult() throws InterruptedException, ExecutionException { - Future completableFuture = calculateAsync(); String result = completableFuture.get(); assertEquals("Hello", result); - } public Future calculateAsync() throws InterruptedException { @@ -35,15 +37,12 @@ public class CompletableFutureTest { @Test public void whenRunningCompletableFutureWithResult_thenGetMethodReturnsImmediately() throws InterruptedException, ExecutionException { - Future completableFuture = CompletableFuture.completedFuture("Hello"); String result = completableFuture.get(); assertEquals("Hello", result); - } - public Future calculateAsyncWithCancellation() throws InterruptedException { CompletableFuture completableFuture = new CompletableFuture<>(); @@ -56,90 +55,67 @@ public class CompletableFutureTest { return completableFuture; } - @Test(expected = CancellationException.class) public void whenCancelingTheFuture_thenThrowsCancellationException() throws ExecutionException, InterruptedException { - Future future = calculateAsyncWithCancellation(); future.get(); - } @Test public void whenCreatingCompletableFutureWithSupplyAsync_thenFutureReturnsValue() throws ExecutionException, InterruptedException { - CompletableFuture future = CompletableFuture.supplyAsync(() -> "Hello"); assertEquals("Hello", future.get()); - } @Test public void whenAddingThenAcceptToFuture_thenFunctionExecutesAfterComputationIsFinished() throws ExecutionException, InterruptedException { - CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello"); CompletableFuture future = completableFuture.thenAccept(s -> System.out.println("Computation returned: " + s)); future.get(); - } @Test public void whenAddingThenRunToFuture_thenFunctionExecutesAfterComputationIsFinished() throws ExecutionException, InterruptedException { - CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello"); CompletableFuture future = completableFuture.thenRun(() -> System.out.println("Computation finished.")); future.get(); - } @Test public void whenAddingThenApplyToFuture_thenFunctionExecutesAfterComputationIsFinished() throws ExecutionException, InterruptedException { - CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello"); CompletableFuture future = completableFuture.thenApply(s -> s + " World"); assertEquals("Hello World", future.get()); - } @Test public void whenUsingThenCompose_thenFuturesExecuteSequentially() throws ExecutionException, InterruptedException { - - CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello") - .thenCompose(s -> CompletableFuture.supplyAsync(() -> s + " World")); + CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello").thenCompose(s -> CompletableFuture.supplyAsync(() -> s + " World")); assertEquals("Hello World", completableFuture.get()); - } @Test public void whenUsingThenCombine_thenWaitForExecutionOfBothFutures() throws ExecutionException, InterruptedException { - - CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello") - .thenCombine(CompletableFuture.supplyAsync(() -> " World"), - (s1, s2) -> s1 + s2); + CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello").thenCombine(CompletableFuture.supplyAsync(() -> " World"), (s1, s2) -> s1 + s2); assertEquals("Hello World", completableFuture.get()); - } @Test public void whenUsingThenAcceptBoth_thenWaitForExecutionOfBothFutures() throws ExecutionException, InterruptedException { - - CompletableFuture.supplyAsync(() -> "Hello") - .thenAcceptBoth(CompletableFuture.supplyAsync(() -> " World"), - (s1, s2) -> System.out.println(s1 + s2)); - + CompletableFuture.supplyAsync(() -> "Hello").thenAcceptBoth(CompletableFuture.supplyAsync(() -> " World"), (s1, s2) -> System.out.println(s1 + s2)); } @Test public void whenFutureCombinedWithAllOfCompletes_thenAllFuturesAreDone() throws ExecutionException, InterruptedException { - CompletableFuture future1 = CompletableFuture.supplyAsync(() -> "Hello"); CompletableFuture future2 = CompletableFuture.supplyAsync(() -> "Beautiful"); CompletableFuture future3 = CompletableFuture.supplyAsync(() -> "World"); @@ -154,17 +130,13 @@ public class CompletableFutureTest { assertTrue(future2.isDone()); assertTrue(future3.isDone()); - String combined = Stream.of(future1, future2, future3) - .map(CompletableFuture::join) - .collect(Collectors.joining(" ")); + String combined = Stream.of(future1, future2, future3).map(CompletableFuture::join).collect(Collectors.joining(" ")); assertEquals("Hello Beautiful World", combined); - } @Test public void whenFutureThrows_thenHandleMethodReceivesException() throws ExecutionException, InterruptedException { - String name = null; // ... @@ -177,12 +149,10 @@ public class CompletableFutureTest { }).handle((s, t) -> s != null ? s : "Hello, Stranger!"); assertEquals("Hello, Stranger!", completableFuture.get()); - } @Test(expected = ExecutionException.class) public void whenCompletingFutureExceptionally_thenGetMethodThrows() throws ExecutionException, InterruptedException { - CompletableFuture completableFuture = new CompletableFuture<>(); // ... @@ -192,18 +162,15 @@ public class CompletableFutureTest { // ... completableFuture.get(); - } @Test public void whenAddingThenApplyAsyncToFuture_thenFunctionExecutesAfterComputationIsFinished() throws ExecutionException, InterruptedException { - CompletableFuture completableFuture = CompletableFuture.supplyAsync(() -> "Hello"); CompletableFuture future = completableFuture.thenApplyAsync(s -> s + " World"); assertEquals("Hello World", future.get()); - } } \ No newline at end of file diff --git a/core-java-8/src/test/java/com/baeldung/dateapi/ConversionExample.java b/core-java/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 core-java/src/test/java/com/baeldung/dateapi/ConversionExample.java diff --git a/core-java-8/src/test/java/com/baeldung/dateapi/JavaUtilTimeTest.java b/core-java/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java similarity index 98% rename from core-java-8/src/test/java/com/baeldung/dateapi/JavaUtilTimeTest.java rename to core-java/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java index 4bce40c2d9..e4753dbd5c 100644 --- a/core-java-8/src/test/java/com/baeldung/dateapi/JavaUtilTimeTest.java +++ b/core-java/src/test/java/com/baeldung/dateapi/JavaUtilTimeUnitTest.java @@ -14,7 +14,7 @@ import java.time.temporal.ChronoUnit; import static org.assertj.core.api.Assertions.assertThat; -public class JavaUtilTimeTest { +public class JavaUtilTimeUnitTest { @Test public void currentTime() { diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeTest.java b/core-java/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java similarity index 93% rename from core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeTest.java rename to core-java/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java index 69a289fd02..906d641632 100644 --- a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeTest.java +++ b/core-java/src/test/java/com/baeldung/datetime/UseLocalDateTimeUnitTest.java @@ -7,7 +7,7 @@ import java.time.Month; import org.junit.Assert; import org.junit.Test; -public class UseLocalDateTimeTest { +public class UseLocalDateTimeUnitTest { UseLocalDateTime useLocalDateTime = new UseLocalDateTime(); diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTest.java b/core-java/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java similarity index 96% rename from core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTest.java rename to core-java/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java index 8af33393be..dcfca792af 100644 --- a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTest.java +++ b/core-java/src/test/java/com/baeldung/datetime/UseLocalDateUnitTest.java @@ -3,12 +3,11 @@ package com.baeldung.datetime; import java.time.DayOfWeek; import java.time.LocalDate; import java.time.LocalDateTime; -import java.time.Month; import org.junit.Assert; import org.junit.Test; -public class UseLocalDateTest { +public class UseLocalDateUnitTest { UseLocalDate useLocalDate = new UseLocalDate(); diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeTest.java b/core-java/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java similarity index 96% rename from core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeTest.java rename to core-java/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java index 7776fad363..520b79d4bf 100644 --- a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeTest.java +++ b/core-java/src/test/java/com/baeldung/datetime/UseLocalTimeUnitTest.java @@ -5,7 +5,7 @@ import java.time.LocalTime; import org.junit.Assert; import org.junit.Test; -public class UseLocalTimeTest { +public class UseLocalTimeUnitTest { UseLocalTime useLocalTime = new UseLocalTime(); diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UsePeriodTest.java b/core-java/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java similarity index 86% rename from core-java-8/src/test/java/com/baeldung/datetime/UsePeriodTest.java rename to core-java/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java index 8a3228aaa5..a060d974ed 100644 --- a/core-java-8/src/test/java/com/baeldung/datetime/UsePeriodTest.java +++ b/core-java/src/test/java/com/baeldung/datetime/UsePeriodUnitTest.java @@ -1,15 +1,12 @@ package com.baeldung.datetime; import java.time.LocalDate; -import java.time.LocalDateTime; import java.time.Period; -import java.time.ZoneId; -import java.time.ZonedDateTime; import org.junit.Assert; import org.junit.Test; -public class UsePeriodTest { +public class UsePeriodUnitTest { UsePeriod usingPeriod=new UsePeriod(); @Test diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeTest.java b/core-java/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java similarity index 93% rename from core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeTest.java rename to core-java/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java index 5af01ad678..d5652430fe 100644 --- a/core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeTest.java +++ b/core-java/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java @@ -7,7 +7,7 @@ import java.time.ZonedDateTime; import org.junit.Assert; import org.junit.Test; -public class UseZonedDateTimeTest { +public class UseZonedDateTimeUnitTest { UseZonedDateTime zonedDateTime=new UseZonedDateTime(); diff --git a/core-java-8/src/test/java/com/baeldung/doublecolon/TestComputerUtils.java b/core-java/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java similarity index 98% rename from core-java-8/src/test/java/com/baeldung/doublecolon/TestComputerUtils.java rename to core-java/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java index 85194f5aa6..f69e4b03ee 100644 --- a/core-java-8/src/test/java/com/baeldung/doublecolon/TestComputerUtils.java +++ b/core-java/src/test/java/com/baeldung/doublecolon/ComputerUtilsUnitTest.java @@ -13,7 +13,7 @@ import java.util.function.BiFunction; import static com.baeldung.doublecolon.ComputerUtils.*; -public class TestComputerUtils { +public class ComputerUtilsUnitTest { @Before public void setup() { diff --git a/core-java-8/src/test/java/com/baeldung/encoderdecoder/EncoderDecoder.java b/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java similarity index 68% rename from core-java-8/src/test/java/com/baeldung/encoderdecoder/EncoderDecoder.java rename to core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java index 208a23eb91..0e3ec29dfd 100644 --- a/core-java-8/src/test/java/com/baeldung/encoderdecoder/EncoderDecoder.java +++ b/core-java/src/test/java/com/baeldung/encoderdecoder/EncoderDecoderUnitTest.java @@ -7,7 +7,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; import java.net.URLEncoder; @@ -15,13 +14,13 @@ import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.HashMap; import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -public class EncoderDecoder { +import static java.util.stream.Collectors.joining; - private static final String URL = "http://www.baeldung.com?key1=value+1&key2=value%40%21%242&key3=value%253"; - private static final Logger LOGGER = LoggerFactory.getLogger(EncoderDecoder.class); +public class EncoderDecoderUnitTest { + + private static final Logger LOGGER = LoggerFactory.getLogger(EncoderDecoderUnitTest.class); + private static final String testUrl = "http://www.baeldung.com?key1=value+1&key2=value%40%21%242&key3=value%253"; private String encodeValue(String value) { String encoded = null; @@ -46,7 +45,7 @@ public class EncoderDecoder { @Test public void givenURL_whenAnalyze_thenCorrect() throws Exception { - URL url = new URL(URL); + URL url = new URL(testUrl); Assert.assertThat(url.getProtocol(), CoreMatchers.is("http")); Assert.assertThat(url.getHost(), CoreMatchers.is("www.baeldung.com")); @@ -60,25 +59,25 @@ public class EncoderDecoder { requestParams.put("key2", "value@!$2"); requestParams.put("key3", "value%3"); - String encodedQuery = requestParams.keySet().stream() - .map(key -> key + "=" + encodeValue(requestParams.get(key))) - .collect(Collectors.joining("&")); - String encodedURL = "http://www.baeldung.com?" + encodedQuery; + String encodedURL = requestParams.keySet().stream() + .map(key -> key + "=" + encodeValue(requestParams.get(key))) + .collect(joining("&", "http://www.baeldung.com?", "")); - Assert.assertThat(URL, CoreMatchers.is(encodedURL)); + Assert.assertThat(testUrl, CoreMatchers.is(encodedURL)); } @Test public void givenRequestParam_whenUTF8Scheme_thenDecodeRequestParams() throws Exception { - URL url = new URL(URL); + URL url = new URL(testUrl); + String query = url.getQuery(); String decodedQuery = Arrays.stream(query.split("&")) - .map(param -> param.split("=")[0] + "=" + decode(param.split("=")[1])) - .collect(Collectors.joining("&")); + .map(param -> param.split("=")[0] + "=" + decode(param.split("=")[1])) + .collect(joining("&")); Assert.assertEquals( - "http://www.baeldung.com?key1=value 1&key2=value@!$2&key3=value%3", url.getProtocol() + "://" + url.getHost() + "?" + decodedQuery); + "http://www.baeldung.com?key1=value 1&key2=value@!$2&key3=value%3", url.getProtocol() + "://" + url.getHost() + "?" + decodedQuery); } } diff --git a/core-java-8/src/test/java/com/baeldung/enums/PizzaTest.java b/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java similarity index 98% rename from core-java-8/src/test/java/com/baeldung/enums/PizzaTest.java rename to core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java index deeebaa240..de60becfce 100644 --- a/core-java-8/src/test/java/com/baeldung/enums/PizzaTest.java +++ b/core-java/src/test/java/com/baeldung/enums/PizzaUnitTest.java @@ -9,7 +9,7 @@ import java.util.List; import static junit.framework.TestCase.assertTrue; -public class PizzaTest { +public class PizzaUnitTest { @Test public void givenPizaOrder_whenReady_thenDeliverable() { diff --git a/core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java b/core-java/src/test/java/com/baeldung/file/FileOperationsUnitTest.java similarity index 96% rename from core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java rename to core-java/src/test/java/com/baeldung/file/FileOperationsUnitTest.java index e21af9552a..3319716dc6 100644 --- a/core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java +++ b/core-java/src/test/java/com/baeldung/file/FileOperationsUnitTest.java @@ -1,11 +1,5 @@ package com.baeldung.file; -import org.apache.commons.io.FileUtils; -import org.hamcrest.CoreMatchers; -import org.hamcrest.Matchers; -import org.junit.Assert; -import org.junit.Test; - import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -20,7 +14,13 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.stream.Stream; -public class FileOperationsTest { +import org.apache.commons.io.FileUtils; +import org.hamcrest.CoreMatchers; +import org.hamcrest.Matchers; +import org.junit.Assert; +import org.junit.Test; + +public class FileOperationsUnitTest { @Test public void givenFileName_whenUsingClassloader_thenFileData() throws IOException { @@ -30,15 +30,15 @@ public class FileOperationsTest { File file = new File(classLoader.getResource("fileTest.txt").getFile()); InputStream inputStream = new FileInputStream(file); String data = readFromInputStream(inputStream); - + Assert.assertEquals(expectedData, data.trim()); } @Test public void givenFileNameAsAbsolutePath_whenUsingClasspath_thenFileData() throws IOException { String expectedData = "Hello World from fileTest.txt!!!"; - - Class clazz = FileOperationsTest.class; + + Class clazz = FileOperationsUnitTest.class; InputStream inputStream = clazz.getResourceAsStream("/fileTest.txt"); String data = readFromInputStream(inputStream); @@ -69,44 +69,44 @@ public class FileOperationsTest { Assert.assertThat(data.trim(), CoreMatchers.containsString(expectedData)); } - + @Test public void givenFileName_whenUsingFileUtils_thenFileData() throws IOException { String expectedData = "Hello World from fileTest.txt!!!"; - + ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("fileTest.txt").getFile()); String data = FileUtils.readFileToString(file); - + Assert.assertEquals(expectedData, data.trim()); } - + @Test public void givenFilePath_whenUsingFilesReadAllBytes_thenFileData() throws IOException, URISyntaxException { String expectedData = "Hello World from fileTest.txt!!!"; Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI()); - + byte[] fileBytes = Files.readAllBytes(path); String data = new String(fileBytes); Assert.assertEquals(expectedData, data.trim()); } - + @Test public void givenFilePath_whenUsingFilesLines_thenFileData() throws IOException, URISyntaxException { String expectedData = "Hello World from fileTest.txt!!!"; Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI()); - + StringBuilder data = new StringBuilder(); Stream lines = Files.lines(path); lines.forEach(line -> data.append(line).append("\n")); lines.close(); - + Assert.assertEquals(expectedData, data.toString().trim()); } - + private String readFromInputStream(InputStream inputStream) throws IOException { StringBuilder resultStringBuilder = new StringBuilder(); try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream))) { diff --git a/core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceTest.java b/core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java similarity index 89% rename from core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceTest.java rename to core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java index e07bcc9a8d..6f3384c8eb 100644 --- a/core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceTest.java +++ b/core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceUnitTest.java @@ -1,7 +1,8 @@ package com.baeldung.functionalinterface; -import com.google.common.util.concurrent.Uninterruptibles; -import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.HashMap; @@ -13,54 +14,43 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; -import static org.junit.Assert.*; +import org.junit.Test; -public class FunctionalInterfaceTest { +import com.google.common.util.concurrent.Uninterruptibles; + +public class FunctionalInterfaceUnitTest { @Test public void whenPassingLambdaToComputeIfAbsent_thenTheValueGetsComputedAndPutIntoMap() { - Map nameMap = new HashMap<>(); Integer value = nameMap.computeIfAbsent("John", s -> s.length()); assertEquals(new Integer(4), nameMap.get("John")); assertEquals(new Integer(4), value); - } @Test public void whenPassingMethodReferenceToComputeIfAbsent_thenTheValueGetsComputedAndPutIntoMap() { - Map nameMap = new HashMap<>(); Integer value = nameMap.computeIfAbsent("John", String::length); assertEquals(new Integer(4), nameMap.get("John")); assertEquals(new Integer(4), value); - - } - - public byte[] transformArray(short[] array, ShortToByteFunction function) { - byte[] transformedArray = new byte[array.length]; - for (int i = 0; i < array.length; i++) { - transformedArray[i] = function.applyAsByte(array[i]); - } - return transformedArray; } @Test public void whenUsingCustomFunctionalInterfaceForPrimitives_thenCanUseItAsLambda() { - short[] array = {(short) 1, (short) 2, (short) 3}; + short[] array = { (short) 1, (short) 2, (short) 3 }; byte[] transformedArray = transformArray(array, s -> (byte) (s * 2)); - byte[] expectedArray = {(byte) 2, (byte) 4, (byte) 6}; + byte[] expectedArray = { (byte) 2, (byte) 4, (byte) 6 }; assertArrayEquals(expectedArray, transformedArray); } @Test public void whenUsingBiFunction_thenCanUseItToReplaceMapValues() { - Map salaries = new HashMap<>(); salaries.put("John", 40000); salaries.put("Freddy", 30000); @@ -71,22 +61,18 @@ public class FunctionalInterfaceTest { assertEquals(new Integer(50000), salaries.get("John")); assertEquals(new Integer(30000), salaries.get("Freddy")); assertEquals(new Integer(60000), salaries.get("Samuel")); - } - @Test public void whenPassingLambdaToThreadConstructor_thenLambdaInferredToRunnable() { - Thread thread = new Thread(() -> System.out.println("Hello From Another Thread")); thread.start(); - } @Test public void whenUsingSupplierToGenerateNumbers_thenCanUseItInStreamGenerate() { - int[] fibs = {0, 1}; + int[] fibs = { 0, 1 }; Stream fibonacci = Stream.generate(() -> { int result = fibs[1]; int fib3 = fibs[0] + fibs[1]; @@ -95,55 +81,44 @@ public class FunctionalInterfaceTest { return result; }); - List fibonacci5 = fibonacci.limit(5) - .collect(Collectors.toList()); + List fibonacci5 = fibonacci.limit(5).collect(Collectors.toList()); assertEquals(new Integer(1), fibonacci5.get(0)); assertEquals(new Integer(1), fibonacci5.get(1)); assertEquals(new Integer(2), fibonacci5.get(2)); assertEquals(new Integer(3), fibonacci5.get(3)); assertEquals(new Integer(5), fibonacci5.get(4)); - } @Test public void whenUsingConsumerInForEach_thenConsumerExecutesForEachListElement() { - List names = Arrays.asList("John", "Freddy", "Samuel"); names.forEach(name -> System.out.println("Hello, " + name)); - } @Test public void whenUsingBiConsumerInForEach_thenConsumerExecutesForEachMapElement() { - Map ages = new HashMap<>(); ages.put("John", 25); ages.put("Freddy", 24); ages.put("Samuel", 30); ages.forEach((name, age) -> System.out.println(name + " is " + age + " years old")); - } @Test public void whenUsingPredicateInFilter_thenListValuesAreFilteredOut() { - List names = Arrays.asList("Angela", "Aaron", "Bob", "Claire", "David"); - List namesWithA = names.stream() - .filter(name -> name.startsWith("A")) - .collect(Collectors.toList()); + List namesWithA = names.stream().filter(name -> name.startsWith("A")).collect(Collectors.toList()); assertEquals(2, namesWithA.size()); assertTrue(namesWithA.contains("Angela")); assertTrue(namesWithA.contains("Aaron")); - } @Test public void whenUsingUnaryOperatorWithReplaceAll_thenAllValuesInTheListAreReplaced() { - List names = Arrays.asList("bob", "josh", "megan"); names.replaceAll(String::toUpperCase); @@ -151,7 +126,6 @@ public class FunctionalInterfaceTest { assertEquals("BOB", names.get(0)); assertEquals("JOSH", names.get(1)); assertEquals("MEGAN", names.get(2)); - } @Test @@ -159,8 +133,7 @@ public class FunctionalInterfaceTest { List values = Arrays.asList(3, 5, 8, 9, 12); - int sum = values.stream() - .reduce(0, (i1, i2) -> i1 + i2); + int sum = values.stream().reduce(0, (i1, i2) -> i1 + i2); assertEquals(37, sum); @@ -178,10 +151,6 @@ public class FunctionalInterfaceTest { } - public double squareLazy(Supplier lazyValue) { - return Math.pow(lazyValue.get(), 2); - } - @Test public void whenUsingSupplierToGenerateValue_thenValueIsGeneratedLazily() { @@ -196,4 +165,18 @@ public class FunctionalInterfaceTest { } + // + + public double squareLazy(Supplier lazyValue) { + return Math.pow(lazyValue.get(), 2); + } + + public byte[] transformArray(short[] array, ShortToByteFunction function) { + byte[] transformedArray = new byte[array.length]; + for (int i = 0; i < array.length; i++) { + transformedArray[i] = function.applyAsByte(array[i]); + } + return transformedArray; + } + } diff --git a/core-java/src/test/java/com/baeldung/java/networking/udp/UDPIntegrationTest.java b/core-java/src/test/java/com/baeldung/java/networking/udp/UDPIntegrationTest.java new file mode 100644 index 0000000000..2ca2d3a0c8 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/java/networking/udp/UDPIntegrationTest.java @@ -0,0 +1,39 @@ +package com.baeldung.java.networking.udp; + + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +public class UDPIntegrationTest { + private EchoClient client; + + @Before + public void setup() throws IOException { + new EchoServer().start(); + client = new EchoClient(); + } + + @Test + public void whenCanSendAndReceivePacket_thenCorrect1() { + String echo = client.sendEcho("hello server"); + assertEquals("hello server", echo); + echo = client.sendEcho("server is working"); + assertFalse(echo.equals("hello server")); + } + + @After + public void tearDown() { + stopEchoServer(); + client.close(); + } + + private void stopEchoServer() { + client.sendEcho("end"); + } +} diff --git a/core-java/src/test/java/com/baeldung/java/networking/url/UrlUnitTest.java b/core-java/src/test/java/com/baeldung/java/networking/url/UrlUnitTest.java new file mode 100644 index 0000000000..505d9595ab --- /dev/null +++ b/core-java/src/test/java/com/baeldung/java/networking/url/UrlUnitTest.java @@ -0,0 +1,104 @@ +package com.baeldung.java.networking.url; + +import static org.junit.Assert.assertEquals; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.junit.Test; + +public class UrlUnitTest { + + @Test + public void givenUrl_whenCanIdentifyProtocol_thenCorrect() throws MalformedURLException { + final URL url = new URL("http://baeldung.com"); + assertEquals("http", url.getProtocol()); + } + + @Test + public void givenUrl_whenCanGetHost_thenCorrect() throws MalformedURLException { + final URL url = new URL("http://baeldung.com"); + assertEquals("baeldung.com", url.getHost()); + } + + @Test + public void givenUrl_whenCanGetFileName_thenCorrect2() throws MalformedURLException { + final URL url = new URL("http://baeldung.com/articles?topic=java&version=8"); + assertEquals("/articles?topic=java&version=8", url.getFile()); + } + + @Test + public void givenUrl_whenCanGetFileName_thenCorrect1() throws MalformedURLException { + final URL url = new URL("http://baeldung.com/guidelines.txt"); + assertEquals("/guidelines.txt", url.getFile()); + } + + @Test + public void givenUrl_whenCanGetPathParams_thenCorrect() throws MalformedURLException { + final URL url = new URL("http://baeldung.com/articles?topic=java&version=8"); + assertEquals("/articles", url.getPath()); + } + + @Test + public void givenUrl_whenCanGetQueryParams_thenCorrect() throws MalformedURLException { + final URL url = new URL("http://baeldung.com/articles?topic=java"); + assertEquals("topic=java", url.getQuery()); + } + + @Test + public void givenUrl_whenGetsDefaultPort_thenCorrect() throws MalformedURLException { + final URL url = new URL("http://baeldung.com"); + assertEquals(-1, url.getPort()); + assertEquals(80, url.getDefaultPort()); + } + + @Test + public void givenUrl_whenGetsPort_thenCorrect() throws MalformedURLException { + final URL url = new URL("http://baeldung.com:8090"); + assertEquals(8090, url.getPort()); + assertEquals(80, url.getDefaultPort()); + } + + @Test + public void givenBaseUrl_whenCreatesRelativeUrl_thenCorrect() throws MalformedURLException { + final URL baseUrl = new URL("http://baeldung.com"); + final URL relativeUrl = new URL(baseUrl, "a-guide-to-java-sockets"); + assertEquals("http://baeldung.com/a-guide-to-java-sockets", relativeUrl.toString()); + } + + @Test + public void givenAbsoluteUrl_whenIgnoresBaseUrl_thenCorrect() throws MalformedURLException { + final URL baseUrl = new URL("http://baeldung.com"); + final URL relativeUrl = new URL(baseUrl, "http://baeldung.com/a-guide-to-java-sockets"); + assertEquals("http://baeldung.com/a-guide-to-java-sockets", relativeUrl.toString()); + } + + @Test + public void givenUrlComponents_whenConstructsCompleteUrl_thenCorrect() throws MalformedURLException { + final String protocol = "http"; + final String host = "baeldung.com"; + final String file = "/guidelines.txt"; + final URL url = new URL(protocol, host, file); + assertEquals("http://baeldung.com/guidelines.txt", url.toString()); + } + + @Test + public void givenUrlComponents_whenConstructsCompleteUrl_thenCorrect2() throws MalformedURLException { + final String protocol = "http"; + final String host = "baeldung.com"; + final String file = "/articles?topic=java&version=8"; + final URL url = new URL(protocol, host, file); + assertEquals("http://baeldung.com/articles?topic=java&version=8", url.toString()); + } + + @Test + public void givenUrlComponentsWithPort_whenConstructsCompleteUrl_thenCorrect() throws MalformedURLException { + final String protocol = "http"; + final String host = "baeldung.com"; + final int port = 9000; + final String file = "/guidelines.txt"; + final URL url = new URL(protocol, host, port, file); + assertEquals("http://baeldung.com:9000/guidelines.txt", url.toString()); + } + +} diff --git a/core-java/src/test/java/com/baeldung/java/nio/selector/EchoTest.java b/core-java/src/test/java/com/baeldung/java/nio/selector/NioEchoIntegrationTest.java similarity index 93% rename from core-java/src/test/java/com/baeldung/java/nio/selector/EchoTest.java rename to core-java/src/test/java/com/baeldung/java/nio/selector/NioEchoIntegrationTest.java index d1ac6df5e4..748dc5b9f4 100644 --- a/core-java/src/test/java/com/baeldung/java/nio/selector/EchoTest.java +++ b/core-java/src/test/java/com/baeldung/java/nio/selector/NioEchoIntegrationTest.java @@ -6,7 +6,7 @@ import java.io.IOException; import org.junit.Test; -public class EchoTest { +public class NioEchoIntegrationTest { @Test public void givenClient_whenServerEchosMessage_thenCorrect() throws IOException, InterruptedException { @@ -16,6 +16,7 @@ public class EchoTest { String resp2 = client.sendMessage("world"); assertEquals("hello", resp1); assertEquals("world", resp2); + process.destroy(); } } diff --git a/core-java/src/test/java/com/baeldung/java/nio2/FileTest.java b/core-java/src/test/java/com/baeldung/java/nio2/FileTest.java new file mode 100644 index 0000000000..4a1ad1da60 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/java/nio2/FileTest.java @@ -0,0 +1,250 @@ +package com.baeldung.java.nio2; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.nio.file.CopyOption; +import java.nio.file.DirectoryNotEmptyException; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.util.Date; + +import org.junit.Test; + +public class FileTest { + private static final String HOME = System.getProperty("user.home"); + + // checking file or dir + @Test + public void givenExistentPath_whenConfirmsFileExists_thenCorrect() { + Path p = Paths.get(HOME); + assertTrue(Files.exists(p)); + } + + @Test + public void givenNonexistentPath_whenConfirmsFileNotExists_thenCorrect() { + Path p = Paths.get(HOME + "/inexistent_file.txt"); + assertTrue(Files.notExists(p)); + } + + @Test + public void givenExistentDirPath_whenConfirmsNotRegularFile_thenCorrect() { + Path p = Paths.get(HOME); + assertFalse(Files.isRegularFile(p)); + } + + @Test + public void givenExistentDirPath_whenConfirmsReadable_thenCorrect() { + Path p = Paths.get(HOME); + assertTrue(Files.isReadable(p)); + } + + @Test + public void givenExistentDirPath_whenConfirmsWritable_thenCorrect() { + Path p = Paths.get(HOME); + assertTrue(Files.isWritable(p)); + } + + @Test + public void givenExistentDirPath_whenConfirmsExecutable_thenCorrect() { + Path p = Paths.get(HOME); + assertTrue(Files.isExecutable(p)); + } + + @Test + public void givenSameFilePaths_whenConfirmsIsSame_thenCorrect() throws IOException { + Path p1 = Paths.get(HOME); + Path p2 = Paths.get(HOME); + assertTrue(Files.isSameFile(p1, p2)); + } + + // reading, writing and creating files + // creating file + @Test + public void givenFilePath_whenCreatesNewFile_thenCorrect() throws IOException { + String fileName = "myfile_" + new Date().getTime() + ".txt"; + Path p = Paths.get(HOME + "/" + fileName); + assertFalse(Files.exists(p)); + Files.createFile(p); + assertTrue(Files.exists(p)); + + } + + @Test + public void givenDirPath_whenCreatesNewDir_thenCorrect() throws IOException { + String dirName = "myDir_" + new Date().getTime(); + Path p = Paths.get(HOME + "/" + dirName); + assertFalse(Files.exists(p)); + Files.createDirectory(p); + assertTrue(Files.exists(p)); + assertFalse(Files.isRegularFile(p)); + assertTrue(Files.isDirectory(p)); + + } + + @Test(expected = NoSuchFileException.class) + public void givenDirPath_whenFailsToCreateRecursively_thenCorrect() throws IOException { + String dirName = "myDir_" + new Date().getTime() + "/subdir"; + Path p = Paths.get(HOME + "/" + dirName); + assertFalse(Files.exists(p)); + Files.createDirectory(p); + + } + + @Test + public void givenDirPath_whenCreatesRecursively_thenCorrect() throws IOException { + Path dir = Paths.get(HOME + "/myDir_" + new Date().getTime()); + Path subdir = dir.resolve("subdir"); + assertFalse(Files.exists(dir)); + assertFalse(Files.exists(subdir)); + Files.createDirectories(subdir); + assertTrue(Files.exists(dir)); + assertTrue(Files.exists(subdir)); + } + + @Test + public void givenFilePath_whenCreatesTempFile_thenCorrect() throws IOException { + String prefix = "log_"; + String suffix = ".txt"; + Path p = Paths.get(HOME + "/"); + p = Files.createTempFile(p, prefix, suffix); + // like log_8821081429012075286.txt + assertTrue(Files.exists(p)); + + } + + @Test + public void givenFilePath_whenCreatesTempFileWithDefaultsNaming_thenCorrect() throws IOException { + Path p = Paths.get(HOME + "/"); + p = Files.createTempFile(p, null, null); + // like 8600179353689423985.tmp + assertTrue(Files.exists(p)); + } + + @Test + public void givenNoFilePath_whenCreatesTempFileInTempDir_thenCorrect() throws IOException { + Path p = Files.createTempFile(null, null); + // like C:\Users\new\AppData\Local\Temp\6100927974988978748.tmp + assertTrue(Files.exists(p)); + + } + + // delete file + @Test + public void givenPath_whenDeletes_thenCorrect() throws IOException { + Path p = Paths.get(HOME + "/fileToDelete.txt"); + assertFalse(Files.exists(p)); + Files.createFile(p); + assertTrue(Files.exists(p)); + Files.delete(p); + assertFalse(Files.exists(p)); + + } + + @Test(expected = DirectoryNotEmptyException.class) + public void givenPath_whenFailsToDeleteNonEmptyDir_thenCorrect() throws IOException { + Path dir = Paths.get(HOME + "/emptyDir" + new Date().getTime()); + Files.createDirectory(dir); + assertTrue(Files.exists(dir)); + Path file = dir.resolve("file.txt"); + Files.createFile(file); + Files.delete(dir); + + assertTrue(Files.exists(dir)); + + } + + @Test + public void givenInexistentFile_whenDeleteFails_thenCorrect() throws IOException { + Path p = Paths.get(HOME + "/inexistentFile.txt"); + assertFalse(Files.exists(p)); + try { + Files.delete(p); + } catch (IOException e) { + assertTrue(e instanceof NoSuchFileException); + } + + } + + @Test + public void givenInexistentFile_whenDeleteIfExistsWorks_thenCorrect() throws IOException { + Path p = Paths.get(HOME + "/inexistentFile.txt"); + assertFalse(Files.exists(p)); + Files.deleteIfExists(p); + + } + + // copy file + @Test + public void givenFilePath_whenCopiesToNewLocation_thenCorrect() throws IOException { + Path dir1 = Paths.get(HOME + "/firstdir_" + new Date().getTime()); + Path dir2 = Paths.get(HOME + "/otherdir_" + new Date().getTime()); + Files.createDirectory(dir1); + Files.createDirectory(dir2); + Path file1 = dir1.resolve("filetocopy.txt"); + Path file2 = dir2.resolve("filetocopy.txt"); + Files.createFile(file1); + assertTrue(Files.exists(file1)); + assertFalse(Files.exists(file2)); + Files.copy(file1, file2); + assertTrue(Files.exists(file2)); + + } + + @Test(expected = FileAlreadyExistsException.class) + public void givenPath_whenCopyFailsDueToExistingFile_thenCorrect() throws IOException { + Path dir1 = Paths.get(HOME + "/firstdir_" + new Date().getTime()); + Path dir2 = Paths.get(HOME + "/otherdir_" + new Date().getTime()); + Files.createDirectory(dir1); + Files.createDirectory(dir2); + Path file1 = dir1.resolve("filetocopy.txt"); + Path file2 = dir2.resolve("filetocopy.txt"); + Files.createFile(file1); + Files.createFile(file2); + assertTrue(Files.exists(file1)); + assertTrue(Files.exists(file2)); + Files.copy(file1, file2); + Files.copy(file1, file2, StandardCopyOption.REPLACE_EXISTING); + } + + // moving files + @Test + public void givenFilePath_whenMovesToNewLocation_thenCorrect() throws IOException { + Path dir1 = Paths.get(HOME + "/firstdir_" + new Date().getTime()); + Path dir2 = Paths.get(HOME + "/otherdir_" + new Date().getTime()); + Files.createDirectory(dir1); + Files.createDirectory(dir2); + Path file1 = dir1.resolve("filetocopy.txt"); + Path file2 = dir2.resolve("filetocopy.txt"); + Files.createFile(file1); + assertTrue(Files.exists(file1)); + assertFalse(Files.exists(file2)); + Files.move(file1, file2); + assertTrue(Files.exists(file2)); + assertFalse(Files.exists(file1)); + + } + + @Test(expected = FileAlreadyExistsException.class) + public void givenFilePath_whenMoveFailsDueToExistingFile_thenCorrect() throws IOException { + Path dir1 = Paths.get(HOME + "/firstdir_" + new Date().getTime()); + Path dir2 = Paths.get(HOME + "/otherdir_" + new Date().getTime()); + Files.createDirectory(dir1); + Files.createDirectory(dir2); + Path file1 = dir1.resolve("filetocopy.txt"); + Path file2 = dir2.resolve("filetocopy.txt"); + Files.createFile(file1); + Files.createFile(file2); + assertTrue(Files.exists(file1)); + assertTrue(Files.exists(file2)); + Files.move(file1, file2); + Files.move(file1, file2, StandardCopyOption.REPLACE_EXISTING); + assertTrue(Files.exists(file2)); + assertFalse(Files.exists(file1)); + } +} diff --git a/core-java/src/test/java/com/baeldung/java/nio2/PathTest.java b/core-java/src/test/java/com/baeldung/java/nio2/PathTest.java new file mode 100644 index 0000000000..004aeb3deb --- /dev/null +++ b/core-java/src/test/java/com/baeldung/java/nio2/PathTest.java @@ -0,0 +1,195 @@ +package com.baeldung.java.nio2; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.net.URI; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Date; + +import org.junit.Test; + +public class PathTest { + + private static final String HOME = System.getProperty("user.home"); + + // creating a path + @Test + public void givenPathString_whenCreatesPathObject_thenCorrect() { + Path p = Paths.get("/articles/baeldung"); + assertEquals("\\articles\\baeldung", p.toString()); + + } + + @Test + public void givenPathParts_whenCreatesPathObject_thenCorrect() { + Path p = Paths.get("/articles", "baeldung"); + assertEquals("\\articles\\baeldung", p.toString()); + + } + + // retrieving path info + @Test + public void givenPath_whenRetrievesFileName_thenCorrect() { + Path p = Paths.get("/articles/baeldung/logs"); + assertEquals("logs", p.getFileName().toString()); + } + + @Test + public void givenPath_whenRetrievesNameByIndex_thenCorrect() { + Path p = Paths.get("/articles/baeldung/logs"); + assertEquals("articles", p.getName(0).toString()); + assertEquals("baeldung", p.getName(1).toString()); + assertEquals("logs", p.getName(2).toString()); + } + + @Test + public void givenPath_whenCountsParts_thenCorrect() { + Path p = Paths.get("/articles/baeldung/logs"); + assertEquals(3, p.getNameCount()); + } + + @Test + public void givenPath_whenCanRetrieveSubsequenceByIndex_thenCorrect() { + Path p = Paths.get("/articles/baeldung/logs"); + assertEquals("articles", p.subpath(0, 1).toString()); + assertEquals("articles\\baeldung", p.subpath(0, 2).toString()); + assertEquals("articles\\baeldung\\logs", p.subpath(0, 3).toString()); + assertEquals("baeldung", p.subpath(1, 2).toString()); + assertEquals("baeldung\\logs", p.subpath(1, 3).toString()); + assertEquals("logs", p.subpath(2, 3).toString()); + } + + @Test + public void givenPath_whenRetrievesParent_thenCorrect() { + Path p1 = Paths.get("/articles/baeldung/logs"); + Path p2 = Paths.get("/articles/baeldung"); + Path p3 = Paths.get("/articles"); + Path p4 = Paths.get("/"); + + assertEquals("\\articles\\baeldung", p1.getParent().toString()); + assertEquals("\\articles", p2.getParent().toString()); + assertEquals("\\", p3.getParent().toString()); + assertEquals(null, p4.getParent()); + } + + @Test + public void givenPath_whenRetrievesRoot_thenCorrect() { + Path p1 = Paths.get("/articles/baeldung/logs"); + Path p2 = Paths.get("c:/articles/baeldung/logs"); + + assertEquals("\\", p1.getRoot().toString()); + assertEquals("c:\\", p2.getRoot().toString()); + } + + // removing redundancies from path + @Test + public void givenPath_whenRemovesRedundancies_thenCorrect1() { + Path p = Paths.get("/home/./baeldung/articles"); + p = p.normalize(); + assertEquals("\\home\\baeldung\\articles", p.toString()); + } + + @Test + public void givenPath_whenRemovesRedundancies_thenCorrect2() { + Path p = Paths.get("/home/baeldung/../articles"); + p = p.normalize(); + assertEquals("\\home\\articles", p.toString()); + } + + // converting a path + @Test + public void givenPath_whenConvertsToBrowseablePath_thenCorrect() { + Path p = Paths.get("/home/baeldung/articles.html"); + URI uri = p.toUri(); + assertEquals("file:///E:/home/baeldung/articles.html", uri.toString()); + } + + @Test + public void givenPath_whenConvertsToAbsolutePath_thenCorrect() { + Path p = Paths.get("/home/baeldung/articles.html"); + assertEquals("E:\\home\\baeldung\\articles.html", p.toAbsolutePath().toString()); + } + + @Test + public void givenAbsolutePath_whenRetainsAsAbsolute_thenCorrect() { + Path p = Paths.get("E:\\home\\baeldung\\articles.html"); + assertEquals("E:\\home\\baeldung\\articles.html", p.toAbsolutePath().toString()); + } + + @Test + public void givenExistingPath_whenGetsRealPathToFile_thenCorrect() throws IOException { + Path p = Paths.get(HOME); + assertEquals(HOME, p.toRealPath().toString()); + } + + @Test(expected = NoSuchFileException.class) + public void givenInExistentPath_whenFailsToConvert_thenCorrect() throws IOException { + Path p = Paths.get("E:\\home\\baeldung\\articles.html"); + + p.toRealPath(); + } + + // joining paths + @Test + public void givenTwoPaths_whenJoinsAndResolves_thenCorrect() throws IOException { + Path p = Paths.get("/baeldung/articles"); + assertEquals("\\baeldung\\articles\\java", p.resolve("java").toString()); + } + + @Test + public void givenAbsolutePath_whenResolutionRetainsIt_thenCorrect() throws IOException { + Path p = Paths.get("/baeldung/articles"); + assertEquals("C:\\baeldung\\articles\\java", p.resolve("C:\\baeldung\\articles\\java").toString()); + } + + @Test + public void givenPathWithRoot_whenResolutionRetainsIt_thenCorrect2() throws IOException { + Path p = Paths.get("/baeldung/articles"); + assertEquals("\\java", p.resolve("/java").toString()); + } + + // creating a path between 2 paths + @Test + public void givenSiblingPaths_whenCreatesPathToOther_thenCorrect() throws IOException { + Path p1 = Paths.get("articles"); + Path p2 = Paths.get("authors"); + assertEquals("..\\authors", p1.relativize(p2).toString()); + assertEquals("..\\articles", p2.relativize(p1).toString()); + } + + @Test + public void givenNonSiblingPaths_whenCreatesPathToOther_thenCorrect() throws IOException { + Path p1 = Paths.get("/baeldung"); + Path p2 = Paths.get("/baeldung/authors/articles"); + assertEquals("authors\\articles", p1.relativize(p2).toString()); + assertEquals("..\\..", p2.relativize(p1).toString()); + } + + // comparing 2 paths + @Test + public void givenTwoPaths_whenTestsEquality_thenCorrect() throws IOException { + Path p1 = Paths.get("/baeldung/articles"); + Path p2 = Paths.get("/baeldung/articles"); + Path p3 = Paths.get("/baeldung/authors"); + + assertTrue(p1.equals(p2)); + assertFalse(p1.equals(p3)); + } + + @Test + public void givenPath_whenInspectsStart_thenCorrect() { + Path p1 = Paths.get("/baeldung/articles"); + assertTrue(p1.startsWith("/baeldung")); + } + + @Test + public void givenPath_whenInspectsEnd_thenCorrect() { + Path p1 = Paths.get("/baeldung/articles"); + assertTrue(p1.endsWith("articles")); + } +} diff --git a/core-java/src/test/java/com/baeldung/java/reflection/ReflectionTest.java b/core-java/src/test/java/com/baeldung/java/reflection/ReflectionTest.java deleted file mode 100644 index a12a2f205f..0000000000 --- a/core-java/src/test/java/com/baeldung/java/reflection/ReflectionTest.java +++ /dev/null @@ -1,326 +0,0 @@ -package com.baeldung.java.reflection; - -import org.junit.Test; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Arrays; -import java.util.List; -import java.util.ArrayList; -import static org.junit.Assert.*; - -public class ReflectionTest { - - @Test - public void givenObject_whenGetsFieldNamesAtRuntime_thenCorrect() { - Object person = new Person(); - Field[] fields = person.getClass().getDeclaredFields(); - - List actualFieldNames = getFieldNames(fields); - - assertTrue(Arrays.asList("name", "age") - .containsAll(actualFieldNames)); - } - - @Test - public void givenObject_whenGetsClassName_thenCorrect() { - Object goat = new Goat("goat"); - Class clazz = goat.getClass(); - - assertEquals("Goat", clazz.getSimpleName()); - assertEquals("com.baeldung.java.reflection.Goat", clazz.getName()); - assertEquals("com.baeldung.java.reflection.Goat", clazz.getCanonicalName()); - } - - @Test - public void givenClassName_whenCreatesObject_thenCorrect() - throws ClassNotFoundException { - Class clazz = Class.forName("com.baeldung.java.reflection.Goat"); - - assertEquals("Goat", clazz.getSimpleName()); - assertEquals("com.baeldung.java.reflection.Goat", clazz.getName()); - assertEquals("com.baeldung.java.reflection.Goat", clazz.getCanonicalName()); - } - - @Test - public void givenClass_whenRecognisesModifiers_thenCorrect() - throws ClassNotFoundException { - Class goatClass = Class.forName("com.baeldung.java.reflection.Goat"); - Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); - int goatMods = goatClass.getModifiers(); - int animalMods = animalClass.getModifiers(); - - assertTrue(Modifier.isPublic(goatMods)); - assertTrue(Modifier.isAbstract(animalMods)); - assertTrue(Modifier.isPublic(animalMods)); - } - - @Test - public void givenClass_whenGetsPackageInfo_thenCorrect() { - Goat goat = new Goat("goat"); - Class goatClass = goat.getClass(); - Package pkg = goatClass.getPackage(); - - assertEquals("com.baeldung.java.reflection", pkg.getName()); - } - - @Test - public void givenClass_whenGetsSuperClass_thenCorrect() { - Goat goat = new Goat("goat"); - String str = "any string"; - - Class goatClass = goat.getClass(); - Class goatSuperClass = goatClass.getSuperclass(); - - assertEquals("Animal", goatSuperClass.getSimpleName()); - assertEquals("Object", str.getClass().getSuperclass().getSimpleName()); - - } - - @Test - public void givenClass_whenGetsImplementedInterfaces_thenCorrect() - throws ClassNotFoundException { - Class goatClass = Class.forName("com.baeldung.java.reflection.Goat"); - Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); - Class[] goatInterfaces = goatClass.getInterfaces(); - Class[] animalInterfaces = animalClass.getInterfaces(); - - assertEquals(1, goatInterfaces.length); - assertEquals(1, animalInterfaces.length); - assertEquals("Locomotion", goatInterfaces[0].getSimpleName()); - assertEquals("Eating", animalInterfaces[0].getSimpleName()); - } - - @Test - public void givenClass_whenGetsConstructor_thenCorrect() - throws ClassNotFoundException { - Class goatClass = Class.forName("com.baeldung.java.reflection.Goat"); - Constructor[] constructors = goatClass.getConstructors(); - - assertEquals(1, constructors.length); - assertEquals("com.baeldung.java.reflection.Goat", constructors[0].getName()); - } - - @Test - public void givenClass_whenGetsFields_thenCorrect() - throws ClassNotFoundException { - Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); - Field[] fields = animalClass.getDeclaredFields(); - - List actualFields = getFieldNames(fields); - - assertEquals(2, actualFields.size()); - assertTrue(actualFields.containsAll(Arrays.asList("name", "CATEGORY"))); - } - - @Test - public void givenClass_whenGetsMethods_thenCorrect() - throws ClassNotFoundException { - Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); - Method[] methods = animalClass.getDeclaredMethods(); - List actualMethods = getMethodNames(methods); - - assertEquals(4, actualMethods.size()); - assertTrue(actualMethods.containsAll(Arrays.asList("getName", - "setName", "getSound"))); - } - - @Test - public void givenClass_whenGetsAllConstructors_thenCorrect() - throws ClassNotFoundException { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Constructor[] constructors = birdClass.getConstructors(); - - assertEquals(3, constructors.length); - } - - @Test - public void givenClass_whenGetsEachConstructorByParamTypes_thenCorrect() - throws Exception { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Constructor cons1 = birdClass.getConstructor(); - Constructor cons2 = birdClass.getConstructor(String.class); - Constructor cons3 = birdClass.getConstructor(String.class, - boolean.class); - } - - @Test - public void givenClass_whenInstantiatesObjectsAtRuntime_thenCorrect() - throws Exception { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - - Constructor cons1 = birdClass.getConstructor(); - Constructor cons2 = birdClass.getConstructor(String.class); - Constructor cons3 = birdClass.getConstructor(String.class, - boolean.class); - - Bird bird1 = (Bird) cons1.newInstance(); - Bird bird2 = (Bird) cons2.newInstance("Weaver bird"); - Bird bird3 = (Bird) cons3.newInstance("dove", true); - - assertEquals("bird", bird1.getName()); - assertEquals("Weaver bird", bird2.getName()); - assertEquals("dove", bird3.getName()); - assertFalse(bird1.walks()); - assertTrue(bird3.walks()); - } - - @Test - public void givenClass_whenGetsPublicFields_thenCorrect() - throws ClassNotFoundException { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Field[] fields = birdClass.getFields(); - assertEquals(1, fields.length); - assertEquals("CATEGORY", fields[0].getName()); - - } - - @Test - public void givenClass_whenGetsPublicFieldByName_thenCorrect() - throws Exception { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Field field = birdClass.getField("CATEGORY"); - assertEquals("CATEGORY", field.getName()); - - } - - @Test - public void givenClass_whenGetsDeclaredFields_thenCorrect() - throws ClassNotFoundException { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Field[] fields = birdClass.getDeclaredFields(); - assertEquals(1, fields.length); - assertEquals("walks", fields[0].getName()); - } - - @Test - public void givenClass_whenGetsFieldsByName_thenCorrect() - throws Exception { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Field field = birdClass.getDeclaredField("walks"); - assertEquals("walks", field.getName()); - - } - - @Test - public void givenClassField_whenGetsType_thenCorrect() - throws Exception { - Field field = Class.forName("com.baeldung.java.reflection.Bird") - .getDeclaredField("walks"); - Class fieldClass = field.getType(); - assertEquals("boolean", fieldClass.getSimpleName()); - } - - @Test - public void givenClassField_whenSetsAndGetsValue_thenCorrect() - throws Exception { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Bird bird = (Bird) birdClass.newInstance(); - Field field = birdClass.getDeclaredField("walks"); - field.setAccessible(true); - - assertFalse(field.getBoolean(bird)); - assertFalse(bird.walks()); - - field.set(bird, true); - - assertTrue(field.getBoolean(bird)); - assertTrue(bird.walks()); - - } - - @Test - public void givenClassField_whenGetsAndSetsWithNull_thenCorrect() - throws Exception { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Field field = birdClass.getField("CATEGORY"); - field.setAccessible(true); - - assertEquals("domestic", field.get(null)); - } - - @Test - public void givenClass_whenGetsAllPublicMethods_thenCorrect() - throws ClassNotFoundException { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Method[] methods = birdClass.getMethods(); - List methodNames = getMethodNames(methods); - - assertTrue(methodNames.containsAll(Arrays - .asList("equals", "notifyAll", "hashCode", - "walks", "eats", "toString"))); - - } - - @Test - public void givenClass_whenGetsOnlyDeclaredMethods_thenCorrect() - throws ClassNotFoundException { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - List actualMethodNames = getMethodNames(birdClass.getDeclaredMethods()); - - List expectedMethodNames = Arrays.asList("setWalks", "walks", "getSound", "eats"); - - assertEquals(expectedMethodNames.size(), actualMethodNames.size()); - assertTrue(expectedMethodNames.containsAll(actualMethodNames)); - assertTrue(actualMethodNames.containsAll(expectedMethodNames)); - - } - - @Test - public void givenMethodName_whenGetsMethod_thenCorrect() - throws Exception { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Method walksMethod = birdClass.getDeclaredMethod("walks"); - Method setWalksMethod = birdClass.getDeclaredMethod("setWalks", - boolean.class); - - assertFalse(walksMethod.isAccessible()); - assertFalse(setWalksMethod.isAccessible()); - - walksMethod.setAccessible(true); - setWalksMethod.setAccessible(true); - - assertTrue(walksMethod.isAccessible()); - assertTrue(setWalksMethod.isAccessible()); - - } - - @Test - public void givenMethod_whenInvokes_thenCorrect() - throws Exception { - Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - Bird bird = (Bird) birdClass.newInstance(); - Method setWalksMethod = birdClass.getDeclaredMethod("setWalks", - boolean.class); - Method walksMethod = birdClass.getDeclaredMethod("walks"); - boolean walks = (boolean) walksMethod.invoke(bird); - - assertFalse(walks); - assertFalse(bird.walks()); - - setWalksMethod.invoke(bird, true); - boolean walks2 = (boolean) walksMethod.invoke(bird); - - assertTrue(walks2); - assertTrue(bird.walks()); - - } - - private static List getFieldNames(Field[] fields) { - List fieldNames = new ArrayList<>(); - for (Field field : fields) - fieldNames.add(field.getName()); - return fieldNames; - - } - - private static List getMethodNames(Method[] methods) { - List methodNames = new ArrayList<>(); - for (Method method : methods) - methodNames.add(method.getName()); - return methodNames; - } - -} diff --git a/core-java/src/test/java/com/baeldung/java/reflection/ReflectionUnitTest.java b/core-java/src/test/java/com/baeldung/java/reflection/ReflectionUnitTest.java new file mode 100644 index 0000000000..0c090901e7 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/java/reflection/ReflectionUnitTest.java @@ -0,0 +1,302 @@ +package com.baeldung.java.reflection; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + +public class ReflectionUnitTest { + + @Test + public void givenObject_whenGetsFieldNamesAtRuntime_thenCorrect() { + final Object person = new Person(); + final Field[] fields = person.getClass().getDeclaredFields(); + + final List actualFieldNames = getFieldNames(fields); + + assertTrue(Arrays.asList("name", "age").containsAll(actualFieldNames)); + } + + @Test + public void givenObject_whenGetsClassName_thenCorrect() { + final Object goat = new Goat("goat"); + final Class clazz = goat.getClass(); + + assertEquals("Goat", clazz.getSimpleName()); + assertEquals("com.baeldung.java.reflection.Goat", clazz.getName()); + assertEquals("com.baeldung.java.reflection.Goat", clazz.getCanonicalName()); + } + + @Test + public void givenClassName_whenCreatesObject_thenCorrect() throws ClassNotFoundException { + final Class clazz = Class.forName("com.baeldung.java.reflection.Goat"); + + assertEquals("Goat", clazz.getSimpleName()); + assertEquals("com.baeldung.java.reflection.Goat", clazz.getName()); + assertEquals("com.baeldung.java.reflection.Goat", clazz.getCanonicalName()); + } + + @Test + public void givenClass_whenRecognisesModifiers_thenCorrect() throws ClassNotFoundException { + final Class goatClass = Class.forName("com.baeldung.java.reflection.Goat"); + final Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); + final int goatMods = goatClass.getModifiers(); + final int animalMods = animalClass.getModifiers(); + + assertTrue(Modifier.isPublic(goatMods)); + assertTrue(Modifier.isAbstract(animalMods)); + assertTrue(Modifier.isPublic(animalMods)); + } + + @Test + public void givenClass_whenGetsPackageInfo_thenCorrect() { + final Goat goat = new Goat("goat"); + final Class goatClass = goat.getClass(); + final Package pkg = goatClass.getPackage(); + + assertEquals("com.baeldung.java.reflection", pkg.getName()); + } + + @Test + public void givenClass_whenGetsSuperClass_thenCorrect() { + final Goat goat = new Goat("goat"); + final String str = "any string"; + + final Class goatClass = goat.getClass(); + final Class goatSuperClass = goatClass.getSuperclass(); + + assertEquals("Animal", goatSuperClass.getSimpleName()); + assertEquals("Object", str.getClass().getSuperclass().getSimpleName()); + + } + + @Test + public void givenClass_whenGetsImplementedInterfaces_thenCorrect() throws ClassNotFoundException { + final Class goatClass = Class.forName("com.baeldung.java.reflection.Goat"); + final Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); + final Class[] goatInterfaces = goatClass.getInterfaces(); + final Class[] animalInterfaces = animalClass.getInterfaces(); + + assertEquals(1, goatInterfaces.length); + assertEquals(1, animalInterfaces.length); + assertEquals("Locomotion", goatInterfaces[0].getSimpleName()); + assertEquals("Eating", animalInterfaces[0].getSimpleName()); + } + + @Test + public void givenClass_whenGetsConstructor_thenCorrect() throws ClassNotFoundException { + final Class goatClass = Class.forName("com.baeldung.java.reflection.Goat"); + final Constructor[] constructors = goatClass.getConstructors(); + + assertEquals(1, constructors.length); + assertEquals("com.baeldung.java.reflection.Goat", constructors[0].getName()); + } + + @Test + public void givenClass_whenGetsFields_thenCorrect() throws ClassNotFoundException { + final Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); + final Field[] fields = animalClass.getDeclaredFields(); + + final List actualFields = getFieldNames(fields); + + assertEquals(2, actualFields.size()); + assertTrue(actualFields.containsAll(Arrays.asList("name", "CATEGORY"))); + } + + @Test + public void givenClass_whenGetsMethods_thenCorrect() throws ClassNotFoundException { + final Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); + final Method[] methods = animalClass.getDeclaredMethods(); + final List actualMethods = getMethodNames(methods); + + assertEquals(3, actualMethods.size()); + assertTrue(actualMethods.containsAll(Arrays.asList("getName", "setName", "getSound"))); + } + + @Test + public void givenClass_whenGetsAllConstructors_thenCorrect() throws ClassNotFoundException { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Constructor[] constructors = birdClass.getConstructors(); + + assertEquals(3, constructors.length); + } + + @Test + public void givenClass_whenGetsEachConstructorByParamTypes_thenCorrect() throws Exception { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + birdClass.getConstructor(); + birdClass.getConstructor(String.class); + birdClass.getConstructor(String.class, boolean.class); + } + + @Test + public void givenClass_whenInstantiatesObjectsAtRuntime_thenCorrect() throws Exception { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + + final Constructor cons1 = birdClass.getConstructor(); + final Constructor cons2 = birdClass.getConstructor(String.class); + final Constructor cons3 = birdClass.getConstructor(String.class, boolean.class); + + final Bird bird1 = (Bird) cons1.newInstance(); + final Bird bird2 = (Bird) cons2.newInstance("Weaver bird"); + final Bird bird3 = (Bird) cons3.newInstance("dove", true); + + assertEquals("bird", bird1.getName()); + assertEquals("Weaver bird", bird2.getName()); + assertEquals("dove", bird3.getName()); + assertFalse(bird1.walks()); + assertTrue(bird3.walks()); + } + + @Test + public void givenClass_whenGetsPublicFields_thenCorrect() throws ClassNotFoundException { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Field[] fields = birdClass.getFields(); + assertEquals(1, fields.length); + assertEquals("CATEGORY", fields[0].getName()); + + } + + @Test + public void givenClass_whenGetsPublicFieldByName_thenCorrect() throws Exception { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Field field = birdClass.getField("CATEGORY"); + assertEquals("CATEGORY", field.getName()); + + } + + @Test + public void givenClass_whenGetsDeclaredFields_thenCorrect() throws ClassNotFoundException { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Field[] fields = birdClass.getDeclaredFields(); + assertEquals(1, fields.length); + assertEquals("walks", fields[0].getName()); + } + + @Test + public void givenClass_whenGetsFieldsByName_thenCorrect() throws Exception { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Field field = birdClass.getDeclaredField("walks"); + assertEquals("walks", field.getName()); + + } + + @Test + public void givenClassField_whenGetsType_thenCorrect() throws Exception { + final Field field = Class.forName("com.baeldung.java.reflection.Bird").getDeclaredField("walks"); + final Class fieldClass = field.getType(); + assertEquals("boolean", fieldClass.getSimpleName()); + } + + @Test + public void givenClassField_whenSetsAndGetsValue_thenCorrect() throws Exception { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Bird bird = (Bird) birdClass.newInstance(); + final Field field = birdClass.getDeclaredField("walks"); + field.setAccessible(true); + + assertFalse(field.getBoolean(bird)); + assertFalse(bird.walks()); + + field.set(bird, true); + + assertTrue(field.getBoolean(bird)); + assertTrue(bird.walks()); + + } + + @Test + public void givenClassField_whenGetsAndSetsWithNull_thenCorrect() throws Exception { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Field field = birdClass.getField("CATEGORY"); + field.setAccessible(true); + + assertEquals("domestic", field.get(null)); + } + + @Test + public void givenClass_whenGetsAllPublicMethods_thenCorrect() throws ClassNotFoundException { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Method[] methods = birdClass.getMethods(); + final List methodNames = getMethodNames(methods); + + assertTrue(methodNames.containsAll(Arrays.asList("equals", "notifyAll", "hashCode", "walks", "eats", "toString"))); + + } + + @Test + public void givenClass_whenGetsOnlyDeclaredMethods_thenCorrect() throws ClassNotFoundException { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final List actualMethodNames = getMethodNames(birdClass.getDeclaredMethods()); + + final List expectedMethodNames = Arrays.asList("setWalks", "walks", "getSound", "eats"); + + assertEquals(expectedMethodNames.size(), actualMethodNames.size()); + assertTrue(expectedMethodNames.containsAll(actualMethodNames)); + assertTrue(actualMethodNames.containsAll(expectedMethodNames)); + + } + + @Test + public void givenMethodName_whenGetsMethod_thenCorrect() throws Exception { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Method walksMethod = birdClass.getDeclaredMethod("walks"); + final Method setWalksMethod = birdClass.getDeclaredMethod("setWalks", boolean.class); + + assertFalse(walksMethod.isAccessible()); + assertFalse(setWalksMethod.isAccessible()); + + walksMethod.setAccessible(true); + setWalksMethod.setAccessible(true); + + assertTrue(walksMethod.isAccessible()); + assertTrue(setWalksMethod.isAccessible()); + + } + + @Test + public void givenMethod_whenInvokes_thenCorrect() throws Exception { + final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Bird bird = (Bird) birdClass.newInstance(); + final Method setWalksMethod = birdClass.getDeclaredMethod("setWalks", boolean.class); + final Method walksMethod = birdClass.getDeclaredMethod("walks"); + final boolean walks = (boolean) walksMethod.invoke(bird); + + assertFalse(walks); + assertFalse(bird.walks()); + + setWalksMethod.invoke(bird, true); + final boolean walks2 = (boolean) walksMethod.invoke(bird); + + assertTrue(walks2); + assertTrue(bird.walks()); + + } + + private static List getFieldNames(Field[] fields) { + final List fieldNames = new ArrayList<>(); + for (final Field field : fields) { + fieldNames.add(field.getName()); + } + return fieldNames; + + } + + private static List getMethodNames(Method[] methods) { + final List methodNames = new ArrayList<>(); + for (final Method method : methods) { + methodNames.add(method.getName()); + } + return methodNames; + } + +} diff --git a/core-java/src/test/java/com/baeldung/java/regex/RegexTest.java b/core-java/src/test/java/com/baeldung/java/regex/RegexUnitTest.java similarity index 99% rename from core-java/src/test/java/com/baeldung/java/regex/RegexTest.java rename to core-java/src/test/java/com/baeldung/java/regex/RegexUnitTest.java index 414401eb85..e4ea55aae3 100644 --- a/core-java/src/test/java/com/baeldung/java/regex/RegexTest.java +++ b/core-java/src/test/java/com/baeldung/java/regex/RegexUnitTest.java @@ -7,7 +7,7 @@ import java.util.regex.Pattern; import org.junit.Test; -public class RegexTest { +public class RegexUnitTest { private static Pattern pattern; private static Matcher matcher; @@ -499,4 +499,3 @@ public class RegexTest { return matches; } } - diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java b/core-java/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsTest.java b/core-java/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java similarity index 93% rename from core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java index 21a5e34b9b..5b07b3e3ae 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsTest.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsUnitTest.java @@ -6,7 +6,7 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; -public class Java8DefaultStaticIntefaceMethodsTest { +public class Java8DefaultStaticIntefaceMethodsUnitTest { @Test public void callStaticInterfaceMethdosMethods_whenExpectedResults_thenCorrect() { diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java b/core-java/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java similarity index 83% rename from core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java index 581ccec182..41eb864fd9 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8ExecutorServiceIntegrationTest.java @@ -1,17 +1,26 @@ package com.baeldung.java8; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import org.junit.Before; import org.junit.Test; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.*; - -import static org.junit.Assert.*; - - -public class Java8ExecutorServiceTest { +public class Java8ExecutorServiceIntegrationTest { private Runnable runnableTask; private Callable callableTask; @@ -53,9 +62,7 @@ public class Java8ExecutorServiceTest { @Test public void creationSubmittingTasksShuttingDownNow_whenShutDownAfterAwating_thenCorrect() { - ExecutorService threadPoolExecutor = - new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, - new LinkedBlockingQueue<>()); + ExecutorService threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>()); for (int i = 0; i < 100; i++) { threadPoolExecutor.submit(callableTask); @@ -138,8 +145,7 @@ public class Java8ExecutorServiceTest { @Test public void submittingTaskScheduling_whenExecuted_thenCorrect() { - ScheduledExecutorService executorService = Executors - .newSingleThreadScheduledExecutor(); + ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); Future resultFuture = executorService.schedule(callableTask, 1, TimeUnit.SECONDS); String result = null; diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8ForkJoinTest.java b/core-java/src/test/java/com/baeldung/java8/Java8ForkJoinIntegrationTest.java similarity index 94% rename from core-java-8/src/test/java/com/baeldung/java8/Java8ForkJoinTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8ForkJoinIntegrationTest.java index 273b2d78db..6778fd782b 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8ForkJoinTest.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8ForkJoinIntegrationTest.java @@ -1,18 +1,20 @@ package com.baeldung.java8; - -import com.baeldung.forkjoin.CustomRecursiveAction; -import com.baeldung.forkjoin.CustomRecursiveTask; -import com.baeldung.forkjoin.util.PoolUtil; -import org.junit.Before; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.Random; import java.util.concurrent.ForkJoinPool; -import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Test; -public class Java8ForkJoinTest { +import com.baeldung.forkjoin.CustomRecursiveAction; +import com.baeldung.forkjoin.CustomRecursiveTask; +import com.baeldung.forkjoin.util.PoolUtil; + +public class Java8ForkJoinIntegrationTest { private int[] arr; private CustomRecursiveTask customRecursiveTask; @@ -27,28 +29,23 @@ public class Java8ForkJoinTest { customRecursiveTask = new CustomRecursiveTask(arr); } - @Test public void callPoolUtil_whenExistsAndExpectedType_thenCorrect() { - ForkJoinPool forkJoinPool = PoolUtil.forkJoinPool; ForkJoinPool forkJoinPoolTwo = PoolUtil.forkJoinPool; assertNotNull(forkJoinPool); assertEquals(2, forkJoinPool.getParallelism()); assertEquals(forkJoinPool, forkJoinPoolTwo); - } @Test public void callCommonPool_whenExistsAndExpectedType_thenCorrect() { - ForkJoinPool commonPool = ForkJoinPool.commonPool(); ForkJoinPool commonPoolTwo = ForkJoinPool.commonPool(); assertNotNull(commonPool); assertEquals(commonPool, commonPoolTwo); - } @Test @@ -63,7 +60,6 @@ public class Java8ForkJoinTest { @Test public void executeRecursiveTask_whenExecuted_thenCorrect() { - ForkJoinPool forkJoinPool = ForkJoinPool.commonPool(); forkJoinPool.execute(customRecursiveTask); @@ -73,12 +69,10 @@ public class Java8ForkJoinTest { forkJoinPool.submit(customRecursiveTask); int resultTwo = customRecursiveTask.join(); assertTrue(customRecursiveTask.isDone()); - } @Test public void executeRecursiveTaskWithFJ_whenExecuted_thenCorrect() { - CustomRecursiveTask customRecursiveTaskFirst = new CustomRecursiveTask(arr); CustomRecursiveTask customRecursiveTaskSecond = new CustomRecursiveTask(arr); CustomRecursiveTask customRecursiveTaskLast = new CustomRecursiveTask(arr); @@ -95,6 +89,6 @@ public class Java8ForkJoinTest { assertTrue(customRecursiveTaskSecond.isDone()); assertTrue(customRecursiveTaskLast.isDone()); assertTrue(result != 0); - } + } diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasTest.java b/core-java/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasUnitTest.java similarity index 98% rename from core-java-8/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasUnitTest.java index faaf3ae407..13ddcc805f 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasTest.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasUnitTest.java @@ -11,7 +11,7 @@ import java.util.function.Function; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; -public class Java8FunctionalInteracesLambdasTest { +public class Java8FunctionalInteracesLambdasUnitTest { private UseFoo useFoo; diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceTest.java b/core-java/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java similarity index 97% rename from core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java index d9d88c5052..2dc1fe18e6 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceTest.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8MethodReferenceUnitTest.java @@ -12,7 +12,7 @@ import java.util.stream.Stream; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -public class Java8MethodReferenceTest { +public class Java8MethodReferenceUnitTest { private List list; diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8OptionalTest.java b/core-java/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java similarity index 80% rename from core-java-8/src/test/java/com/baeldung/java8/Java8OptionalTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java index 26de39bc0e..c6d5836387 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8OptionalTest.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8OptionalUnitTest.java @@ -1,16 +1,23 @@ package com.baeldung.java8; -import com.baeldung.java_8_features.*; -import org.junit.Before; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Test; -public class Java8OptionalTest { +import com.baeldung.java_8_features.Address; +import com.baeldung.java_8_features.CustomException; +import com.baeldung.java_8_features.OptionalAddress; +import com.baeldung.java_8_features.OptionalUser; +import com.baeldung.java_8_features.User; + +public class Java8OptionalUnitTest { private List list; @@ -32,7 +39,6 @@ public class Java8OptionalTest { @Test public void checkOptional_whenAsExpected_thenCorrect() { - Optional optionalEmpty = Optional.empty(); assertFalse(optionalEmpty.isPresent()); @@ -52,27 +58,19 @@ public class Java8OptionalTest { assertTrue(listOptNull.isEmpty()); Optional user = Optional.ofNullable(getUser()); - String result = user.map(User::getAddress) - .map(Address::getStreet) - .orElse("not specified"); + String result = user.map(User::getAddress).map(Address::getStreet).orElse("not specified"); assertEquals(result, "1st Avenue"); Optional optionalUser = Optional.ofNullable(getOptionalUser()); - String resultOpt = optionalUser.flatMap(OptionalUser::getAddress) - .flatMap(OptionalAddress::getStreet) - .orElse("not specified"); + String resultOpt = optionalUser.flatMap(OptionalUser::getAddress).flatMap(OptionalAddress::getStreet).orElse("not specified"); assertEquals(resultOpt, "1st Avenue"); Optional userNull = Optional.ofNullable(getUserNull()); - String resultNull = userNull.map(User::getAddress) - .map(Address::getStreet) - .orElse("not specified"); + String resultNull = userNull.map(User::getAddress).map(Address::getStreet).orElse("not specified"); assertEquals(resultNull, "not specified"); Optional optionalUserNull = Optional.ofNullable(getOptionalUserNull()); - String resultOptNull = optionalUserNull.flatMap(OptionalUser::getAddress) - .flatMap(OptionalAddress::getStreet) - .orElse("not specified"); + String resultOptNull = optionalUserNull.flatMap(OptionalUser::getAddress).flatMap(OptionalAddress::getStreet).orElse("not specified"); assertEquals(resultOptNull, "not specified"); } diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java b/core-java/src/test/java/com/baeldung/java8/Java8SortUnitTest.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8SortUnitTest.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiTest.java b/core-java/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java similarity index 99% rename from core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java index 37326c6d26..d9a72063af 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiTest.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8StreamApiUnitTest.java @@ -17,11 +17,11 @@ import java.util.stream.*; import static org.junit.Assert.*; -public class Java8StreamApiTest { +public class Java8StreamApiUnitTest { private long counter; - private static Logger log = LoggerFactory.getLogger(Java8StreamApiTest.class); + private static Logger log = LoggerFactory.getLogger(Java8StreamApiUnitTest.class); private List productList; diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamsTest.java b/core-java/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java similarity index 98% rename from core-java-8/src/test/java/com/baeldung/java8/Java8StreamsTest.java rename to core-java/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java index 1f1dda49ce..fc83553c6e 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamsTest.java +++ b/core-java/src/test/java/com/baeldung/java8/Java8StreamsUnitTest.java @@ -14,7 +14,7 @@ import java.util.stream.Stream; import static org.junit.Assert.*; -public class Java8StreamsTest { +public class Java8StreamsUnitTest { private List list; diff --git a/core-java-8/src/test/java/com/baeldung/java8/JavaFolderSizeTest.java b/core-java/src/test/java/com/baeldung/java8/JavaFolderSizeUnitTest.java similarity index 76% rename from core-java-8/src/test/java/com/baeldung/java8/JavaFolderSizeTest.java rename to core-java/src/test/java/com/baeldung/java8/JavaFolderSizeUnitTest.java index f2e7452137..1f3b380772 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/JavaFolderSizeTest.java +++ b/core-java/src/test/java/com/baeldung/java8/JavaFolderSizeUnitTest.java @@ -1,43 +1,43 @@ package com.baeldung.java8; -import org.apache.commons.io.FileUtils; -import org.junit.Before; -import org.junit.Test; +import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; -import java.nio.file.*; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.text.DecimalFormat; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.StreamSupport; -import static org.junit.Assert.assertEquals; - -public class JavaFolderSizeTest { +import org.apache.commons.io.FileUtils; +import org.junit.Before; +import org.junit.Test; +public class JavaFolderSizeUnitTest { + private final long EXPECTED_SIZE = 24; private String path; @Before public void init() { final String separator = File.separator; - path = String.format("src%stest%sresources", separator, separator); + path = String.format("src%stest%sresources%stestFolder", separator, separator, separator); } @Test public void whenGetFolderSizeRecursive_thenCorrect() { - final long expectedSize = 136; - final File folder = new File(path); final long size = getFolderSize(folder); - assertEquals(expectedSize, size); + assertEquals(EXPECTED_SIZE, size); } @Test public void whenGetFolderSizeUsingJava7_thenCorrect() throws IOException { - final long expectedSize = 136; - final AtomicLong size = new AtomicLong(0); final Path folder = Paths.get(path); @@ -49,41 +49,33 @@ public class JavaFolderSizeTest { } }); - assertEquals(expectedSize, size.longValue()); + assertEquals(EXPECTED_SIZE, size.longValue()); } @Test public void whenGetFolderSizeUsingJava8_thenCorrect() throws IOException { - final long expectedSize = 136; - final Path folder = Paths.get(path); final long size = Files.walk(folder).filter(p -> p.toFile().isFile()).mapToLong(p -> p.toFile().length()).sum(); - assertEquals(expectedSize, size); + assertEquals(EXPECTED_SIZE, size); } @Test public void whenGetFolderSizeUsingApacheCommonsIO_thenCorrect() { - final long expectedSize = 136; - final File folder = new File(path); final long size = FileUtils.sizeOfDirectory(folder); - assertEquals(expectedSize, size); + assertEquals(EXPECTED_SIZE, size); } @Test public void whenGetFolderSizeUsingGuava_thenCorrect() { - final long expectedSize = 136; - final File folder = new File(path); final Iterable files = com.google.common.io.Files.fileTreeTraverser().breadthFirstTraversal(folder); - final long size = StreamSupport.stream(files.spliterator(), false) - .filter(File::isFile) - .mapToLong(File::length).sum(); + final long size = StreamSupport.stream(files.spliterator(), false).filter(File::isFile).mapToLong(File::length).sum(); - assertEquals(expectedSize, size); + assertEquals(EXPECTED_SIZE, size); } @Test @@ -91,19 +83,19 @@ public class JavaFolderSizeTest { final File folder = new File(path); final long size = getFolderSize(folder); - final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"}; + final String[] units = new String[] { "B", "KB", "MB", "GB", "TB" }; final int unitIndex = (int) (Math.log10(size) / 3); final double unitValue = 1 << (unitIndex * 10); final String readableSize = new DecimalFormat("#,##0.#").format(size / unitValue) + " " + units[unitIndex]; - assertEquals("136 B", readableSize); + assertEquals(EXPECTED_SIZE + " B", readableSize); } private long getFolderSize(final File folder) { long length = 0; final File[] files = folder.listFiles(); - for (File file : files) { + for (final File file : files) { if (file.isFile()) { length += file.length(); } else { diff --git a/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesTest.java b/core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesUnitTest.java similarity index 98% rename from core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesTest.java rename to core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesUnitTest.java index 224c4e9d6a..4c843ccaaf 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesTest.java +++ b/core-java/src/test/java/com/baeldung/java8/JavaTryWithResourcesUnitTest.java @@ -8,7 +8,7 @@ import java.io.StringWriter; import java.util.Date; import java.util.Scanner; -public class JavaTryWithResourcesTest { +public class JavaTryWithResourcesUnitTest { private static final String TEST_STRING_HELLO_WORLD = "Hello World"; private Date resource1Date, resource2Date; diff --git a/core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeTest.java b/core-java/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java similarity index 97% rename from core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeTest.java rename to core-java/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java index 164a571817..7889e6ad53 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeTest.java +++ b/core-java/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeUnitTest.java @@ -7,7 +7,7 @@ import java.io.UnsupportedEncodingException; import static org.junit.Assert.*; -public class ApacheCommonsEncodeDecodeTest { +public class ApacheCommonsEncodeDecodeUnitTest { // tests diff --git a/core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeTest.java b/core-java/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java similarity index 98% rename from core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeTest.java rename to core-java/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java index 18dccf71ba..62cfa4c0a1 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeTest.java +++ b/core-java/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeUnitTest.java @@ -8,7 +8,7 @@ import java.util.UUID; import static org.junit.Assert.*; -public class Java8EncodeDecodeTest { +public class Java8EncodeDecodeUnitTest { // tests diff --git a/core-java-8/src/test/java/com/baeldung/java8/entity/Human.java b/core-java/src/test/java/com/baeldung/java8/entity/Human.java similarity index 100% rename from core-java-8/src/test/java/com/baeldung/java8/entity/Human.java rename to core-java/src/test/java/com/baeldung/java8/entity/Human.java diff --git a/core-java/src/test/java/com/baeldung/printscreen/ScreenshotTest.java b/core-java/src/test/java/com/baeldung/printscreen/ScreenshotIntegrationTest.java similarity index 92% rename from core-java/src/test/java/com/baeldung/printscreen/ScreenshotTest.java rename to core-java/src/test/java/com/baeldung/printscreen/ScreenshotIntegrationTest.java index 7e35fc3e30..13609b6977 100644 --- a/core-java/src/test/java/com/baeldung/printscreen/ScreenshotTest.java +++ b/core-java/src/test/java/com/baeldung/printscreen/ScreenshotIntegrationTest.java @@ -7,8 +7,7 @@ import java.io.File; import static org.junit.Assert.assertTrue; - -public class ScreenshotTest { +public class ScreenshotIntegrationTest { private Screenshot screenshot = new Screenshot("Screenshot.jpg"); private File file = new File("Screenshot.jpg"); diff --git a/core-java/src/test/java/com/baeldung/socket/EchoIntegrationTest.java b/core-java/src/test/java/com/baeldung/socket/EchoIntegrationTest.java new file mode 100644 index 0000000000..7ac8e0a97a --- /dev/null +++ b/core-java/src/test/java/com/baeldung/socket/EchoIntegrationTest.java @@ -0,0 +1,47 @@ +package com.baeldung.socket; + +import static org.junit.Assert.assertEquals; + +import java.util.concurrent.Executors; + +import org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class EchoIntegrationTest { + private static final Integer PORT = 4444; + + @BeforeClass + public static void start() throws InterruptedException { + Executors.newSingleThreadExecutor().submit(() -> new EchoServer().start(PORT)); + Thread.sleep(500); + } + + private EchoClient client = new EchoClient(); + + @Before + public void init() { + client.startConnection("127.0.0.1", PORT); + } + + @After + public void tearDown() { + client.stopConnection(); + } + + // + + @Test + public void givenClient_whenServerEchosMessage_thenCorrect() { + String resp1 = client.sendMessage("hello"); + String resp2 = client.sendMessage("world"); + String resp3 = client.sendMessage("!"); + String resp4 = client.sendMessage("."); + assertEquals("hello", resp1); + assertEquals("world", resp2); + assertEquals("!", resp3); + assertEquals("good bye", resp4); + } + +} diff --git a/core-java/src/test/java/com/baeldung/socket/EchoMultiTest.java b/core-java/src/test/java/com/baeldung/socket/EchoMultiTest.java deleted file mode 100644 index fcf353281d..0000000000 --- a/core-java/src/test/java/com/baeldung/socket/EchoMultiTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.baeldung.socket; - -import org.junit.BeforeClass; -import org.junit.Test; - -import java.util.concurrent.Executors; - -import static org.junit.Assert.assertEquals; - -public class EchoMultiTest { - - private static final Integer PORT = 5555; - - @BeforeClass - public static void start() throws InterruptedException { - Executors.newSingleThreadExecutor().submit(() -> new EchoMultiServer().start(PORT)); - Thread.sleep(500); - } - - @Test - public void givenClient1_whenServerResponds_thenCorrect() { - EchoClient client = new EchoClient(); - client.startConnection("127.0.0.1", PORT); - String msg1 = client.sendMessage("hello"); - String msg2 = client.sendMessage("world"); - String terminate = client.sendMessage("."); - - assertEquals(msg1, "hello"); - assertEquals(msg2, "world"); - assertEquals(terminate, "bye"); - client.stopConnection(); - } - - @Test - public void givenClient2_whenServerResponds_thenCorrect() { - EchoClient client = new EchoClient(); - client.startConnection("127.0.0.1", PORT); - String msg1 = client.sendMessage("hello"); - String msg2 = client.sendMessage("world"); - String terminate = client.sendMessage("."); - assertEquals(msg1, "hello"); - assertEquals(msg2, "world"); - assertEquals(terminate, "bye"); - client.stopConnection(); - } - - @Test - public void givenClient3_whenServerResponds_thenCorrect() { - EchoClient client = new EchoClient(); - client.startConnection("127.0.0.1", PORT); - String msg1 = client.sendMessage("hello"); - String msg2 = client.sendMessage("world"); - String terminate = client.sendMessage("."); - assertEquals(msg1, "hello"); - assertEquals(msg2, "world"); - assertEquals(terminate, "bye"); - client.stopConnection(); - } -} diff --git a/core-java/src/test/java/com/baeldung/socket/EchoTest.java b/core-java/src/test/java/com/baeldung/socket/EchoTest.java deleted file mode 100644 index cb09d42f79..0000000000 --- a/core-java/src/test/java/com/baeldung/socket/EchoTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baeldung.socket; - -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.util.concurrent.Executors; - -import static org.junit.Assert.assertEquals; - -public class EchoTest { - private static final Integer PORT = 4444; - - @BeforeClass - public static void start() throws InterruptedException { - Executors.newSingleThreadExecutor().submit(() -> new EchoServer().start(PORT)); - Thread.sleep(500); - } - - private EchoClient client = new EchoClient(); - - @Before - public void init() { - client.startConnection("127.0.0.1", PORT); - } - - @Test - public void givenClient_whenServerEchosMessage_thenCorrect() { - - String resp1 = client.sendMessage("hello"); - String resp2 = client.sendMessage("world"); - String resp3 = client.sendMessage("!"); - String resp4 = client.sendMessage("."); - assertEquals("hello", resp1); - assertEquals("world", resp2); - assertEquals("!", resp3); - assertEquals("good bye", resp4); - } - - @After - public void tearDown() { - client.stopConnection(); - } -} diff --git a/core-java/src/test/java/com/baeldung/socket/GreetServerTest.java b/core-java/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java similarity index 90% rename from core-java/src/test/java/com/baeldung/socket/GreetServerTest.java rename to core-java/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java index caf56a8c76..06b37d8539 100644 --- a/core-java/src/test/java/com/baeldung/socket/GreetServerTest.java +++ b/core-java/src/test/java/com/baeldung/socket/GreetServerIntegrationTest.java @@ -9,7 +9,7 @@ import java.util.concurrent.Executors; import static org.junit.Assert.assertEquals; -public class GreetServerTest { +public class GreetServerIntegrationTest { private GreetClient client; @@ -24,7 +24,7 @@ public class GreetServerTest { @Before public void init() { client = new GreetClient(); - client.startConnection("127.0.0.1", PORT); + client.startConnection("127.0.0.1", PORT); } diff --git a/core-java/src/test/java/com/baeldung/socket/SocketEchoMultiIntegrationTest.java b/core-java/src/test/java/com/baeldung/socket/SocketEchoMultiIntegrationTest.java new file mode 100644 index 0000000000..6ebc0946c5 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/socket/SocketEchoMultiIntegrationTest.java @@ -0,0 +1,59 @@ +package com.baeldung.socket; + +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.concurrent.Executors; + +import static org.junit.Assert.assertEquals; + +public class SocketEchoMultiIntegrationTest { + + private static final Integer PORT = 5555; + + @BeforeClass + public static void start() throws InterruptedException { + Executors.newSingleThreadExecutor().submit(() -> new EchoMultiServer().start(PORT)); + Thread.sleep(500); + } + + @Test + public void givenClient1_whenServerResponds_thenCorrect() { + EchoClient client = new EchoClient(); + client.startConnection("127.0.0.1", PORT); + String msg1 = client.sendMessage("hello"); + String msg2 = client.sendMessage("world"); + String terminate = client.sendMessage("."); + + assertEquals(msg1, "hello"); + assertEquals(msg2, "world"); + assertEquals(terminate, "bye"); + client.stopConnection(); + } + + @Test + public void givenClient2_whenServerResponds_thenCorrect() { + EchoClient client = new EchoClient(); + client.startConnection("127.0.0.1", PORT); + String msg1 = client.sendMessage("hello"); + String msg2 = client.sendMessage("world"); + String terminate = client.sendMessage("."); + assertEquals(msg1, "hello"); + assertEquals(msg2, "world"); + assertEquals(terminate, "bye"); + client.stopConnection(); + } + + @Test + public void givenClient3_whenServerResponds_thenCorrect() { + EchoClient client = new EchoClient(); + client.startConnection("127.0.0.1", PORT); + String msg1 = client.sendMessage("hello"); + String msg2 = client.sendMessage("world"); + String terminate = client.sendMessage("."); + assertEquals(msg1, "hello"); + assertEquals(msg2, "world"); + assertEquals(terminate, "bye"); + client.stopConnection(); + } +} diff --git a/core-java-8/src/test/java/com/baeldung/threadpool/CoreThreadPoolTest.java b/core-java/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java similarity index 86% rename from core-java-8/src/test/java/com/baeldung/threadpool/CoreThreadPoolTest.java rename to core-java/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java index df336f4a93..a62ec99043 100644 --- a/core-java-8/src/test/java/com/baeldung/threadpool/CoreThreadPoolTest.java +++ b/core-java/src/test/java/com/baeldung/threadpool/CoreThreadPoolIntegrationTest.java @@ -1,13 +1,23 @@ package com.baeldung.threadpool; -import java.util.concurrent.*; +import static org.junit.Assert.assertEquals; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.junit.Test; -import static org.junit.Assert.assertEquals; - -public class CoreThreadPoolTest { +public class CoreThreadPoolIntegrationTest { @Test(timeout = 1000) public void whenCallingExecuteWithRunnable_thenRunnableIsExecuted() throws InterruptedException { @@ -132,9 +142,7 @@ public class CoreThreadPoolTest { @Test public void whenUsingForkJoinPool_thenSumOfTreeElementsIsCalculatedCorrectly() { - TreeNode tree = new TreeNode(5, - new TreeNode(3), new TreeNode(2, - new TreeNode(2), new TreeNode(8))); + TreeNode tree = new TreeNode(5, new TreeNode(3), new TreeNode(2, new TreeNode(2), new TreeNode(8))); ForkJoinPool forkJoinPool = ForkJoinPool.commonPool(); int sum = forkJoinPool.invoke(new CountingTask(tree)); @@ -142,5 +150,4 @@ public class CoreThreadPoolTest { assertEquals(20, sum); } - } diff --git a/core-java-8/src/test/java/com/baeldung/threadpool/GuavaThreadPoolTest.java b/core-java/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java similarity index 97% rename from core-java-8/src/test/java/com/baeldung/threadpool/GuavaThreadPoolTest.java rename to core-java/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java index 92e0f9a8cb..fd13a4fd78 100644 --- a/core-java-8/src/test/java/com/baeldung/threadpool/GuavaThreadPoolTest.java +++ b/core-java/src/test/java/com/baeldung/threadpool/GuavaThreadPoolIntegrationTest.java @@ -16,7 +16,7 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -public class GuavaThreadPoolTest { +public class GuavaThreadPoolIntegrationTest { @Test public void whenExecutingTaskWithDirectExecutor_thenTheTaskIsExecutedInTheCurrentThread() { diff --git a/core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeTest.java b/core-java/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java similarity index 85% rename from core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeTest.java rename to core-java/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java index da9027060e..3ad3deb548 100644 --- a/core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeTest.java +++ b/core-java/src/test/java/com/baeldung/util/CurrentDateTimeUnitTest.java @@ -1,41 +1,43 @@ -package com.baeldung.util; - -import org.junit.Test; - -import java.time.*; -import java.time.temporal.ChronoField; - -import static org.junit.Assert.assertEquals; - -public class CurrentDateTimeTest { - - private static final Clock clock = Clock.fixed(Instant.parse("2016-10-09T15:10:30.00Z"), ZoneId.of("UTC")); - - @Test - public void shouldReturnCurrentDate() { - - final LocalDate now = LocalDate.now(clock); - - assertEquals(9, now.get(ChronoField.DAY_OF_MONTH)); - assertEquals(10, now.get(ChronoField.MONTH_OF_YEAR)); - assertEquals(2016, now.get(ChronoField.YEAR)); - } - - @Test - public void shouldReturnCurrentTime() { - - final LocalTime now = LocalTime.now(clock); - - assertEquals(15, now.get(ChronoField.HOUR_OF_DAY)); - assertEquals(10, now.get(ChronoField.MINUTE_OF_HOUR)); - assertEquals(30, now.get(ChronoField.SECOND_OF_MINUTE)); - } - - @Test - public void shouldReturnCurrentTimestamp() { - - final Instant now = Instant.now(clock); - - assertEquals(clock.instant().getEpochSecond(), now.getEpochSecond()); - } -} +package com.baeldung.util; + +import static org.junit.Assert.assertEquals; + +import java.time.Clock; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalTime; +import java.time.ZoneId; +import java.time.temporal.ChronoField; + +import org.junit.Test; + +public class CurrentDateTimeUnitTest { + + private static final Clock clock = Clock.fixed(Instant.parse("2016-10-09T15:10:30.00Z"), ZoneId.of("UTC")); + + @Test + public void shouldReturnCurrentDate() { + final LocalDate now = LocalDate.now(clock); + + assertEquals(9, now.get(ChronoField.DAY_OF_MONTH)); + assertEquals(10, now.get(ChronoField.MONTH_OF_YEAR)); + assertEquals(2016, now.get(ChronoField.YEAR)); + } + + @Test + public void shouldReturnCurrentTime() { + final LocalTime now = LocalTime.now(clock); + + assertEquals(15, now.get(ChronoField.HOUR_OF_DAY)); + assertEquals(10, now.get(ChronoField.MINUTE_OF_HOUR)); + assertEquals(30, now.get(ChronoField.SECOND_OF_MINUTE)); + } + + @Test + public void shouldReturnCurrentTimestamp() { + final Instant now = Instant.now(clock); + + assertEquals(clock.instant().getEpochSecond(), now.getEpochSecond()); + } + +} diff --git a/core-java/src/test/java/org/baeldung/core/exceptions/FileNotFoundExceptionTest.java b/core-java/src/test/java/org/baeldung/core/exceptions/FileNotFoundExceptionUnitTest.java similarity index 87% rename from core-java/src/test/java/org/baeldung/core/exceptions/FileNotFoundExceptionTest.java rename to core-java/src/test/java/org/baeldung/core/exceptions/FileNotFoundExceptionUnitTest.java index 23be2200d3..e615e6a7d1 100644 --- a/core-java/src/test/java/org/baeldung/core/exceptions/FileNotFoundExceptionTest.java +++ b/core-java/src/test/java/org/baeldung/core/exceptions/FileNotFoundExceptionUnitTest.java @@ -1,13 +1,17 @@ package org.baeldung.core.exceptions; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; + import org.apache.log4j.Logger; import org.junit.Test; -import java.io.*; +public class FileNotFoundExceptionUnitTest { -public class FileNotFoundExceptionTest { - - private static final Logger LOG = Logger.getLogger(FileNotFoundExceptionTest.class); + private static final Logger LOG = Logger.getLogger(FileNotFoundExceptionUnitTest.class); private String fileName = Double.toString(Math.random()); @@ -42,7 +46,7 @@ public class FileNotFoundExceptionTest { LOG.error("Optional file " + fileName + " was not found.", ex); } } - + private void readFailingFile() throws IOException { BufferedReader rd = new BufferedReader(new FileReader(new File(fileName))); rd.readLine(); diff --git a/core-java/src/test/java/org/baeldung/equalshashcode/entities/ComplexClassTest.java b/core-java/src/test/java/org/baeldung/equalshashcode/entities/ComplexClassUnitTest.java similarity index 83% rename from core-java/src/test/java/org/baeldung/equalshashcode/entities/ComplexClassTest.java rename to core-java/src/test/java/org/baeldung/equalshashcode/entities/ComplexClassUnitTest.java index 75d96e5989..e4866d0078 100644 --- a/core-java/src/test/java/org/baeldung/equalshashcode/entities/ComplexClassTest.java +++ b/core-java/src/test/java/org/baeldung/equalshashcode/entities/ComplexClassUnitTest.java @@ -2,22 +2,22 @@ package org.baeldung.equalshashcode.entities; import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import org.junit.Assert; import org.junit.Test; -public class ComplexClassTest { +public class ComplexClassUnitTest { @Test public void testEqualsAndHashcodes() { - - ArrayList strArrayList = new ArrayList(); + List strArrayList = new ArrayList(); strArrayList.add("abc"); strArrayList.add("def"); ComplexClass aObject = new ComplexClass(strArrayList, new HashSet(45, 67)); ComplexClass bObject = new ComplexClass(strArrayList, new HashSet(45, 67)); - ArrayList strArrayListD = new ArrayList(); + List strArrayListD = new ArrayList(); strArrayListD.add("lmn"); strArrayListD.add("pqr"); ComplexClass dObject = new ComplexClass(strArrayListD, new HashSet(45, 67)); diff --git a/core-java/src/test/java/org/baeldung/equalshashcode/entities/PrimitiveClassTest.java b/core-java/src/test/java/org/baeldung/equalshashcode/entities/PrimitiveClassUnitTest.java similarity index 94% rename from core-java/src/test/java/org/baeldung/equalshashcode/entities/PrimitiveClassTest.java rename to core-java/src/test/java/org/baeldung/equalshashcode/entities/PrimitiveClassUnitTest.java index 16f25ae021..603b0bfbf9 100644 --- a/core-java/src/test/java/org/baeldung/equalshashcode/entities/PrimitiveClassTest.java +++ b/core-java/src/test/java/org/baeldung/equalshashcode/entities/PrimitiveClassUnitTest.java @@ -3,7 +3,7 @@ package org.baeldung.equalshashcode.entities; import org.junit.Assert; import org.junit.Test; -public class PrimitiveClassTest { +public class PrimitiveClassUnitTest { @Test public void testTwoEqualsObjects() { diff --git a/core-java/src/test/java/org/baeldung/equalshashcode/entities/SquareClassTest.java b/core-java/src/test/java/org/baeldung/equalshashcode/entities/SquareClassUnitTest.java similarity index 94% rename from core-java/src/test/java/org/baeldung/equalshashcode/entities/SquareClassTest.java rename to core-java/src/test/java/org/baeldung/equalshashcode/entities/SquareClassUnitTest.java index 52d024a696..0943436883 100644 --- a/core-java/src/test/java/org/baeldung/equalshashcode/entities/SquareClassTest.java +++ b/core-java/src/test/java/org/baeldung/equalshashcode/entities/SquareClassUnitTest.java @@ -5,11 +5,10 @@ import java.awt.Color; import org.junit.Assert; import org.junit.Test; -public class SquareClassTest { +public class SquareClassUnitTest { @Test public void testEqualsAndHashcodes() { - Square aObject = new Square(10, Color.BLUE); Square bObject = new Square(10, Color.BLUE); diff --git a/core-java/src/test/java/org/baeldung/java/JavaIoIntegrationTest.java b/core-java/src/test/java/org/baeldung/java/JavaIoUnitTest.java similarity index 97% rename from core-java/src/test/java/org/baeldung/java/JavaIoIntegrationTest.java rename to core-java/src/test/java/org/baeldung/java/JavaIoUnitTest.java index ff92410bc4..3ab8e1de91 100644 --- a/core-java/src/test/java/org/baeldung/java/JavaIoIntegrationTest.java +++ b/core-java/src/test/java/org/baeldung/java/JavaIoUnitTest.java @@ -7,6 +7,7 @@ import java.util.Scanner; import org.apache.commons.io.FileUtils; import org.apache.commons.io.LineIterator; +import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -14,7 +15,8 @@ import org.slf4j.LoggerFactory; import com.google.common.base.Charsets; import com.google.common.io.Files; -public class JavaIoIntegrationTest { +@Ignore("need large file for testing") +public class JavaIoUnitTest { protected final Logger logger = LoggerFactory.getLogger(getClass()); // tests - iterate lines in a file diff --git a/core-java/src/test/java/org/baeldung/java/JavaTimerUnitTest.java b/core-java/src/test/java/org/baeldung/java/JavaTimerLongRunningUnitTest.java similarity index 98% rename from core-java/src/test/java/org/baeldung/java/JavaTimerUnitTest.java rename to core-java/src/test/java/org/baeldung/java/JavaTimerLongRunningUnitTest.java index fcc74dbe64..3b126464ab 100644 --- a/core-java/src/test/java/org/baeldung/java/JavaTimerUnitTest.java +++ b/core-java/src/test/java/org/baeldung/java/JavaTimerLongRunningUnitTest.java @@ -9,7 +9,7 @@ import java.util.concurrent.TimeUnit; import org.junit.Test; -public class JavaTimerUnitTest { +public class JavaTimerLongRunningUnitTest { // tests @@ -90,7 +90,6 @@ public class JavaTimerUnitTest { @Override public void run() { System.out.println("Task performed on " + new Date()); - // TODO: stop the thread } }; final Timer timer = new Timer("Timer"); diff --git a/core-java/src/test/java/org/baeldung/java/arrays/ArraysJoinAndSplitJUnitTest.java b/core-java/src/test/java/org/baeldung/java/arrays/ArraysJoinAndSplitJUnitTest.java index ad1f2dc70c..885c3bcd6c 100644 --- a/core-java/src/test/java/org/baeldung/java/arrays/ArraysJoinAndSplitJUnitTest.java +++ b/core-java/src/test/java/org/baeldung/java/arrays/ArraysJoinAndSplitJUnitTest.java @@ -7,11 +7,11 @@ import org.junit.Test; public class ArraysJoinAndSplitJUnitTest { - private final String[] sauces = {"Marinara", "Olive Oil"}; - private final String[] cheeses = {"Mozzarella", "Feta", "Parmesan"}; - private final String[] vegetables = {"Olives", "Spinach", "Green Peppers"}; + private final String[] sauces = { "Marinara", "Olive Oil" }; + private final String[] cheeses = { "Mozzarella", "Feta", "Parmesan" }; + private final String[] vegetables = { "Olives", "Spinach", "Green Peppers" }; - private final String[] customers = {"Jay", "Harry", "Ronnie", "Gary", "Ross"}; + private final String[] customers = { "Jay", "Harry", "Ronnie", "Gary", "Ross" }; @Test public void givenThreeStringArrays_whenJoiningIntoOneStringArray_shouldSucceed() { @@ -25,12 +25,9 @@ public class ArraysJoinAndSplitJUnitTest { System.arraycopy(vegetables, 0, toppings, AddedSoFar, vegetables.length); - Assert.assertArrayEquals(toppings, - new String[]{"Marinara", "Olive Oil", "Mozzarella", "Feta", - "Parmesan", "Olives", "Spinach", "Green Peppers"}); + Assert.assertArrayEquals(toppings, new String[] { "Marinara", "Olive Oil", "Mozzarella", "Feta", "Parmesan", "Olives", "Spinach", "Green Peppers" }); } - @Test public void givenOneStringArray_whenSplittingInHalfTwoStringArrays_shouldSucceed() { int ordersHalved = (customers.length / 2) + (customers.length % 2); @@ -38,7 +35,7 @@ public class ArraysJoinAndSplitJUnitTest { String[] driverOne = Arrays.copyOf(customers, ordersHalved); String[] driverTwo = Arrays.copyOfRange(customers, ordersHalved, customers.length); - Assert.assertArrayEquals(driverOne, new String[]{"Jay", "Harry", "Ronnie"}); - Assert.assertArrayEquals(driverTwo, new String[]{"Gary", "Ross"}); + Assert.assertArrayEquals(driverOne, new String[] { "Jay", "Harry", "Ronnie" }); + Assert.assertArrayEquals(driverTwo, new String[] { "Gary", "Ross" }); } } diff --git a/core-java/src/test/java/org/baeldung/java/collections/ArrayListTest.java b/core-java/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java similarity index 85% rename from core-java/src/test/java/org/baeldung/java/collections/ArrayListTest.java rename to core-java/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java index 30b0111555..5d07628a96 100644 --- a/core-java/src/test/java/org/baeldung/java/collections/ArrayListTest.java +++ b/core-java/src/test/java/org/baeldung/java/collections/ArrayListUnitTest.java @@ -12,16 +12,13 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.core.IsNot.not; import static org.junit.Assert.*; -public class ArrayListTest { +public class ArrayListUnitTest { private List stringsToSearch; @Before public void setUp() { - List list = LongStream.range(0, 16) - .boxed() - .map(Long::toHexString) - .collect(toCollection(ArrayList::new)); + List list = LongStream.range(0, 16).boxed().map(Long::toHexString).collect(toCollection(ArrayList::new)); stringsToSearch = new ArrayList<>(list); stringsToSearch.addAll(list); } @@ -34,8 +31,7 @@ public class ArrayListTest { @Test public void givenCollection_whenProvideItToArrayListCtor_thenArrayListIsPopulatedWithItsElements() { - Collection numbers = - IntStream.range(0, 10).boxed().collect(toSet()); + Collection numbers = IntStream.range(0, 10).boxed().collect(toSet()); List list = new ArrayList<>(numbers); assertEquals(10, list.size()); @@ -56,8 +52,7 @@ public class ArrayListTest { @Test public void givenCollection_whenAddToArrayList_thenIsAdded() { List list = new ArrayList<>(Arrays.asList(1L, 2L, 3L)); - LongStream.range(4, 10).boxed() - .collect(collectingAndThen(toCollection(ArrayList::new), ys -> list.addAll(0, ys))); + LongStream.range(4, 10).boxed().collect(collectingAndThen(toCollection(ArrayList::new), ys -> list.addAll(0, ys))); assertThat(Arrays.asList(4L, 5L, 6L, 7L, 8L, 9L, 1L, 2L, 3L), equalTo(list)); } @@ -88,10 +83,7 @@ public class ArrayListTest { public void givenPredicate_whenIterateArrayList_thenFindAllElementsSatisfyingPredicate() { Set matchingStrings = new HashSet<>(Arrays.asList("a", "c", "9")); - List result = stringsToSearch - .stream() - .filter(matchingStrings::contains) - .collect(toCollection(ArrayList::new)); + List result = stringsToSearch.stream().filter(matchingStrings::contains).collect(toCollection(ArrayList::new)); assertEquals(6, result.size()); } @@ -131,8 +123,7 @@ public class ArrayListTest { @Test public void givenCondition_whenIterateArrayList_thenRemoveAllElementsSatisfyingCondition() { - Set matchingStrings - = Sets.newHashSet("a", "b", "c", "d", "e", "f"); + Set matchingStrings = Sets.newHashSet("a", "b", "c", "d", "e", "f"); Iterator it = stringsToSearch.iterator(); while (it.hasNext()) { diff --git a/core-java/src/test/java/org/baeldung/java/enums/PizzaTest.java b/core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java similarity index 60% rename from core-java/src/test/java/org/baeldung/java/enums/PizzaTest.java rename to core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java index a6814ee600..cc042eeca9 100644 --- a/core-java/src/test/java/org/baeldung/java/enums/PizzaTest.java +++ b/core-java/src/test/java/org/baeldung/java/enums/PizzaUnitTest.java @@ -1,21 +1,21 @@ package org.baeldung.java.enums; - -import com.baeldung.enums.Pizza; -import org.junit.Test; +import static junit.framework.TestCase.assertTrue; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; -import static junit.framework.TestCase.assertTrue; +import org.junit.Test; +import com.baeldung.enums.Pizza; + +public class PizzaUnitTest { -public class PizzaTest { @Test public void givenPizaOrder_whenReady_thenDeliverable() { Pizza testPz = new Pizza(); - testPz.setStatus(Pizza.PizzaStatus.READY); + testPz.setStatus(Pizza.PizzaStatusEnum.READY); assertTrue(testPz.isDeliverable()); } @@ -23,16 +23,16 @@ public class PizzaTest { public void givenPizaOrders_whenRetrievingUnDeliveredPzs_thenCorrectlyRetrieved() { List pzList = new ArrayList<>(); Pizza pz1 = new Pizza(); - pz1.setStatus(Pizza.PizzaStatus.DELIVERED); + pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED); Pizza pz2 = new Pizza(); - pz2.setStatus(Pizza.PizzaStatus.ORDERED); + pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED); Pizza pz3 = new Pizza(); - pz3.setStatus(Pizza.PizzaStatus.ORDERED); + pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED); Pizza pz4 = new Pizza(); - pz4.setStatus(Pizza.PizzaStatus.READY); + pz4.setStatus(Pizza.PizzaStatusEnum.READY); pzList.add(pz1); pzList.add(pz2); @@ -48,33 +48,34 @@ public class PizzaTest { List pzList = new ArrayList<>(); Pizza pz1 = new Pizza(); - pz1.setStatus(Pizza.PizzaStatus.DELIVERED); + pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED); Pizza pz2 = new Pizza(); - pz2.setStatus(Pizza.PizzaStatus.ORDERED); + pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED); Pizza pz3 = new Pizza(); - pz3.setStatus(Pizza.PizzaStatus.ORDERED); + pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED); Pizza pz4 = new Pizza(); - pz4.setStatus(Pizza.PizzaStatus.READY); + 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.PizzaStatus.DELIVERED).size() == 1); - assertTrue(map.get(Pizza.PizzaStatus.ORDERED).size() == 2); - assertTrue(map.get(Pizza.PizzaStatus.READY).size() == 1); + 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.PizzaStatus.READY); + pz.setStatus(Pizza.PizzaStatusEnum.READY); pz.deliver(); - assertTrue(pz.getStatus() == Pizza.PizzaStatus.DELIVERED); + assertTrue(pz.getStatus() == Pizza.PizzaStatusEnum.DELIVERED); } + } diff --git a/core-java/src/test/java/org/baeldung/java/io/JavaFileIntegrationTest.java b/core-java/src/test/java/org/baeldung/java/io/JavaFileUnitTest.java similarity index 86% rename from core-java/src/test/java/org/baeldung/java/io/JavaFileIntegrationTest.java rename to core-java/src/test/java/org/baeldung/java/io/JavaFileUnitTest.java index 24213ba869..4b56a97325 100644 --- a/core-java/src/test/java/org/baeldung/java/io/JavaFileIntegrationTest.java +++ b/core-java/src/test/java/org/baeldung/java/io/JavaFileUnitTest.java @@ -13,7 +13,7 @@ import java.nio.file.Paths; import org.apache.commons.io.FileUtils; import org.junit.Test; -public class JavaFileIntegrationTest { +public class JavaFileUnitTest { // create a file @@ -46,7 +46,7 @@ public class JavaFileIntegrationTest { @Test public final void givenUsingJDK6_whenMovingFile_thenCorrect() throws IOException { final File fileToMove = new File("src/test/resources/toMoveFile_jdk6.txt"); - fileToMove.exists(); + fileToMove.createNewFile();// .exists(); final File destDir = new File("src/test/resources/"); destDir.mkdir(); @@ -68,7 +68,7 @@ public class JavaFileIntegrationTest { public final void givenUsingGuava_whenMovingFile_thenCorrect() throws IOException { final File fileToMove = new File("src/test/resources/fileToMove.txt"); fileToMove.createNewFile(); - final File destDir = new File("src/test/resources/"); + final File destDir = new File("src/main/resources/"); final File targetFile = new File(destDir, fileToMove.getName()); com.google.common.io.Files.createParentDirs(targetFile); com.google.common.io.Files.move(fileToMove, targetFile); @@ -76,13 +76,14 @@ public class JavaFileIntegrationTest { @Test public final void givenUsingApache_whenMovingFile_thenCorrect() throws IOException { - FileUtils.moveFile(FileUtils.getFile("src/test/resources/fileToMove.txt"), FileUtils.getFile("src/test/resources/fileMoved.txt")); + FileUtils.touch(new File("src/test/resources/fileToMove_apache.txt")); + FileUtils.moveFile(FileUtils.getFile("src/test/resources/fileToMove_apache.txt"), FileUtils.getFile("src/test/resources/fileMoved_apache2.txt")); } @Test public final void givenUsingApache_whenMovingFileApproach2_thenCorrect() throws IOException { - FileUtils.touch(new File("src/test/resources/fileToMove.txt")); - FileUtils.moveFileToDirectory(FileUtils.getFile("src/test/resources/fileToMove.txt"), FileUtils.getFile("src/main/resources/"), true); + FileUtils.touch(new File("src/test/resources/fileToMove_apache.txt")); + FileUtils.moveFileToDirectory(FileUtils.getFile("src/test/resources/fileToMove_apache.txt"), FileUtils.getFile("src/main/resources/"), true); } // delete a file @@ -99,7 +100,7 @@ public class JavaFileIntegrationTest { @Test public final void givenUsingJDK7nio2_whenDeletingAFile_thenCorrect() throws IOException { - // Files.createFile(Paths.get("src/test/resources/fileToDelete_jdk7.txt")); + Files.createFile(Paths.get("src/test/resources/fileToDelete_jdk7.txt")); final Path fileToDeletePath = Paths.get("src/test/resources/fileToDelete_jdk7.txt"); Files.delete(fileToDeletePath); @@ -117,7 +118,7 @@ public class JavaFileIntegrationTest { @Test public void givenUsingCommonsIo_whenDeletingAFileV2_thenCorrect() throws IOException { - // FileUtils.touch(new File("src/test/resources/fileToDelete.txt")); + FileUtils.touch(new File("src/test/resources/fileToDelete.txt")); FileUtils.forceDelete(FileUtils.getFile("src/test/resources/fileToDelete.txt")); } diff --git a/core-java/src/test/java/org/baeldung/java/io/JavaReadFromFileTest.java b/core-java/src/test/java/org/baeldung/java/io/JavaReadFromFileUnitTest.java similarity index 97% rename from core-java/src/test/java/org/baeldung/java/io/JavaReadFromFileTest.java rename to core-java/src/test/java/org/baeldung/java/io/JavaReadFromFileUnitTest.java index e679b82d3f..b1aa58424d 100644 --- a/core-java/src/test/java/org/baeldung/java/io/JavaReadFromFileTest.java +++ b/core-java/src/test/java/org/baeldung/java/io/JavaReadFromFileUnitTest.java @@ -23,7 +23,7 @@ import java.util.Scanner; import org.junit.Test; -public class JavaReadFromFileTest { +public class JavaReadFromFileUnitTest { @Test public void whenReadWithBufferedReader_thenCorrect() throws IOException { @@ -115,7 +115,7 @@ public class JavaReadFromFileTest { final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("src/test/resources/test_read7.in"), "UTF-8")); final String currentLine = reader.readLine(); reader.close(); - + System.out.println(currentLine); assertEquals(expected_value, currentLine); } @@ -143,8 +143,9 @@ public class JavaReadFromFileTest { final FileChannel channel = reader.getChannel(); int bufferSize = 1024; - if (bufferSize > channel.size()) + if (bufferSize > channel.size()) { bufferSize = (int) channel.size(); + } final ByteBuffer buff = ByteBuffer.allocate(bufferSize); channel.read(buff); buff.flip(); diff --git a/core-java/src/test/java/org/baeldung/java/io/JavaScannerTest.java b/core-java/src/test/java/org/baeldung/java/io/JavaScannerUnitTest.java similarity index 99% rename from core-java/src/test/java/org/baeldung/java/io/JavaScannerTest.java rename to core-java/src/test/java/org/baeldung/java/io/JavaScannerUnitTest.java index 61f0f52316..5af286dbca 100644 --- a/core-java/src/test/java/org/baeldung/java/io/JavaScannerTest.java +++ b/core-java/src/test/java/org/baeldung/java/io/JavaScannerUnitTest.java @@ -15,7 +15,7 @@ import java.util.Scanner; import org.junit.Test; -public class JavaScannerTest { +public class JavaScannerUnitTest { @Test public void whenReadFileWithScanner_thenCorrect() throws IOException { diff --git a/core-java/src/test/java/org/baeldung/java/io/JavaWriteToFileTest.java b/core-java/src/test/java/org/baeldung/java/io/JavaWriteToFileUnitTest.java similarity index 99% rename from core-java/src/test/java/org/baeldung/java/io/JavaWriteToFileTest.java rename to core-java/src/test/java/org/baeldung/java/io/JavaWriteToFileUnitTest.java index 93cfffa39d..9ff95c4e16 100644 --- a/core-java/src/test/java/org/baeldung/java/io/JavaWriteToFileTest.java +++ b/core-java/src/test/java/org/baeldung/java/io/JavaWriteToFileUnitTest.java @@ -26,7 +26,7 @@ import java.nio.file.Paths; import org.junit.Test; -public class JavaWriteToFileTest { +public class JavaWriteToFileUnitTest { private String fileName = "src/test/resources/test_write.txt"; private String fileName1 = "src/test/resources/test_write_1.txt"; diff --git a/core-java/src/test/java/org/baeldung/java/lists/ListAssertJTest.java b/core-java/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java similarity index 83% rename from core-java/src/test/java/org/baeldung/java/lists/ListAssertJTest.java rename to core-java/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java index b8926946a9..c609f5badb 100644 --- a/core-java/src/test/java/org/baeldung/java/lists/ListAssertJTest.java +++ b/core-java/src/test/java/org/baeldung/java/lists/ListAssertJUnitTest.java @@ -7,7 +7,7 @@ import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -public class ListAssertJTest { +public class ListAssertJUnitTest { private final List list1 = Arrays.asList("1", "2", "3", "4"); private final List list2 = Arrays.asList("1", "2", "3", "4"); @@ -15,9 +15,7 @@ public class ListAssertJTest { @Test public void whenTestingForEquality_ShouldBeEqual() throws Exception { - assertThat(list1) - .isEqualTo(list2) - .isNotEqualTo(list3); + assertThat(list1).isEqualTo(list2).isNotEqualTo(list3); assertThat(list1.equals(list2)).isTrue(); assertThat(list1.equals(list3)).isFalse(); diff --git a/core-java/src/test/java/org/baeldung/java/lists/ListTestNGTest.java b/core-java/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java similarity index 94% rename from core-java/src/test/java/org/baeldung/java/lists/ListTestNGTest.java rename to core-java/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java index fa80d0e224..b7c2bd7272 100644 --- a/core-java/src/test/java/org/baeldung/java/lists/ListTestNGTest.java +++ b/core-java/src/test/java/org/baeldung/java/lists/ListTestNgUnitTest.java @@ -6,7 +6,7 @@ import org.testng.annotations.Test; import java.util.Arrays; import java.util.List; -public class ListTestNGTest { +public class ListTestNgUnitTest { private final List list1 = Arrays.asList("1", "2", "3", "4"); private final List list2 = Arrays.asList("1", "2", "3", "4"); diff --git a/core-java/src/test/java/org/baeldung/java/md5/JavaMD5Test.java b/core-java/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java similarity index 77% rename from core-java/src/test/java/org/baeldung/java/md5/JavaMD5Test.java rename to core-java/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java index 83f1fb33b6..55e71470c8 100644 --- a/core-java/src/test/java/org/baeldung/java/md5/JavaMD5Test.java +++ b/core-java/src/test/java/org/baeldung/java/md5/JavaMD5UnitTest.java @@ -1,9 +1,10 @@ package org.baeldung.java.md5; -import static org.junit.Assert.*; +import static org.assertj.core.api.Assertions.assertThat; +import java.io.File; +import java.io.IOException; import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -11,80 +12,64 @@ import java.security.NoSuchAlgorithmException; import javax.xml.bind.DatatypeConverter; import org.apache.commons.codec.digest.DigestUtils; -import org.junit.Before; import org.junit.Test; import com.google.common.hash.HashCode; import com.google.common.hash.Hashing; -import java.io.File; -import java.io.IOException; -import java.nio.*; -import static org.assertj.core.api.Assertions.assertThat; +public class JavaMD5UnitTest { - -public class JavaMD5Test { - - String filename = "src/test/resources/test_md5.txt"; String checksum = "5EB63BBBE01EEED093CB22BB8F5ACDC3"; - + String hash = "35454B055CC325EA1AF2126E27707052"; String password = "ILoveJava"; - - - + @Test public void givenPassword_whenHashing_thenVerifying() throws NoSuchAlgorithmException { String hash = "35454B055CC325EA1AF2126E27707052"; String password = "ILoveJava"; - + MessageDigest md = MessageDigest.getInstance("MD5"); md.update(password.getBytes()); byte[] digest = md.digest(); String myHash = DatatypeConverter.printHexBinary(digest).toUpperCase(); - + assertThat(myHash.equals(hash)).isTrue(); } - + @Test public void givenFile_generatingChecksum_thenVerifying() throws NoSuchAlgorithmException, IOException { String filename = "src/test/resources/test_md5.txt"; String checksum = "5EB63BBBE01EEED093CB22BB8F5ACDC3"; - + MessageDigest md = MessageDigest.getInstance("MD5"); md.update(Files.readAllBytes(Paths.get(filename))); byte[] digest = md.digest(); - String myChecksum = DatatypeConverter - .printHexBinary(digest).toUpperCase(); - + String myChecksum = DatatypeConverter.printHexBinary(digest).toUpperCase(); + assertThat(myChecksum.equals(checksum)).isTrue(); } - + @Test - public void givenPassword_whenHashingUsingCommons_thenVerifying() { + public void givenPassword_whenHashingUsingCommons_thenVerifying() { String hash = "35454B055CC325EA1AF2126E27707052"; String password = "ILoveJava"; - String md5Hex = DigestUtils - .md5Hex(password).toUpperCase(); - + String md5Hex = DigestUtils.md5Hex(password).toUpperCase(); + assertThat(md5Hex.equals(hash)).isTrue(); } - - + @Test public void givenFile_whenChecksumUsingGuava_thenVerifying() throws IOException { String filename = "src/test/resources/test_md5.txt"; String checksum = "5EB63BBBE01EEED093CB22BB8F5ACDC3"; - - HashCode hash = com.google.common.io.Files - .hash(new File(filename), Hashing.md5()); - String myChecksum = hash.toString() - .toUpperCase(); - + + HashCode hash = com.google.common.io.Files.hash(new File(filename), Hashing.md5()); + String myChecksum = hash.toString().toUpperCase(); + assertThat(myChecksum.equals(checksum)).isTrue(); } - } diff --git a/core-java/src/test/java/org/baeldung/java/sandbox/SandboxJavaTest.java b/core-java/src/test/java/org/baeldung/java/sandbox/SandboxJavaManualTest.java similarity index 98% rename from core-java/src/test/java/org/baeldung/java/sandbox/SandboxJavaTest.java rename to core-java/src/test/java/org/baeldung/java/sandbox/SandboxJavaManualTest.java index 5127ccb10c..bb849d6a13 100644 --- a/core-java/src/test/java/org/baeldung/java/sandbox/SandboxJavaTest.java +++ b/core-java/src/test/java/org/baeldung/java/sandbox/SandboxJavaManualTest.java @@ -6,7 +6,7 @@ import java.util.TimerTask; import org.junit.Test; -public class SandboxJavaTest { +public class SandboxJavaManualTest { @Test public void givenUsingTimer_whenSchedulingTimerTaskOnce_thenCorrect() throws InterruptedException { diff --git a/core-java/src/test/resources/testFolder/sample_file_1.in b/core-java/src/test/resources/testFolder/sample_file_1.in new file mode 100644 index 0000000000..70c379b63f --- /dev/null +++ b/core-java/src/test/resources/testFolder/sample_file_1.in @@ -0,0 +1 @@ +Hello world \ No newline at end of file diff --git a/core-java/src/test/resources/testFolder/sample_file_2.in b/core-java/src/test/resources/testFolder/sample_file_2.in new file mode 100644 index 0000000000..93b493a513 --- /dev/null +++ b/core-java/src/test/resources/testFolder/sample_file_2.in @@ -0,0 +1 @@ +Hello world ! \ No newline at end of file diff --git a/couchbase-sdk/pom.xml b/couchbase-sdk/pom.xml index 4c277f4c85..b7b3d1788f 100644 --- a/couchbase-sdk/pom.xml +++ b/couchbase-sdk/pom.xml @@ -85,6 +85,17 @@ 1.7 + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/*IntegrationTest.java + **/*LiveTest.java + + + @@ -97,6 +108,7 @@ 1.7.12 4.11 3.4 + 2.19.1 diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceTest.java b/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTest.java similarity index 98% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceTest.java rename to couchbase-sdk/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTest.java index afc5bbd53b..5907a4cc63 100644 --- a/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceTest.java +++ b/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/person/PersonCrudServiceIntegrationTest.java @@ -21,7 +21,7 @@ import com.baeldung.couchbase.async.service.BucketService; import com.couchbase.client.java.Bucket; import com.couchbase.client.java.document.JsonDocument; -public class PersonCrudServiceTest extends AsyncIntegrationTest { +public class PersonCrudServiceIntegrationTest extends AsyncIntegrationTest { @Autowired private PersonCrudService personService; diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceTest.java b/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceIntegrationTest.java similarity index 94% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceTest.java rename to couchbase-sdk/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceIntegrationTest.java index 8ecb51a4b9..08e3728c77 100644 --- a/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceTest.java +++ b/couchbase-sdk/src/test/java/com/baeldung/couchbase/async/service/ClusterServiceIntegrationTest.java @@ -18,7 +18,7 @@ import com.couchbase.client.java.Bucket; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { AsyncIntegrationTestConfig.class }) @TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class }) -public class ClusterServiceTest extends AsyncIntegrationTest { +public class ClusterServiceIntegrationTest extends AsyncIntegrationTest { @Autowired private ClusterService couchbaseService; diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceTest.java b/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceIntegrationTest.java similarity index 97% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceTest.java rename to couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceIntegrationTest.java index 601b261f6e..b3fadae6ca 100644 --- a/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceTest.java +++ b/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/person/PersonCrudServiceIntegrationTest.java @@ -10,7 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; import com.baeldung.couchbase.spring.IntegrationTest; -public class PersonCrudServiceTest extends IntegrationTest { +public class PersonCrudServiceIntegrationTest extends IntegrationTest { private static final String CLARK_KENT = "Clark Kent"; private static final String SMALLVILLE = "Smallville"; diff --git a/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceTest.java b/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceIntegrationTest.java similarity index 94% rename from couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceTest.java rename to couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceIntegrationTest.java index d1968e1c04..f3ee4585a3 100644 --- a/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceTest.java +++ b/couchbase-sdk/src/test/java/com/baeldung/couchbase/spring/service/ClusterServiceIntegrationTest.java @@ -17,7 +17,7 @@ import com.couchbase.client.java.Bucket; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { IntegrationTestConfig.class }) @TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class }) -public class ClusterServiceTest extends IntegrationTest { +public class ClusterServiceIntegrationTest extends IntegrationTest { @Autowired private ClusterService couchbaseService; diff --git a/enterprise-patterns/intercepting-filter-pattern/src/main/java/com/baeldung/enterprise/patterns/front/controller/filters/AuditFilter.java b/enterprise-patterns/intercepting-filter-pattern/src/main/java/com/baeldung/enterprise/patterns/front/controller/filters/AuditFilter.java new file mode 100644 index 0000000000..d24c0a94b3 --- /dev/null +++ b/enterprise-patterns/intercepting-filter-pattern/src/main/java/com/baeldung/enterprise/patterns/front/controller/filters/AuditFilter.java @@ -0,0 +1,25 @@ +package com.baeldung.enterprise.patterns.front.controller.filters; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +public class AuditFilter extends BaseFilter { + @Override + public void doFilter( + ServletRequest request, + ServletResponse response, + FilterChain chain + ) throws IOException, ServletException { + HttpServletRequest httpServletRequest = (HttpServletRequest) request; + HttpSession session = httpServletRequest.getSession(false); + if (session != null && session.getAttribute("username") != null) { + request.setAttribute("username", session.getAttribute("username")); + } + chain.doFilter(request, response); + } +} diff --git a/enterprise-patterns/intercepting-filter-pattern/src/main/java/com/baeldung/enterprise/patterns/front/controller/filters/VisitorCounterFilter.java b/enterprise-patterns/intercepting-filter-pattern/src/main/java/com/baeldung/enterprise/patterns/front/controller/filters/VisitorCounterFilter.java new file mode 100644 index 0000000000..0ae7cd73fd --- /dev/null +++ b/enterprise-patterns/intercepting-filter-pattern/src/main/java/com/baeldung/enterprise/patterns/front/controller/filters/VisitorCounterFilter.java @@ -0,0 +1,23 @@ +package com.baeldung.enterprise.patterns.front.controller.filters; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebFilter; +import java.io.IOException; + +@WebFilter(servletNames = "front-controller") +public class VisitorCounterFilter extends BaseFilter { + private int counter; + + @Override + public void doFilter( + ServletRequest request, + ServletResponse response, + FilterChain chain + ) throws IOException, ServletException { + request.setAttribute("counter", ++counter); + chain.doFilter(request, response); + } +} diff --git a/gson/src/main/java/org/baeldung/gson/entities/ActorGson.java b/gson/src/main/java/org/baeldung/gson/entities/ActorGson.java index 5bbf776705..92468683bf 100644 --- a/gson/src/main/java/org/baeldung/gson/entities/ActorGson.java +++ b/gson/src/main/java/org/baeldung/gson/entities/ActorGson.java @@ -1,7 +1,10 @@ package org.baeldung.gson.entities; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.TimeZone; public class ActorGson { @@ -18,7 +21,7 @@ public class ActorGson { @Override public String toString() { - return "ActorGson [imdbId=" + imdbId + ", dateOfBirth=" + dateOfBirth + ", filmography=" + filmography + "]"; + return "ActorGson [imdbId=" + imdbId + ", dateOfBirth=" + formatDateOfBirth() + ", filmography=" + filmography + "]"; } public String getImdbId() { @@ -45,5 +48,10 @@ public class ActorGson { this.filmography = filmography; } + private String formatDateOfBirth() { + final DateFormat formatter = new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy"); + formatter.setTimeZone(TimeZone.getTimeZone("GMT")); + return formatter.format(dateOfBirth); + } } \ No newline at end of file diff --git a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java b/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java index 70a03500d5..016e3ba1e2 100644 --- a/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java +++ b/gson/src/main/java/org/baeldung/gson/serialization/ActorGsonDeserializer.java @@ -1,27 +1,33 @@ package org.baeldung.gson.serialization; -import com.google.gson.*; -import org.baeldung.gson.entities.ActorGson; - import java.lang.reflect.Type; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import org.baeldung.gson.entities.ActorGson; + +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; + public class ActorGsonDeserializer implements JsonDeserializer { - private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); + private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); @Override public ActorGson deserialize(JsonElement json, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { - JsonObject jsonObject = json.getAsJsonObject(); + final JsonObject jsonObject = json.getAsJsonObject(); - JsonElement jsonImdbId = jsonObject.get("imdbId"); - JsonElement jsonDateOfBirth = jsonObject.get("dateOfBirth"); - JsonArray jsonFilmography = jsonObject.getAsJsonArray("filmography"); + final JsonElement jsonImdbId = jsonObject.get("imdbId"); + final JsonElement jsonDateOfBirth = jsonObject.get("dateOfBirth"); + final JsonArray jsonFilmography = jsonObject.getAsJsonArray("filmography"); - ArrayList filmList = new ArrayList(); + final ArrayList filmList = new ArrayList(); if (jsonFilmography != null) { for (int i = 0; i < jsonFilmography.size(); i++) { filmList.add(jsonFilmography.get(i).getAsString()); @@ -31,7 +37,7 @@ public class ActorGsonDeserializer implements JsonDeserializer { ActorGson actorGson = null; try { actorGson = new ActorGson(jsonImdbId.getAsString(), sdf.parse(jsonDateOfBirth.getAsString()), filmList); - } catch (ParseException e) { + } catch (final ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeTest.java b/gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeTest.java index d87f0f4bd9..3844c55cd8 100644 --- a/gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeTest.java +++ b/gson/src/test/java/org/baeldung/gson/deserialization/GsonDeserializeTest.java @@ -1,38 +1,40 @@ package org.baeldung.gson.deserialization; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import java.text.ParseException; + import org.baeldung.gson.entities.ActorGson; import org.baeldung.gson.entities.Movie; import org.baeldung.gson.serialization.ActorGsonDeserializer; import org.junit.Assert; import org.junit.Test; -import java.text.ParseException; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; public class GsonDeserializeTest { - @Test public void whenSimpleDeserialize_thenCorrect() throws ParseException { - String jsonInput = "{\"imdbId\":\"tt0472043\",\"actors\":" + "[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"1982-09-21T12:00:00+01:00\",\"filmography\":" + "[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; + final String jsonInput = "{\"imdbId\":\"tt0472043\",\"actors\":" + "[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"Tue Sep 21 11:00:00 GMT 1982\",\"filmography\":" + "[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; - Movie outputMovie = new Gson().fromJson(jsonInput, Movie.class); + final Gson gson = new GsonBuilder().setDateFormat("EEE MMM dd hh:mm:ss zzz yyyy").create(); - String expectedOutput = "Movie [imdbId=tt0472043, director=null, actors=[ActorGson [imdbId=nm2199632, dateOfBirth=Tue Sep 21 04:00:00 PDT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]]"; + final Movie outputMovie = gson.fromJson(jsonInput, Movie.class); + + final String expectedOutput = "Movie [imdbId=tt0472043, director=null, actors=[ActorGson [imdbId=nm2199632, dateOfBirth=Tue Sep 21 11:00:00 GMT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]]"; Assert.assertEquals(outputMovie.toString(), expectedOutput); } @Test public void whenCustomDeserialize_thenCorrect() throws ParseException { - String jsonInput = "{\"imdbId\":\"tt0472043\",\"actors\":" + "[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"1982-09-21T12:00:00+01:00\",\"filmography\":" + "[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; + final String jsonInput = "{\"imdbId\":\"tt0472043\",\"actors\":" + "[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"1982-09-21T12:00:00+01:00\",\"filmography\":" + "[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; - Gson gson = new GsonBuilder().registerTypeAdapter(ActorGson.class, new ActorGsonDeserializer()).create(); + final Gson gson = new GsonBuilder().registerTypeAdapter(ActorGson.class, new ActorGsonDeserializer()).create(); - Movie outputMovie = gson.fromJson(jsonInput, Movie.class); + final Movie outputMovie = gson.fromJson(jsonInput, Movie.class); - String expectedOutput = "Movie [imdbId=tt0472043, director=null, actors=[ActorGson [imdbId=nm2199632, dateOfBirth=Tue Sep 21 12:00:00 PDT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]]"; + final String expectedOutput = "Movie [imdbId=tt0472043, director=null, actors=[ActorGson [imdbId=nm2199632, dateOfBirth=Tue Sep 21 11:00:00 GMT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]]"; Assert.assertEquals(outputMovie.toString(), expectedOutput); } } diff --git a/httpclient/pom.xml b/httpclient/pom.xml index 66b2076852..cac363c414 100644 --- a/httpclient/pom.xml +++ b/httpclient/pom.xml @@ -141,12 +141,52 @@ org.apache.maven.plugins maven-surefire-plugin ${maven-surefire-plugin.version} + + + **/*LiveTest.java + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*ManualTest.java + + + **/*LiveTest.java + + + + + + + json + + + + + + + + 4.3.11.Final diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java index bfe1e68ebe..b1399dcab8 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java @@ -51,7 +51,7 @@ public class HttpAsyncClientLiveTest { @Test public void whenUseHttpAsyncClient_thenCorrect() throws InterruptedException, ExecutionException, IOException { final CloseableHttpAsyncClient client = HttpAsyncClients.createDefault(); - // client.start(); + client.start(); final HttpGet request = new HttpGet(HOST); final Future future = client.execute(request, null); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java similarity index 98% rename from httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartTest.java rename to httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java index 371657af62..6fad126537 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java @@ -28,15 +28,17 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; -public class HttpClientMultipartTest { +@Ignore("Server is not available") +public class HttpClientMultipartLiveTest { private static final String SERVER = "http://echo.200please.com"; private static final String TEXTFILENAME = "temp.txt"; private static final String IMAGEFILENAME = "image.jpg"; private static final String ZIPFILENAME = "zipFile.zip"; - private static final Logger LOGGER = Logger.getLogger("org.baeldung.httpclient.HttpClientMultipartTest"); + private static final Logger LOGGER = Logger.getLogger("org.baeldung.httpclient.HttpClientMultipartLiveTest"); private CloseableHttpClient client; private HttpPost post; private BufferedReader rd; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingLiveTest.java similarity index 98% rename from httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingTest.java rename to httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingLiveTest.java index 7b75cdfc19..ada5667f0b 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingLiveTest.java @@ -29,7 +29,10 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.junit.Test; -public class HttpClientPostingTest { +/* + * NOTE : Need module spring-rest to be running + */ +public class HttpClientPostingLiveTest { private static final String SAMPLE_URL = "http://localhost:8080/spring-rest/users"; private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://browserspy.dk/password-ok.php"; private static final String DEFAULT_USER = "test"; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpsClientSslLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpsClientSslLiveTest.java index 66b4f5cff4..fb272b0a33 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpsClientSslLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpsClientSslLiveTest.java @@ -1,28 +1,35 @@ package org.baeldung.httpclient; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.conn.ClientConnectionManager; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.*; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.impl.conn.PoolingClientConnectionManager; -import org.junit.Test; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLException; import java.io.IOException; import java.security.GeneralSecurityException; import java.security.KeyManagementException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.junit.Assert.assertThat; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLException; + +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.SSLContextBuilder; +import org.apache.http.conn.ssl.SSLContexts; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.conn.ssl.TrustSelfSignedStrategy; +import org.apache.http.conn.ssl.TrustStrategy; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingClientConnectionManager; +import org.junit.Test; /** * This test requires a localhost server over HTTPS
@@ -96,7 +103,7 @@ public class HttpsClientSslLiveTest { @Test public final void givenIgnoringCertificates_whenHttpsUrlIsConsumed_thenCorrect() throws IOException { - TrustStrategy acceptingTrustStrategy = (certificate, authType) -> true; + final TrustStrategy acceptingTrustStrategy = (certificate, authType) -> true; SSLContext sslContext = null; try { @@ -106,8 +113,8 @@ public class HttpsClientSslLiveTest { e.printStackTrace(); } - CloseableHttpClient client = HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier(new NoopHostnameVerifier()).build(); - final HttpGet httpGet = new HttpGet("https://sesar3.geoinfogeochem.org/sample/igsn/ODP000002"); + final CloseableHttpClient client = HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier(new NoopHostnameVerifier()).build(); + final HttpGet httpGet = new HttpGet(HOST_WITH_SSL); httpGet.setHeader("Accept", "application/xml"); final HttpResponse response = client.execute(httpGet); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java index 22b32e7ef5..40216a70a5 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java @@ -1,5 +1,8 @@ package org.baeldung.httpclient.base; +import java.io.IOException; +import java.io.InputStream; + import org.apache.http.HttpEntity; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; @@ -11,9 +14,9 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.junit.Test; -import java.io.IOException; -import java.io.InputStream; - +/* + * NOTE : Need module spring-security-rest-basic-auth to be running + */ public class HttpClientSandboxLiveTest { @Test @@ -22,10 +25,10 @@ public class HttpClientSandboxLiveTest { final AuthScope authscp = new AuthScope("localhost", 8080); credentialsProvider.setCredentials(authscp, new UsernamePasswordCredentials("user1", "user1Pass")); - CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).build(); + final CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).build(); final HttpGet httpGet = new HttpGet("http://localhost:8080/spring-security-rest-basic-auth/api/foos/1"); - CloseableHttpResponse response = client.execute(httpGet); + final CloseableHttpResponse response = client.execute(httpGet); System.out.println(response.getStatusLine()); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java index 495d46e91f..e98dd4d14f 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java @@ -30,6 +30,10 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +/* + * NOTE : Need module spring-security-rest-basic-auth to be running + */ + public class HttpClientAuthLiveTest { private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://localhost:8081/spring-security-rest-basic-auth/api/foos/1"; diff --git a/jackson/src/main/java/org/baeldung/jackson/entities/ActorJackson.java b/jackson/src/main/java/org/baeldung/jackson/entities/ActorJackson.java index 68cd6117d6..375b2204ff 100644 --- a/jackson/src/main/java/org/baeldung/jackson/entities/ActorJackson.java +++ b/jackson/src/main/java/org/baeldung/jackson/entities/ActorJackson.java @@ -1,7 +1,10 @@ package org.baeldung.jackson.entities; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.TimeZone; public class ActorJackson { @@ -22,7 +25,7 @@ public class ActorJackson { @Override public String toString() { - return "ActorJackson [imdbId=" + imdbId + ", dateOfBirth=" + dateOfBirth + ", filmography=" + filmography + "]"; + return "ActorJackson [imdbId=" + imdbId + ", dateOfBirth=" + formatDateOfBirth() + ", filmography=" + filmography + "]"; } public String getImdbId() { @@ -49,4 +52,9 @@ public class ActorJackson { this.filmography = filmography; } + private String formatDateOfBirth() { + final DateFormat formatter = new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy"); + formatter.setTimeZone(TimeZone.getTimeZone("GMT")); + return formatter.format(dateOfBirth); + } } diff --git a/jackson/src/test/java/org/baeldung/jackson/deserialization/JacksonDeserializeTest.java b/jackson/src/test/java/org/baeldung/jackson/deserialization/JacksonDeserializeTest.java index 71d5ad3d81..503b6eb99b 100644 --- a/jackson/src/test/java/org/baeldung/jackson/deserialization/JacksonDeserializeTest.java +++ b/jackson/src/test/java/org/baeldung/jackson/deserialization/JacksonDeserializeTest.java @@ -1,39 +1,40 @@ package org.baeldung.jackson.deserialization; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.baeldung.jackson.entities.Movie; -import org.junit.Assert; -import org.junit.Test; - import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; +import org.baeldung.jackson.entities.Movie; +import org.junit.Assert; +import org.junit.Test; + +import com.fasterxml.jackson.databind.ObjectMapper; + public class JacksonDeserializeTest { @Test public void whenSimpleDeserialize_thenCorrect() throws IOException { - String jsonInput = "{\"imdbId\":\"tt0472043\",\"actors\":[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"1982-09-21T12:00:00+01:00\",\"filmography\":[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; - ObjectMapper mapper = new ObjectMapper(); - Movie movie = mapper.readValue(jsonInput, Movie.class); + final String jsonInput = "{\"imdbId\":\"tt0472043\",\"actors\":[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"1982-09-21T12:00:00+01:00\",\"filmography\":[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; + final ObjectMapper mapper = new ObjectMapper(); + final Movie movie = mapper.readValue(jsonInput, Movie.class); - String expectedOutput = "Movie [imdbId=tt0472043, director=null, actors=[ActorJackson [imdbId=nm2199632, dateOfBirth=Tue Sep 21 04:00:00 PDT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]]"; + final String expectedOutput = "Movie [imdbId=tt0472043, director=null, actors=[ActorJackson [imdbId=nm2199632, dateOfBirth=Tue Sep 21 11:00:00 GMT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]]"; Assert.assertEquals(movie.toString(), expectedOutput); } @Test public void whenCustomDeserialize_thenCorrect() throws IOException { - String jsonInput = "{\"imdbId\":\"tt0472043\",\"director\":\"Mel Gibson\",\"actors\":[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"1982-09-21T12:00:00+01:00\",\"filmography\":[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; + final String jsonInput = "{\"imdbId\":\"tt0472043\",\"director\":\"Mel Gibson\",\"actors\":[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"1982-09-21T12:00:00+01:00\",\"filmography\":[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; - ObjectMapper mapper = new ObjectMapper(); - final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); + final ObjectMapper mapper = new ObjectMapper(); + final DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"); mapper.setDateFormat(df); - Movie movie = mapper.readValue(jsonInput, Movie.class); + final Movie movie = mapper.readValue(jsonInput, Movie.class); - String expectedOutput = "Movie [imdbId=tt0472043, director=Mel Gibson, actors=[ActorJackson [imdbId=nm2199632, dateOfBirth=Tue Sep 21 12:00:00 PDT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]]"; + final String expectedOutput = "Movie [imdbId=tt0472043, director=Mel Gibson, actors=[ActorJackson [imdbId=nm2199632, dateOfBirth=Tue Sep 21 11:00:00 GMT 1982, filmography=[Apocalypto, Beatdown, Wind Walkers]]]]"; Assert.assertEquals(movie.toString(), expectedOutput); } diff --git a/jackson/src/test/java/org/baeldung/jackson/serialization/JacksonSerializeTest.java b/jackson/src/test/java/org/baeldung/jackson/serialization/JacksonSerializeTest.java index 6c8aa90fae..6d9e378025 100644 --- a/jackson/src/test/java/org/baeldung/jackson/serialization/JacksonSerializeTest.java +++ b/jackson/src/test/java/org/baeldung/jackson/serialization/JacksonSerializeTest.java @@ -1,22 +1,19 @@ package org.baeldung.jackson.serialization; import java.io.IOException; -import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; +import java.util.TimeZone; import org.baeldung.jackson.entities.ActorJackson; import org.baeldung.jackson.entities.Movie; import org.baeldung.jackson.entities.MovieWithNullValue; -import org.baeldung.jackson.serialization.ActorJacksonSerializer; import org.junit.Assert; import org.junit.Test; -import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.module.SimpleModule; @@ -26,34 +23,35 @@ public class JacksonSerializeTest { @Test public void whenSimpleSerialize_thenCorrect() throws JsonProcessingException, ParseException { - SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + final SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + sdf.setTimeZone(TimeZone.getTimeZone("GMT")); - ActorJackson rudyYoungblood = new ActorJackson("nm2199632", sdf.parse("21-09-1982"), Arrays.asList("Apocalypto", "Beatdown", "Wind Walkers")); - Movie movie = new Movie("tt0472043", "Mel Gibson", Arrays.asList(rudyYoungblood)); + final ActorJackson rudyYoungblood = new ActorJackson("nm2199632", sdf.parse("21-09-1982"), Arrays.asList("Apocalypto", "Beatdown", "Wind Walkers")); + final Movie movie = new Movie("tt0472043", "Mel Gibson", Arrays.asList(rudyYoungblood)); - ObjectMapper mapper = new ObjectMapper(); - String jsonResult = mapper.writeValueAsString(movie); + final ObjectMapper mapper = new ObjectMapper(); + final String jsonResult = mapper.writeValueAsString(movie); - String expectedOutput = "{\"imdbId\":\"tt0472043\",\"director\":\"Mel Gibson\",\"actors\":[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":401439600000,\"filmography\":[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; + final String expectedOutput = "{\"imdbId\":\"tt0472043\",\"director\":\"Mel Gibson\",\"actors\":[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":401414400000,\"filmography\":[\"Apocalypto\",\"Beatdown\",\"Wind Walkers\"]}]}"; Assert.assertEquals(jsonResult, expectedOutput); } @Test public void whenCustomSerialize_thenCorrect() throws ParseException, IOException { - SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + final SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); - ActorJackson rudyYoungblood = new ActorJackson("nm2199632", sdf.parse("21-09-1982"), Arrays.asList("Apocalypto", "Beatdown", "Wind Walkers")); - MovieWithNullValue movieWithNullValue = new MovieWithNullValue(null, "Mel Gibson", Arrays.asList(rudyYoungblood)); + final ActorJackson rudyYoungblood = new ActorJackson("nm2199632", sdf.parse("21-09-1982"), Arrays.asList("Apocalypto", "Beatdown", "Wind Walkers")); + final MovieWithNullValue movieWithNullValue = new MovieWithNullValue(null, "Mel Gibson", Arrays.asList(rudyYoungblood)); - SimpleModule module = new SimpleModule(); + final SimpleModule module = new SimpleModule(); module.addSerializer(new ActorJacksonSerializer(ActorJackson.class)); - ObjectMapper mapper = new ObjectMapper(); + final ObjectMapper mapper = new ObjectMapper(); - String jsonResult = mapper.registerModule(module).writer(new DefaultPrettyPrinter()).writeValueAsString(movieWithNullValue); + final String jsonResult = mapper.registerModule(module).writer(new DefaultPrettyPrinter()).writeValueAsString(movieWithNullValue); - Object json = mapper.readValue("{\"actors\":[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"21-09-1982\",\"N° Film: \":3,\"filmography\":\"Apocalypto-Beatdown-Wind Walkers\"}],\"imdbID\":null}", Object.class); - String expectedOutput = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(json); + final Object json = mapper.readValue("{\"actors\":[{\"imdbId\":\"nm2199632\",\"dateOfBirth\":\"21-09-1982\",\"N° Film: \":3,\"filmography\":\"Apocalypto-Beatdown-Wind Walkers\"}],\"imdbID\":null}", Object.class); + final String expectedOutput = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(json); Assert.assertEquals(jsonResult, expectedOutput); } diff --git a/jpa-storedprocedure/pom.xml b/jpa-storedprocedure/pom.xml index b2ebaa32e2..b5a2e8693c 100644 --- a/jpa-storedprocedure/pom.xml +++ b/jpa-storedprocedure/pom.xml @@ -11,6 +11,7 @@ 7.0 5.1.0.Final 5.1.38 + 2.19.1
@@ -33,6 +34,16 @@ + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/*IntegrationTest.java + + + diff --git a/jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java b/jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureIntegrationTest.java similarity index 98% rename from jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java rename to jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureIntegrationTest.java index 69351d9683..c93d59fe30 100644 --- a/jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java +++ b/jpa-storedprocedure/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureIntegrationTest.java @@ -15,7 +15,7 @@ import org.junit.Test; import com.baeldung.jpa.model.Car; -public class StoredProcedureTest { +public class StoredProcedureIntegrationTest { private static EntityManagerFactory factory = null; private static EntityManager entityManager = null; diff --git a/junit5/src/test/java/com/baeldung/FirstTest.java b/junit5/src/test/java/com/baeldung/FirstTest.java index 4fc6037174..3306dc01f9 100644 --- a/junit5/src/test/java/com/baeldung/FirstTest.java +++ b/junit5/src/test/java/com/baeldung/FirstTest.java @@ -19,6 +19,7 @@ class FirstTest { .sum() > 5, "Sum should be greater than 5"); } + @Disabled("test to show MultipleFailuresError") @Test void groupAssertions() { int[] numbers = {0, 1, 2, 3, 4}; diff --git a/patterns/front-controller/pom.xml b/patterns/front-controller/pom.xml new file mode 100644 index 0000000000..2dabf484e1 --- /dev/null +++ b/patterns/front-controller/pom.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + + front-controller + war + + + patterns-parent + com.baeldung.patterns + 1.0.0-SNAPSHOT + .. + + + + + javax.servlet + javax.servlet-api + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-war-plugin + + + org.eclipse.jetty + jetty-maven-plugin + + + /front-controller + + + + + + diff --git a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/FrontControllerServlet.java b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/FrontControllerServlet.java similarity index 76% rename from patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/FrontControllerServlet.java rename to patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/FrontControllerServlet.java index a8962f5108..9fb120399c 100644 --- a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/FrontControllerServlet.java +++ b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/FrontControllerServlet.java @@ -1,7 +1,7 @@ -package com.baeldung.enterprise.patterns.front.controller; +package com.baeldung.patterns.front.controller; -import com.baeldung.enterprise.patterns.front.controller.commands.FrontCommand; -import com.baeldung.enterprise.patterns.front.controller.commands.UnknownCommand; +import com.baeldung.patterns.front.controller.commands.FrontCommand; +import com.baeldung.patterns.front.controller.commands.UnknownCommand; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -24,7 +24,7 @@ public class FrontControllerServlet extends HttpServlet { try { Class type = Class.forName( String.format( - "com.baeldung.enterprise.patterns.front.controller.commands.%sCommand", + "com.baeldung.patterns.front.controller.commands.%sCommand", request.getParameter("command") ) ); diff --git a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/FrontCommand.java b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/commands/FrontCommand.java similarity index 93% rename from patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/FrontCommand.java rename to patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/commands/FrontCommand.java index 12a008faeb..cc92731050 100644 --- a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/FrontCommand.java +++ b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/commands/FrontCommand.java @@ -1,4 +1,4 @@ -package com.baeldung.enterprise.patterns.front.controller.commands; +package com.baeldung.patterns.front.controller.commands; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; diff --git a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/SearchCommand.java b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/commands/SearchCommand.java similarity index 69% rename from patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/SearchCommand.java rename to patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/commands/SearchCommand.java index 0c5bd64bbc..21028b07f0 100644 --- a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/SearchCommand.java +++ b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/commands/SearchCommand.java @@ -1,7 +1,7 @@ -package com.baeldung.enterprise.patterns.front.controller.commands; +package com.baeldung.patterns.front.controller.commands; -import com.baeldung.enterprise.patterns.front.controller.data.Book; -import com.baeldung.enterprise.patterns.front.controller.data.BookshelfImpl; +import com.baeldung.patterns.front.controller.data.Book; +import com.baeldung.patterns.front.controller.data.BookshelfImpl; import javax.servlet.ServletException; import java.io.IOException; diff --git a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/UnknownCommand.java b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/commands/UnknownCommand.java similarity index 77% rename from patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/UnknownCommand.java rename to patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/commands/UnknownCommand.java index 90103c8f42..9f24746598 100644 --- a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/commands/UnknownCommand.java +++ b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/commands/UnknownCommand.java @@ -1,4 +1,4 @@ -package com.baeldung.enterprise.patterns.front.controller.commands; +package com.baeldung.patterns.front.controller.commands; import javax.servlet.ServletException; import java.io.IOException; diff --git a/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/Book.java b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/Book.java new file mode 100644 index 0000000000..5a15df92c4 --- /dev/null +++ b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/Book.java @@ -0,0 +1,15 @@ +package com.baeldung.patterns.front.controller.data; + +public interface Book { + String getAuthor(); + + void setAuthor(String author); + + String getTitle(); + + void setTitle(String title); + + Double getPrice(); + + void setPrice(Double price); +} diff --git a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/Book.java b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/BookImpl.java similarity index 69% rename from patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/Book.java rename to patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/BookImpl.java index 634e05c3a0..0421ff5623 100644 --- a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/Book.java +++ b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/BookImpl.java @@ -1,39 +1,45 @@ -package com.baeldung.enterprise.patterns.front.controller.data; +package com.baeldung.patterns.front.controller.data; -public class Book { +public class BookImpl implements Book { private String author; private String title; private Double price; - public Book() { + public BookImpl() { } - public Book(String author, String title, Double price) { + public BookImpl(String author, String title, Double price) { this.author = author; this.title = title; this.price = price; } + @Override public String getAuthor() { return author; } + @Override public void setAuthor(String author) { this.author = author; } + @Override public String getTitle() { return title; } + @Override public void setTitle(String title) { this.title = title; } + @Override public Double getPrice() { return price; } + @Override public void setPrice(Double price) { this.price = price; } diff --git a/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/Bookshelf.java b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/Bookshelf.java new file mode 100644 index 0000000000..21e3067133 --- /dev/null +++ b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/Bookshelf.java @@ -0,0 +1,15 @@ +package com.baeldung.patterns.front.controller.data; + +public interface Bookshelf { + + default void init() { + add(new BookImpl("Wilson, Robert Anton & Shea, Robert", "Illuminati", 9.99)); + add(new BookImpl("Fowler, Martin", "Patterns of Enterprise Application Architecture", 27.88)); + } + + Bookshelf getInstance(); + + boolean add(E book); + + Book findByTitle(String title); +} diff --git a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/BookshelfImpl.java b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/BookshelfImpl.java similarity index 89% rename from patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/BookshelfImpl.java rename to patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/BookshelfImpl.java index 3862418857..dd1fa4e523 100644 --- a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/BookshelfImpl.java +++ b/patterns/front-controller/src/main/java/com/baeldung/patterns/front/controller/data/BookshelfImpl.java @@ -1,4 +1,4 @@ -package com.baeldung.enterprise.patterns.front.controller.data; +package com.baeldung.patterns.front.controller.data; import java.util.ArrayList; diff --git a/patterns/front-controller/src/main/resources/front controller.png b/patterns/front-controller/src/main/resources/front controller.png new file mode 100644 index 0000000000..bd475bf3f3 Binary files /dev/null and b/patterns/front-controller/src/main/resources/front controller.png differ diff --git a/patterns/front-controller/src/main/resources/front controller.puml b/patterns/front-controller/src/main/resources/front controller.puml new file mode 100644 index 0000000000..fbd4f416ef --- /dev/null +++ b/patterns/front-controller/src/main/resources/front controller.puml @@ -0,0 +1,22 @@ +@startuml + +class Handler { +doGet +doPost +} + +abstract class AbstractCommand { +process +} +class ConcreteCommand1 { +process +} +class ConcreteCommand2 { +process +} + +Handler .right.> AbstractCommand +AbstractCommand <|-- ConcreteCommand1 +AbstractCommand <|-- ConcreteCommand2 + +@enduml \ No newline at end of file diff --git a/patterns/src/main/webapp/WEB-INF/jsp/book-found.jsp b/patterns/front-controller/src/main/webapp/WEB-INF/jsp/book-found.jsp similarity index 100% rename from patterns/src/main/webapp/WEB-INF/jsp/book-found.jsp rename to patterns/front-controller/src/main/webapp/WEB-INF/jsp/book-found.jsp diff --git a/patterns/src/main/webapp/WEB-INF/jsp/book-notfound.jsp b/patterns/front-controller/src/main/webapp/WEB-INF/jsp/book-notfound.jsp similarity index 100% rename from patterns/src/main/webapp/WEB-INF/jsp/book-notfound.jsp rename to patterns/front-controller/src/main/webapp/WEB-INF/jsp/book-notfound.jsp diff --git a/patterns/src/main/webapp/WEB-INF/jsp/unknown.jsp b/patterns/front-controller/src/main/webapp/WEB-INF/jsp/unknown.jsp similarity index 100% rename from patterns/src/main/webapp/WEB-INF/jsp/unknown.jsp rename to patterns/front-controller/src/main/webapp/WEB-INF/jsp/unknown.jsp diff --git a/patterns/src/main/webapp/WEB-INF/web.xml b/patterns/front-controller/src/main/webapp/WEB-INF/web.xml similarity index 82% rename from patterns/src/main/webapp/WEB-INF/web.xml rename to patterns/front-controller/src/main/webapp/WEB-INF/web.xml index 77113db09b..4abca2bb97 100644 --- a/patterns/src/main/webapp/WEB-INF/web.xml +++ b/patterns/front-controller/src/main/webapp/WEB-INF/web.xml @@ -6,7 +6,7 @@ version="3.1"> front-controller - com.baeldung.enterprise.patterns.front.controller.FrontControllerServlet + com.baeldung.patterns.front.controller.FrontControllerServlet front-controller diff --git a/patterns/intercepting-filter/pom.xml b/patterns/intercepting-filter/pom.xml new file mode 100644 index 0000000000..2cf89246f9 --- /dev/null +++ b/patterns/intercepting-filter/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + intercepting-filter + war + + + com.baeldung.patterns + patterns-parent + 1.0.0-SNAPSHOT + .. + + + + + javax.servlet + javax.servlet-api + + + org.slf4j + slf4j-api + 1.7.21 + provided + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-war-plugin + + false + + + + org.eclipse.jetty + jetty-maven-plugin + + + / + + + + + + diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/FrontControllerServlet.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/FrontControllerServlet.java new file mode 100644 index 0000000000..9d8a004265 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/FrontControllerServlet.java @@ -0,0 +1,66 @@ +package com.baeldung.patterns.intercepting.filter; + +import com.baeldung.patterns.intercepting.filter.commands.FrontCommand; +import com.baeldung.patterns.intercepting.filter.commands.UnknownCommand; +import com.baeldung.patterns.intercepting.filter.data.Bookshelf; +import com.baeldung.patterns.intercepting.filter.data.BookshelfImpl; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@WebServlet(name = "intercepting-filter", urlPatterns = "/") +public class FrontControllerServlet extends HttpServlet { + @Override + public void init(ServletConfig config) throws ServletException { + super.init(config); + Bookshelf bookshelf = new BookshelfImpl(); + bookshelf.init(); + getServletContext().setAttribute("bookshelf", bookshelf); + } + + @Override + protected void doGet( + HttpServletRequest request, + HttpServletResponse response + ) throws ServletException, IOException { + doCommand(request, response); + } + + @Override + protected void doPost( + HttpServletRequest request, + HttpServletResponse response + ) throws ServletException, IOException { + doCommand(request, response); + } + + private void doCommand( + HttpServletRequest request, + HttpServletResponse response + ) throws ServletException, IOException { + FrontCommand command = getCommand(request); + command.init(request, response); + command.process(); + } + + private FrontCommand getCommand(HttpServletRequest request) { + try { + Class type = Class.forName( + String.format( + "com.baeldung.patterns.intercepting.filter.commands.%sCommand", + request.getParameter("command") + ) + ); + return (FrontCommand) type + .asSubclass(FrontCommand.class) + .newInstance(); + } catch (Exception e) { + return new UnknownCommand(); + } + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/CheckoutCommand.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/CheckoutCommand.java new file mode 100644 index 0000000000..fda88c741e --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/CheckoutCommand.java @@ -0,0 +1,27 @@ +package com.baeldung.patterns.intercepting.filter.commands; + +import com.baeldung.patterns.intercepting.filter.data.Order; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +public class CheckoutCommand extends FrontCommand { + @Override + public void process() throws ServletException, IOException { + super.process(); + HttpSession session = request.getSession(false); + if (request.getMethod().equals("POST")) { + session.removeAttribute("order"); + response.sendRedirect("/?command=Home&message=Thank you for buying!"); + } else { + Order order = (Order) session.getAttribute("order"); + Double total = order.getItems().entrySet().stream() + .map(entry -> entry.getKey().getPrice() * entry.getValue()) + .reduce((p1, p2) -> p1 + p2) + .orElse(0.00); + request.setAttribute("total", total); + forward("shopping-cart"); + } + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/FrontCommand.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/FrontCommand.java new file mode 100644 index 0000000000..a3c545703b --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/FrontCommand.java @@ -0,0 +1,43 @@ +package com.baeldung.patterns.intercepting.filter.commands; + +import com.baeldung.patterns.intercepting.filter.filters.FilterManager; +import com.baeldung.patterns.intercepting.filter.filters.OnIntercept; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public abstract class FrontCommand implements OnIntercept { + protected HttpServletRequest request; + protected HttpServletResponse response; + private boolean intercept; + + public FrontCommand() { + } + + public void init(HttpServletRequest request, HttpServletResponse response) { + this.request = request; + this.response = response; + } + + public void process() throws ServletException, IOException { + FilterManager.process(request, response, this); + } + + public void forward(String target) throws ServletException, IOException { + if (intercept) { + return; + } + String path = String.format("/WEB-INF/jsp/%s.jsp", target); + RequestDispatcher dispatcher = request.getServletContext() + .getRequestDispatcher(path); + dispatcher.forward(request, response); + } + + @Override + public void intercept() { + intercept = true; + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/HomeCommand.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/HomeCommand.java new file mode 100644 index 0000000000..33e60b44b5 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/HomeCommand.java @@ -0,0 +1,17 @@ +package com.baeldung.patterns.intercepting.filter.commands; + +import com.baeldung.patterns.intercepting.filter.data.Bookshelf; + +import javax.servlet.ServletException; +import java.io.IOException; + +public class HomeCommand extends FrontCommand { + @Override + public void process() throws ServletException, IOException { + super.process(); + Bookshelf bookshelf = (Bookshelf) request.getServletContext() + .getAttribute("bookshelf"); + request.setAttribute("books", bookshelf); + forward("home"); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/LoginCommand.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/LoginCommand.java new file mode 100644 index 0000000000..cbc8ad9498 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/LoginCommand.java @@ -0,0 +1,24 @@ +package com.baeldung.patterns.intercepting.filter.commands; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +public class LoginCommand extends FrontCommand { + @Override + public void process() throws ServletException, IOException { + if (request.getMethod().equals("POST")) { + HttpSession session = request.getSession(true); + session.setAttribute("username", request.getParameter("username")); + response.sendRedirect(request.getParameter("redirect")); + } else { + String queryString = request.getQueryString(); + if (queryString == null) { + queryString = "command=Home"; + } + request.setAttribute("redirect", request.getRequestURL() + .append("?").append(queryString).toString()); + forward("login"); + } + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/LogoutCommand.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/LogoutCommand.java new file mode 100644 index 0000000000..3c9475d6af --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/LogoutCommand.java @@ -0,0 +1,16 @@ +package com.baeldung.patterns.intercepting.filter.commands; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +public class LogoutCommand extends FrontCommand { + @Override + public void process() throws ServletException, IOException { + super.process(); + HttpSession session = request.getSession(false); + session.removeAttribute("username"); + session.removeAttribute("order"); + response.sendRedirect("/?command=Home"); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/OrderCommand.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/OrderCommand.java new file mode 100644 index 0000000000..e53fcf78dd --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/OrderCommand.java @@ -0,0 +1,33 @@ +package com.baeldung.patterns.intercepting.filter.commands; + +import com.baeldung.patterns.intercepting.filter.data.Book; +import com.baeldung.patterns.intercepting.filter.data.Bookshelf; +import com.baeldung.patterns.intercepting.filter.data.Order; +import com.baeldung.patterns.intercepting.filter.data.OrderImpl; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +public class OrderCommand extends FrontCommand { + @Override + public void process() throws ServletException, IOException { + super.process(); + if (request.getMethod().equals("POST")) { + HttpSession session = request.getSession(false); + Order order = (Order) session.getAttribute("order"); + if (order == null) { + String username = (String) session.getAttribute("username"); + order = new OrderImpl(username); + } + Bookshelf bookshelf = (Bookshelf) request.getServletContext() + .getAttribute("bookshelf"); + String isbn = request.getParameter("isbn"); + Integer quantity = Integer.parseInt(request.getParameter("quantity")); + Book book = bookshelf.get(isbn); + order.add(book, quantity); + session.setAttribute("order", order); + response.sendRedirect(String.format("/?command=Show&isbn=%s", isbn)); + } + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/SearchCommand.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/SearchCommand.java new file mode 100644 index 0000000000..6c52f4f5a9 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/SearchCommand.java @@ -0,0 +1,25 @@ +package com.baeldung.patterns.intercepting.filter.commands; + +import com.baeldung.patterns.intercepting.filter.data.Book; +import com.baeldung.patterns.intercepting.filter.data.Bookshelf; + +import javax.servlet.ServletException; +import java.io.IOException; +import java.util.List; + +public class SearchCommand extends FrontCommand { + @Override + public void process() throws ServletException, IOException { + super.process(); + Bookshelf bookshelf = (Bookshelf) request.getServletContext() + .getAttribute("bookshelf"); + String q = request.getParameter("q"); + List books = bookshelf.find(q); + if (books.size() > 0) { + request.setAttribute("books", books); + forward("book-found"); + } else { + forward("book-notfound"); + } + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/ShowCommand.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/ShowCommand.java new file mode 100644 index 0000000000..1ea5ca6edb --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/ShowCommand.java @@ -0,0 +1,21 @@ +package com.baeldung.patterns.intercepting.filter.commands; + +import com.baeldung.patterns.intercepting.filter.data.Book; +import com.baeldung.patterns.intercepting.filter.data.Bookshelf; + +import javax.servlet.ServletException; +import java.io.IOException; +import java.util.Collections; + +public class ShowCommand extends FrontCommand { + @Override + public void process() throws ServletException, IOException { + super.process(); + Bookshelf bookshelf = (Bookshelf) request.getServletContext() + .getAttribute("bookshelf"); + String title = request.getParameter("isbn"); + Book book = bookshelf.get(title); + request.setAttribute("books", Collections.singletonList(book)); + forward("book-found"); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/UnknownCommand.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/UnknownCommand.java new file mode 100644 index 0000000000..427efe5aba --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/commands/UnknownCommand.java @@ -0,0 +1,12 @@ +package com.baeldung.patterns.intercepting.filter.commands; + +import javax.servlet.ServletException; +import java.io.IOException; + +public class UnknownCommand extends FrontCommand { + @Override + public void process() throws ServletException, IOException { + super.process(); + forward("unknown"); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/Book.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/Book.java new file mode 100644 index 0000000000..4e98095c2c --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/Book.java @@ -0,0 +1,19 @@ +package com.baeldung.patterns.intercepting.filter.data; + +public interface Book { + String getIsbn(); + + void setIsbn(String isbn); + + String getAuthor(); + + void setAuthor(String author); + + String getTitle(); + + void setTitle(String title); + + Double getPrice(); + + void setPrice(Double price); +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/BookImpl.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/BookImpl.java new file mode 100644 index 0000000000..cd0c0924e2 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/BookImpl.java @@ -0,0 +1,58 @@ +package com.baeldung.patterns.intercepting.filter.data; + +public class BookImpl implements Book { + private String isbn; + private String author; + private String title; + private Double price; + + public BookImpl() { + } + + public BookImpl(String isbn, String author, String title, Double price) { + this.isbn = isbn; + this.author = author; + this.title = title; + this.price = price; + } + + @Override + public String getIsbn() { + return isbn; + } + + @Override + public void setIsbn(String isbn) { + this.isbn = isbn; + } + + @Override + public String getAuthor() { + return author; + } + + @Override + public void setAuthor(String author) { + this.author = author; + } + + @Override + public String getTitle() { + return title; + } + + @Override + public void setTitle(String title) { + this.title = title; + } + + @Override + public Double getPrice() { + return price; + } + + @Override + public void setPrice(Double price) { + this.price = price; + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/Bookshelf.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/Bookshelf.java new file mode 100644 index 0000000000..26541de8e0 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/Bookshelf.java @@ -0,0 +1,18 @@ +package com.baeldung.patterns.intercepting.filter.data; + +import java.util.List; + +public interface Bookshelf { + + default void init() { + add(new BookImpl("001", "Wilson, Robert Anton & Shea, Robert", "Illuminati", 9.99)); + add(new BookImpl("002", "Fowler, Martin", "Patterns of Enterprise Application Architecture", 27.88)); + add(new BookImpl("003", "Unknown", "Something about German Umlauts (äüö) and ß", 5.49)); + } + + boolean add(E book); + + Book get(String isbn); + + List find(String q); +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/BookshelfImpl.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/BookshelfImpl.java new file mode 100644 index 0000000000..5767af8e50 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/BookshelfImpl.java @@ -0,0 +1,23 @@ +package com.baeldung.patterns.intercepting.filter.data; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class BookshelfImpl extends ArrayList implements Bookshelf { + @Override + public Book get(String isbn) { + return this.stream() + .filter(book -> book.getIsbn().equals(isbn)) + .findFirst() + .orElse(null); + } + + @Override + public List find(String q) { + return this.stream() + .filter(book -> book.getTitle().toLowerCase().contains(q.toLowerCase()) + || book.getAuthor().toLowerCase().contains(q.toLowerCase())) + .collect(Collectors.toList()); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/Order.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/Order.java new file mode 100644 index 0000000000..f4a32002d7 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/Order.java @@ -0,0 +1,11 @@ +package com.baeldung.patterns.intercepting.filter.data; + +import java.util.Map; + +public interface Order { + String getUsername(); + + Map getItems(); + + void add(Book item, Integer quantity); +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/OrderImpl.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/OrderImpl.java new file mode 100644 index 0000000000..9f50e45082 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/data/OrderImpl.java @@ -0,0 +1,40 @@ +package com.baeldung.patterns.intercepting.filter.data; + +import java.util.HashMap; +import java.util.Map; + +public class OrderImpl implements Order { + private String username; + private Map items = new HashMap<>(); + + public OrderImpl(String username) { + this.username = username; + } + + @Override + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + @Override + public Map getItems() { + return items; + } + + public void setItems(Map items) { + this.items = items; + } + + @Override + public void add(Book item, Integer quantity) { + Integer q = 0; + if (this.items.containsKey(item)) { + q = this.items.get(item); + } + this.items.put(item, quantity + q); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/AuthenticationFilter.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/AuthenticationFilter.java new file mode 100644 index 0000000000..a2cac9d84c --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/AuthenticationFilter.java @@ -0,0 +1,45 @@ +package com.baeldung.patterns.intercepting.filter.filters; + +import com.baeldung.patterns.intercepting.filter.commands.FrontCommand; +import com.baeldung.patterns.intercepting.filter.commands.LoginCommand; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; + +public class AuthenticationFilter implements Filter { + private OnIntercept callback; + + public AuthenticationFilter(OnIntercept callback) { + this.callback = callback; + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + @Override + public void doFilter( + ServletRequest request, + ServletResponse response, + FilterChain chain + ) throws IOException, ServletException { + HttpServletRequest httpServletRequest = (HttpServletRequest) request; + HttpServletResponse httpServletResponse = (HttpServletResponse) response; + HttpSession session = httpServletRequest.getSession(false); + if (session == null || session.getAttribute("username") == null) { + callback.intercept(); + FrontCommand command = new LoginCommand(); + command.init(httpServletRequest, httpServletResponse); + command.process(); + } else { + chain.doFilter(request, response); + } + } + + @Override + public void destroy() { + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/BaseFilter.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/BaseFilter.java new file mode 100644 index 0000000000..90d13a6eda --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/BaseFilter.java @@ -0,0 +1,25 @@ +package com.baeldung.patterns.intercepting.filter.filters; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.Filter; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; + +public abstract class BaseFilter implements Filter { + private static final Logger log = LoggerFactory.getLogger(BaseFilter.class); + + protected FilterConfig filterConfig; + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + log.info("Initialize filter: {}", getClass().getSimpleName()); + this.filterConfig = filterConfig; + } + + @Override + public void destroy() { + log.info("Destroy filter: {}", getClass().getSimpleName()); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/EncodingFilter.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/EncodingFilter.java new file mode 100644 index 0000000000..ef3f95382e --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/EncodingFilter.java @@ -0,0 +1,34 @@ +package com.baeldung.patterns.intercepting.filter.filters; + +import javax.servlet.*; +import javax.servlet.annotation.WebFilter; +import javax.servlet.annotation.WebInitParam; +import java.io.IOException; + +@WebFilter( + servletNames = {"intercepting-filter"}, + initParams = {@WebInitParam(name = "encoding", value = "UTF-8")} +) +public class EncodingFilter extends BaseFilter { + private String encoding; + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + super.init(filterConfig); + this.encoding = filterConfig.getInitParameter("encoding"); + } + + @Override + public void doFilter( + ServletRequest request, + ServletResponse response, + FilterChain chain + ) throws IOException, ServletException { + String encoding = request.getParameter("encoding"); + if (encoding == null) { + encoding = this.encoding; + } + response.setCharacterEncoding(encoding); + chain.doFilter(request, response); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/FilterChainImpl.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/FilterChainImpl.java new file mode 100644 index 0000000000..80ddef785c --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/FilterChainImpl.java @@ -0,0 +1,25 @@ +package com.baeldung.patterns.intercepting.filter.filters; + +import javax.servlet.*; +import java.io.IOException; +import java.util.Arrays; +import java.util.Iterator; + +public class FilterChainImpl implements FilterChain { + private Iterator filters; + + public FilterChainImpl(Filter... filters) { + this.filters = Arrays.asList(filters).iterator(); + } + + @Override + public void doFilter( + ServletRequest request, + ServletResponse response + ) throws IOException, ServletException { + if (filters.hasNext()) { + Filter filter = filters.next(); + filter.doFilter(request, response, this); + } + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/FilterManager.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/FilterManager.java new file mode 100644 index 0000000000..2f7b7ac703 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/FilterManager.java @@ -0,0 +1,21 @@ +package com.baeldung.patterns.intercepting.filter.filters; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class FilterManager { + public static void process( + HttpServletRequest request, + HttpServletResponse response, + OnIntercept callback + ) throws ServletException, IOException { + FilterChain filterChain = new FilterChainImpl( + new AuthenticationFilter(callback), + new VisitorCounterFilter() + ); + filterChain.doFilter(request, response); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/LoggingFilter.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/LoggingFilter.java new file mode 100644 index 0000000000..0ebb397938 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/LoggingFilter.java @@ -0,0 +1,33 @@ +package com.baeldung.patterns.intercepting.filter.filters; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebFilter; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +@WebFilter(servletNames = "intercepting-filter") +public class LoggingFilter extends BaseFilter { + private static final Logger log = LoggerFactory.getLogger(LoggingFilter.class); + + @Override + public void doFilter( + ServletRequest request, + ServletResponse response, + FilterChain chain + ) throws IOException, ServletException { + chain.doFilter(request, response); + HttpServletRequest httpServletRequest = (HttpServletRequest) request; + String username = (String) httpServletRequest.getAttribute("username"); + if (username == null) { + username = "guest"; + } + log.info("Request from '{}@{}': {}?{}", username, request.getRemoteAddr(), + httpServletRequest.getRequestURI(), request.getParameterMap()); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/OnIntercept.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/OnIntercept.java new file mode 100644 index 0000000000..1a138f1e1c --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/OnIntercept.java @@ -0,0 +1,5 @@ +package com.baeldung.patterns.intercepting.filter.filters; + +public interface OnIntercept { + void intercept(); +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/TemplateFilter.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/TemplateFilter.java new file mode 100644 index 0000000000..64396ef931 --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/TemplateFilter.java @@ -0,0 +1,34 @@ +package com.baeldung.patterns.intercepting.filter.filters; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public abstract class TemplateFilter extends BaseFilter { + protected abstract void preFilter( + HttpServletRequest request, + HttpServletResponse response + ) throws IOException, ServletException; + + protected abstract void postFilter( + HttpServletRequest request, + HttpServletResponse response + ) throws IOException, ServletException; + + @Override + public void doFilter( + ServletRequest request, + ServletResponse response, + FilterChain chain + ) throws IOException, ServletException { + HttpServletRequest httpServletRequest = (HttpServletRequest) request; + HttpServletResponse httpServletResponse = (HttpServletResponse) response; + preFilter(httpServletRequest, httpServletResponse); + chain.doFilter(request, response); + postFilter(httpServletRequest, httpServletResponse); + } +} diff --git a/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/VisitorCounterFilter.java b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/VisitorCounterFilter.java new file mode 100644 index 0000000000..5521b9faee --- /dev/null +++ b/patterns/intercepting-filter/src/main/java/com/baeldung/patterns/intercepting/filter/filters/VisitorCounterFilter.java @@ -0,0 +1,33 @@ +package com.baeldung.patterns.intercepting.filter.filters; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import java.io.IOException; +import java.util.HashSet; +import java.util.Set; + +public class VisitorCounterFilter implements Filter { + private static Set users = new HashSet<>(); + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + @Override + public void doFilter( + ServletRequest request, + ServletResponse response, + FilterChain chain + ) throws IOException, ServletException { + HttpSession session = ((HttpServletRequest) request).getSession(false); + String username = (String) session.getAttribute("username"); + users.add(username); + request.setAttribute("counter", users.size()); + chain.doFilter(request, response); + } + + @Override + public void destroy() { + } +} diff --git a/patterns/src/main/resources/front controller.png b/patterns/intercepting-filter/src/main/resources/front_controller.png similarity index 100% rename from patterns/src/main/resources/front controller.png rename to patterns/intercepting-filter/src/main/resources/front_controller.png diff --git a/patterns/src/main/resources/front controller.puml b/patterns/intercepting-filter/src/main/resources/front_controller.puml similarity index 100% rename from patterns/src/main/resources/front controller.puml rename to patterns/intercepting-filter/src/main/resources/front_controller.puml diff --git a/patterns/intercepting-filter/src/main/resources/intercepting_filter-custom_strategy.png b/patterns/intercepting-filter/src/main/resources/intercepting_filter-custom_strategy.png new file mode 100644 index 0000000000..2f025fad5e Binary files /dev/null and b/patterns/intercepting-filter/src/main/resources/intercepting_filter-custom_strategy.png differ diff --git a/patterns/intercepting-filter/src/main/resources/intercepting_filter-custom_strategy.puml b/patterns/intercepting-filter/src/main/resources/intercepting_filter-custom_strategy.puml new file mode 100644 index 0000000000..4090085d85 --- /dev/null +++ b/patterns/intercepting-filter/src/main/resources/intercepting_filter-custom_strategy.puml @@ -0,0 +1,29 @@ +@startuml +scale 1.5 + +class FrontControllerServlet { + void doGet() + void doPost() +} +class FilterManager { + {static} void process() +} +class FilterChainImpl { + void doFilter() +} +class AuthenticationFilter { + void doFilter() +} +class VisitorCounterFilter { + void doFilter() +} +class FrontCommand { + void process() +} + +FrontControllerServlet -- FrontCommand +FrontCommand .right.-- FilterManager +FilterManager -- FilterChainImpl +FilterChainImpl .right.-- AuthenticationFilter +AuthenticationFilter .right.-- VisitorCounterFilter +@enduml diff --git a/patterns/intercepting-filter/src/main/resources/intercepting_filter-standard_strategy.png b/patterns/intercepting-filter/src/main/resources/intercepting_filter-standard_strategy.png new file mode 100644 index 0000000000..0d8db711a7 Binary files /dev/null and b/patterns/intercepting-filter/src/main/resources/intercepting_filter-standard_strategy.png differ diff --git a/patterns/intercepting-filter/src/main/resources/intercepting_filter-standard_strategy.puml b/patterns/intercepting-filter/src/main/resources/intercepting_filter-standard_strategy.puml new file mode 100644 index 0000000000..1261d9ee4b --- /dev/null +++ b/patterns/intercepting-filter/src/main/resources/intercepting_filter-standard_strategy.puml @@ -0,0 +1,26 @@ +@startuml +scale 1.5 + +class FrontControllerServlet { + void doGet() + void doPost() +} +abstract class BaseFilter { + void init() + void destroy() +} +class LoggingFilter { + void doFilter() +} +class EncodingFilter { + void doFilter() +} +class FrontCommand { + void process() +} + +FrontControllerServlet .right.-- FrontCommand +FrontControllerServlet -- BaseFilter +BaseFilter <|-- LoggingFilter +BaseFilter <|-- EncodingFilter +@enduml diff --git a/patterns/intercepting-filter/src/main/resources/intercepting_filter-template_strategy.png b/patterns/intercepting-filter/src/main/resources/intercepting_filter-template_strategy.png new file mode 100644 index 0000000000..5c37aa2937 Binary files /dev/null and b/patterns/intercepting-filter/src/main/resources/intercepting_filter-template_strategy.png differ diff --git a/patterns/intercepting-filter/src/main/resources/intercepting_filter-template_strategy.puml b/patterns/intercepting-filter/src/main/resources/intercepting_filter-template_strategy.puml new file mode 100644 index 0000000000..77b001f547 --- /dev/null +++ b/patterns/intercepting-filter/src/main/resources/intercepting_filter-template_strategy.puml @@ -0,0 +1,25 @@ +@startuml +scale 1.5 + +class FrontControllerServlet { + void doGet() + void doPost() +} +abstract class BaseFilter { + void init() + void destroy() +} +abstract class TemplateFilter { + {abstract} void preFilter() + {abstract} void postFilter() + -- + void doFilter() +} +class FrontCommand { + void process() +} + +FrontControllerServlet .right.-- FrontCommand +FrontControllerServlet -- BaseFilter +BaseFilter <|-- TemplateFilter +@enduml diff --git a/patterns/intercepting-filter/src/main/resources/intercepting_filter.png b/patterns/intercepting-filter/src/main/resources/intercepting_filter.png new file mode 100644 index 0000000000..9ccacc8081 Binary files /dev/null and b/patterns/intercepting-filter/src/main/resources/intercepting_filter.png differ diff --git a/patterns/intercepting-filter/src/main/resources/intercepting_filter.puml b/patterns/intercepting-filter/src/main/resources/intercepting_filter.puml new file mode 100644 index 0000000000..b06b822323 --- /dev/null +++ b/patterns/intercepting-filter/src/main/resources/intercepting_filter.puml @@ -0,0 +1,17 @@ +@startuml +scale 1.5 + +class Client +class FilterManager +interface FilterChain +interface "Filter 1" +interface "Filter 2" +interface "Filter 3" + +Client .right.-- FilterManager +FilterManager .right.-- Target +FilterManager -- FilterChain +FilterChain .right.-- "Filter 3" +FilterChain .right.-- "Filter 2" +FilterChain .right.-- "Filter 1" +@enduml diff --git a/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/book-found.jsp b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/book-found.jsp new file mode 100644 index 0000000000..4de1d3ca23 --- /dev/null +++ b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/book-found.jsp @@ -0,0 +1,24 @@ +<%@ page import="com.baeldung.patterns.intercepting.filter.data.Book" %> +<%@ page import="java.util.List" %> + + + + Bookshelf: Title found + + +

Our Bookshelf contains following titles:

+ <% for (Book book : (List) request.getAttribute("books")) { %> +

<%= book.getTitle() %>

+

Author: <%= book.getAuthor() %>

+
+ + + + + Go back... +
+ <% } %> + <%@ include file="shopping-cart-hint.jsp"%> + <%@ include file="visitor-counter.jsp"%> + + diff --git a/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/book-notfound.jsp b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/book-notfound.jsp new file mode 100644 index 0000000000..284b1e4759 --- /dev/null +++ b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/book-notfound.jsp @@ -0,0 +1,11 @@ + + + + Bookshelf: Title not found + + +

Our Bookshelf doesn't contains this title:

+

<%= request.getParameter("q") %>

+ <%@ include file="visitor-counter.jsp"%> + + diff --git a/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/home.jsp b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/home.jsp new file mode 100644 index 0000000000..2c2d7c2f22 --- /dev/null +++ b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/home.jsp @@ -0,0 +1,27 @@ +<%@ page import="com.baeldung.patterns.intercepting.filter.data.Book" %> +<%@ page import="java.util.List" %> + + + + Bookshelf: Home + + +
+ + +
+ <% if (request.getParameter("message") != null) { %> +

<%= request.getParameter("message") %>

+ <% } else { %> +

Welcome to the Bookshelf!

+ <% } %> + <% for (Book book : (List) request.getAttribute("books")) { %> +
+

<%= book.getAuthor() %>:

+

<%= book.getTitle() %>

+ More... + <% } %> + <%@ include file="shopping-cart-hint.jsp"%> + <%@ include file="visitor-counter.jsp"%> + + diff --git a/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/login.jsp b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/login.jsp new file mode 100644 index 0000000000..619068bcae --- /dev/null +++ b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/login.jsp @@ -0,0 +1,16 @@ + + + + Bookshelf: Login + + +

Please input a username:

+

Login

+
+ + "> + +
+ <%@ include file="visitor-counter.jsp" %> + + diff --git a/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/shopping-cart-hint.jsp b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/shopping-cart-hint.jsp new file mode 100644 index 0000000000..7e0c051540 --- /dev/null +++ b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/shopping-cart-hint.jsp @@ -0,0 +1,16 @@ +<%@ page import="com.baeldung.patterns.intercepting.filter.data.Order" %> +<% if (session != null && session.getAttribute("order") != null) { %> + <% Order order = ((Order) session.getAttribute("order")); %> + <% if (order != null && order.getItems().size() > 0) { %> +
+

+ Your shopping cart is holding + <% if (order.getItems().size() == 1) { %> + 1 item. + <% } else { %> + <%= (order.getItems().size()) %> items. + <% } %> + Checkout +

+ <% } %> +<% } %> diff --git a/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/shopping-cart.jsp b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/shopping-cart.jsp new file mode 100644 index 0000000000..5f71d2e54e --- /dev/null +++ b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/shopping-cart.jsp @@ -0,0 +1,29 @@ +<%@ page import="com.baeldung.patterns.intercepting.filter.data.Book" %> +<%@ page import="com.baeldung.patterns.intercepting.filter.data.Order" %> +<%@ page import="java.util.Map" %> + + + + Bookshelf: Checkout + + +

You are about to buy the following books:

+

Shopping Cart

+ <% Order order = (Order) session.getAttribute("order"); %> +
    + <% for (Map.Entry entry : order.getItems().entrySet()) { %> +
  • + <%= entry.getValue() %> x <%= entry.getKey().getPrice() %> +

    <%= entry.getKey().getTitle() %>

    + by <%= entry.getKey().getAuthor()%> +
  • + <% } %> +
+

+ Total: <%= request.getAttribute("total") %> +

+
+ +
+ + diff --git a/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/unknown.jsp b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/unknown.jsp new file mode 100644 index 0000000000..b52b2de8d5 --- /dev/null +++ b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/unknown.jsp @@ -0,0 +1,9 @@ + + + + Bookshelf: Command unknown + + +

Sorry, this command is not known!

+ + diff --git a/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/visitor-counter.jsp b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/visitor-counter.jsp new file mode 100644 index 0000000000..de1c741fb1 --- /dev/null +++ b/patterns/intercepting-filter/src/main/webapp/WEB-INF/jsp/visitor-counter.jsp @@ -0,0 +1,5 @@ +<% Integer counter = (Integer) request.getAttribute("counter"); %> +<% if (counter != null && counter > 0) { %> +
+

You are visitor #<%= counter %>. Logout

+<% } %> diff --git a/patterns/pom.xml b/patterns/pom.xml index 7c23b6f55d..6797891353 100644 --- a/patterns/pom.xml +++ b/patterns/pom.xml @@ -4,46 +4,55 @@ 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.enterprise.patterns - patterns - war - - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - - + com.baeldung.patterns + patterns-parent + pom + + front-controller + intercepting-filter + com.baeldung parent-modules 1.0.0-SNAPSHOT + .. + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + + - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - org.eclipse.jetty - jetty-maven-plugin - 9.4.0.M1 - - - /front-controller - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-war-plugin + 3.0.0 + + + org.eclipse.jetty + jetty-maven-plugin + 9.3.12.v20160915 + + + diff --git a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/Bookshelf.java b/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/Bookshelf.java deleted file mode 100644 index 524e000bd9..0000000000 --- a/patterns/src/main/java/com/baeldung/enterprise/patterns/front/controller/data/Bookshelf.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.enterprise.patterns.front.controller.data; - -public interface Bookshelf { - - default void init() { - add(new Book("Wilson, Robert Anton & Shea, Robert", "Illuminati", 9.99)); - add(new Book("Fowler, Martin", "Patterns of Enterprise Application Architecture", 27.88)); - } - - Bookshelf getInstance(); - - boolean add(E book); - - Book findByTitle(String title); -} diff --git a/play-framework/student-api/.gitignore b/play-framework/introduction/.gitignore similarity index 100% rename from play-framework/student-api/.gitignore rename to play-framework/introduction/.gitignore diff --git a/play-framework/student-api/LICENSE b/play-framework/introduction/LICENSE similarity index 100% rename from play-framework/student-api/LICENSE rename to play-framework/introduction/LICENSE diff --git a/play-framework/student-api/README b/play-framework/introduction/README similarity index 100% rename from play-framework/student-api/README rename to play-framework/introduction/README diff --git a/play-framework/student-api/app/Filters.java b/play-framework/introduction/app/Filters.java similarity index 100% rename from play-framework/student-api/app/Filters.java rename to play-framework/introduction/app/Filters.java diff --git a/play-framework/student-api/app/Module.java b/play-framework/introduction/app/Module.java similarity index 100% rename from play-framework/student-api/app/Module.java rename to play-framework/introduction/app/Module.java diff --git a/play-framework/student-api/app/controllers/AsyncController.java b/play-framework/introduction/app/controllers/AsyncController.java similarity index 100% rename from play-framework/student-api/app/controllers/AsyncController.java rename to play-framework/introduction/app/controllers/AsyncController.java diff --git a/play-framework/student-api/app/controllers/CountController.java b/play-framework/introduction/app/controllers/CountController.java similarity index 100% rename from play-framework/student-api/app/controllers/CountController.java rename to play-framework/introduction/app/controllers/CountController.java diff --git a/play-framework/student-api/app/controllers/HomeController.java b/play-framework/introduction/app/controllers/HomeController.java similarity index 100% rename from play-framework/student-api/app/controllers/HomeController.java rename to play-framework/introduction/app/controllers/HomeController.java diff --git a/play-framework/student-api/app/controllers/StudentController.java b/play-framework/introduction/app/controllers/StudentController.java similarity index 100% rename from play-framework/student-api/app/controllers/StudentController.java rename to play-framework/introduction/app/controllers/StudentController.java diff --git a/play-framework/student-api/app/filters/ExampleFilter.java b/play-framework/introduction/app/filters/ExampleFilter.java similarity index 100% rename from play-framework/student-api/app/filters/ExampleFilter.java rename to play-framework/introduction/app/filters/ExampleFilter.java diff --git a/play-framework/student-api/app/models/Student.java b/play-framework/introduction/app/models/Student.java similarity index 100% rename from play-framework/student-api/app/models/Student.java rename to play-framework/introduction/app/models/Student.java diff --git a/play-framework/student-api/app/models/StudentStore.java b/play-framework/introduction/app/models/StudentStore.java similarity index 100% rename from play-framework/student-api/app/models/StudentStore.java rename to play-framework/introduction/app/models/StudentStore.java diff --git a/play-framework/student-api/app/services/ApplicationTimer.java b/play-framework/introduction/app/services/ApplicationTimer.java similarity index 100% rename from play-framework/student-api/app/services/ApplicationTimer.java rename to play-framework/introduction/app/services/ApplicationTimer.java diff --git a/play-framework/student-api/app/services/AtomicCounter.java b/play-framework/introduction/app/services/AtomicCounter.java similarity index 100% rename from play-framework/student-api/app/services/AtomicCounter.java rename to play-framework/introduction/app/services/AtomicCounter.java diff --git a/play-framework/student-api/app/services/Counter.java b/play-framework/introduction/app/services/Counter.java similarity index 100% rename from play-framework/student-api/app/services/Counter.java rename to play-framework/introduction/app/services/Counter.java diff --git a/play-framework/student-api/app/util/Util.java b/play-framework/introduction/app/util/Util.java similarity index 100% rename from play-framework/student-api/app/util/Util.java rename to play-framework/introduction/app/util/Util.java diff --git a/play-framework/student-api/app/views/index.scala.html b/play-framework/introduction/app/views/index.scala.html similarity index 100% rename from play-framework/student-api/app/views/index.scala.html rename to play-framework/introduction/app/views/index.scala.html diff --git a/play-framework/student-api/app/views/main.scala.html b/play-framework/introduction/app/views/main.scala.html similarity index 100% rename from play-framework/student-api/app/views/main.scala.html rename to play-framework/introduction/app/views/main.scala.html diff --git a/play-framework/student-api/bin/activator b/play-framework/introduction/bin/activator similarity index 100% rename from play-framework/student-api/bin/activator rename to play-framework/introduction/bin/activator diff --git a/play-framework/student-api/bin/activator.bat b/play-framework/introduction/bin/activator.bat similarity index 100% rename from play-framework/student-api/bin/activator.bat rename to play-framework/introduction/bin/activator.bat diff --git a/play-framework/student-api/build.sbt b/play-framework/introduction/build.sbt similarity index 100% rename from play-framework/student-api/build.sbt rename to play-framework/introduction/build.sbt diff --git a/play-framework/student-api/conf/application.conf b/play-framework/introduction/conf/application.conf similarity index 100% rename from play-framework/student-api/conf/application.conf rename to play-framework/introduction/conf/application.conf diff --git a/play-framework/student-api/conf/logback.xml b/play-framework/introduction/conf/logback.xml similarity index 100% rename from play-framework/student-api/conf/logback.xml rename to play-framework/introduction/conf/logback.xml diff --git a/play-framework/student-api/conf/routes b/play-framework/introduction/conf/routes similarity index 100% rename from play-framework/student-api/conf/routes rename to play-framework/introduction/conf/routes diff --git a/play-framework/student-api/libexec/activator-launch-1.3.10.jar b/play-framework/introduction/libexec/activator-launch-1.3.10.jar similarity index 100% rename from play-framework/student-api/libexec/activator-launch-1.3.10.jar rename to play-framework/introduction/libexec/activator-launch-1.3.10.jar diff --git a/play-framework/student-api/project/build.properties b/play-framework/introduction/project/build.properties similarity index 100% rename from play-framework/student-api/project/build.properties rename to play-framework/introduction/project/build.properties diff --git a/play-framework/student-api/project/plugins.sbt b/play-framework/introduction/project/plugins.sbt similarity index 100% rename from play-framework/student-api/project/plugins.sbt rename to play-framework/introduction/project/plugins.sbt diff --git a/play-framework/student-api/public/images/favicon.png b/play-framework/introduction/public/images/favicon.png similarity index 100% rename from play-framework/student-api/public/images/favicon.png rename to play-framework/introduction/public/images/favicon.png diff --git a/play-framework/student-api/public/javascripts/hello.js b/play-framework/introduction/public/javascripts/hello.js similarity index 100% rename from play-framework/student-api/public/javascripts/hello.js rename to play-framework/introduction/public/javascripts/hello.js diff --git a/play-framework/student-api/public/stylesheets/main.css b/play-framework/introduction/public/stylesheets/main.css similarity index 100% rename from play-framework/student-api/public/stylesheets/main.css rename to play-framework/introduction/public/stylesheets/main.css diff --git a/play-framework/introduction/test/ApplicationTest.java b/play-framework/introduction/test/ApplicationTest.java new file mode 100644 index 0000000000..1133978e9a --- /dev/null +++ b/play-framework/introduction/test/ApplicationTest.java @@ -0,0 +1,172 @@ + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Arrays; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Before; +import org.junit.Test; +import model.Student; +import play.test.*; +import static play.test.Helpers.*; + +public class ApplicationTest{ + private static final String BASE_URL = "http://localhost:9000"; + + @Test +public void testInServer() throws Exception { + TestServer server = testServer(3333); + running(server, () -> { + try { + WSClient ws = play.libs.ws.WS.newClient(3333); + CompletionStage completionStage = ws.url("/").get(); + WSResponse response = completionStage.toCompletableFuture().get(); + ws.close(); + assertEquals(OK, response.getStatus()); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + }); +} + @Test + public void whenCreatesRecord_thenCorrect() { + Student student = new Student("jody", "west", 50); + JSONObject obj = new JSONObject(makeRequest(BASE_URL, "POST", new JSONObject(student))); + assertTrue(obj.getBoolean("isSuccessfull")); + JSONObject body = obj.getJSONObject("body"); + assertEquals(student.getAge(), body.getInt("age")); + assertEquals(student.getFirstName(), body.getString("firstName")); + assertEquals(student.getLastName(), body.getString("lastName")); + } + + @Test + public void whenDeletesCreatedRecord_thenCorrect() { + Student student = new Student("Usain", "Bolt", 25); + JSONObject ob1 = new JSONObject(makeRequest(BASE_URL, "POST", new JSONObject(student))).getJSONObject("body"); + int id = ob1.getInt("id"); + JSONObject obj1 = new JSONObject(makeRequest(BASE_URL + "/" + id, "POST", new JSONObject())); + assertTrue(obj1.getBoolean("isSuccessfull")); + makeRequest(BASE_URL + "/" + id, "DELETE", null); + JSONObject obj2 = new JSONObject(makeRequest(BASE_URL + "/" + id, "POST", new JSONObject())); + assertFalse(obj2.getBoolean("isSuccessfull")); + } + + @Test + public void whenUpdatesCreatedRecord_thenCorrect() { + Student student = new Student("john", "doe", 50); + JSONObject body1 = new JSONObject(makeRequest(BASE_URL, "POST", new JSONObject(student))).getJSONObject("body"); + assertEquals(student.getAge(), body1.getInt("age")); + int newAge = 60; + body1.put("age", newAge); + JSONObject body2 = new JSONObject(makeRequest(BASE_URL, "PUT", body1)).getJSONObject("body"); + assertFalse(student.getAge() == body2.getInt("age")); + assertTrue(newAge == body2.getInt("age")); + } + + @Test + public void whenGetsAllRecords_thenCorrect() { + Student student1 = new Student("jane", "daisy", 50); + Student student2 = new Student("john", "daniel", 60); + Student student3 = new Student("don", "mason", 55); + Student student4 = new Student("scarlet", "ohara", 90); + + makeRequest(BASE_URL, "POST", new JSONObject(student1)); + makeRequest(BASE_URL, "POST", new JSONObject(student2)); + makeRequest(BASE_URL, "POST", new JSONObject(student3)); + makeRequest(BASE_URL, "POST", new JSONObject(student4)); + + JSONObject objects = new JSONObject(makeRequest(BASE_URL, "GET", null)); + assertTrue(objects.getBoolean("isSuccessfull")); + JSONArray array = objects.getJSONArray("body"); + assertTrue(array.length() >= 4); + } + + public static String makeRequest(String myUrl, String httpMethod, JSONObject parameters) { + + URL url = null; + try { + url = new URL(myUrl); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + HttpURLConnection conn = null; + try { + + conn = (HttpURLConnection) url.openConnection(); + } catch (IOException e) { + e.printStackTrace(); + } + conn.setDoInput(true); + + conn.setReadTimeout(10000); + + conn.setRequestProperty("Content-Type", "application/json"); + DataOutputStream dos = null; + int respCode = 0; + String inputString = null; + try { + conn.setRequestMethod(httpMethod); + + if (Arrays.asList("POST", "PUT").contains(httpMethod)) { + String params = parameters.toString(); + + conn.setDoOutput(true); + + dos = new DataOutputStream(conn.getOutputStream()); + dos.writeBytes(params); + dos.flush(); + dos.close(); + } + respCode = conn.getResponseCode(); + if (respCode != 200 && respCode != 201) { + String error = inputStreamToString(conn.getErrorStream()); + return error; + } + inputString = inputStreamToString(conn.getInputStream()); + + } catch (IOException e) { + + e.printStackTrace(); + } + return inputString; + } + + public static String inputStreamToString(InputStream is) { + BufferedReader br = null; + StringBuilder sb = new StringBuilder(); + + String line; + try { + + br = new BufferedReader(new InputStreamReader(is)); + while ((line = br.readLine()) != null) { + sb.append(line); + } + + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + return sb.toString(); + + } +} diff --git a/routing-in-play/.gitignore b/play-framework/routing-in-play/.gitignore similarity index 100% rename from routing-in-play/.gitignore rename to play-framework/routing-in-play/.gitignore diff --git a/routing-in-play/LICENSE b/play-framework/routing-in-play/LICENSE similarity index 100% rename from routing-in-play/LICENSE rename to play-framework/routing-in-play/LICENSE diff --git a/routing-in-play/README b/play-framework/routing-in-play/README similarity index 100% rename from routing-in-play/README rename to play-framework/routing-in-play/README diff --git a/routing-in-play/app/Filters.java b/play-framework/routing-in-play/app/Filters.java similarity index 100% rename from routing-in-play/app/Filters.java rename to play-framework/routing-in-play/app/Filters.java diff --git a/routing-in-play/app/Module.java b/play-framework/routing-in-play/app/Module.java similarity index 100% rename from routing-in-play/app/Module.java rename to play-framework/routing-in-play/app/Module.java diff --git a/routing-in-play/app/controllers/HomeController.java b/play-framework/routing-in-play/app/controllers/HomeController.java similarity index 100% rename from routing-in-play/app/controllers/HomeController.java rename to play-framework/routing-in-play/app/controllers/HomeController.java diff --git a/routing-in-play/app/filters/ExampleFilter.java b/play-framework/routing-in-play/app/filters/ExampleFilter.java similarity index 100% rename from routing-in-play/app/filters/ExampleFilter.java rename to play-framework/routing-in-play/app/filters/ExampleFilter.java diff --git a/routing-in-play/app/services/ApplicationTimer.java b/play-framework/routing-in-play/app/services/ApplicationTimer.java similarity index 100% rename from routing-in-play/app/services/ApplicationTimer.java rename to play-framework/routing-in-play/app/services/ApplicationTimer.java diff --git a/routing-in-play/app/services/AtomicCounter.java b/play-framework/routing-in-play/app/services/AtomicCounter.java similarity index 100% rename from routing-in-play/app/services/AtomicCounter.java rename to play-framework/routing-in-play/app/services/AtomicCounter.java diff --git a/routing-in-play/app/services/Counter.java b/play-framework/routing-in-play/app/services/Counter.java similarity index 100% rename from routing-in-play/app/services/Counter.java rename to play-framework/routing-in-play/app/services/Counter.java diff --git a/routing-in-play/app/views/index.scala.html b/play-framework/routing-in-play/app/views/index.scala.html similarity index 100% rename from routing-in-play/app/views/index.scala.html rename to play-framework/routing-in-play/app/views/index.scala.html diff --git a/routing-in-play/app/views/main.scala.html b/play-framework/routing-in-play/app/views/main.scala.html similarity index 100% rename from routing-in-play/app/views/main.scala.html rename to play-framework/routing-in-play/app/views/main.scala.html diff --git a/routing-in-play/bin/activator b/play-framework/routing-in-play/bin/activator similarity index 100% rename from routing-in-play/bin/activator rename to play-framework/routing-in-play/bin/activator diff --git a/routing-in-play/bin/activator.bat b/play-framework/routing-in-play/bin/activator.bat similarity index 100% rename from routing-in-play/bin/activator.bat rename to play-framework/routing-in-play/bin/activator.bat diff --git a/routing-in-play/build.sbt b/play-framework/routing-in-play/build.sbt similarity index 100% rename from routing-in-play/build.sbt rename to play-framework/routing-in-play/build.sbt diff --git a/routing-in-play/conf/application.conf b/play-framework/routing-in-play/conf/application.conf similarity index 100% rename from routing-in-play/conf/application.conf rename to play-framework/routing-in-play/conf/application.conf diff --git a/routing-in-play/conf/logback.xml b/play-framework/routing-in-play/conf/logback.xml similarity index 100% rename from routing-in-play/conf/logback.xml rename to play-framework/routing-in-play/conf/logback.xml diff --git a/routing-in-play/conf/routes b/play-framework/routing-in-play/conf/routes similarity index 100% rename from routing-in-play/conf/routes rename to play-framework/routing-in-play/conf/routes diff --git a/routing-in-play/libexec/activator-launch-1.3.10.jar b/play-framework/routing-in-play/libexec/activator-launch-1.3.10.jar similarity index 100% rename from routing-in-play/libexec/activator-launch-1.3.10.jar rename to play-framework/routing-in-play/libexec/activator-launch-1.3.10.jar diff --git a/routing-in-play/project/build.properties b/play-framework/routing-in-play/project/build.properties similarity index 100% rename from routing-in-play/project/build.properties rename to play-framework/routing-in-play/project/build.properties diff --git a/routing-in-play/project/plugins.sbt b/play-framework/routing-in-play/project/plugins.sbt similarity index 100% rename from routing-in-play/project/plugins.sbt rename to play-framework/routing-in-play/project/plugins.sbt diff --git a/routing-in-play/public/images/favicon.png b/play-framework/routing-in-play/public/images/favicon.png similarity index 100% rename from routing-in-play/public/images/favicon.png rename to play-framework/routing-in-play/public/images/favicon.png diff --git a/routing-in-play/public/javascripts/hello.js b/play-framework/routing-in-play/public/javascripts/hello.js similarity index 100% rename from routing-in-play/public/javascripts/hello.js rename to play-framework/routing-in-play/public/javascripts/hello.js diff --git a/routing-in-play/public/stylesheets/main.css b/play-framework/routing-in-play/public/stylesheets/main.css similarity index 100% rename from routing-in-play/public/stylesheets/main.css rename to play-framework/routing-in-play/public/stylesheets/main.css diff --git a/routing-in-play/test/ApplicationTest.java b/play-framework/routing-in-play/test/ApplicationTest.java similarity index 100% rename from routing-in-play/test/ApplicationTest.java rename to play-framework/routing-in-play/test/ApplicationTest.java diff --git a/routing-in-play/test/IntegrationTest.java b/play-framework/routing-in-play/test/IntegrationTest.java similarity index 100% rename from routing-in-play/test/IntegrationTest.java rename to play-framework/routing-in-play/test/IntegrationTest.java diff --git a/pom.xml b/pom.xml index 0de16500d6..82aa022269 100644 --- a/pom.xml +++ b/pom.xml @@ -14,25 +14,25 @@
- assertj + annotations apache-cxf - + apache-fop + assertj autovalue cdi - core-java - core-java-8 - couchbase-sdk + core-java + couchbase-sdk - dozer deltaspike + dozer - patterns feign + flyway + - flyway gson guava @@ -40,55 +40,66 @@ guava19 handling-spring-static-resources + hazelcast httpclient + hystrix immutables jackson + java-cassandra javaxval - jjwt - - jpa-storedprocedure - json - json-path - junit5 jee7 - - + jjwt + jpa-storedprocedure + jsf + json-path + json + junit5 + log4j + lombok + mapstruct mockito mocks - mutation-testing orika + patterns + querydsl + redis rest-assured rest-testing resteasy + selenium-junit-testng + spring-akka spring-all - spring-akka spring-apache-camel spring-autowire spring-batch spring-boot + spring-cloud-data-flow + spring-cloud spring-core spring-cucumber spring-data-cassandra spring-data-couchbase-2 + spring-data-dynamodb spring-data-elasticsearch - spring-data-neo4j spring-data-mongodb + spring-data-neo4j spring-data-redis spring-data-rest spring-exceptions spring-freemarker spring-hibernate3 spring-hibernate4 + spring-integration spring-jms spring-jooq spring-jpa @@ -96,47 +107,42 @@ spring-mockito spring-mvc-java spring-mvc-no-xml - spring-mvc-xml spring-mvc-tiles + spring-mvc-velocity + spring-mvc-web-vs-initializer + spring-mvc-xml spring-openid spring-protobuf spring-quartz - spring-spel - spring-rest spring-rest-angular spring-rest-docs - spring-cloud - spring-cloud-data-flow - + spring-rest spring-security-basic-auth spring-security-custom-permission - spring-security-custom-voter spring-security-mvc-custom spring-security-mvc-digest-auth spring-security-mvc-ldap spring-security-mvc-login spring-security-mvc-persisted-remember-me spring-security-mvc-session - spring-security-rest spring-security-rest-basic-auth spring-security-rest-custom spring-security-rest-digest-auth spring-security-rest-full + spring-security-rest spring-security-x509 + spring-spel spring-thymeleaf + spring-userservice spring-zuul - spring-mvc-velocity - jsf - xml - xmlunit2 - lombok - redis + testing wicket + + xml + xmlunit2 xstream - java-cassandra - annotations diff --git a/resteasy/pom.xml b/resteasy/pom.xml index ec9e87b0d1..04e8576e1f 100644 --- a/resteasy/pom.xml +++ b/resteasy/pom.xml @@ -10,6 +10,8 @@ 3.0.14.Final + 2.19.1 + 1.6.0 @@ -23,6 +25,35 @@ 1.8 + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + + org.codehaus.cargo + cargo-maven2-plugin + ${cargo-maven2-plugin.version} + + true + + jetty8x + embedded + + + + 8082 + + + + @@ -73,5 +104,66 @@ + + + live + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*IntegrationTest.java + + + **/*LiveTest.java + + + + + + + json + + + + + org.codehaus.cargo + cargo-maven2-plugin + ${cargo-maven2-plugin.version} + + false + + + + start-server + pre-integration-test + + start + + + + stop-server + post-integration-test + + stop + + + + + + + + + + \ No newline at end of file diff --git a/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java b/resteasy/src/test/java/com/baeldung/server/RestEasyClientLiveTest.java similarity index 61% rename from resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java rename to resteasy/src/test/java/com/baeldung/server/RestEasyClientLiveTest.java index ef18b0f23f..7e709edb96 100644 --- a/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/resteasy/src/test/java/com/baeldung/server/RestEasyClientLiveTest.java @@ -1,7 +1,15 @@ package com.baeldung.server; -import com.baeldung.client.ServicesInterface; -import com.baeldung.model.Movie; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.Locale; + +import javax.naming.NamingException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; + import org.apache.commons.io.IOUtils; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; @@ -14,18 +22,13 @@ import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine; import org.junit.Before; import org.junit.Test; -import javax.naming.NamingException; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.List; -import java.util.Locale; -public class RestEasyClientTest { +import com.baeldung.client.ServicesInterface; +import com.baeldung.model.Movie; - public static final UriBuilder FULL_PATH = UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest"); +public class RestEasyClientLiveTest { + + public static final UriBuilder FULL_PATH = UriBuilder.fromPath("http://127.0.0.1:8082/RestEasyTutorial/rest"); Movie transformerMovie = null; Movie batmanMovie = null; ObjectMapper jsonMapper = null; @@ -35,22 +38,22 @@ public class RestEasyClientTest { jsonMapper = new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + final SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); jsonMapper.setDateFormat(sdf); - try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/transformer.json")) { - String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + try (InputStream inputStream = new RestEasyClientLiveTest().getClass().getResourceAsStream("./movies/transformer.json")) { + final String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); throw new RuntimeException("Test is going to die ...", e); } - try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/batman.json")) { - String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + try (InputStream inputStream = new RestEasyClientLiveTest().getClass().getResourceAsStream("./movies/batman.json")) { + final String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException("Test is going to die ...", e); } } @@ -58,41 +61,41 @@ public class RestEasyClientTest { @Test public void testListAllMovies() { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface proxy = target.proxy(ServicesInterface.class); + final ResteasyClient client = new ResteasyClientBuilder().build(); + final ResteasyWebTarget target = client.target(FULL_PATH); + final ServicesInterface proxy = target.proxy(ServicesInterface.class); Response moviesResponse = proxy.addMovie(transformerMovie); moviesResponse.close(); moviesResponse = proxy.addMovie(batmanMovie); moviesResponse.close(); - List movies = proxy.listMovies(); + final List movies = proxy.listMovies(); System.out.println(movies); } @Test public void testMovieByImdbId() { - String transformerImdbId = "tt0418279"; + final String transformerImdbId = "tt0418279"; - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface proxy = target.proxy(ServicesInterface.class); + final ResteasyClient client = new ResteasyClientBuilder().build(); + final ResteasyWebTarget target = client.target(FULL_PATH); + final ServicesInterface proxy = target.proxy(ServicesInterface.class); - Response moviesResponse = proxy.addMovie(transformerMovie); + final Response moviesResponse = proxy.addMovie(transformerMovie); moviesResponse.close(); - Movie movies = proxy.movieByImdbId(transformerImdbId); + final Movie movies = proxy.movieByImdbId(transformerImdbId); System.out.println(movies); } @Test public void testAddMovie() { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface proxy = target.proxy(ServicesInterface.class); + final ResteasyClient client = new ResteasyClientBuilder().build(); + final ResteasyWebTarget target = client.target(FULL_PATH); + final ServicesInterface proxy = target.proxy(ServicesInterface.class); Response moviesResponse = proxy.addMovie(batmanMovie); moviesResponse.close(); @@ -109,17 +112,15 @@ public class RestEasyClientTest { @Test public void testAddMovieMultiConnection() { - PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); - CloseableHttpClient httpClient = HttpClients.custom() - .setConnectionManager(cm) - .build(); - ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient); - ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build(); - ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface proxy = target.proxy(ServicesInterface.class); + final PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); + final CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build(); + final ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient); + final ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build(); + final ResteasyWebTarget target = client.target(FULL_PATH); + final ServicesInterface proxy = target.proxy(ServicesInterface.class); - Response batmanResponse = proxy.addMovie(batmanMovie); - Response transformerResponse = proxy.addMovie(transformerMovie); + final Response batmanResponse = proxy.addMovie(batmanMovie); + final Response transformerResponse = proxy.addMovie(transformerMovie); if (batmanResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { System.out.println("Batman Movie creation Failed : HTTP error code : " + batmanResponse.getStatus()); @@ -132,16 +133,14 @@ public class RestEasyClientTest { transformerResponse.close(); cm.close(); - - } @Test public void testDeleteMovie() { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface proxy = target.proxy(ServicesInterface.class); + final ResteasyClient client = new ResteasyClientBuilder().build(); + final ResteasyWebTarget target = client.target(FULL_PATH); + final ServicesInterface proxy = target.proxy(ServicesInterface.class); Response moviesResponse = proxy.addMovie(batmanMovie); moviesResponse.close(); @@ -159,9 +158,9 @@ public class RestEasyClientTest { @Test public void testUpdateMovie() { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface proxy = target.proxy(ServicesInterface.class); + final ResteasyClient client = new ResteasyClientBuilder().build(); + final ResteasyWebTarget target = client.target(FULL_PATH); + final ServicesInterface proxy = target.proxy(ServicesInterface.class); Response moviesResponse = proxy.addMovie(batmanMovie); moviesResponse.close(); diff --git a/selenium-junit-testng/pom.xml b/selenium-junit-testng/pom.xml index 861c0b1986..cc96ea8529 100644 --- a/selenium-junit-testng/pom.xml +++ b/selenium-junit-testng/pom.xml @@ -53,7 +53,7 @@ org.seleniumhq.selenium selenium-java - 2.53.1 + 3.0.1 junit diff --git a/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java b/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java index 1007bf7503..58d47c0162 100644 --- a/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java +++ b/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java @@ -1,6 +1,7 @@ package main.java.com.baeldung.selenium; import java.util.List; +import java.util.NoSuchElementException; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; @@ -14,6 +15,7 @@ public class SeleniumExample { private String url = "http://www.baeldung.com/"; public SeleniumExample() { + System.setProperty("webdriver.firefox.marionette", "C:\\selenium\\geckodriver.exe"); webDriver = new FirefoxDriver(); webDriver.manage().window().maximize(); webDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); @@ -36,8 +38,12 @@ public class SeleniumExample { private void closeOverlay() { List webElementList = webDriver.findElements(By.tagName("a")); - if (webElementList != null && !webElementList.isEmpty()) { - webElementList.stream().filter(webElement -> "Close".equalsIgnoreCase(webElement.getAttribute("title"))).findAny().get().click(); + try { + if (webElementList != null && !webElementList.isEmpty()) { + webElementList.stream().filter(webElement -> "Close".equalsIgnoreCase(webElement.getAttribute("title"))).findAny().orElseThrow(NoSuchElementException::new).click(); + } + } catch (NoSuchElementException exception) { + exception.printStackTrace(); } } @@ -50,8 +56,6 @@ public class SeleniumExample { } public boolean isAuthorInformationAvailable() { - return webDriver - .findElement(By.xpath("//*[contains(text(), 'Eugen – an engineer')]")) - .isDisplayed(); + return webDriver.findElement(By.xpath("//*[contains(text(), 'Eugen – an engineer')]")).isDisplayed(); } } diff --git a/spring-all/src/main/webapp/WEB-INF/web.xml b/spring-all/src/main/webapp/WEB-INF/web.xml index 4e0e7a231c..3ac9e9ed8c 100644 --- a/spring-all/src/main/webapp/WEB-INF/web.xml +++ b/spring-all/src/main/webapp/WEB-INF/web.xml @@ -9,11 +9,11 @@ org.springframework.web.servlet.DispatcherServlet - 1 contextConfigLocation /WEB-INF/test-mvc.xml + 1 diff --git a/spring-cloud-data-flow/batch-job/pom.xml b/spring-cloud-data-flow/batch-job/pom.xml index 2ddb9d85a3..99e57d4c20 100644 --- a/spring-cloud-data-flow/batch-job/pom.xml +++ b/spring-cloud-data-flow/batch-job/pom.xml @@ -67,8 +67,17 @@ org.springframework.boot spring-boot-maven-plugin - - - + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + diff --git a/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/spring/cloud/DataFlowServerApplicationTests.java b/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/spring/cloud/BatchJobApplicationIntegrationTest.java similarity index 86% rename from spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/spring/cloud/DataFlowServerApplicationTests.java rename to spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/spring/cloud/BatchJobApplicationIntegrationTest.java index f853e29244..f8dfdec197 100644 --- a/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/spring/cloud/DataFlowServerApplicationTests.java +++ b/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/spring/cloud/BatchJobApplicationIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class DataFlowServerApplicationTests { +public class BatchJobApplicationIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud-data-flow/data-flow-server/pom.xml b/spring-cloud-data-flow/data-flow-server/pom.xml index 94c4106d6f..451a58e12a 100644 --- a/spring-cloud-data-flow/data-flow-server/pom.xml +++ b/spring-cloud-data-flow/data-flow-server/pom.xml @@ -62,8 +62,53 @@ org.springframework.boot spring-boot-maven-plugin - - + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + diff --git a/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/spring/cloud/DataFlowServerApplicationIntegrationTest.java b/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/spring/cloud/DataFlowServerApplicationIntegrationTest.java new file mode 100644 index 0000000000..bb8660b816 --- /dev/null +++ b/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/spring/cloud/DataFlowServerApplicationIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung.spring.cloud; + +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 DataFlowServerApplicationIntegrationTest { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-cloud-data-flow/data-flow-shell/pom.xml b/spring-cloud-data-flow/data-flow-shell/pom.xml index a074fef88f..31d3dce507 100644 --- a/spring-cloud-data-flow/data-flow-shell/pom.xml +++ b/spring-cloud-data-flow/data-flow-shell/pom.xml @@ -62,8 +62,18 @@ org.springframework.boot spring-boot-maven-plugin - - + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + diff --git a/spring-cloud-data-flow/data-flow-shell/spring-shell.log b/spring-cloud-data-flow/data-flow-shell/spring-shell.log index d497215e2a..92a8488c7d 100644 --- a/spring-cloud-data-flow/data-flow-shell/spring-shell.log +++ b/spring-cloud-data-flow/data-flow-shell/spring-shell.log @@ -1 +1,2 @@ // dataflow 1.2.0.RELEASE log opened at 2016-10-20 13:13:20 +// dataflow 1.2.0.RELEASE log opened at 2016-10-24 16:51:17 diff --git a/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/spring/cloud/BatchJobApplicationTests.java b/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationIntegrationTest.java similarity index 85% rename from spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/spring/cloud/BatchJobApplicationTests.java rename to spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationIntegrationTest.java index 5f18ec75c4..5ab3292388 100644 --- a/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/spring/cloud/BatchJobApplicationTests.java +++ b/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class BatchJobApplicationTests { +public class DataFlowShellApplicationIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud-data-flow/log-sink/pom.xml b/spring-cloud-data-flow/log-sink/pom.xml index 8415d95373..db488c05ef 100644 --- a/spring-cloud-data-flow/log-sink/pom.xml +++ b/spring-cloud-data-flow/log-sink/pom.xml @@ -1,62 +1,105 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - org.baeldung.spring.cloud - log-sink - 0.0.1-SNAPSHOT - jar + org.baeldung.spring.cloud + log-sink + 0.0.1-SNAPSHOT + jar - log-sink - Demo project for Spring Boot + log-sink + Demo project for Spring Boot - - org.springframework.boot - spring-boot-starter-parent - 1.4.0.RELEASE - - + + org.springframework.boot + spring-boot-starter-parent + 1.4.0.RELEASE + + - - UTF-8 - UTF-8 - 1.8 - + + UTF-8 + UTF-8 + 1.8 + - - - org.springframework.cloud - spring-cloud-starter-stream-rabbit - + + + org.springframework.cloud + spring-cloud-starter-stream-rabbit + - - org.springframework.boot - spring-boot-starter-test - test - - + + org.springframework.boot + spring-boot-starter-test + test + + - - - - org.springframework.cloud - spring-cloud-dependencies - Brixton.SR5 - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + org.springframework.cloud + spring-cloud-dependencies + Brixton.SR5 + pom + import + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + diff --git a/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationTests.java b/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java similarity index 86% rename from spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationTests.java rename to spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java index 7e2bc1cb37..b362d72705 100644 --- a/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationTests.java +++ b/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class DataFlowShellApplicationTests { +public class LogSinkApplicationIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud-data-flow/time-processor/pom.xml b/spring-cloud-data-flow/time-processor/pom.xml index bc2efe7754..8277c9c836 100644 --- a/spring-cloud-data-flow/time-processor/pom.xml +++ b/spring-cloud-data-flow/time-processor/pom.xml @@ -49,14 +49,57 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + diff --git a/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java b/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java new file mode 100644 index 0000000000..9bd0fd8c24 --- /dev/null +++ b/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung.spring.cloud; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class TimeProcessorApplicationIntegrationTest { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationTests.java b/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationTests.java deleted file mode 100644 index 875346f9db..0000000000 --- a/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung.spring.cloud; - -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 TimeProcessorApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud-data-flow/time-source/pom.xml b/spring-cloud-data-flow/time-source/pom.xml index 587b782227..086d761f78 100644 --- a/spring-cloud-data-flow/time-source/pom.xml +++ b/spring-cloud-data-flow/time-source/pom.xml @@ -49,14 +49,57 @@ - - - - org.springframework.boot - spring-boot-maven-plugin - - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + + + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + + + **/*IntegrationTest.java + + + + + + + json + + + + + + + diff --git a/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationTests.java b/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationIntegrationTest.java similarity index 85% rename from spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationTests.java rename to spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationIntegrationTest.java index 9f88c7f632..6d71a785a3 100644 --- a/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationTests.java +++ b/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class LogSinkApplicationTests { +public class TimeSourceApplicationIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationTests.java b/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationTests.java deleted file mode 100644 index 61fd8323d2..0000000000 --- a/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.baeldung.spring.cloud; - -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 TimeSourceApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/spring-cloud/spring-cloud-bootstrap/application-config/discovery.properties b/spring-cloud/spring-cloud-bootstrap/application-config/discovery.properties index 7f3df86c7e..e6ca72cf69 100644 --- a/spring-cloud/spring-cloud-bootstrap/application-config/discovery.properties +++ b/spring-cloud/spring-cloud-bootstrap/application-config/discovery.properties @@ -3,6 +3,9 @@ server.port=8082 eureka.instance.hostname=localhost -eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/ +eureka.client.serviceUrl.defaultZone=http://discUser:discPassword@localhost:8082/eureka/ eureka.client.register-with-eureka=false eureka.client.fetch-registry=false + +spring.redis.host=localhost +spring.redis.port=6379 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/application-config/gateway.properties b/spring-cloud/spring-cloud-bootstrap/application-config/gateway.properties index 77faec8421..6f52a59db9 100644 --- a/spring-cloud/spring-cloud-bootstrap/application-config/gateway.properties +++ b/spring-cloud/spring-cloud-bootstrap/application-config/gateway.properties @@ -3,8 +3,21 @@ server.port=8080 eureka.client.region = default eureka.client.registryFetchIntervalSeconds = 5 -eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/ + +management.security.sessions=always zuul.routes.resource.path=/resource/** -hystrix.command.resource.execution.isolation.thread.timeoutInMilliseconds: 5000 +zuul.routes.resource.sensitive-headers=Set-Cookie,Authorization +hystrix.command.resource.execution.isolation.thread.timeoutInMilliseconds=600000 +zuul.routes.discovery.path=/discovery/** +zuul.routes.discovery.sensitive-headers=Set-Cookie,Authorization +zuul.routes.discovery.url=http://localhost:8082 +hystrix.command.discovery.execution.isolation.thread.timeoutInMilliseconds=600000 + +logging.level.org.springframework.web.=debug +logging.level.org.springframework.security=debug +logging.level.org.springframework.cloud.netflix.zuul=debug + +spring.redis.host=localhost +spring.redis.port=6379 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/application-config/resource.properties b/spring-cloud/spring-cloud-bootstrap/application-config/resource.properties index 4e6cf3817c..9fb610d655 100644 --- a/spring-cloud/spring-cloud-bootstrap/application-config/resource.properties +++ b/spring-cloud/spring-cloud-bootstrap/application-config/resource.properties @@ -2,7 +2,16 @@ spring.application.name=resource server.port=8083 resource.returnString=hello cloud +resource.user.returnString=hello cloud user +resource.admin.returnString=hello cloud admin eureka.client.region = default eureka.client.registryFetchIntervalSeconds = 5 -eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/ + +management.security.sessions=never + +logging.level.org.springframework.web.=debug +logging.level.org.springframework.security=debug + +spring.redis.host=localhost +spring.redis.port=6379 diff --git a/spring-cloud/spring-cloud-bootstrap/config/pom.xml b/spring-cloud/spring-cloud-bootstrap/config/pom.xml index 0cb217acfb..bcb40ac062 100644 --- a/spring-cloud/spring-cloud-bootstrap/config/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/config/pom.xml @@ -28,6 +28,10 @@ spring-boot-starter-test test + + org.springframework.boot + spring-boot-starter-security + @@ -48,6 +52,15 @@ org.springframework.boot spring-boot-maven-plugin + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + diff --git a/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/integration/config/ConfigApplication.java b/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/ConfigApplication.java similarity index 89% rename from spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/integration/config/ConfigApplication.java rename to spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/ConfigApplication.java index ff6c093b8b..847c86f881 100644 --- a/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/integration/config/ConfigApplication.java +++ b/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/ConfigApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.cloud.integration.config; +package com.baeldung.spring.cloud.bootstrap.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/SecurityConfig.java b/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/SecurityConfig.java new file mode 100644 index 0000000000..e607144f11 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/config/src/main/java/com/baeldung/spring/cloud/bootstrap/config/SecurityConfig.java @@ -0,0 +1,29 @@ +package com.baeldung.spring.cloud.bootstrap.config; + +import org.springframework.beans.factory.annotation.Autowired; +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; + +@Configuration +@EnableWebSecurity +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception{ + auth.inMemoryAuthentication().withUser("configUser").password("configPassword").roles("SYSTEM"); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests() + .anyRequest().hasRole("SYSTEM") + .and() + .httpBasic() + .and() + .csrf() + .disable(); + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/application.properties b/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/application.properties index 6f614d0690..6c47d001f4 100644 --- a/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/application.properties +++ b/spring-cloud/spring-cloud-bootstrap/config/src/main/resources/application.properties @@ -5,4 +5,4 @@ spring.cloud.config.server.git.uri=file:///${user.home}/application-config eureka.client.region = default eureka.client.registryFetchIntervalSeconds = 5 -eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka \ No newline at end of file +eureka.client.serviceUrl.defaultZone=http://discUser:discPassword@localhost:8082/eureka/ \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml index ee7c589549..f3cb3be2af 100644 --- a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml @@ -28,6 +28,20 @@ spring-boot-starter-test test
+ + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.session + spring-session + 1.2.1.RELEASE + + + org.springframework.boot + spring-boot-starter-data-redis + @@ -48,6 +62,15 @@ org.springframework.boot spring-boot-maven-plugin + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/integration/discovery/DiscoveryApplication.java b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/DiscoveryApplication.java similarity index 87% rename from spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/integration/discovery/DiscoveryApplication.java rename to spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/DiscoveryApplication.java index a21c65312f..32bcdc90b6 100644 --- a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/integration/discovery/DiscoveryApplication.java +++ b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/DiscoveryApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.cloud.integration.discovery; +package com.baeldung.spring.cloud.bootstrap.discovery; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/SecurityConfig.java b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/SecurityConfig.java new file mode 100644 index 0000000000..b559da6394 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/SecurityConfig.java @@ -0,0 +1,65 @@ +package com.baeldung.spring.cloud.bootstrap.discovery; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.Order; +import org.springframework.http.HttpMethod; +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.config.http.SessionCreationPolicy; + +@Configuration +@EnableWebSecurity +@Order(1) +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception{ + auth.inMemoryAuthentication().withUser("discUser").password("discPassword").roles("SYSTEM"); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.ALWAYS) + .and() + .requestMatchers() + .antMatchers("/eureka/**") + .and() + .authorizeRequests() + .antMatchers("/eureka/**").hasRole("SYSTEM") + .anyRequest().denyAll() + .and() + .httpBasic() + .and() + .csrf() + .disable(); + } + + @Configuration + //no order tag means this is the last security filter to be evaluated + public static class AdminSecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { + auth.inMemoryAuthentication(); + } + + @Override protected void configure(HttpSecurity http) throws Exception { + http + .sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.NEVER) + .and() + .httpBasic() + .disable() + .authorizeRequests() + .antMatchers(HttpMethod.GET, "/").hasRole("ADMIN") + .antMatchers("/info","/health").authenticated() + .anyRequest().denyAll() + .and() + .csrf() + .disable(); + } + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/SessionConfig.java b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/SessionConfig.java new file mode 100644 index 0000000000..83e5f51c97 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/java/com/baeldung/spring/cloud/bootstrap/discovery/SessionConfig.java @@ -0,0 +1,8 @@ +package com.baeldung.spring.cloud.bootstrap.discovery; + +import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer; + +@EnableRedisHttpSession +public class SessionConfig extends AbstractHttpSessionApplicationInitializer { +} diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/bootstrap.properties index ca9d59c9ed..d31caf55b5 100644 --- a/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/bootstrap.properties +++ b/spring-cloud/spring-cloud-bootstrap/discovery/src/main/resources/bootstrap.properties @@ -1,2 +1,4 @@ spring.cloud.config.name=discovery -spring.cloud.config.uri=http://localhost:8081 \ No newline at end of file +spring.cloud.config.uri=http://localhost:8081 +spring.cloud.config.username=configUser +spring.cloud.config.password=configPassword \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml index 8e56d0fd35..add551ff95 100644 --- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml @@ -27,6 +27,21 @@ org.springframework.cloud spring-cloud-starter-zuul + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.session + spring-session + 1.2.1.RELEASE + + + org.springframework.boot + spring-boot-starter-data-redis + + org.springframework.boot spring-boot-starter-test @@ -52,6 +67,15 @@ org.springframework.boot spring-boot-maven-plugin + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplication.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplication.java new file mode 100644 index 0000000000..a3d2df5357 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/GatewayApplication.java @@ -0,0 +1,40 @@ +package com.baeldung.spring.cloud.bootstrap.gateway; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.loadbalancer.LoadBalanced; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.cloud.netflix.ribbon.RibbonClientSpecification; +import org.springframework.cloud.netflix.ribbon.SpringClientFactory; +import org.springframework.cloud.netflix.zuul.EnableZuulProxy; +import org.springframework.context.annotation.Bean; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.List; + +@SpringBootApplication +@EnableZuulProxy +@EnableEurekaClient +public class GatewayApplication { + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } + + @Autowired(required = false) + private List configurations = new ArrayList<>(); + + @Bean + @LoadBalanced RestTemplate restTemplate(){ + return new RestTemplate(); + } + + + @Bean + public SpringClientFactory springClientFactory() { + SpringClientFactory factory = new SpringClientFactory(); + factory.setConfigurations(this.configurations); + return factory; + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SecurityConfig.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SecurityConfig.java new file mode 100644 index 0000000000..60dccf9042 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SecurityConfig.java @@ -0,0 +1,37 @@ +package com.baeldung.spring.cloud.bootstrap.gateway; + +import org.springframework.beans.factory.annotation.Autowired; +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; + +@EnableWebSecurity +@Configuration +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { + auth.inMemoryAuthentication() + .withUser("user").password("password").roles("USER") + .and() + .withUser("admin").password("admin").roles("ADMIN"); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/resource/hello/cloud").permitAll() + .antMatchers("/eureka/**").hasRole("ADMIN") + .anyRequest().authenticated() + .and() + .formLogin() + .and() + .logout().permitAll() + .logoutSuccessUrl("/resource/hello/cloud").permitAll() + .and() + .csrf() + .disable(); + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SessionConfig.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SessionConfig.java new file mode 100644 index 0000000000..14f7deb770 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/SessionConfig.java @@ -0,0 +1,11 @@ +package com.baeldung.spring.cloud.bootstrap.gateway; + +import org.springframework.context.annotation.Configuration; +import org.springframework.session.data.redis.RedisFlushMode; +import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer; + +@Configuration +@EnableRedisHttpSession(redisFlushMode = RedisFlushMode.IMMEDIATE) +public class SessionConfig extends AbstractHttpSessionApplicationInitializer { +} diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/filter/SessionSavingZuulPreFilter.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/filter/SessionSavingZuulPreFilter.java new file mode 100644 index 0000000000..9a2b5bab74 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/bootstrap/gateway/filter/SessionSavingZuulPreFilter.java @@ -0,0 +1,47 @@ +package com.baeldung.spring.cloud.bootstrap.gateway.filter; + +import com.netflix.zuul.ZuulFilter; +import com.netflix.zuul.context.RequestContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.session.Session; +import org.springframework.session.SessionRepository; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpSession; + +@Component +public class SessionSavingZuulPreFilter extends ZuulFilter { + + private Logger log = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private SessionRepository repository; + + @Override public boolean shouldFilter() { + return true; + } + + @Override + public Object run() { + RequestContext context = RequestContext.getCurrentContext(); + + HttpSession httpSession = context.getRequest().getSession(); + Session session = repository.getSession(httpSession.getId()); + + context.addZuulRequestHeader("Cookie", "SESSION=" + httpSession.getId()); + + log.info("ZuulPreFilter session proxy: {}", session.getId()); + + return null; + } + + @Override public String filterType() { + return "pre"; + } + + @Override public int filterOrder() { + return 0; + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/integration/resource/GatewayApplication.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/integration/resource/GatewayApplication.java deleted file mode 100644 index 66e7c36f2a..0000000000 --- a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/java/com/baeldung/spring/cloud/integration/resource/GatewayApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.spring.cloud.integration.resource; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.netflix.eureka.EnableEurekaClient; -import org.springframework.cloud.netflix.zuul.EnableZuulProxy; - -@SpringBootApplication -@EnableZuulProxy -@EnableEurekaClient -public class GatewayApplication { - public static void main(String[] args) { - SpringApplication.run(GatewayApplication.class, args); - } -} diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/bootstrap.properties b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/bootstrap.properties index 9610d72675..43491ff36b 100644 --- a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/bootstrap.properties +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/bootstrap.properties @@ -1,5 +1,7 @@ spring.cloud.config.name=gateway spring.cloud.config.discovery.service-id=config spring.cloud.config.discovery.enabled=true +spring.cloud.config.username=configUser +spring.cloud.config.password=configPassword -eureka.client.serviceUrl.defaultZone=http://localhost:8082/eureka/ \ No newline at end of file +eureka.client.serviceUrl.defaultZone=http://discUser:discPassword@localhost:8082/eureka/ \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/css/wro.css b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/css/wro.css new file mode 100644 index 0000000000..e023c0a145 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/css/wro.css @@ -0,0 +1,6393 @@ +html { + font-family: sans-serif; + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; +} +body { + margin: 0; +} +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} +audio, +canvas, +progress, +video { + display: inline-block; + vertical-align: baseline; +} +audio:not([controls]) { + display: none; + height: 0; +} +[hidden], +template { + display: none; +} +a { + background: transparent; +} +a:active, +a:hover { + outline: 0; +} +abbr[title] { + border-bottom: 1px dotted; +} +b, +strong { + font-weight: bold; +} +dfn { + font-style: italic; +} +h1 { + font-size: 2em; + margin: 0.67em 0; +} +mark { + background: #ff0; + color: #000; +} +small { + font-size: 80%; +} +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} +sup { + top: -0.5em; +} +sub { + bottom: -0.25em; +} +img { + border: 0; +} +svg:not(:root) { + overflow: hidden; +} +figure { + margin: 1em 40px; +} +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} +pre { + overflow: auto; +} +code, +kbd, +pre, +samp { + font-family: monospace, monospace; + font-size: 1em; +} +button, +input, +optgroup, +select, +textarea { + color: inherit; + font: inherit; + margin: 0; +} +button { + overflow: visible; +} +button, +select { + text-transform: none; +} +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + cursor: pointer; +} +button[disabled], +html input[disabled] { + cursor: default; +} +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} +input { + line-height: normal; +} +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; + padding: 0; +} +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} +input[type="search"] { + -webkit-appearance: textfield; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} +legend { + border: 0; + padding: 0; +} +textarea { + overflow: auto; +} +optgroup { + font-weight: bold; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +td, +th { + padding: 0; +} +@media print { + * { + text-shadow: none !important; + color: #000 !important; + background: transparent !important; + box-shadow: none !important; + } + a, + a:visited { + text-decoration: underline; + } + a[href]:after { + content: " (" attr(href) ")"; + } + abbr[title]:after { + content: " (" attr(title) ")"; + } + a[href^="javascript:"]:after, + a[href^="#"]:after { + content: ""; + } + pre, + blockquote { + border: 1px solid #999; + page-break-inside: avoid; + } + thead { + display: table-header-group; + } + tr, + img { + page-break-inside: avoid; + } + img { + max-width: 100% !important; + } + p, + h2, + h3 { + orphans: 3; + widows: 3; + } + h2, + h3 { + page-break-after: avoid; + } + select { + background: #fff !important; + } + .navbar { + display: none; + } + .table td, + .table th { + background-color: #fff !important; + } + .btn > .caret, + .dropup > .btn > .caret { + border-top-color: #000 !important; + } + .label { + border: 1px solid #000; + } + .table { + border-collapse: collapse !important; + } + .table-bordered th, + .table-bordered td { + border: 1px solid #ddd !important; + } +} +@font-face { + font-family: 'Glyphicons Halflings'; + src: url('../fonts/glyphicons-halflings-regular.eot'); + src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); +} +.glyphicon { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +.glyphicon-asterisk:before { + content: "\2a"; +} +.glyphicon-plus:before { + content: "\2b"; +} +.glyphicon-euro:before { + content: "\20ac"; +} +.glyphicon-minus:before { + content: "\2212"; +} +.glyphicon-cloud:before { + content: "\2601"; +} +.glyphicon-envelope:before { + content: "\2709"; +} +.glyphicon-pencil:before { + content: "\270f"; +} +.glyphicon-glass:before { + content: "\e001"; +} +.glyphicon-music:before { + content: "\e002"; +} +.glyphicon-search:before { + content: "\e003"; +} +.glyphicon-heart:before { + content: "\e005"; +} +.glyphicon-star:before { + content: "\e006"; +} +.glyphicon-star-empty:before { + content: "\e007"; +} +.glyphicon-user:before { + content: "\e008"; +} +.glyphicon-film:before { + content: "\e009"; +} +.glyphicon-th-large:before { + content: "\e010"; +} +.glyphicon-th:before { + content: "\e011"; +} +.glyphicon-th-list:before { + content: "\e012"; +} +.glyphicon-ok:before { + content: "\e013"; +} +.glyphicon-remove:before { + content: "\e014"; +} +.glyphicon-zoom-in:before { + content: "\e015"; +} +.glyphicon-zoom-out:before { + content: "\e016"; +} +.glyphicon-off:before { + content: "\e017"; +} +.glyphicon-signal:before { + content: "\e018"; +} +.glyphicon-cog:before { + content: "\e019"; +} +.glyphicon-trash:before { + content: "\e020"; +} +.glyphicon-home:before { + content: "\e021"; +} +.glyphicon-file:before { + content: "\e022"; +} +.glyphicon-time:before { + content: "\e023"; +} +.glyphicon-road:before { + content: "\e024"; +} +.glyphicon-download-alt:before { + content: "\e025"; +} +.glyphicon-download:before { + content: "\e026"; +} +.glyphicon-upload:before { + content: "\e027"; +} +.glyphicon-inbox:before { + content: "\e028"; +} +.glyphicon-play-circle:before { + content: "\e029"; +} +.glyphicon-repeat:before { + content: "\e030"; +} +.glyphicon-refresh:before { + content: "\e031"; +} +.glyphicon-list-alt:before { + content: "\e032"; +} +.glyphicon-lock:before { + content: "\e033"; +} +.glyphicon-flag:before { + content: "\e034"; +} +.glyphicon-headphones:before { + content: "\e035"; +} +.glyphicon-volume-off:before { + content: "\e036"; +} +.glyphicon-volume-down:before { + content: "\e037"; +} +.glyphicon-volume-up:before { + content: "\e038"; +} +.glyphicon-qrcode:before { + content: "\e039"; +} +.glyphicon-barcode:before { + content: "\e040"; +} +.glyphicon-tag:before { + content: "\e041"; +} +.glyphicon-tags:before { + content: "\e042"; +} +.glyphicon-book:before { + content: "\e043"; +} +.glyphicon-bookmark:before { + content: "\e044"; +} +.glyphicon-print:before { + content: "\e045"; +} +.glyphicon-camera:before { + content: "\e046"; +} +.glyphicon-font:before { + content: "\e047"; +} +.glyphicon-bold:before { + content: "\e048"; +} +.glyphicon-italic:before { + content: "\e049"; +} +.glyphicon-text-height:before { + content: "\e050"; +} +.glyphicon-text-width:before { + content: "\e051"; +} +.glyphicon-align-left:before { + content: "\e052"; +} +.glyphicon-align-center:before { + content: "\e053"; +} +.glyphicon-align-right:before { + content: "\e054"; +} +.glyphicon-align-justify:before { + content: "\e055"; +} +.glyphicon-list:before { + content: "\e056"; +} +.glyphicon-indent-left:before { + content: "\e057"; +} +.glyphicon-indent-right:before { + content: "\e058"; +} +.glyphicon-facetime-video:before { + content: "\e059"; +} +.glyphicon-picture:before { + content: "\e060"; +} +.glyphicon-map-marker:before { + content: "\e062"; +} +.glyphicon-adjust:before { + content: "\e063"; +} +.glyphicon-tint:before { + content: "\e064"; +} +.glyphicon-edit:before { + content: "\e065"; +} +.glyphicon-share:before { + content: "\e066"; +} +.glyphicon-check:before { + content: "\e067"; +} +.glyphicon-move:before { + content: "\e068"; +} +.glyphicon-step-backward:before { + content: "\e069"; +} +.glyphicon-fast-backward:before { + content: "\e070"; +} +.glyphicon-backward:before { + content: "\e071"; +} +.glyphicon-play:before { + content: "\e072"; +} +.glyphicon-pause:before { + content: "\e073"; +} +.glyphicon-stop:before { + content: "\e074"; +} +.glyphicon-forward:before { + content: "\e075"; +} +.glyphicon-fast-forward:before { + content: "\e076"; +} +.glyphicon-step-forward:before { + content: "\e077"; +} +.glyphicon-eject:before { + content: "\e078"; +} +.glyphicon-chevron-left:before { + content: "\e079"; +} +.glyphicon-chevron-right:before { + content: "\e080"; +} +.glyphicon-plus-sign:before { + content: "\e081"; +} +.glyphicon-minus-sign:before { + content: "\e082"; +} +.glyphicon-remove-sign:before { + content: "\e083"; +} +.glyphicon-ok-sign:before { + content: "\e084"; +} +.glyphicon-question-sign:before { + content: "\e085"; +} +.glyphicon-info-sign:before { + content: "\e086"; +} +.glyphicon-screenshot:before { + content: "\e087"; +} +.glyphicon-remove-circle:before { + content: "\e088"; +} +.glyphicon-ok-circle:before { + content: "\e089"; +} +.glyphicon-ban-circle:before { + content: "\e090"; +} +.glyphicon-arrow-left:before { + content: "\e091"; +} +.glyphicon-arrow-right:before { + content: "\e092"; +} +.glyphicon-arrow-up:before { + content: "\e093"; +} +.glyphicon-arrow-down:before { + content: "\e094"; +} +.glyphicon-share-alt:before { + content: "\e095"; +} +.glyphicon-resize-full:before { + content: "\e096"; +} +.glyphicon-resize-small:before { + content: "\e097"; +} +.glyphicon-exclamation-sign:before { + content: "\e101"; +} +.glyphicon-gift:before { + content: "\e102"; +} +.glyphicon-leaf:before { + content: "\e103"; +} +.glyphicon-fire:before { + content: "\e104"; +} +.glyphicon-eye-open:before { + content: "\e105"; +} +.glyphicon-eye-close:before { + content: "\e106"; +} +.glyphicon-warning-sign:before { + content: "\e107"; +} +.glyphicon-plane:before { + content: "\e108"; +} +.glyphicon-calendar:before { + content: "\e109"; +} +.glyphicon-random:before { + content: "\e110"; +} +.glyphicon-comment:before { + content: "\e111"; +} +.glyphicon-magnet:before { + content: "\e112"; +} +.glyphicon-chevron-up:before { + content: "\e113"; +} +.glyphicon-chevron-down:before { + content: "\e114"; +} +.glyphicon-retweet:before { + content: "\e115"; +} +.glyphicon-shopping-cart:before { + content: "\e116"; +} +.glyphicon-folder-close:before { + content: "\e117"; +} +.glyphicon-folder-open:before { + content: "\e118"; +} +.glyphicon-resize-vertical:before { + content: "\e119"; +} +.glyphicon-resize-horizontal:before { + content: "\e120"; +} +.glyphicon-hdd:before { + content: "\e121"; +} +.glyphicon-bullhorn:before { + content: "\e122"; +} +.glyphicon-bell:before { + content: "\e123"; +} +.glyphicon-certificate:before { + content: "\e124"; +} +.glyphicon-thumbs-up:before { + content: "\e125"; +} +.glyphicon-thumbs-down:before { + content: "\e126"; +} +.glyphicon-hand-right:before { + content: "\e127"; +} +.glyphicon-hand-left:before { + content: "\e128"; +} +.glyphicon-hand-up:before { + content: "\e129"; +} +.glyphicon-hand-down:before { + content: "\e130"; +} +.glyphicon-circle-arrow-right:before { + content: "\e131"; +} +.glyphicon-circle-arrow-left:before { + content: "\e132"; +} +.glyphicon-circle-arrow-up:before { + content: "\e133"; +} +.glyphicon-circle-arrow-down:before { + content: "\e134"; +} +.glyphicon-globe:before { + content: "\e135"; +} +.glyphicon-wrench:before { + content: "\e136"; +} +.glyphicon-tasks:before { + content: "\e137"; +} +.glyphicon-filter:before { + content: "\e138"; +} +.glyphicon-briefcase:before { + content: "\e139"; +} +.glyphicon-fullscreen:before { + content: "\e140"; +} +.glyphicon-dashboard:before { + content: "\e141"; +} +.glyphicon-paperclip:before { + content: "\e142"; +} +.glyphicon-heart-empty:before { + content: "\e143"; +} +.glyphicon-link:before { + content: "\e144"; +} +.glyphicon-phone:before { + content: "\e145"; +} +.glyphicon-pushpin:before { + content: "\e146"; +} +.glyphicon-usd:before { + content: "\e148"; +} +.glyphicon-gbp:before { + content: "\e149"; +} +.glyphicon-sort:before { + content: "\e150"; +} +.glyphicon-sort-by-alphabet:before { + content: "\e151"; +} +.glyphicon-sort-by-alphabet-alt:before { + content: "\e152"; +} +.glyphicon-sort-by-order:before { + content: "\e153"; +} +.glyphicon-sort-by-order-alt:before { + content: "\e154"; +} +.glyphicon-sort-by-attributes:before { + content: "\e155"; +} +.glyphicon-sort-by-attributes-alt:before { + content: "\e156"; +} +.glyphicon-unchecked:before { + content: "\e157"; +} +.glyphicon-expand:before { + content: "\e158"; +} +.glyphicon-collapse-down:before { + content: "\e159"; +} +.glyphicon-collapse-up:before { + content: "\e160"; +} +.glyphicon-log-in:before { + content: "\e161"; +} +.glyphicon-flash:before { + content: "\e162"; +} +.glyphicon-log-out:before { + content: "\e163"; +} +.glyphicon-new-window:before { + content: "\e164"; +} +.glyphicon-record:before { + content: "\e165"; +} +.glyphicon-save:before { + content: "\e166"; +} +.glyphicon-open:before { + content: "\e167"; +} +.glyphicon-saved:before { + content: "\e168"; +} +.glyphicon-import:before { + content: "\e169"; +} +.glyphicon-export:before { + content: "\e170"; +} +.glyphicon-send:before { + content: "\e171"; +} +.glyphicon-floppy-disk:before { + content: "\e172"; +} +.glyphicon-floppy-saved:before { + content: "\e173"; +} +.glyphicon-floppy-remove:before { + content: "\e174"; +} +.glyphicon-floppy-save:before { + content: "\e175"; +} +.glyphicon-floppy-open:before { + content: "\e176"; +} +.glyphicon-credit-card:before { + content: "\e177"; +} +.glyphicon-transfer:before { + content: "\e178"; +} +.glyphicon-cutlery:before { + content: "\e179"; +} +.glyphicon-header:before { + content: "\e180"; +} +.glyphicon-compressed:before { + content: "\e181"; +} +.glyphicon-earphone:before { + content: "\e182"; +} +.glyphicon-phone-alt:before { + content: "\e183"; +} +.glyphicon-tower:before { + content: "\e184"; +} +.glyphicon-stats:before { + content: "\e185"; +} +.glyphicon-sd-video:before { + content: "\e186"; +} +.glyphicon-hd-video:before { + content: "\e187"; +} +.glyphicon-subtitles:before { + content: "\e188"; +} +.glyphicon-sound-stereo:before { + content: "\e189"; +} +.glyphicon-sound-dolby:before { + content: "\e190"; +} +.glyphicon-sound-5-1:before { + content: "\e191"; +} +.glyphicon-sound-6-1:before { + content: "\e192"; +} +.glyphicon-sound-7-1:before { + content: "\e193"; +} +.glyphicon-copyright-mark:before { + content: "\e194"; +} +.glyphicon-registration-mark:before { + content: "\e195"; +} +.glyphicon-cloud-download:before { + content: "\e197"; +} +.glyphicon-cloud-upload:before { + content: "\e198"; +} +.glyphicon-tree-conifer:before { + content: "\e199"; +} +.glyphicon-tree-deciduous:before { + content: "\e200"; +} +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +*:before, +*:after { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +html { + font-size: 10px; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); +} +body { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 1.428571429; + color: #f1f1f1; + background-color: #f1f1f1; +} +input, +button, +select, +textarea { + font-family: inherit; + font-size: inherit; + line-height: inherit; +} +a { + color: #5fa134; + text-decoration: none; +} +a:hover, +a:focus { + color: #5fa134; + text-decoration: underline; +} +a:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +figure { + margin: 0; +} +img { + vertical-align: middle; +} +.img-responsive, +.thumbnail > img, +.thumbnail a > img, +.carousel-inner > .item > img, +.carousel-inner > .item > a > img { + display: block; + width: 100% \9; + max-width: 100%; + height: auto; +} +.img-rounded { + border-radius: 0; +} +.img-thumbnail { + padding: 4px; + line-height: 1.428571429; + background-color: #f1f1f1; + border: 1px solid #ddd; + border-radius: 0; + -webkit-transition: all .2s ease-in-out; + -o-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; + display: inline-block; + width: 100% \9; + max-width: 100%; + height: auto; +} +.img-circle { + border-radius: 50%; +} +hr { + margin-top: 20px; + margin-bottom: 20px; + border: 0; + border-top: 1px solid #eeeeee; +} +.sr-only { + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + padding: 0; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; +} +.sr-only-focusable:active, +.sr-only-focusable:focus { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip: auto; +} +h1, +h2, +h3, +h4, +h5, +h6, +.h1, +.h2, +.h3, +.h4, +.h5, +.h6 { + font-family: inherit; + font-weight: 500; + line-height: 1.1; + color: inherit; +} +h1 small, +h2 small, +h3 small, +h4 small, +h5 small, +h6 small, +.h1 small, +.h2 small, +.h3 small, +.h4 small, +.h5 small, +.h6 small, +h1 .small, +h2 .small, +h3 .small, +h4 .small, +h5 .small, +h6 .small, +.h1 .small, +.h2 .small, +.h3 .small, +.h4 .small, +.h5 .small, +.h6 .small { + font-weight: normal; + line-height: 1; + color: #777777; +} +h1, +.h1, +h2, +.h2, +h3, +.h3 { + margin-top: 20px; + margin-bottom: 10px; +} +h1 small, +.h1 small, +h2 small, +.h2 small, +h3 small, +.h3 small, +h1 .small, +.h1 .small, +h2 .small, +.h2 .small, +h3 .small, +.h3 .small { + font-size: 65%; +} +h4, +.h4, +h5, +.h5, +h6, +.h6 { + margin-top: 10px; + margin-bottom: 10px; +} +h4 small, +.h4 small, +h5 small, +.h5 small, +h6 small, +.h6 small, +h4 .small, +.h4 .small, +h5 .small, +.h5 .small, +h6 .small, +.h6 .small { + font-size: 75%; +} +h1, +.h1 { + font-size: 36px; +} +h2, +.h2 { + font-size: 30px; +} +h3, +.h3 { + font-size: 24px; +} +h4, +.h4 { + font-size: 18px; +} +h5, +.h5 { + font-size: 14px; +} +h6, +.h6 { + font-size: 12px; +} +p { + margin: 0 0 10px; +} +.lead { + margin-bottom: 20px; + font-size: 16px; + font-weight: 300; + line-height: 1.4; +} +@media (min-width: 768px) { + .lead { + font-size: 21px; + } +} +small, +.small { + font-size: 85%; +} +cite { + font-style: normal; +} +mark, +.mark { + background-color: #fcf8e3; + padding: .2em; +} +.text-left { + text-align: left; +} +.text-right { + text-align: right; +} +.text-center { + text-align: center; +} +.text-justify { + text-align: justify; +} +.text-nowrap { + white-space: nowrap; +} +.text-lowercase { + text-transform: lowercase; +} +.text-uppercase { + text-transform: uppercase; +} +.text-capitalize { + text-transform: capitalize; +} +.text-muted { + color: #777777; +} +.text-primary { + color: #428bca; +} +a.text-primary:hover { + color: #3071a9; +} +.text-success { + color: #3c763d; +} +a.text-success:hover { + color: #2b542c; +} +.text-info { + color: #31708f; +} +a.text-info:hover { + color: #245269; +} +.text-warning { + color: #8a6d3b; +} +a.text-warning:hover { + color: #66512c; +} +.text-danger { + color: #a94442; +} +a.text-danger:hover { + color: #843534; +} +.bg-primary { + color: #fff; + background-color: #428bca; +} +a.bg-primary:hover { + background-color: #3071a9; +} +.bg-success { + background-color: #dff0d8; +} +a.bg-success:hover { + background-color: #c1e2b3; +} +.bg-info { + background-color: #d9edf7; +} +a.bg-info:hover { + background-color: #afd9ee; +} +.bg-warning { + background-color: #fcf8e3; +} +a.bg-warning:hover { + background-color: #f7ecb5; +} +.bg-danger { + background-color: #f2dede; +} +a.bg-danger:hover { + background-color: #e4b9b9; +} +.page-header { + padding-bottom: 9px; + margin: 40px 0 20px; + border-bottom: 1px solid #eeeeee; +} +ul, +ol { + margin-top: 0; + margin-bottom: 10px; +} +ul ul, +ol ul, +ul ol, +ol ol { + margin-bottom: 0; +} +.list-unstyled { + padding-left: 0; + list-style: none; +} +.list-inline { + padding-left: 0; + list-style: none; + margin-left: -5px; +} +.list-inline > li { + display: inline-block; + padding-left: 5px; + padding-right: 5px; +} +dl { + margin-top: 0; + margin-bottom: 20px; +} +dt, +dd { + line-height: 1.428571429; +} +dt { + font-weight: bold; +} +dd { + margin-left: 0; +} +@media (min-width: 768px) { + .dl-horizontal dt { + float: left; + width: 160px; + clear: left; + text-align: right; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .dl-horizontal dd { + margin-left: 180px; + } +} +abbr[title], +abbr[data-original-title] { + cursor: help; + border-bottom: 1px dotted #777777; +} +.initialism { + font-size: 90%; + text-transform: uppercase; +} +blockquote { + padding: 10px 20px; + margin: 0 0 20px; + font-size: 17.5px; + border-left: 5px solid #eeeeee; +} +blockquote p:last-child, +blockquote ul:last-child, +blockquote ol:last-child { + margin-bottom: 0; +} +blockquote footer, +blockquote small, +blockquote .small { + display: block; + font-size: 80%; + line-height: 1.428571429; + color: #777777; +} +blockquote footer:before, +blockquote small:before, +blockquote .small:before { + content: '\2014 \00A0'; +} +.blockquote-reverse, +blockquote.pull-right { + padding-right: 15px; + padding-left: 0; + border-right: 5px solid #eeeeee; + border-left: 0; + text-align: right; +} +.blockquote-reverse footer:before, +blockquote.pull-right footer:before, +.blockquote-reverse small:before, +blockquote.pull-right small:before, +.blockquote-reverse .small:before, +blockquote.pull-right .small:before { + content: ''; +} +.blockquote-reverse footer:after, +blockquote.pull-right footer:after, +.blockquote-reverse small:after, +blockquote.pull-right small:after, +.blockquote-reverse .small:after, +blockquote.pull-right .small:after { + content: '\00A0 \2014'; +} +blockquote:before, +blockquote:after { + content: ""; +} +address { + margin-bottom: 20px; + font-style: normal; + line-height: 1.428571429; +} +code, +kbd, +pre, +samp { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} +code { + padding: 2px 4px; + font-size: 90%; + color: #c7254e; + background-color: #f9f2f4; + border-radius: 0; +} +kbd { + padding: 2px 4px; + font-size: 90%; + color: #fff; + background-color: #333; + border-radius: 0; + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); +} +kbd kbd { + padding: 0; + font-size: 100%; + box-shadow: none; +} +pre { + display: block; + padding: 9.5px; + margin: 0 0 10px; + font-size: 13px; + line-height: 1.428571429; + word-break: break-all; + word-wrap: break-word; + color: #333333; + background-color: #f5f5f5; + border: 1px solid #ccc; + border-radius: 0; +} +pre code { + padding: 0; + font-size: inherit; + color: inherit; + white-space: pre-wrap; + background-color: transparent; + border-radius: 0; +} +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; +} +.container { + margin-right: auto; + margin-left: auto; + padding-left: 15px; + padding-right: 15px; +} +@media (min-width: 768px) { + .container { + width: 750px; + } +} +@media (min-width: 992px) { + .container { + width: 970px; + } +} +@media (min-width: 1200px) { + .container { + width: 1170px; + } +} +.container-fluid { + margin-right: auto; + margin-left: auto; + padding-left: 15px; + padding-right: 15px; +} +.row { + margin-left: -15px; + margin-right: -15px; +} +.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { + position: relative; + min-height: 1px; + padding-left: 15px; + padding-right: 15px; +} +.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { + float: left; +} +.col-xs-12 { + width: 100%; +} +.col-xs-11 { + width: 91.66666666666666%; +} +.col-xs-10 { + width: 83.33333333333334%; +} +.col-xs-9 { + width: 75%; +} +.col-xs-8 { + width: 66.66666666666666%; +} +.col-xs-7 { + width: 58.333333333333336%; +} +.col-xs-6 { + width: 50%; +} +.col-xs-5 { + width: 41.66666666666667%; +} +.col-xs-4 { + width: 33.33333333333333%; +} +.col-xs-3 { + width: 25%; +} +.col-xs-2 { + width: 16.666666666666664%; +} +.col-xs-1 { + width: 8.333333333333332%; +} +.col-xs-pull-12 { + right: 100%; +} +.col-xs-pull-11 { + right: 91.66666666666666%; +} +.col-xs-pull-10 { + right: 83.33333333333334%; +} +.col-xs-pull-9 { + right: 75%; +} +.col-xs-pull-8 { + right: 66.66666666666666%; +} +.col-xs-pull-7 { + right: 58.333333333333336%; +} +.col-xs-pull-6 { + right: 50%; +} +.col-xs-pull-5 { + right: 41.66666666666667%; +} +.col-xs-pull-4 { + right: 33.33333333333333%; +} +.col-xs-pull-3 { + right: 25%; +} +.col-xs-pull-2 { + right: 16.666666666666664%; +} +.col-xs-pull-1 { + right: 8.333333333333332%; +} +.col-xs-pull-0 { + right: auto; +} +.col-xs-push-12 { + left: 100%; +} +.col-xs-push-11 { + left: 91.66666666666666%; +} +.col-xs-push-10 { + left: 83.33333333333334%; +} +.col-xs-push-9 { + left: 75%; +} +.col-xs-push-8 { + left: 66.66666666666666%; +} +.col-xs-push-7 { + left: 58.333333333333336%; +} +.col-xs-push-6 { + left: 50%; +} +.col-xs-push-5 { + left: 41.66666666666667%; +} +.col-xs-push-4 { + left: 33.33333333333333%; +} +.col-xs-push-3 { + left: 25%; +} +.col-xs-push-2 { + left: 16.666666666666664%; +} +.col-xs-push-1 { + left: 8.333333333333332%; +} +.col-xs-push-0 { + left: auto; +} +.col-xs-offset-12 { + margin-left: 100%; +} +.col-xs-offset-11 { + margin-left: 91.66666666666666%; +} +.col-xs-offset-10 { + margin-left: 83.33333333333334%; +} +.col-xs-offset-9 { + margin-left: 75%; +} +.col-xs-offset-8 { + margin-left: 66.66666666666666%; +} +.col-xs-offset-7 { + margin-left: 58.333333333333336%; +} +.col-xs-offset-6 { + margin-left: 50%; +} +.col-xs-offset-5 { + margin-left: 41.66666666666667%; +} +.col-xs-offset-4 { + margin-left: 33.33333333333333%; +} +.col-xs-offset-3 { + margin-left: 25%; +} +.col-xs-offset-2 { + margin-left: 16.666666666666664%; +} +.col-xs-offset-1 { + margin-left: 8.333333333333332%; +} +.col-xs-offset-0 { + margin-left: 0%; +} +@media (min-width: 768px) { + .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { + float: left; + } + .col-sm-12 { + width: 100%; + } + .col-sm-11 { + width: 91.66666666666666%; + } + .col-sm-10 { + width: 83.33333333333334%; + } + .col-sm-9 { + width: 75%; + } + .col-sm-8 { + width: 66.66666666666666%; + } + .col-sm-7 { + width: 58.333333333333336%; + } + .col-sm-6 { + width: 50%; + } + .col-sm-5 { + width: 41.66666666666667%; + } + .col-sm-4 { + width: 33.33333333333333%; + } + .col-sm-3 { + width: 25%; + } + .col-sm-2 { + width: 16.666666666666664%; + } + .col-sm-1 { + width: 8.333333333333332%; + } + .col-sm-pull-12 { + right: 100%; + } + .col-sm-pull-11 { + right: 91.66666666666666%; + } + .col-sm-pull-10 { + right: 83.33333333333334%; + } + .col-sm-pull-9 { + right: 75%; + } + .col-sm-pull-8 { + right: 66.66666666666666%; + } + .col-sm-pull-7 { + right: 58.333333333333336%; + } + .col-sm-pull-6 { + right: 50%; + } + .col-sm-pull-5 { + right: 41.66666666666667%; + } + .col-sm-pull-4 { + right: 33.33333333333333%; + } + .col-sm-pull-3 { + right: 25%; + } + .col-sm-pull-2 { + right: 16.666666666666664%; + } + .col-sm-pull-1 { + right: 8.333333333333332%; + } + .col-sm-pull-0 { + right: auto; + } + .col-sm-push-12 { + left: 100%; + } + .col-sm-push-11 { + left: 91.66666666666666%; + } + .col-sm-push-10 { + left: 83.33333333333334%; + } + .col-sm-push-9 { + left: 75%; + } + .col-sm-push-8 { + left: 66.66666666666666%; + } + .col-sm-push-7 { + left: 58.333333333333336%; + } + .col-sm-push-6 { + left: 50%; + } + .col-sm-push-5 { + left: 41.66666666666667%; + } + .col-sm-push-4 { + left: 33.33333333333333%; + } + .col-sm-push-3 { + left: 25%; + } + .col-sm-push-2 { + left: 16.666666666666664%; + } + .col-sm-push-1 { + left: 8.333333333333332%; + } + .col-sm-push-0 { + left: auto; + } + .col-sm-offset-12 { + margin-left: 100%; + } + .col-sm-offset-11 { + margin-left: 91.66666666666666%; + } + .col-sm-offset-10 { + margin-left: 83.33333333333334%; + } + .col-sm-offset-9 { + margin-left: 75%; + } + .col-sm-offset-8 { + margin-left: 66.66666666666666%; + } + .col-sm-offset-7 { + margin-left: 58.333333333333336%; + } + .col-sm-offset-6 { + margin-left: 50%; + } + .col-sm-offset-5 { + margin-left: 41.66666666666667%; + } + .col-sm-offset-4 { + margin-left: 33.33333333333333%; + } + .col-sm-offset-3 { + margin-left: 25%; + } + .col-sm-offset-2 { + margin-left: 16.666666666666664%; + } + .col-sm-offset-1 { + margin-left: 8.333333333333332%; + } + .col-sm-offset-0 { + margin-left: 0%; + } +} +@media (min-width: 992px) { + .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { + float: left; + } + .col-md-12 { + width: 100%; + } + .col-md-11 { + width: 91.66666666666666%; + } + .col-md-10 { + width: 83.33333333333334%; + } + .col-md-9 { + width: 75%; + } + .col-md-8 { + width: 66.66666666666666%; + } + .col-md-7 { + width: 58.333333333333336%; + } + .col-md-6 { + width: 50%; + } + .col-md-5 { + width: 41.66666666666667%; + } + .col-md-4 { + width: 33.33333333333333%; + } + .col-md-3 { + width: 25%; + } + .col-md-2 { + width: 16.666666666666664%; + } + .col-md-1 { + width: 8.333333333333332%; + } + .col-md-pull-12 { + right: 100%; + } + .col-md-pull-11 { + right: 91.66666666666666%; + } + .col-md-pull-10 { + right: 83.33333333333334%; + } + .col-md-pull-9 { + right: 75%; + } + .col-md-pull-8 { + right: 66.66666666666666%; + } + .col-md-pull-7 { + right: 58.333333333333336%; + } + .col-md-pull-6 { + right: 50%; + } + .col-md-pull-5 { + right: 41.66666666666667%; + } + .col-md-pull-4 { + right: 33.33333333333333%; + } + .col-md-pull-3 { + right: 25%; + } + .col-md-pull-2 { + right: 16.666666666666664%; + } + .col-md-pull-1 { + right: 8.333333333333332%; + } + .col-md-pull-0 { + right: auto; + } + .col-md-push-12 { + left: 100%; + } + .col-md-push-11 { + left: 91.66666666666666%; + } + .col-md-push-10 { + left: 83.33333333333334%; + } + .col-md-push-9 { + left: 75%; + } + .col-md-push-8 { + left: 66.66666666666666%; + } + .col-md-push-7 { + left: 58.333333333333336%; + } + .col-md-push-6 { + left: 50%; + } + .col-md-push-5 { + left: 41.66666666666667%; + } + .col-md-push-4 { + left: 33.33333333333333%; + } + .col-md-push-3 { + left: 25%; + } + .col-md-push-2 { + left: 16.666666666666664%; + } + .col-md-push-1 { + left: 8.333333333333332%; + } + .col-md-push-0 { + left: auto; + } + .col-md-offset-12 { + margin-left: 100%; + } + .col-md-offset-11 { + margin-left: 91.66666666666666%; + } + .col-md-offset-10 { + margin-left: 83.33333333333334%; + } + .col-md-offset-9 { + margin-left: 75%; + } + .col-md-offset-8 { + margin-left: 66.66666666666666%; + } + .col-md-offset-7 { + margin-left: 58.333333333333336%; + } + .col-md-offset-6 { + margin-left: 50%; + } + .col-md-offset-5 { + margin-left: 41.66666666666667%; + } + .col-md-offset-4 { + margin-left: 33.33333333333333%; + } + .col-md-offset-3 { + margin-left: 25%; + } + .col-md-offset-2 { + margin-left: 16.666666666666664%; + } + .col-md-offset-1 { + margin-left: 8.333333333333332%; + } + .col-md-offset-0 { + margin-left: 0%; + } +} +@media (min-width: 1200px) { + .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { + float: left; + } + .col-lg-12 { + width: 100%; + } + .col-lg-11 { + width: 91.66666666666666%; + } + .col-lg-10 { + width: 83.33333333333334%; + } + .col-lg-9 { + width: 75%; + } + .col-lg-8 { + width: 66.66666666666666%; + } + .col-lg-7 { + width: 58.333333333333336%; + } + .col-lg-6 { + width: 50%; + } + .col-lg-5 { + width: 41.66666666666667%; + } + .col-lg-4 { + width: 33.33333333333333%; + } + .col-lg-3 { + width: 25%; + } + .col-lg-2 { + width: 16.666666666666664%; + } + .col-lg-1 { + width: 8.333333333333332%; + } + .col-lg-pull-12 { + right: 100%; + } + .col-lg-pull-11 { + right: 91.66666666666666%; + } + .col-lg-pull-10 { + right: 83.33333333333334%; + } + .col-lg-pull-9 { + right: 75%; + } + .col-lg-pull-8 { + right: 66.66666666666666%; + } + .col-lg-pull-7 { + right: 58.333333333333336%; + } + .col-lg-pull-6 { + right: 50%; + } + .col-lg-pull-5 { + right: 41.66666666666667%; + } + .col-lg-pull-4 { + right: 33.33333333333333%; + } + .col-lg-pull-3 { + right: 25%; + } + .col-lg-pull-2 { + right: 16.666666666666664%; + } + .col-lg-pull-1 { + right: 8.333333333333332%; + } + .col-lg-pull-0 { + right: auto; + } + .col-lg-push-12 { + left: 100%; + } + .col-lg-push-11 { + left: 91.66666666666666%; + } + .col-lg-push-10 { + left: 83.33333333333334%; + } + .col-lg-push-9 { + left: 75%; + } + .col-lg-push-8 { + left: 66.66666666666666%; + } + .col-lg-push-7 { + left: 58.333333333333336%; + } + .col-lg-push-6 { + left: 50%; + } + .col-lg-push-5 { + left: 41.66666666666667%; + } + .col-lg-push-4 { + left: 33.33333333333333%; + } + .col-lg-push-3 { + left: 25%; + } + .col-lg-push-2 { + left: 16.666666666666664%; + } + .col-lg-push-1 { + left: 8.333333333333332%; + } + .col-lg-push-0 { + left: auto; + } + .col-lg-offset-12 { + margin-left: 100%; + } + .col-lg-offset-11 { + margin-left: 91.66666666666666%; + } + .col-lg-offset-10 { + margin-left: 83.33333333333334%; + } + .col-lg-offset-9 { + margin-left: 75%; + } + .col-lg-offset-8 { + margin-left: 66.66666666666666%; + } + .col-lg-offset-7 { + margin-left: 58.333333333333336%; + } + .col-lg-offset-6 { + margin-left: 50%; + } + .col-lg-offset-5 { + margin-left: 41.66666666666667%; + } + .col-lg-offset-4 { + margin-left: 33.33333333333333%; + } + .col-lg-offset-3 { + margin-left: 25%; + } + .col-lg-offset-2 { + margin-left: 16.666666666666664%; + } + .col-lg-offset-1 { + margin-left: 8.333333333333332%; + } + .col-lg-offset-0 { + margin-left: 0%; + } +} +table { + background-color: transparent; +} +th { + text-align: left; +} +.table { + width: 100%; + max-width: 100%; + margin-bottom: 20px; +} +.table > thead > tr > th, +.table > tbody > tr > th, +.table > tfoot > tr > th, +.table > thead > tr > td, +.table > tbody > tr > td, +.table > tfoot > tr > td { + padding: 8px; + line-height: 1.428571429; + vertical-align: top; + border-top: 1px solid #34302D; +} +.table > thead > tr > th { + vertical-align: bottom; + border-bottom: 2px solid #34302D; +} +.table > caption + thead > tr:first-child > th, +.table > colgroup + thead > tr:first-child > th, +.table > thead:first-child > tr:first-child > th, +.table > caption + thead > tr:first-child > td, +.table > colgroup + thead > tr:first-child > td, +.table > thead:first-child > tr:first-child > td { + border-top: 0; +} +.table > tbody + tbody { + border-top: 2px solid #34302D; +} +.table .table { + background-color: #f1f1f1; +} +.table-condensed > thead > tr > th, +.table-condensed > tbody > tr > th, +.table-condensed > tfoot > tr > th, +.table-condensed > thead > tr > td, +.table-condensed > tbody > tr > td, +.table-condensed > tfoot > tr > td { + padding: 5px; +} +.table-bordered { + border: 1px solid #34302D; +} +.table-bordered > thead > tr > th, +.table-bordered > tbody > tr > th, +.table-bordered > tfoot > tr > th, +.table-bordered > thead > tr > td, +.table-bordered > tbody > tr > td, +.table-bordered > tfoot > tr > td { + border: 1px solid #34302D; +} +.table-bordered > thead > tr > th, +.table-bordered > thead > tr > td { + border-bottom-width: 2px; +} +.table-striped > tbody > tr:nth-child(odd) > td, +.table-striped > tbody > tr:nth-child(odd) > th { + background-color: #f9f9f9; +} +.table-hover > tbody > tr:hover > td, +.table-hover > tbody > tr:hover > th { + background-color: #f5f5f5; +} +table col[class*="col-"] { + position: static; + float: none; + display: table-column; +} +table td[class*="col-"], +table th[class*="col-"] { + position: static; + float: none; + display: table-cell; +} +.table > thead > tr > td.active, +.table > tbody > tr > td.active, +.table > tfoot > tr > td.active, +.table > thead > tr > th.active, +.table > tbody > tr > th.active, +.table > tfoot > tr > th.active, +.table > thead > tr.active > td, +.table > tbody > tr.active > td, +.table > tfoot > tr.active > td, +.table > thead > tr.active > th, +.table > tbody > tr.active > th, +.table > tfoot > tr.active > th { + background-color: #f5f5f5; +} +.table-hover > tbody > tr > td.active:hover, +.table-hover > tbody > tr > th.active:hover, +.table-hover > tbody > tr.active:hover > td, +.table-hover > tbody > tr:hover > .active, +.table-hover > tbody > tr.active:hover > th { + background-color: #e8e8e8; +} +.table > thead > tr > td.success, +.table > tbody > tr > td.success, +.table > tfoot > tr > td.success, +.table > thead > tr > th.success, +.table > tbody > tr > th.success, +.table > tfoot > tr > th.success, +.table > thead > tr.success > td, +.table > tbody > tr.success > td, +.table > tfoot > tr.success > td, +.table > thead > tr.success > th, +.table > tbody > tr.success > th, +.table > tfoot > tr.success > th { + background-color: #dff0d8; +} +.table-hover > tbody > tr > td.success:hover, +.table-hover > tbody > tr > th.success:hover, +.table-hover > tbody > tr.success:hover > td, +.table-hover > tbody > tr:hover > .success, +.table-hover > tbody > tr.success:hover > th { + background-color: #d0e9c6; +} +.table > thead > tr > td.info, +.table > tbody > tr > td.info, +.table > tfoot > tr > td.info, +.table > thead > tr > th.info, +.table > tbody > tr > th.info, +.table > tfoot > tr > th.info, +.table > thead > tr.info > td, +.table > tbody > tr.info > td, +.table > tfoot > tr.info > td, +.table > thead > tr.info > th, +.table > tbody > tr.info > th, +.table > tfoot > tr.info > th { + background-color: #d9edf7; +} +.table-hover > tbody > tr > td.info:hover, +.table-hover > tbody > tr > th.info:hover, +.table-hover > tbody > tr.info:hover > td, +.table-hover > tbody > tr:hover > .info, +.table-hover > tbody > tr.info:hover > th { + background-color: #c4e3f3; +} +.table > thead > tr > td.warning, +.table > tbody > tr > td.warning, +.table > tfoot > tr > td.warning, +.table > thead > tr > th.warning, +.table > tbody > tr > th.warning, +.table > tfoot > tr > th.warning, +.table > thead > tr.warning > td, +.table > tbody > tr.warning > td, +.table > tfoot > tr.warning > td, +.table > thead > tr.warning > th, +.table > tbody > tr.warning > th, +.table > tfoot > tr.warning > th { + background-color: #fcf8e3; +} +.table-hover > tbody > tr > td.warning:hover, +.table-hover > tbody > tr > th.warning:hover, +.table-hover > tbody > tr.warning:hover > td, +.table-hover > tbody > tr:hover > .warning, +.table-hover > tbody > tr.warning:hover > th { + background-color: #faf2cc; +} +.table > thead > tr > td.danger, +.table > tbody > tr > td.danger, +.table > tfoot > tr > td.danger, +.table > thead > tr > th.danger, +.table > tbody > tr > th.danger, +.table > tfoot > tr > th.danger, +.table > thead > tr.danger > td, +.table > tbody > tr.danger > td, +.table > tfoot > tr.danger > td, +.table > thead > tr.danger > th, +.table > tbody > tr.danger > th, +.table > tfoot > tr.danger > th { + background-color: #f2dede; +} +.table-hover > tbody > tr > td.danger:hover, +.table-hover > tbody > tr > th.danger:hover, +.table-hover > tbody > tr.danger:hover > td, +.table-hover > tbody > tr:hover > .danger, +.table-hover > tbody > tr.danger:hover > th { + background-color: #ebcccc; +} +@media screen and (max-width: 767px) { + .table-responsive { + width: 100%; + margin-bottom: 15px; + overflow-y: hidden; + overflow-x: auto; + -ms-overflow-style: -ms-autohiding-scrollbar; + border: 1px solid #34302D; + -webkit-overflow-scrolling: touch; + } + .table-responsive > .table { + margin-bottom: 0; + } + .table-responsive > .table > thead > tr > th, + .table-responsive > .table > tbody > tr > th, + .table-responsive > .table > tfoot > tr > th, + .table-responsive > .table > thead > tr > td, + .table-responsive > .table > tbody > tr > td, + .table-responsive > .table > tfoot > tr > td { + white-space: nowrap; + } + .table-responsive > .table-bordered { + border: 0; + } + .table-responsive > .table-bordered > thead > tr > th:first-child, + .table-responsive > .table-bordered > tbody > tr > th:first-child, + .table-responsive > .table-bordered > tfoot > tr > th:first-child, + .table-responsive > .table-bordered > thead > tr > td:first-child, + .table-responsive > .table-bordered > tbody > tr > td:first-child, + .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-left: 0; + } + .table-responsive > .table-bordered > thead > tr > th:last-child, + .table-responsive > .table-bordered > tbody > tr > th:last-child, + .table-responsive > .table-bordered > tfoot > tr > th:last-child, + .table-responsive > .table-bordered > thead > tr > td:last-child, + .table-responsive > .table-bordered > tbody > tr > td:last-child, + .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: 0; + } + .table-responsive > .table-bordered > tbody > tr:last-child > th, + .table-responsive > .table-bordered > tfoot > tr:last-child > th, + .table-responsive > .table-bordered > tbody > tr:last-child > td, + .table-responsive > .table-bordered > tfoot > tr:last-child > td { + border-bottom: 0; + } +} +fieldset { + padding: 0; + margin: 0; + border: 0; + min-width: 0; +} +legend { + display: block; + width: 100%; + padding: 0; + margin-bottom: 20px; + font-size: 21px; + line-height: inherit; + color: #333333; + border: 0; + border-bottom: 1px solid #e5e5e5; +} +label { + display: inline-block; + max-width: 100%; + margin-bottom: 5px; + font-weight: bold; +} +input[type="search"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +input[type="radio"], +input[type="checkbox"] { + margin: 4px 0 0; + margin-top: 1px \9; + line-height: normal; +} +input[type="file"] { + display: block; +} +input[type="range"] { + display: block; + width: 100%; +} +select[multiple], +select[size] { + height: auto; +} +input[type="file"]:focus, +input[type="radio"]:focus, +input[type="checkbox"]:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +output { + display: block; + padding-top: 7px; + font-size: 14px; + line-height: 1.428571429; + color: #555555; +} +.form-control { + display: block; + width: 100%; + height: 34px; + padding: 6px 12px; + font-size: 14px; + line-height: 1.428571429; + color: #555555; + background-color: #fff; + background-image: none; + border: 1px solid #ccc; + border-radius: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; + -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; + transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; +} +.form-control:focus { + border-color: #66afe9; + outline: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); + box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); +} +.form-control::-moz-placeholder { + color: #777777; + opacity: 1; +} +.form-control:-ms-input-placeholder { + color: #777777; +} +.form-control::-webkit-input-placeholder { + color: #777777; +} +.form-control[disabled], +.form-control[readonly], +fieldset[disabled] .form-control { + cursor: not-allowed; + background-color: #eeeeee; + opacity: 1; +} +textarea.form-control { + height: auto; +} +input[type="search"] { + -webkit-appearance: none; +} +input[type="date"], +input[type="time"], +input[type="datetime-local"], +input[type="month"] { + line-height: 34px; + line-height: 1.428571429 \0; +} +input[type="date"].input-sm, +input[type="time"].input-sm, +input[type="datetime-local"].input-sm, +input[type="month"].input-sm { + line-height: 30px; +} +input[type="date"].input-lg, +input[type="time"].input-lg, +input[type="datetime-local"].input-lg, +input[type="month"].input-lg { + line-height: 46px; +} +.form-group { + margin-bottom: 15px; +} +.radio, +.checkbox { + position: relative; + display: block; + min-height: 20px; + margin-top: 10px; + margin-bottom: 10px; +} +.radio label, +.checkbox label { + padding-left: 20px; + margin-bottom: 0; + font-weight: normal; + cursor: pointer; +} +.radio input[type="radio"], +.radio-inline input[type="radio"], +.checkbox input[type="checkbox"], +.checkbox-inline input[type="checkbox"] { + position: absolute; + margin-left: -20px; + margin-top: 4px \9; +} +.radio + .radio, +.checkbox + .checkbox { + margin-top: -5px; +} +.radio-inline, +.checkbox-inline { + display: inline-block; + padding-left: 20px; + margin-bottom: 0; + vertical-align: middle; + font-weight: normal; + cursor: pointer; +} +.radio-inline + .radio-inline, +.checkbox-inline + .checkbox-inline { + margin-top: 0; + margin-left: 10px; +} +input[type="radio"][disabled], +input[type="checkbox"][disabled], +input[type="radio"].disabled, +input[type="checkbox"].disabled, +fieldset[disabled] input[type="radio"], +fieldset[disabled] input[type="checkbox"] { + cursor: not-allowed; +} +.radio-inline.disabled, +.checkbox-inline.disabled, +fieldset[disabled] .radio-inline, +fieldset[disabled] .checkbox-inline { + cursor: not-allowed; +} +.radio.disabled label, +.checkbox.disabled label, +fieldset[disabled] .radio label, +fieldset[disabled] .checkbox label { + cursor: not-allowed; +} +.form-control-static { + padding-top: 7px; + padding-bottom: 7px; + margin-bottom: 0; +} +.form-control-static.input-lg, +.form-control-static.input-sm { + padding-left: 0; + padding-right: 0; +} +.input-sm, +.form-horizontal .form-group-sm .form-control { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 0; +} +select.input-sm { + height: 30px; + line-height: 30px; +} +textarea.input-sm, +select[multiple].input-sm { + height: auto; +} +.input-lg, +.form-horizontal .form-group-lg .form-control { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.33; + border-radius: 0; +} +select.input-lg { + height: 46px; + line-height: 46px; +} +textarea.input-lg, +select[multiple].input-lg { + height: auto; +} +.has-feedback { + position: relative; +} +.has-feedback .form-control { + padding-right: 42.5px; +} +.form-control-feedback { + position: absolute; + top: 25px; + right: 0; + z-index: 2; + display: block; + width: 34px; + height: 34px; + line-height: 34px; + text-align: center; +} +.input-lg + .form-control-feedback { + width: 46px; + height: 46px; + line-height: 46px; +} +.input-sm + .form-control-feedback { + width: 30px; + height: 30px; + line-height: 30px; +} +.has-success .help-block, +.has-success .control-label, +.has-success .radio, +.has-success .checkbox, +.has-success .radio-inline, +.has-success .checkbox-inline { + color: #3c763d; +} +.has-success .form-control { + border-color: #3c763d; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} +.has-success .form-control:focus { + border-color: #2b542c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168; +} +.has-success .input-group-addon { + color: #3c763d; + border-color: #3c763d; + background-color: #dff0d8; +} +.has-success .form-control-feedback { + color: #3c763d; +} +.has-warning .help-block, +.has-warning .control-label, +.has-warning .radio, +.has-warning .checkbox, +.has-warning .radio-inline, +.has-warning .checkbox-inline { + color: #8a6d3b; +} +.has-warning .form-control { + border-color: #8a6d3b; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} +.has-warning .form-control:focus { + border-color: #66512c; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b; +} +.has-warning .input-group-addon { + color: #8a6d3b; + border-color: #8a6d3b; + background-color: #fcf8e3; +} +.has-warning .form-control-feedback { + color: #8a6d3b; +} +.has-error .help-block, +.has-error .control-label, +.has-error .radio, +.has-error .checkbox, +.has-error .radio-inline, +.has-error .checkbox-inline { + color: #a94442; +} +.has-error .form-control { + border-color: #a94442; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); +} +.has-error .form-control:focus { + border-color: #843534; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483; +} +.has-error .input-group-addon { + color: #a94442; + border-color: #a94442; + background-color: #f2dede; +} +.has-error .form-control-feedback { + color: #a94442; +} +.has-feedback label.sr-only ~ .form-control-feedback { + top: 0; +} +.help-block { + display: block; + margin-top: 5px; + margin-bottom: 10px; + color: #ffffff; +} +@media (min-width: 768px) { + .form-inline .form-group { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .form-control { + display: inline-block; + width: auto; + vertical-align: middle; + } + .form-inline .input-group { + display: inline-table; + vertical-align: middle; + } + .form-inline .input-group .input-group-addon, + .form-inline .input-group .input-group-btn, + .form-inline .input-group .form-control { + width: auto; + } + .form-inline .input-group > .form-control { + width: 100%; + } + .form-inline .control-label { + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .radio, + .form-inline .checkbox { + display: inline-block; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + } + .form-inline .radio label, + .form-inline .checkbox label { + padding-left: 0; + } + .form-inline .radio input[type="radio"], + .form-inline .checkbox input[type="checkbox"] { + position: relative; + margin-left: 0; + } + .form-inline .has-feedback .form-control-feedback { + top: 0; + } +} +.form-horizontal .radio, +.form-horizontal .checkbox, +.form-horizontal .radio-inline, +.form-horizontal .checkbox-inline { + margin-top: 0; + margin-bottom: 0; + padding-top: 7px; +} +.form-horizontal .radio, +.form-horizontal .checkbox { + min-height: 27px; +} +.form-horizontal .form-group { + margin-left: -15px; + margin-right: -15px; +} +@media (min-width: 768px) { + .form-horizontal .control-label { + text-align: right; + margin-bottom: 0; + padding-top: 7px; + } +} +.form-horizontal .has-feedback .form-control-feedback { + top: 0; + right: 15px; +} +@media (min-width: 768px) { + .form-horizontal .form-group-lg .control-label { + padding-top: 14.3px; + } +} +@media (min-width: 768px) { + .form-horizontal .form-group-sm .control-label { + padding-top: 6px; + } +} +.btn { + display: inline-block; + margin-bottom: 0; + font-weight: normal; + text-align: center; + vertical-align: middle; + cursor: pointer; + background-image: none; + border: 1px solid transparent; + white-space: nowrap; + padding: 6px 12px; + font-size: 14px; + line-height: 1.428571429; + border-radius: 0; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.btn:focus, +.btn:active:focus, +.btn.active:focus { + outline: thin dotted; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} +.btn:hover, +.btn:focus { + color: #f1f1f1; + text-decoration: none; +} +.btn:active, +.btn.active { + outline: 0; + background-image: none; + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); +} +.btn.disabled, +.btn[disabled], +fieldset[disabled] .btn { + cursor: not-allowed; + pointer-events: none; + opacity: .65; + filter: alpha(opacity=65); + -webkit-box-shadow: none; + box-shadow: none; +} +.btn-default { + color: #f1f1f1; + background-color: #34302D; + border-color: #6db33f; +} +.btn-default:hover, +.btn-default:focus, +.btn-default:active, +.btn-default.active, +.open > .dropdown-toggle.btn-default { + color: #f1f1f1; + background-color: #191715; + border-color: #51862f; +} +.btn-default:active, +.btn-default.active, +.open > .dropdown-toggle.btn-default { + background-image: none; +} +.btn-default.disabled, +.btn-default[disabled], +fieldset[disabled] .btn-default, +.btn-default.disabled:hover, +.btn-default[disabled]:hover, +fieldset[disabled] .btn-default:hover, +.btn-default.disabled:focus, +.btn-default[disabled]:focus, +fieldset[disabled] .btn-default:focus, +.btn-default.disabled:active, +.btn-default[disabled]:active, +fieldset[disabled] .btn-default:active, +.btn-default.disabled.active, +.btn-default[disabled].active, +fieldset[disabled] .btn-default.active { + background-color: #34302D; + border-color: #6db33f; +} +.btn-default .badge { + color: #34302D; + background-color: #f1f1f1; +} +.btn-primary { + color: #fff; + background-color: #428bca; + border-color: #357ebd; +} +.btn-primary:hover, +.btn-primary:focus, +.btn-primary:active, +.btn-primary.active, +.open > .dropdown-toggle.btn-primary { + color: #fff; + background-color: #3071a9; + border-color: #285e8e; +} +.btn-primary:active, +.btn-primary.active, +.open > .dropdown-toggle.btn-primary { + background-image: none; +} +.btn-primary.disabled, +.btn-primary[disabled], +fieldset[disabled] .btn-primary, +.btn-primary.disabled:hover, +.btn-primary[disabled]:hover, +fieldset[disabled] .btn-primary:hover, +.btn-primary.disabled:focus, +.btn-primary[disabled]:focus, +fieldset[disabled] .btn-primary:focus, +.btn-primary.disabled:active, +.btn-primary[disabled]:active, +fieldset[disabled] .btn-primary:active, +.btn-primary.disabled.active, +.btn-primary[disabled].active, +fieldset[disabled] .btn-primary.active { + background-color: #428bca; + border-color: #357ebd; +} +.btn-primary .badge { + color: #428bca; + background-color: #fff; +} +.btn-success { + color: #fff; + background-color: #5cb85c; + border-color: #4cae4c; +} +.btn-success:hover, +.btn-success:focus, +.btn-success:active, +.btn-success.active, +.open > .dropdown-toggle.btn-success { + color: #fff; + background-color: #449d44; + border-color: #398439; +} +.btn-success:active, +.btn-success.active, +.open > .dropdown-toggle.btn-success { + background-image: none; +} +.btn-success.disabled, +.btn-success[disabled], +fieldset[disabled] .btn-success, +.btn-success.disabled:hover, +.btn-success[disabled]:hover, +fieldset[disabled] .btn-success:hover, +.btn-success.disabled:focus, +.btn-success[disabled]:focus, +fieldset[disabled] .btn-success:focus, +.btn-success.disabled:active, +.btn-success[disabled]:active, +fieldset[disabled] .btn-success:active, +.btn-success.disabled.active, +.btn-success[disabled].active, +fieldset[disabled] .btn-success.active { + background-color: #5cb85c; + border-color: #4cae4c; +} +.btn-success .badge { + color: #5cb85c; + background-color: #fff; +} +.btn-info { + color: #fff; + background-color: #5bc0de; + border-color: #46b8da; +} +.btn-info:hover, +.btn-info:focus, +.btn-info:active, +.btn-info.active, +.open > .dropdown-toggle.btn-info { + color: #fff; + background-color: #31b0d5; + border-color: #269abc; +} +.btn-info:active, +.btn-info.active, +.open > .dropdown-toggle.btn-info { + background-image: none; +} +.btn-info.disabled, +.btn-info[disabled], +fieldset[disabled] .btn-info, +.btn-info.disabled:hover, +.btn-info[disabled]:hover, +fieldset[disabled] .btn-info:hover, +.btn-info.disabled:focus, +.btn-info[disabled]:focus, +fieldset[disabled] .btn-info:focus, +.btn-info.disabled:active, +.btn-info[disabled]:active, +fieldset[disabled] .btn-info:active, +.btn-info.disabled.active, +.btn-info[disabled].active, +fieldset[disabled] .btn-info.active { + background-color: #5bc0de; + border-color: #46b8da; +} +.btn-info .badge { + color: #5bc0de; + background-color: #fff; +} +.btn-warning { + color: #fff; + background-color: #f0ad4e; + border-color: #eea236; +} +.btn-warning:hover, +.btn-warning:focus, +.btn-warning:active, +.btn-warning.active, +.open > .dropdown-toggle.btn-warning { + color: #fff; + background-color: #ec971f; + border-color: #d58512; +} +.btn-warning:active, +.btn-warning.active, +.open > .dropdown-toggle.btn-warning { + background-image: none; +} +.btn-warning.disabled, +.btn-warning[disabled], +fieldset[disabled] .btn-warning, +.btn-warning.disabled:hover, +.btn-warning[disabled]:hover, +fieldset[disabled] .btn-warning:hover, +.btn-warning.disabled:focus, +.btn-warning[disabled]:focus, +fieldset[disabled] .btn-warning:focus, +.btn-warning.disabled:active, +.btn-warning[disabled]:active, +fieldset[disabled] .btn-warning:active, +.btn-warning.disabled.active, +.btn-warning[disabled].active, +fieldset[disabled] .btn-warning.active { + background-color: #f0ad4e; + border-color: #eea236; +} +.btn-warning .badge { + color: #f0ad4e; + background-color: #fff; +} +.btn-danger { + color: #fff; + background-color: #d9534f; + border-color: #d43f3a; +} +.btn-danger:hover, +.btn-danger:focus, +.btn-danger:active, +.btn-danger.active, +.open > .dropdown-toggle.btn-danger { + color: #fff; + background-color: #c9302c; + border-color: #ac2925; +} +.btn-danger:active, +.btn-danger.active, +.open > .dropdown-toggle.btn-danger { + background-image: none; +} +.btn-danger.disabled, +.btn-danger[disabled], +fieldset[disabled] .btn-danger, +.btn-danger.disabled:hover, +.btn-danger[disabled]:hover, +fieldset[disabled] .btn-danger:hover, +.btn-danger.disabled:focus, +.btn-danger[disabled]:focus, +fieldset[disabled] .btn-danger:focus, +.btn-danger.disabled:active, +.btn-danger[disabled]:active, +fieldset[disabled] .btn-danger:active, +.btn-danger.disabled.active, +.btn-danger[disabled].active, +fieldset[disabled] .btn-danger.active { + background-color: #d9534f; + border-color: #d43f3a; +} +.btn-danger .badge { + color: #d9534f; + background-color: #fff; +} +.btn-link { + color: #5fa134; + font-weight: normal; + cursor: pointer; + border-radius: 0; +} +.btn-link, +.btn-link:active, +.btn-link[disabled], +fieldset[disabled] .btn-link { + background-color: transparent; + -webkit-box-shadow: none; + box-shadow: none; +} +.btn-link, +.btn-link:hover, +.btn-link:focus, +.btn-link:active { + border-color: transparent; +} +.btn-link:hover, +.btn-link:focus { + color: #5fa134; + text-decoration: underline; + background-color: transparent; +} +.btn-link[disabled]:hover, +fieldset[disabled] .btn-link:hover, +.btn-link[disabled]:focus, +fieldset[disabled] .btn-link:focus { + color: #777777; + text-decoration: none; +} +.btn-lg, +.btn-group-lg > .btn { + padding: 10px 16px; + font-size: 18px; + line-height: 1.33; + border-radius: 0; +} +.btn-sm, +.btn-group-sm > .btn { + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 0; +} +.btn-xs, +.btn-group-xs > .btn { + padding: 1px 5px; + font-size: 12px; + line-height: 1.5; + border-radius: 0; +} +.btn-block { + display: block; + width: 100%; +} +.btn-block + .btn-block { + margin-top: 5px; +} +input[type="submit"].btn-block, +input[type="reset"].btn-block, +input[type="button"].btn-block { + width: 100%; +} +.fade { + opacity: 0; + -webkit-transition: opacity .15s linear; + -o-transition: opacity .15s linear; + transition: opacity .15s linear; +} +.fade.in { + opacity: 1; +} +.collapse { + display: none; +} +.collapse.in { + display: block; +} +tr.collapse.in { + display: table-row; +} +tbody.collapse.in { + display: table-row-group; +} +.collapsing { + position: relative; + height: 0; + overflow: hidden; + -webkit-transition: height .35s ease; + -o-transition: height .35s ease; + transition: height .35s ease; +} +.caret { + display: inline-block; + width: 0; + height: 0; + margin-left: 2px; + vertical-align: middle; + border-top: 4px solid; + border-right: 4px solid transparent; + border-left: 4px solid transparent; +} +.dropdown { + position: relative; +} +.dropdown-toggle:focus { + outline: 0; +} +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + padding: 5px 0; + margin: 2px 0 0; + list-style: none; + font-size: 14px; + text-align: left; + background-color: #fff; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 0; + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); + background-clip: padding-box; +} +.dropdown-menu.pull-right { + right: 0; + left: auto; +} +.dropdown-menu .divider { + height: 1px; + margin: 9px 0; + overflow: hidden; + background-color: #e5e5e5; +} +.dropdown-menu > li > a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.428571429; + color: #333333; + white-space: nowrap; +} +.dropdown-menu > li > a:hover, +.dropdown-menu > li > a:focus { + text-decoration: none; + color: #262626; + background-color: #f5f5f5; +} +.dropdown-menu > .active > a, +.dropdown-menu > .active > a:hover, +.dropdown-menu > .active > a:focus { + color: #fff; + text-decoration: none; + outline: 0; + background-color: #428bca; +} +.dropdown-menu > .disabled > a, +.dropdown-menu > .disabled > a:hover, +.dropdown-menu > .disabled > a:focus { + color: #777777; +} +.dropdown-menu > .disabled > a:hover, +.dropdown-menu > .disabled > a:focus { + text-decoration: none; + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + cursor: not-allowed; +} +.open > .dropdown-menu { + display: block; +} +.open > a { + outline: 0; +} +.dropdown-menu-right { + left: auto; + right: 0; +} +.dropdown-menu-left { + left: 0; + right: auto; +} +.dropdown-header { + display: block; + padding: 3px 20px; + font-size: 12px; + line-height: 1.428571429; + color: #777777; + white-space: nowrap; +} +.dropdown-backdrop { + position: fixed; + left: 0; + right: 0; + bottom: 0; + top: 0; + z-index: 990; +} +.pull-right > .dropdown-menu { + right: 0; + left: auto; +} +.dropup .caret, +.navbar-fixed-bottom .dropdown .caret { + border-top: 0; + border-bottom: 4px solid; + content: ""; +} +.dropup .dropdown-menu, +.navbar-fixed-bottom .dropdown .dropdown-menu { + top: auto; + bottom: 100%; + margin-bottom: 1px; +} +@media (min-width: 768px) { + .navbar-right .dropdown-menu { + left: auto; + right: 0; + } + .navbar-right .dropdown-menu-left { + left: 0; + right: auto; + } +} +.btn-group, +.btn-group-vertical { + position: relative; + display: inline-block; + vertical-align: middle; +} +.btn-group > .btn, +.btn-group-vertical > .btn { + position: relative; + float: left; +} +.btn-group > .btn:hover, +.btn-group-vertical > .btn:hover, +.btn-group > .btn:focus, +.btn-group-vertical > .btn:focus, +.btn-group > .btn:active, +.btn-group-vertical > .btn:active, +.btn-group > .btn.active, +.btn-group-vertical > .btn.active { + z-index: 2; +} +.btn-group > .btn:focus, +.btn-group-vertical > .btn:focus { + outline: 0; +} +.btn-group .btn + .btn, +.btn-group .btn + .btn-group, +.btn-group .btn-group + .btn, +.btn-group .btn-group + .btn-group { + margin-left: -1px; +} +.btn-toolbar { + margin-left: -5px; +} +.btn-toolbar .btn-group, +.btn-toolbar .input-group { + float: left; +} +.btn-toolbar > .btn, +.btn-toolbar > .btn-group, +.btn-toolbar > .input-group { + margin-left: 5px; +} +.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { + border-radius: 0; +} +.btn-group > .btn:first-child { + margin-left: 0; +} +.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) { + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.btn-group > .btn:last-child:not(:first-child), +.btn-group > .dropdown-toggle:not(:first-child) { + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.btn-group > .btn-group { + float: left; +} +.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { + border-radius: 0; +} +.btn-group > .btn-group:first-child > .btn:last-child, +.btn-group > .btn-group:first-child > .dropdown-toggle { + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.btn-group > .btn-group:last-child > .btn:first-child { + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.btn-group .dropdown-toggle:active, +.btn-group.open .dropdown-toggle { + outline: 0; +} +.btn-group > .btn + .dropdown-toggle { + padding-left: 8px; + padding-right: 8px; +} +.btn-group > .btn-lg + .dropdown-toggle { + padding-left: 12px; + padding-right: 12px; +} +.btn-group.open .dropdown-toggle { + -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); +} +.btn-group.open .dropdown-toggle.btn-link { + -webkit-box-shadow: none; + box-shadow: none; +} +.btn .caret { + margin-left: 0; +} +.btn-lg .caret { + border-width: 5px 5px 0; + border-bottom-width: 0; +} +.dropup .btn-lg .caret { + border-width: 0 5px 5px; +} +.btn-group-vertical > .btn, +.btn-group-vertical > .btn-group, +.btn-group-vertical > .btn-group > .btn { + display: block; + float: none; + width: 100%; + max-width: 100%; +} +.btn-group-vertical > .btn-group > .btn { + float: none; +} +.btn-group-vertical > .btn + .btn, +.btn-group-vertical > .btn + .btn-group, +.btn-group-vertical > .btn-group + .btn, +.btn-group-vertical > .btn-group + .btn-group { + margin-top: -1px; + margin-left: 0; +} +.btn-group-vertical > .btn:not(:first-child):not(:last-child) { + border-radius: 0; +} +.btn-group-vertical > .btn:first-child:not(:last-child) { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group-vertical > .btn:last-child:not(:first-child) { + border-bottom-left-radius: 0; + border-top-right-radius: 0; + border-top-left-radius: 0; +} +.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { + border-radius: 0; +} +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child, +.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child { + border-top-right-radius: 0; + border-top-left-radius: 0; +} +.btn-group-justified { + display: table; + width: 100%; + table-layout: fixed; + border-collapse: separate; +} +.btn-group-justified > .btn, +.btn-group-justified > .btn-group { + float: none; + display: table-cell; + width: 1%; +} +.btn-group-justified > .btn-group .btn { + width: 100%; +} +.btn-group-justified > .btn-group .dropdown-menu { + left: auto; +} +[data-toggle="buttons"] > .btn > input[type="radio"], +[data-toggle="buttons"] > .btn > input[type="checkbox"] { + position: absolute; + z-index: -1; + opacity: 0; + filter: alpha(opacity=0); +} +.input-group { + position: relative; + display: table; + border-collapse: separate; +} +.input-group[class*="col-"] { + float: none; + padding-left: 0; + padding-right: 0; +} +.input-group .form-control { + position: relative; + z-index: 2; + float: left; + width: 100%; + margin-bottom: 0; +} +.input-group-lg > .form-control, +.input-group-lg > .input-group-addon, +.input-group-lg > .input-group-btn > .btn { + height: 46px; + padding: 10px 16px; + font-size: 18px; + line-height: 1.33; + border-radius: 0; +} +select.input-group-lg > .form-control, +select.input-group-lg > .input-group-addon, +select.input-group-lg > .input-group-btn > .btn { + height: 46px; + line-height: 46px; +} +textarea.input-group-lg > .form-control, +textarea.input-group-lg > .input-group-addon, +textarea.input-group-lg > .input-group-btn > .btn, +select[multiple].input-group-lg > .form-control, +select[multiple].input-group-lg > .input-group-addon, +select[multiple].input-group-lg > .input-group-btn > .btn { + height: auto; +} +.input-group-sm > .form-control, +.input-group-sm > .input-group-addon, +.input-group-sm > .input-group-btn > .btn { + height: 30px; + padding: 5px 10px; + font-size: 12px; + line-height: 1.5; + border-radius: 0; +} +select.input-group-sm > .form-control, +select.input-group-sm > .input-group-addon, +select.input-group-sm > .input-group-btn > .btn { + height: 30px; + line-height: 30px; +} +textarea.input-group-sm > .form-control, +textarea.input-group-sm > .input-group-addon, +textarea.input-group-sm > .input-group-btn > .btn, +select[multiple].input-group-sm > .form-control, +select[multiple].input-group-sm > .input-group-addon, +select[multiple].input-group-sm > .input-group-btn > .btn { + height: auto; +} +.input-group-addon, +.input-group-btn, +.input-group .form-control { + display: table-cell; +} +.input-group-addon:not(:first-child):not(:last-child), +.input-group-btn:not(:first-child):not(:last-child), +.input-group .form-control:not(:first-child):not(:last-child) { + border-radius: 0; +} +.input-group-addon, +.input-group-btn { + width: 1%; + white-space: nowrap; + vertical-align: middle; +} +.input-group-addon { + padding: 6px 12px; + font-size: 14px; + font-weight: normal; + line-height: 1; + color: #555555; + text-align: center; + background-color: #eeeeee; + border: 1px solid #ccc; + border-radius: 0; +} +.input-group-addon.input-sm { + padding: 5px 10px; + font-size: 12px; + border-radius: 0; +} +.input-group-addon.input-lg { + padding: 10px 16px; + font-size: 18px; + border-radius: 0; +} +.input-group-addon input[type="radio"], +.input-group-addon input[type="checkbox"] { + margin-top: 0; +} +.input-group .form-control:first-child, +.input-group-addon:first-child, +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group > .btn, +.input-group-btn:first-child > .dropdown-toggle, +.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle), +.input-group-btn:last-child > .btn-group:not(:last-child) > .btn { + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.input-group-addon:first-child { + border-right: 0; +} +.input-group .form-control:last-child, +.input-group-addon:last-child, +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group > .btn, +.input-group-btn:last-child > .dropdown-toggle, +.input-group-btn:first-child > .btn:not(:first-child), +.input-group-btn:first-child > .btn-group:not(:first-child) > .btn { + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.input-group-addon:last-child { + border-left: 0; +} +.input-group-btn { + position: relative; + font-size: 0; + white-space: nowrap; +} +.input-group-btn > .btn { + position: relative; +} +.input-group-btn > .btn + .btn { + margin-left: -1px; +} +.input-group-btn > .btn:hover, +.input-group-btn > .btn:focus, +.input-group-btn > .btn:active { + z-index: 2; +} +.input-group-btn:first-child > .btn, +.input-group-btn:first-child > .btn-group { + margin-right: -1px; +} +.input-group-btn:last-child > .btn, +.input-group-btn:last-child > .btn-group { + margin-left: -1px; +} +.nav { + margin-bottom: 0; + padding-left: 0; + list-style: none; +} +.nav > li { + position: relative; + display: block; +} +.nav > li > a { + position: relative; + display: block; + padding: 10px 15px; +} +.nav > li > a:hover, +.nav > li > a:focus { + text-decoration: none; + background-color: #eeeeee; +} +.nav > li.disabled > a { + color: #777777; +} +.nav > li.disabled > a:hover, +.nav > li.disabled > a:focus { + color: #777777; + text-decoration: none; + background-color: transparent; + cursor: not-allowed; +} +.nav .open > a, +.nav .open > a:hover, +.nav .open > a:focus { + background-color: #eeeeee; + border-color: #5fa134; +} +.nav .nav-divider { + height: 1px; + margin: 9px 0; + overflow: hidden; + background-color: #e5e5e5; +} +.nav > li > a > img { + max-width: none; +} +.nav-tabs { + border-bottom: 1px solid #34302D; +} +.nav-tabs > li { + float: left; + margin-bottom: -1px; +} +.nav-tabs > li > a { + margin-right: 2px; + line-height: 1.428571429; + border: 1px solid transparent; + border-radius: 0 0 0 0; +} +.nav-tabs > li > a:hover { + border-color: #eeeeee #eeeeee #34302D; +} +.nav-tabs > li.active > a, +.nav-tabs > li.active > a:hover, +.nav-tabs > li.active > a:focus { + color: #f1f1f1; + background-color: #34302D; + border: 1px solid #34302D; + border-bottom-color: transparent; + cursor: default; +} +.nav-tabs.nav-justified { + width: 100%; + border-bottom: 0; +} +.nav-tabs.nav-justified > li { + float: none; +} +.nav-tabs.nav-justified > li > a { + text-align: center; + margin-bottom: 5px; +} +.nav-tabs.nav-justified > .dropdown .dropdown-menu { + top: auto; + left: auto; +} +@media (min-width: 768px) { + .nav-tabs.nav-justified > li { + display: table-cell; + width: 1%; + } + .nav-tabs.nav-justified > li > a { + margin-bottom: 0; + } +} +.nav-tabs.nav-justified > li > a { + margin-right: 0; + border-radius: 0; +} +.nav-tabs.nav-justified > .active > a, +.nav-tabs.nav-justified > .active > a:hover, +.nav-tabs.nav-justified > .active > a:focus { + border: 1px solid #ddd; +} +@media (min-width: 768px) { + .nav-tabs.nav-justified > li > a { + border-bottom: 1px solid #ddd; + border-radius: 0 0 0 0; + } + .nav-tabs.nav-justified > .active > a, + .nav-tabs.nav-justified > .active > a:hover, + .nav-tabs.nav-justified > .active > a:focus { + border-bottom-color: #f1f1f1; + } +} +.nav-pills > li { + float: left; +} +.nav-pills > li > a { + border-radius: 0; +} +.nav-pills > li + li { + margin-left: 2px; +} +.nav-pills > li.active > a, +.nav-pills > li.active > a:hover, +.nav-pills > li.active > a:focus { + color: #fff; + background-color: #428bca; +} +.nav-stacked > li { + float: none; +} +.nav-stacked > li + li { + margin-top: 2px; + margin-left: 0; +} +.nav-justified { + width: 100%; +} +.nav-justified > li { + float: none; +} +.nav-justified > li > a { + text-align: center; + margin-bottom: 5px; +} +.nav-justified > .dropdown .dropdown-menu { + top: auto; + left: auto; +} +@media (min-width: 768px) { + .nav-justified > li { + display: table-cell; + width: 1%; + } + .nav-justified > li > a { + margin-bottom: 0; + } +} +.nav-tabs-justified { + border-bottom: 0; +} +.nav-tabs-justified > li > a { + margin-right: 0; + border-radius: 0; +} +.nav-tabs-justified > .active > a, +.nav-tabs-justified > .active > a:hover, +.nav-tabs-justified > .active > a:focus { + border: 1px solid #ddd; +} +@media (min-width: 768px) { + .nav-tabs-justified > li > a { + border-bottom: 1px solid #ddd; + border-radius: 0 0 0 0; + } + .nav-tabs-justified > .active > a, + .nav-tabs-justified > .active > a:hover, + .nav-tabs-justified > .active > a:focus { + border-bottom-color: #f1f1f1; + } +} +.tab-content > .tab-pane { + display: none; +} +.tab-content > .active { + display: block; +} +.nav-tabs .dropdown-menu { + margin-top: -1px; + border-top-right-radius: 0; + border-top-left-radius: 0; +} +.navbar { + position: relative; + min-height: 50px; + margin-bottom: 20px; + border: 1px solid transparent; +} +@media (min-width: 768px) { + .navbar { + border-radius: 0; + } +} +@media (min-width: 768px) { + .navbar-header { + float: left; + } +} +.navbar-collapse { + overflow-x: visible; + padding-right: 15px; + padding-left: 15px; + border-top: 1px solid transparent; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-overflow-scrolling: touch; +} +.navbar-collapse.in { + overflow-y: auto; +} +@media (min-width: 768px) { + .navbar-collapse { + width: auto; + border-top: 0; + box-shadow: none; + } + .navbar-collapse.collapse { + display: block !important; + height: auto !important; + padding-bottom: 0; + overflow: visible !important; + } + .navbar-collapse.in { + overflow-y: visible; + } + .navbar-fixed-top .navbar-collapse, + .navbar-static-top .navbar-collapse, + .navbar-fixed-bottom .navbar-collapse { + padding-left: 0; + padding-right: 0; + } +} +.navbar-fixed-top .navbar-collapse, +.navbar-fixed-bottom .navbar-collapse { + max-height: 340px; +} +@media (max-width: 480px) and (orientation: landscape) { + .navbar-fixed-top .navbar-collapse, + .navbar-fixed-bottom .navbar-collapse { + max-height: 200px; + } +} +.container > .navbar-header, +.container-fluid > .navbar-header, +.container > .navbar-collapse, +.container-fluid > .navbar-collapse { + margin-right: -15px; + margin-left: -15px; +} +@media (min-width: 768px) { + .container > .navbar-header, + .container-fluid > .navbar-header, + .container > .navbar-collapse, + .container-fluid > .navbar-collapse { + margin-right: 0; + margin-left: 0; + } +} +.navbar-static-top { + z-index: 1000; + border-width: 0 0 1px; +} +@media (min-width: 768px) { + .navbar-static-top { + border-radius: 0; + } +} +.navbar-fixed-top, +.navbar-fixed-bottom { + position: fixed; + right: 0; + left: 0; + z-index: 1030; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} +@media (min-width: 768px) { + .navbar-fixed-top, + .navbar-fixed-bottom { + border-radius: 0; + } +} +.navbar-fixed-top { + top: 0; + border-width: 0 0 1px; +} +.navbar-fixed-bottom { + bottom: 0; + margin-bottom: 0; + border-width: 1px 0 0; +} +.navbar-brand { + float: left; + padding: 15px 15px; + font-size: 18px; + line-height: 20px; + height: 50px; +} +.navbar-brand:hover, +.navbar-brand:focus { + text-decoration: none; +} +@media (min-width: 768px) { + .navbar > .container .navbar-brand, + .navbar > .container-fluid .navbar-brand { + margin-left: -15px; + } +} +.navbar-toggle { + position: relative; + float: right; + margin-right: 15px; + padding: 9px 10px; + margin-top: 8px; + margin-bottom: 8px; + background-color: transparent; + background-image: none; + border: 1px solid transparent; + border-radius: 0; +} +.navbar-toggle:focus { + outline: 0; +} +.navbar-toggle .icon-bar { + display: block; + width: 22px; + height: 2px; + border-radius: 1px; +} +.navbar-toggle .icon-bar + .icon-bar { + margin-top: 4px; +} +@media (min-width: 768px) { + .navbar-toggle { + display: none; + } +} +.navbar-nav { + margin: 7.5px -15px; +} +.navbar-nav > li > a { + padding-top: 10px; + padding-bottom: 10px; + line-height: 20px; +} +@media (max-width: 767px) { + .navbar-nav .open .dropdown-menu { + position: static; + float: none; + width: auto; + margin-top: 0; + background-color: transparent; + border: 0; + box-shadow: none; + } + .navbar-nav .open .dropdown-menu > li > a, + .navbar-nav .open .dropdown-menu .dropdown-header { + padding: 5px 15px 5px 25px; + } + .navbar-nav .open .dropdown-menu > li > a { + line-height: 20px; + } + .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-nav .open .dropdown-menu > li > a:focus { + background-image: none; + } +} +@media (min-width: 768px) { + .navbar-nav { + float: left; + margin: 0; + } + .navbar-nav > li { + float: left; + } + .navbar-nav > li > a { + padding-top: 15px; + padding-bottom: 15px; + } + .navbar-nav.navbar-right:last-child { + margin-right: -15px; + } +} +@media (min-width: 768px) { + .navbar-left { + float: left !important; + } + .navbar-right { + float: right !important; + } +} +.navbar-form { + margin-left: -15px; + margin-right: -15px; + padding: 10px 15px; + border-top: 1px solid transparent; + border-bottom: 1px solid transparent; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); + margin-top: 8px; + margin-bottom: 8px; +} +@media (min-width: 768px) { + .navbar-form .form-group { + display: inline-block; + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .form-control { + display: inline-block; + width: auto; + vertical-align: middle; + } + .navbar-form .input-group { + display: inline-table; + vertical-align: middle; + } + .navbar-form .input-group .input-group-addon, + .navbar-form .input-group .input-group-btn, + .navbar-form .input-group .form-control { + width: auto; + } + .navbar-form .input-group > .form-control { + width: 100%; + } + .navbar-form .control-label { + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .radio, + .navbar-form .checkbox { + display: inline-block; + margin-top: 0; + margin-bottom: 0; + vertical-align: middle; + } + .navbar-form .radio label, + .navbar-form .checkbox label { + padding-left: 0; + } + .navbar-form .radio input[type="radio"], + .navbar-form .checkbox input[type="checkbox"] { + position: relative; + margin-left: 0; + } + .navbar-form .has-feedback .form-control-feedback { + top: 0; + } +} +@media (max-width: 767px) { + .navbar-form .form-group { + margin-bottom: 5px; + } +} +@media (min-width: 768px) { + .navbar-form { + width: auto; + border: 0; + margin-left: 0; + margin-right: 0; + padding-top: 0; + padding-bottom: 0; + -webkit-box-shadow: none; + box-shadow: none; + } + .navbar-form.navbar-right:last-child { + margin-right: -15px; + } +} +.navbar-nav > li > .dropdown-menu { + margin-top: 0; + border-top-right-radius: 0; + border-top-left-radius: 0; +} +.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu { + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.navbar-btn { + margin-top: 8px; + margin-bottom: 8px; +} +.navbar-btn.btn-sm { + margin-top: 10px; + margin-bottom: 10px; +} +.navbar-btn.btn-xs { + margin-top: 14px; + margin-bottom: 14px; +} +.navbar-text { + margin-top: 15px; + margin-bottom: 15px; +} +@media (min-width: 768px) { + .navbar-text { + float: left; + margin-left: 15px; + margin-right: 15px; + } + .navbar-text.navbar-right:last-child { + margin-right: 0; + } +} +.navbar-default { + background-color: #f8f8f8; + border-color: #e7e7e7; +} +.navbar-default .navbar-brand { + color: #f1f1f1; +} +.navbar-default .navbar-brand:hover, +.navbar-default .navbar-brand:focus { + color: #d8d8d8; + background-color: transparent; +} +.navbar-default .navbar-text { + color: #777; +} +.navbar-default .navbar-nav > li > a { + color: #f1f1f1; +} +.navbar-default .navbar-nav > li > a:hover, +.navbar-default .navbar-nav > li > a:focus { + color: #f1f1f1; + background-color: #6db33f; +} +.navbar-default .navbar-nav > .active > a, +.navbar-default .navbar-nav > .active > a:hover, +.navbar-default .navbar-nav > .active > a:focus { + color: #f1f1f1; + background-color: #6db33f; +} +.navbar-default .navbar-nav > .disabled > a, +.navbar-default .navbar-nav > .disabled > a:hover, +.navbar-default .navbar-nav > .disabled > a:focus { + color: #ccc; + background-color: transparent; +} +.navbar-default .navbar-toggle { + border-color: #ddd; +} +.navbar-default .navbar-toggle:hover, +.navbar-default .navbar-toggle:focus { + background-color: transparent; +} +.navbar-default .navbar-toggle .icon-bar { + background-color: #f1f1f1; +} +.navbar-default .navbar-collapse, +.navbar-default .navbar-form { + border-color: #e7e7e7; +} +.navbar-default .navbar-nav > .open > a, +.navbar-default .navbar-nav > .open > a:hover, +.navbar-default .navbar-nav > .open > a:focus { + background-color: #6db33f; + color: #f1f1f1; +} +@media (max-width: 767px) { + .navbar-default .navbar-nav .open .dropdown-menu > li > a { + color: #f1f1f1; + } + .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { + color: #f1f1f1; + background-color: #6db33f; + } + .navbar-default .navbar-nav .open .dropdown-menu > .active > a, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #f1f1f1; + background-color: #6db33f; + } + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus { + color: #ccc; + background-color: transparent; + } +} +.navbar-default .navbar-link { + color: #f1f1f1; +} +.navbar-default .navbar-link:hover { + color: #f1f1f1; +} +.navbar-default .btn-link { + color: #f1f1f1; +} +.navbar-default .btn-link:hover, +.navbar-default .btn-link:focus { + color: #f1f1f1; +} +.navbar-default .btn-link[disabled]:hover, +fieldset[disabled] .navbar-default .btn-link:hover, +.navbar-default .btn-link[disabled]:focus, +fieldset[disabled] .navbar-default .btn-link:focus { + color: #ccc; +} +.navbar-inverse { + background-color: #222; + border-color: #080808; +} +.navbar-inverse .navbar-brand { + color: #777777; +} +.navbar-inverse .navbar-brand:hover, +.navbar-inverse .navbar-brand:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-text { + color: #777777; +} +.navbar-inverse .navbar-nav > li > a { + color: #777777; +} +.navbar-inverse .navbar-nav > li > a:hover, +.navbar-inverse .navbar-nav > li > a:focus { + color: #fff; + background-color: transparent; +} +.navbar-inverse .navbar-nav > .active > a, +.navbar-inverse .navbar-nav > .active > a:hover, +.navbar-inverse .navbar-nav > .active > a:focus { + color: #fff; + background-color: #080808; +} +.navbar-inverse .navbar-nav > .disabled > a, +.navbar-inverse .navbar-nav > .disabled > a:hover, +.navbar-inverse .navbar-nav > .disabled > a:focus { + color: #444; + background-color: transparent; +} +.navbar-inverse .navbar-toggle { + border-color: #333; +} +.navbar-inverse .navbar-toggle:hover, +.navbar-inverse .navbar-toggle:focus { + background-color: #333; +} +.navbar-inverse .navbar-toggle .icon-bar { + background-color: #fff; +} +.navbar-inverse .navbar-collapse, +.navbar-inverse .navbar-form { + border-color: #101010; +} +.navbar-inverse .navbar-nav > .open > a, +.navbar-inverse .navbar-nav > .open > a:hover, +.navbar-inverse .navbar-nav > .open > a:focus { + background-color: #080808; + color: #fff; +} +@media (max-width: 767px) { + .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header { + border-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu .divider { + background-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a { + color: #777777; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus { + color: #fff; + background-color: transparent; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a, + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus { + color: #fff; + background-color: #080808; + } + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a, + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover, + .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus { + color: #444; + background-color: transparent; + } +} +.navbar-inverse .navbar-link { + color: #777777; +} +.navbar-inverse .navbar-link:hover { + color: #fff; +} +.navbar-inverse .btn-link { + color: #777777; +} +.navbar-inverse .btn-link:hover, +.navbar-inverse .btn-link:focus { + color: #fff; +} +.navbar-inverse .btn-link[disabled]:hover, +fieldset[disabled] .navbar-inverse .btn-link:hover, +.navbar-inverse .btn-link[disabled]:focus, +fieldset[disabled] .navbar-inverse .btn-link:focus { + color: #444; +} +.breadcrumb { + padding: 8px 15px; + margin-bottom: 20px; + list-style: none; + background-color: #f5f5f5; + border-radius: 0; +} +.breadcrumb > li { + display: inline-block; +} +.breadcrumb > li + li:before { + content: "/\00a0"; + padding: 0 5px; + color: #ccc; +} +.breadcrumb > .active { + color: #777777; +} +.pagination { + display: inline-block; + padding-left: 0; + margin: 20px 0; + border-radius: 0; +} +.pagination > li { + display: inline; +} +.pagination > li > a, +.pagination > li > span { + position: relative; + float: left; + padding: 6px 12px; + line-height: 1.428571429; + text-decoration: none; + color: #5fa134; + background-color: #fff; + border: 1px solid #ddd; + margin-left: -1px; +} +.pagination > li:first-child > a, +.pagination > li:first-child > span { + margin-left: 0; + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.pagination > li:last-child > a, +.pagination > li:last-child > span { + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.pagination > li > a:hover, +.pagination > li > span:hover, +.pagination > li > a:focus, +.pagination > li > span:focus { + color: #5fa134; + background-color: #eeeeee; + border-color: #ddd; +} +.pagination > .active > a, +.pagination > .active > span, +.pagination > .active > a:hover, +.pagination > .active > span:hover, +.pagination > .active > a:focus, +.pagination > .active > span:focus { + z-index: 2; + color: #fff; + background-color: #428bca; + border-color: #428bca; + cursor: default; +} +.pagination > .disabled > span, +.pagination > .disabled > span:hover, +.pagination > .disabled > span:focus, +.pagination > .disabled > a, +.pagination > .disabled > a:hover, +.pagination > .disabled > a:focus { + color: #777777; + background-color: #fff; + border-color: #ddd; + cursor: not-allowed; +} +.pagination-lg > li > a, +.pagination-lg > li > span { + padding: 10px 16px; + font-size: 18px; +} +.pagination-lg > li:first-child > a, +.pagination-lg > li:first-child > span { + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.pagination-lg > li:last-child > a, +.pagination-lg > li:last-child > span { + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.pagination-sm > li > a, +.pagination-sm > li > span { + padding: 5px 10px; + font-size: 12px; +} +.pagination-sm > li:first-child > a, +.pagination-sm > li:first-child > span { + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} +.pagination-sm > li:last-child > a, +.pagination-sm > li:last-child > span { + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} +.pager { + padding-left: 0; + margin: 20px 0; + list-style: none; + text-align: center; +} +.pager li { + display: inline; +} +.pager li > a, +.pager li > span { + display: inline-block; + padding: 5px 14px; + background-color: #fff; + border: 1px solid #ddd; + border-radius: 15px; +} +.pager li > a:hover, +.pager li > a:focus { + text-decoration: none; + background-color: #eeeeee; +} +.pager .next > a, +.pager .next > span { + float: right; +} +.pager .previous > a, +.pager .previous > span { + float: left; +} +.pager .disabled > a, +.pager .disabled > a:hover, +.pager .disabled > a:focus, +.pager .disabled > span { + color: #777777; + background-color: #fff; + cursor: not-allowed; +} +.label { + display: inline; + padding: .2em .6em .3em; + font-size: 75%; + font-weight: bold; + line-height: 1; + color: #fff; + text-align: center; + white-space: nowrap; + vertical-align: baseline; + border-radius: .25em; +} +a.label:hover, +a.label:focus { + color: #fff; + text-decoration: none; + cursor: pointer; +} +.label:empty { + display: none; +} +.btn .label { + position: relative; + top: -1px; +} +.label-default { + background-color: #777777; +} +.label-default[href]:hover, +.label-default[href]:focus { + background-color: #5e5e5e; +} +.label-primary { + background-color: #428bca; +} +.label-primary[href]:hover, +.label-primary[href]:focus { + background-color: #3071a9; +} +.label-success { + background-color: #5cb85c; +} +.label-success[href]:hover, +.label-success[href]:focus { + background-color: #449d44; +} +.label-info { + background-color: #5bc0de; +} +.label-info[href]:hover, +.label-info[href]:focus { + background-color: #31b0d5; +} +.label-warning { + background-color: #f0ad4e; +} +.label-warning[href]:hover, +.label-warning[href]:focus { + background-color: #ec971f; +} +.label-danger { + background-color: #d9534f; +} +.label-danger[href]:hover, +.label-danger[href]:focus { + background-color: #c9302c; +} +.badge { + display: inline-block; + min-width: 10px; + padding: 3px 7px; + font-size: 12px; + font-weight: bold; + color: #fff; + line-height: 1; + vertical-align: baseline; + white-space: nowrap; + text-align: center; + background-color: #777777; + border-radius: 10px; +} +.badge:empty { + display: none; +} +.btn .badge { + position: relative; + top: -1px; +} +.btn-xs .badge { + top: 0; + padding: 1px 5px; +} +a.badge:hover, +a.badge:focus { + color: #fff; + text-decoration: none; + cursor: pointer; +} +a.list-group-item.active > .badge, +.nav-pills > .active > a > .badge { + color: #5fa134; + background-color: #fff; +} +.nav-pills > li > a > .badge { + margin-left: 3px; +} +.jumbotron { + padding: 30px; + margin-bottom: 30px; + color: inherit; + background-color: #eeeeee; +} +.jumbotron h1, +.jumbotron .h1 { + color: inherit; +} +.jumbotron p { + margin-bottom: 15px; + font-size: 21px; + font-weight: 200; +} +.jumbotron > hr { + border-top-color: #d5d5d5; +} +.container .jumbotron { + border-radius: 0; +} +.jumbotron .container { + max-width: 100%; +} +@media screen and (min-width: 768px) { + .jumbotron { + padding-top: 48px; + padding-bottom: 48px; + } + .container .jumbotron { + padding-left: 60px; + padding-right: 60px; + } + .jumbotron h1, + .jumbotron .h1 { + font-size: 63px; + } +} +.thumbnail { + display: block; + padding: 4px; + margin-bottom: 20px; + line-height: 1.428571429; + background-color: #f1f1f1; + border: 1px solid #ddd; + border-radius: 0; + -webkit-transition: all .2s ease-in-out; + -o-transition: all .2s ease-in-out; + transition: all .2s ease-in-out; +} +.thumbnail > img, +.thumbnail a > img { + margin-left: auto; + margin-right: auto; +} +a.thumbnail:hover, +a.thumbnail:focus, +a.thumbnail.active { + border-color: #5fa134; +} +.thumbnail .caption { + padding: 9px; + color: #f1f1f1; +} +.alert { + padding: 15px; + margin-bottom: 20px; + border: 1px solid transparent; + border-radius: 0; +} +.alert h4 { + margin-top: 0; + color: inherit; +} +.alert .alert-link { + font-weight: bold; +} +.alert > p, +.alert > ul { + margin-bottom: 0; +} +.alert > p + p { + margin-top: 5px; +} +.alert-dismissable, +.alert-dismissible { + padding-right: 35px; +} +.alert-dismissable .close, +.alert-dismissible .close { + position: relative; + top: -2px; + right: -21px; + color: inherit; +} +.alert-success { + background-color: #dff0d8; + border-color: #d6e9c6; + color: #3c763d; +} +.alert-success hr { + border-top-color: #c9e2b3; +} +.alert-success .alert-link { + color: #2b542c; +} +.alert-info { + background-color: #d9edf7; + border-color: #bce8f1; + color: #31708f; +} +.alert-info hr { + border-top-color: #a6e1ec; +} +.alert-info .alert-link { + color: #245269; +} +.alert-warning { + background-color: #fcf8e3; + border-color: #faebcc; + color: #8a6d3b; +} +.alert-warning hr { + border-top-color: #f7e1b5; +} +.alert-warning .alert-link { + color: #66512c; +} +.alert-danger { + background-color: #f2dede; + border-color: #ebccd1; + color: #a94442; +} +.alert-danger hr { + border-top-color: #e4b9c0; +} +.alert-danger .alert-link { + color: #843534; +} +@-webkit-keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +@keyframes progress-bar-stripes { + from { + background-position: 40px 0; + } + to { + background-position: 0 0; + } +} +.progress { + overflow: hidden; + height: 20px; + margin-bottom: 20px; + background-color: #f5f5f5; + border-radius: 0; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); +} +.progress-bar { + float: left; + width: 0%; + height: 100%; + font-size: 12px; + line-height: 20px; + color: #fff; + text-align: center; + background-color: #428bca; + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -webkit-transition: width .6s ease; + -o-transition: width .6s ease; + transition: width .6s ease; +} +.progress-striped .progress-bar, +.progress-bar-striped { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-size: 40px 40px; +} +.progress.active .progress-bar, +.progress-bar.active { + -webkit-animation: progress-bar-stripes 2s linear infinite; + -o-animation: progress-bar-stripes 2s linear infinite; + animation: progress-bar-stripes 2s linear infinite; +} +.progress-bar[aria-valuenow="1"], +.progress-bar[aria-valuenow="2"] { + min-width: 30px; +} +.progress-bar[aria-valuenow="0"] { + color: #777777; + min-width: 30px; + background-color: transparent; + background-image: none; + box-shadow: none; +} +.progress-bar-success { + background-color: #5cb85c; +} +.progress-striped .progress-bar-success { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-bar-info { + background-color: #5bc0de; +} +.progress-striped .progress-bar-info { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-bar-warning { + background-color: #f0ad4e; +} +.progress-striped .progress-bar-warning { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.progress-bar-danger { + background-color: #d9534f; +} +.progress-striped .progress-bar-danger { + background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); +} +.media, +.media-body { + overflow: hidden; + zoom: 1; +} +.media, +.media .media { + margin-top: 15px; +} +.media:first-child { + margin-top: 0; +} +.media-object { + display: block; +} +.media-heading { + margin: 0 0 5px; +} +.media > .pull-left { + margin-right: 10px; +} +.media > .pull-right { + margin-left: 10px; +} +.media-list { + padding-left: 0; + list-style: none; +} +.list-group { + margin-bottom: 20px; + padding-left: 0; +} +.list-group-item { + position: relative; + display: block; + padding: 10px 15px; + margin-bottom: -1px; + background-color: #fff; + border: 1px solid #ddd; +} +.list-group-item:first-child { + border-top-right-radius: 0; + border-top-left-radius: 0; +} +.list-group-item:last-child { + margin-bottom: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} +.list-group-item > .badge { + float: right; +} +.list-group-item > .badge + .badge { + margin-right: 5px; +} +a.list-group-item { + color: #555; +} +a.list-group-item .list-group-item-heading { + color: #333; +} +a.list-group-item:hover, +a.list-group-item:focus { + text-decoration: none; + color: #555; + background-color: #f5f5f5; +} +.list-group-item.disabled, +.list-group-item.disabled:hover, +.list-group-item.disabled:focus { + background-color: #eeeeee; + color: #777777; +} +.list-group-item.disabled .list-group-item-heading, +.list-group-item.disabled:hover .list-group-item-heading, +.list-group-item.disabled:focus .list-group-item-heading { + color: inherit; +} +.list-group-item.disabled .list-group-item-text, +.list-group-item.disabled:hover .list-group-item-text, +.list-group-item.disabled:focus .list-group-item-text { + color: #777777; +} +.list-group-item.active, +.list-group-item.active:hover, +.list-group-item.active:focus { + z-index: 2; + color: #fff; + background-color: #428bca; + border-color: #428bca; +} +.list-group-item.active .list-group-item-heading, +.list-group-item.active:hover .list-group-item-heading, +.list-group-item.active:focus .list-group-item-heading, +.list-group-item.active .list-group-item-heading > small, +.list-group-item.active:hover .list-group-item-heading > small, +.list-group-item.active:focus .list-group-item-heading > small, +.list-group-item.active .list-group-item-heading > .small, +.list-group-item.active:hover .list-group-item-heading > .small, +.list-group-item.active:focus .list-group-item-heading > .small { + color: inherit; +} +.list-group-item.active .list-group-item-text, +.list-group-item.active:hover .list-group-item-text, +.list-group-item.active:focus .list-group-item-text { + color: #e1edf7; +} +.list-group-item-success { + color: #3c763d; + background-color: #dff0d8; +} +a.list-group-item-success { + color: #3c763d; +} +a.list-group-item-success .list-group-item-heading { + color: inherit; +} +a.list-group-item-success:hover, +a.list-group-item-success:focus { + color: #3c763d; + background-color: #d0e9c6; +} +a.list-group-item-success.active, +a.list-group-item-success.active:hover, +a.list-group-item-success.active:focus { + color: #fff; + background-color: #3c763d; + border-color: #3c763d; +} +.list-group-item-info { + color: #31708f; + background-color: #d9edf7; +} +a.list-group-item-info { + color: #31708f; +} +a.list-group-item-info .list-group-item-heading { + color: inherit; +} +a.list-group-item-info:hover, +a.list-group-item-info:focus { + color: #31708f; + background-color: #c4e3f3; +} +a.list-group-item-info.active, +a.list-group-item-info.active:hover, +a.list-group-item-info.active:focus { + color: #fff; + background-color: #31708f; + border-color: #31708f; +} +.list-group-item-warning { + color: #8a6d3b; + background-color: #fcf8e3; +} +a.list-group-item-warning { + color: #8a6d3b; +} +a.list-group-item-warning .list-group-item-heading { + color: inherit; +} +a.list-group-item-warning:hover, +a.list-group-item-warning:focus { + color: #8a6d3b; + background-color: #faf2cc; +} +a.list-group-item-warning.active, +a.list-group-item-warning.active:hover, +a.list-group-item-warning.active:focus { + color: #fff; + background-color: #8a6d3b; + border-color: #8a6d3b; +} +.list-group-item-danger { + color: #a94442; + background-color: #f2dede; +} +a.list-group-item-danger { + color: #a94442; +} +a.list-group-item-danger .list-group-item-heading { + color: inherit; +} +a.list-group-item-danger:hover, +a.list-group-item-danger:focus { + color: #a94442; + background-color: #ebcccc; +} +a.list-group-item-danger.active, +a.list-group-item-danger.active:hover, +a.list-group-item-danger.active:focus { + color: #fff; + background-color: #a94442; + border-color: #a94442; +} +.list-group-item-heading { + margin-top: 0; + margin-bottom: 5px; +} +.list-group-item-text { + margin-bottom: 0; + line-height: 1.3; +} +.panel { + margin-bottom: 20px; + background-color: #fff; + border: 1px solid transparent; + border-radius: 0; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); +} +.panel-body { + padding: 15px; +} +.panel-heading { + padding: 10px 15px; + border-bottom: 1px solid transparent; + border-top-right-radius: -1; + border-top-left-radius: -1; +} +.panel-heading > .dropdown .dropdown-toggle { + color: inherit; +} +.panel-title { + margin-top: 0; + margin-bottom: 0; + font-size: 16px; + color: inherit; +} +.panel-title > a { + color: inherit; +} +.panel-footer { + padding: 10px 15px; + background-color: #f5f5f5; + border-top: 1px solid #ddd; + border-bottom-right-radius: -1; + border-bottom-left-radius: -1; +} +.panel > .list-group { + margin-bottom: 0; +} +.panel > .list-group .list-group-item { + border-width: 1px 0; + border-radius: 0; +} +.panel > .list-group:first-child .list-group-item:first-child { + border-top: 0; + border-top-right-radius: -1; + border-top-left-radius: -1; +} +.panel > .list-group:last-child .list-group-item:last-child { + border-bottom: 0; + border-bottom-right-radius: -1; + border-bottom-left-radius: -1; +} +.panel-heading + .list-group .list-group-item:first-child { + border-top-width: 0; +} +.list-group + .panel-footer { + border-top-width: 0; +} +.panel > .table, +.panel > .table-responsive > .table, +.panel > .panel-collapse > .table { + margin-bottom: 0; +} +.panel > .table:first-child, +.panel > .table-responsive:first-child > .table:first-child { + border-top-right-radius: -1; + border-top-left-radius: -1; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { + border-top-left-radius: -1; +} +.panel > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, +.panel > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, +.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, +.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { + border-top-right-radius: -1; +} +.panel > .table:last-child, +.panel > .table-responsive:last-child > .table:last-child { + border-bottom-right-radius: -1; + border-bottom-left-radius: -1; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { + border-bottom-left-radius: -1; +} +.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, +.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, +.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, +.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { + border-bottom-right-radius: -1; +} +.panel > .panel-body + .table, +.panel > .panel-body + .table-responsive { + border-top: 1px solid #34302D; +} +.panel > .table > tbody:first-child > tr:first-child th, +.panel > .table > tbody:first-child > tr:first-child td { + border-top: 0; +} +.panel > .table-bordered, +.panel > .table-responsive > .table-bordered { + border: 0; +} +.panel > .table-bordered > thead > tr > th:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:first-child, +.panel > .table-bordered > tbody > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child, +.panel > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child, +.panel > .table-bordered > thead > tr > td:first-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:first-child, +.panel > .table-bordered > tbody > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child, +.panel > .table-bordered > tfoot > tr > td:first-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child { + border-left: 0; +} +.panel > .table-bordered > thead > tr > th:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > th:last-child, +.panel > .table-bordered > tbody > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child, +.panel > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child, +.panel > .table-bordered > thead > tr > td:last-child, +.panel > .table-responsive > .table-bordered > thead > tr > td:last-child, +.panel > .table-bordered > tbody > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child, +.panel > .table-bordered > tfoot > tr > td:last-child, +.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child { + border-right: 0; +} +.panel > .table-bordered > thead > tr:first-child > td, +.panel > .table-responsive > .table-bordered > thead > tr:first-child > td, +.panel > .table-bordered > tbody > tr:first-child > td, +.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td, +.panel > .table-bordered > thead > tr:first-child > th, +.panel > .table-responsive > .table-bordered > thead > tr:first-child > th, +.panel > .table-bordered > tbody > tr:first-child > th, +.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th { + border-bottom: 0; +} +.panel > .table-bordered > tbody > tr:last-child > td, +.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td, +.panel > .table-bordered > tfoot > tr:last-child > td, +.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, +.panel > .table-bordered > tbody > tr:last-child > th, +.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th, +.panel > .table-bordered > tfoot > tr:last-child > th, +.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th { + border-bottom: 0; +} +.panel > .table-responsive { + border: 0; + margin-bottom: 0; +} +.panel-group { + margin-bottom: 20px; +} +.panel-group .panel { + margin-bottom: 0; + border-radius: 0; +} +.panel-group .panel + .panel { + margin-top: 5px; +} +.panel-group .panel-heading { + border-bottom: 0; +} +.panel-group .panel-heading + .panel-collapse > .panel-body { + border-top: 1px solid #ddd; +} +.panel-group .panel-footer { + border-top: 0; +} +.panel-group .panel-footer + .panel-collapse .panel-body { + border-bottom: 1px solid #ddd; +} +.panel-default { + border-color: #ddd; +} +.panel-default > .panel-heading { + color: #333333; + background-color: #f5f5f5; + border-color: #ddd; +} +.panel-default > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #ddd; +} +.panel-default > .panel-heading .badge { + color: #f5f5f5; + background-color: #333333; +} +.panel-default > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #ddd; +} +.panel-primary { + border-color: #428bca; +} +.panel-primary > .panel-heading { + color: #fff; + background-color: #428bca; + border-color: #428bca; +} +.panel-primary > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #428bca; +} +.panel-primary > .panel-heading .badge { + color: #428bca; + background-color: #fff; +} +.panel-primary > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #428bca; +} +.panel-success { + border-color: #d6e9c6; +} +.panel-success > .panel-heading { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} +.panel-success > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #d6e9c6; +} +.panel-success > .panel-heading .badge { + color: #dff0d8; + background-color: #3c763d; +} +.panel-success > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #d6e9c6; +} +.panel-info { + border-color: #bce8f1; +} +.panel-info > .panel-heading { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.panel-info > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #bce8f1; +} +.panel-info > .panel-heading .badge { + color: #d9edf7; + background-color: #31708f; +} +.panel-info > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #bce8f1; +} +.panel-warning { + border-color: #faebcc; +} +.panel-warning > .panel-heading { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +.panel-warning > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #faebcc; +} +.panel-warning > .panel-heading .badge { + color: #fcf8e3; + background-color: #8a6d3b; +} +.panel-warning > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #faebcc; +} +.panel-danger { + border-color: #ebccd1; +} +.panel-danger > .panel-heading { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +.panel-danger > .panel-heading + .panel-collapse > .panel-body { + border-top-color: #ebccd1; +} +.panel-danger > .panel-heading .badge { + color: #f2dede; + background-color: #a94442; +} +.panel-danger > .panel-footer + .panel-collapse > .panel-body { + border-bottom-color: #ebccd1; +} +.embed-responsive { + position: relative; + display: block; + height: 0; + padding: 0; + overflow: hidden; +} +.embed-responsive .embed-responsive-item, +.embed-responsive iframe, +.embed-responsive embed, +.embed-responsive object { + position: absolute; + top: 0; + left: 0; + bottom: 0; + height: 100%; + width: 100%; + border: 0; +} +.embed-responsive.embed-responsive-16by9 { + padding-bottom: 56.25%; +} +.embed-responsive.embed-responsive-4by3 { + padding-bottom: 75%; +} +.well { + min-height: 20px; + padding: 19px; + margin-bottom: 20px; + background-color: #f5f5f5; + border: 1px solid #e3e3e3; + border-radius: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); +} +.well blockquote { + border-color: #ddd; + border-color: rgba(0, 0, 0, 0.15); +} +.well-lg { + padding: 24px; + border-radius: 0; +} +.well-sm { + padding: 9px; + border-radius: 0; +} +.close { + float: right; + font-size: 21px; + font-weight: bold; + line-height: 1; + color: #000; + text-shadow: 0 1px 0 #fff; + opacity: .2; + filter: alpha(opacity=20); +} +.close:hover, +.close:focus { + color: #000; + text-decoration: none; + cursor: pointer; + opacity: .5; + filter: alpha(opacity=50); +} +button.close { + padding: 0; + cursor: pointer; + background: transparent; + border: 0; + -webkit-appearance: none; +} +.modal-open { + overflow: hidden; +} +.modal { + display: none; + overflow: hidden; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1050; + -webkit-overflow-scrolling: touch; + outline: 0; +} +.modal.fade .modal-dialog { + -webkit-transform: translate3d(0, -25%, 0); + transform: translate3d(0, -25%, 0); + -webkit-transition: -webkit-transform 0.3s ease-out; + -moz-transition: -moz-transform 0.3s ease-out; + -o-transition: -o-transform 0.3s ease-out; + transition: transform 0.3s ease-out; +} +.modal.in .modal-dialog { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} +.modal-open .modal { + overflow-x: hidden; + overflow-y: auto; +} +.modal-dialog { + position: relative; + width: auto; + margin: 10px; +} +.modal-content { + position: relative; + background-color: #fff; + border: 1px solid #999; + border: 1px solid rgba(0, 0, 0, 0.2); + border-radius: 0; + -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); + box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); + background-clip: padding-box; + outline: 0; +} +.modal-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1040; + background-color: #000; +} +.modal-backdrop.fade { + opacity: 0; + filter: alpha(opacity=0); +} +.modal-backdrop.in { + opacity: .5; + filter: alpha(opacity=50); +} +.modal-header { + padding: 15px; + border-bottom: 1px solid #e5e5e5; + min-height: 16.428571429px; +} +.modal-header .close { + margin-top: -2px; +} +.modal-title { + margin: 0; + line-height: 1.428571429; +} +.modal-body { + position: relative; + padding: 15px; +} +.modal-footer { + padding: 15px; + text-align: right; + border-top: 1px solid #e5e5e5; +} +.modal-footer .btn + .btn { + margin-left: 5px; + margin-bottom: 0; +} +.modal-footer .btn-group .btn + .btn { + margin-left: -1px; +} +.modal-footer .btn-block + .btn-block { + margin-left: 0; +} +.modal-scrollbar-measure { + position: absolute; + top: -9999px; + width: 50px; + height: 50px; + overflow: scroll; +} +@media (min-width: 768px) { + .modal-dialog { + width: 600px; + margin: 30px auto; + } + .modal-content { + -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); + box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); + } + .modal-sm { + width: 300px; + } +} +@media (min-width: 992px) { + .modal-lg { + width: 900px; + } +} +.tooltip { + position: absolute; + z-index: 1070; + display: block; + visibility: visible; + font-size: 12px; + line-height: 1.4; + opacity: 0; + filter: alpha(opacity=0); +} +.tooltip.in { + opacity: .9; + filter: alpha(opacity=90); +} +.tooltip.top { + margin-top: -3px; + padding: 5px 0; +} +.tooltip.right { + margin-left: 3px; + padding: 0 5px; +} +.tooltip.bottom { + margin-top: 3px; + padding: 5px 0; +} +.tooltip.left { + margin-left: -3px; + padding: 0 5px; +} +.tooltip-inner { + max-width: 200px; + padding: 3px 8px; + color: #fff; + text-align: center; + text-decoration: none; + background-color: #000; + border-radius: 0; +} +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.tooltip.top .tooltip-arrow { + bottom: 0; + left: 50%; + margin-left: -5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.top-left .tooltip-arrow { + bottom: 0; + left: 5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.top-right .tooltip-arrow { + bottom: 0; + right: 5px; + border-width: 5px 5px 0; + border-top-color: #000; +} +.tooltip.right .tooltip-arrow { + top: 50%; + left: 0; + margin-top: -5px; + border-width: 5px 5px 5px 0; + border-right-color: #000; +} +.tooltip.left .tooltip-arrow { + top: 50%; + right: 0; + margin-top: -5px; + border-width: 5px 0 5px 5px; + border-left-color: #000; +} +.tooltip.bottom .tooltip-arrow { + top: 0; + left: 50%; + margin-left: -5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.tooltip.bottom-left .tooltip-arrow { + top: 0; + left: 5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.tooltip.bottom-right .tooltip-arrow { + top: 0; + right: 5px; + border-width: 0 5px 5px; + border-bottom-color: #000; +} +.popover { + position: absolute; + top: 0; + left: 0; + z-index: 1060; + display: none; + max-width: 276px; + padding: 1px; + text-align: left; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.2); + border-radius: 0; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + white-space: normal; +} +.popover.top { + margin-top: -10px; +} +.popover.right { + margin-left: 10px; +} +.popover.bottom { + margin-top: 10px; +} +.popover.left { + margin-left: -10px; +} +.popover-title { + margin: 0; + padding: 8px 14px; + font-size: 14px; + font-weight: normal; + line-height: 18px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + border-radius: -1 -1 0 0; +} +.popover-content { + padding: 9px 14px; +} +.popover > .arrow, +.popover > .arrow:after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; +} +.popover > .arrow { + border-width: 11px; +} +.popover > .arrow:after { + border-width: 10px; + content: ""; +} +.popover.top > .arrow { + left: 50%; + margin-left: -11px; + border-bottom-width: 0; + border-top-color: #999999; + border-top-color: rgba(0, 0, 0, 0.25); + bottom: -11px; +} +.popover.top > .arrow:after { + content: " "; + bottom: 1px; + margin-left: -10px; + border-bottom-width: 0; + border-top-color: #fff; +} +.popover.right > .arrow { + top: 50%; + left: -11px; + margin-top: -11px; + border-left-width: 0; + border-right-color: #999999; + border-right-color: rgba(0, 0, 0, 0.25); +} +.popover.right > .arrow:after { + content: " "; + left: 1px; + bottom: -10px; + border-left-width: 0; + border-right-color: #fff; +} +.popover.bottom > .arrow { + left: 50%; + margin-left: -11px; + border-top-width: 0; + border-bottom-color: #999999; + border-bottom-color: rgba(0, 0, 0, 0.25); + top: -11px; +} +.popover.bottom > .arrow:after { + content: " "; + top: 1px; + margin-left: -10px; + border-top-width: 0; + border-bottom-color: #fff; +} +.popover.left > .arrow { + top: 50%; + right: -11px; + margin-top: -11px; + border-right-width: 0; + border-left-color: #999999; + border-left-color: rgba(0, 0, 0, 0.25); +} +.popover.left > .arrow:after { + content: " "; + right: 1px; + border-right-width: 0; + border-left-color: #fff; + bottom: -10px; +} +.carousel { + position: relative; +} +.carousel-inner { + position: relative; + overflow: hidden; + width: 100%; +} +.carousel-inner > .item { + display: none; + position: relative; + -webkit-transition: .6s ease-in-out left; + -o-transition: .6s ease-in-out left; + transition: .6s ease-in-out left; +} +.carousel-inner > .item > img, +.carousel-inner > .item > a > img { + line-height: 1; +} +.carousel-inner > .active, +.carousel-inner > .next, +.carousel-inner > .prev { + display: block; +} +.carousel-inner > .active { + left: 0; +} +.carousel-inner > .next, +.carousel-inner > .prev { + position: absolute; + top: 0; + width: 100%; +} +.carousel-inner > .next { + left: 100%; +} +.carousel-inner > .prev { + left: -100%; +} +.carousel-inner > .next.left, +.carousel-inner > .prev.right { + left: 0; +} +.carousel-inner > .active.left { + left: -100%; +} +.carousel-inner > .active.right { + left: 100%; +} +.carousel-control { + position: absolute; + top: 0; + left: 0; + bottom: 0; + width: 15%; + opacity: .5; + filter: alpha(opacity=50); + font-size: 20px; + color: #fff; + text-align: center; + text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); +} +.carousel-control.left { + background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); + background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); +} +.carousel-control.right { + left: auto; + right: 0; + background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); + background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); + background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1); +} +.carousel-control:hover, +.carousel-control:focus { + outline: 0; + color: #fff; + text-decoration: none; + opacity: .9; + filter: alpha(opacity=90); +} +.carousel-control .icon-prev, +.carousel-control .icon-next, +.carousel-control .glyphicon-chevron-left, +.carousel-control .glyphicon-chevron-right { + position: absolute; + top: 50%; + z-index: 5; + display: inline-block; +} +.carousel-control .icon-prev, +.carousel-control .glyphicon-chevron-left { + left: 50%; + margin-left: -10px; +} +.carousel-control .icon-next, +.carousel-control .glyphicon-chevron-right { + right: 50%; + margin-right: -10px; +} +.carousel-control .icon-prev, +.carousel-control .icon-next { + width: 20px; + height: 20px; + margin-top: -10px; + font-family: serif; +} +.carousel-control .icon-prev:before { + content: '\2039'; +} +.carousel-control .icon-next:before { + content: '\203a'; +} +.carousel-indicators { + position: absolute; + bottom: 10px; + left: 50%; + z-index: 15; + width: 60%; + margin-left: -30%; + padding-left: 0; + list-style: none; + text-align: center; +} +.carousel-indicators li { + display: inline-block; + width: 10px; + height: 10px; + margin: 1px; + text-indent: -999px; + border: 1px solid #fff; + border-radius: 10px; + cursor: pointer; + background-color: #000 \9; + background-color: rgba(0, 0, 0, 0); +} +.carousel-indicators .active { + margin: 0; + width: 12px; + height: 12px; + background-color: #fff; +} +.carousel-caption { + position: absolute; + left: 15%; + right: 15%; + bottom: 20px; + z-index: 10; + padding-top: 20px; + padding-bottom: 20px; + color: #fff; + text-align: center; + text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); +} +.carousel-caption .btn { + text-shadow: none; +} +@media screen and (min-width: 768px) { + .carousel-control .glyphicon-chevron-left, + .carousel-control .glyphicon-chevron-right, + .carousel-control .icon-prev, + .carousel-control .icon-next { + width: 30px; + height: 30px; + margin-top: -15px; + font-size: 30px; + } + .carousel-control .glyphicon-chevron-left, + .carousel-control .icon-prev { + margin-left: -15px; + } + .carousel-control .glyphicon-chevron-right, + .carousel-control .icon-next { + margin-right: -15px; + } + .carousel-caption { + left: 20%; + right: 20%; + padding-bottom: 30px; + } + .carousel-indicators { + bottom: 20px; + } +} +.clearfix:before, +.clearfix:after, +.dl-horizontal dd:before, +.dl-horizontal dd:after, +.container:before, +.container:after, +.container-fluid:before, +.container-fluid:after, +.row:before, +.row:after, +.form-horizontal .form-group:before, +.form-horizontal .form-group:after, +.btn-toolbar:before, +.btn-toolbar:after, +.btn-group-vertical > .btn-group:before, +.btn-group-vertical > .btn-group:after, +.nav:before, +.nav:after, +.navbar:before, +.navbar:after, +.navbar-header:before, +.navbar-header:after, +.navbar-collapse:before, +.navbar-collapse:after, +.pager:before, +.pager:after, +.panel-body:before, +.panel-body:after, +.modal-footer:before, +.modal-footer:after { + content: " "; + display: table; +} +.clearfix:after, +.dl-horizontal dd:after, +.container:after, +.container-fluid:after, +.row:after, +.form-horizontal .form-group:after, +.btn-toolbar:after, +.btn-group-vertical > .btn-group:after, +.nav:after, +.navbar:after, +.navbar-header:after, +.navbar-collapse:after, +.pager:after, +.panel-body:after, +.modal-footer:after { + clear: both; +} +.center-block { + display: block; + margin-left: auto; + margin-right: auto; +} +.pull-right { + float: right !important; +} +.pull-left { + float: left !important; +} +.hide { + display: none !important; +} +.show { + display: block !important; +} +.invisible { + visibility: hidden; +} +.text-hide { + font: 0/0 a; + color: transparent; + text-shadow: none; + background-color: transparent; + border: 0; +} +.hidden { + display: none !important; + visibility: hidden !important; +} +.affix { + position: fixed; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} +@-ms-viewport { + width: device-width; +} +.visible-xs, +.visible-sm, +.visible-md, +.visible-lg { + display: none !important; +} +.visible-xs-block, +.visible-xs-inline, +.visible-xs-inline-block, +.visible-sm-block, +.visible-sm-inline, +.visible-sm-inline-block, +.visible-md-block, +.visible-md-inline, +.visible-md-inline-block, +.visible-lg-block, +.visible-lg-inline, +.visible-lg-inline-block { + display: none !important; +} +@media (max-width: 767px) { + .visible-xs { + display: block !important; + } + table.visible-xs { + display: table; + } + tr.visible-xs { + display: table-row !important; + } + th.visible-xs, + td.visible-xs { + display: table-cell !important; + } +} +@media (max-width: 767px) { + .visible-xs-block { + display: block !important; + } +} +@media (max-width: 767px) { + .visible-xs-inline { + display: inline !important; + } +} +@media (max-width: 767px) { + .visible-xs-inline-block { + display: inline-block !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm { + display: block !important; + } + table.visible-sm { + display: table; + } + tr.visible-sm { + display: table-row !important; + } + th.visible-sm, + td.visible-sm { + display: table-cell !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm-block { + display: block !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm-inline { + display: inline !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .visible-sm-inline-block { + display: inline-block !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md { + display: block !important; + } + table.visible-md { + display: table; + } + tr.visible-md { + display: table-row !important; + } + th.visible-md, + td.visible-md { + display: table-cell !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md-block { + display: block !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md-inline { + display: inline !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .visible-md-inline-block { + display: inline-block !important; + } +} +@media (min-width: 1200px) { + .visible-lg { + display: block !important; + } + table.visible-lg { + display: table; + } + tr.visible-lg { + display: table-row !important; + } + th.visible-lg, + td.visible-lg { + display: table-cell !important; + } +} +@media (min-width: 1200px) { + .visible-lg-block { + display: block !important; + } +} +@media (min-width: 1200px) { + .visible-lg-inline { + display: inline !important; + } +} +@media (min-width: 1200px) { + .visible-lg-inline-block { + display: inline-block !important; + } +} +@media (max-width: 767px) { + .hidden-xs { + display: none !important; + } +} +@media (min-width: 768px) and (max-width: 991px) { + .hidden-sm { + display: none !important; + } +} +@media (min-width: 992px) and (max-width: 1199px) { + .hidden-md { + display: none !important; + } +} +@media (min-width: 1200px) { + .hidden-lg { + display: none !important; + } +} +.visible-print { + display: none !important; +} +@media print { + .visible-print { + display: block !important; + } + table.visible-print { + display: table; + } + tr.visible-print { + display: table-row !important; + } + th.visible-print, + td.visible-print { + display: table-cell !important; + } +} +.visible-print-block { + display: none !important; +} +@media print { + .visible-print-block { + display: block !important; + } +} +.visible-print-inline { + display: none !important; +} +@media print { + .visible-print-inline { + display: inline !important; + } +} +.visible-print-inline-block { + display: none !important; +} +@media print { + .visible-print-inline-block { + display: inline-block !important; + } +} +@media print { + .hidden-print { + display: none !important; + } +} +@font-face { + font-family: 'varela_roundregular'; + src: url('../fonts/varela_round-webfont.eot'); + src: url('../fonts/varela_round-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/varela_round-webfont.woff') format('woff'), url('../fonts/varela_round-webfont.ttf') format('truetype'), url('../fonts/varela_round-webfont.svg#varela_roundregular') format('svg'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'montserratregular'; + src: url('../fonts/montserrat-webfont.eot'); + src: url('../fonts/montserrat-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/montserrat-webfont.woff') format('woff'), url('../fonts/montserrat-webfont.ttf') format('truetype'), url('../fonts/montserrat-webfont.svg#montserratregular') format('svg'); + font-weight: normal; + font-style: normal; +} +body, +h1, +h2, +h3, +p, +input { + margin: 0; + font-weight: 400; + font-family: "varela_roundregular", sans-serif; + color: #34302d; +} +h1 { + font-size: 24px; + line-height: 30px; + font-family: "montserratregular", sans-serif; +} +h2 { + font-size: 18px; + font-weight: 700; + line-height: 24px; + margin-bottom: 10px; + font-family: "montserratregular", sans-serif; +} +h3 { + font-size: 16px; + line-height: 24px; + margin-bottom: 10px; + font-weight: 700; +} +strong { + font-weight: 700; + font-family: "montserratregular", sans-serif; +} +.navbar { + border-top: 4px solid #6db33f; + background-color: #34302d; + margin-bottom: 0px; + border-bottom: 0; + border-left: 0; + border-right: 0; +} +.navbar a.navbar-brand { + background: url("../images/spring-logo-eureka.png") -1px -1px no-repeat; + margin: 12px 0 6px; + width: 300px; + height: 46px; + display: inline-block; + text-decoration: none; + padding: 0; +} +.navbar a.navbar-brand span { + display: block; + width: 300px; + height: 46px; + background: url("../images/spring-logo-eureka.png") -1px -48px no-repeat; + opacity: 0; + -moz-transition: opacity 0.12s ease-in-out; + -webkit-transition: opacity 0.12s ease-in-out; + -o-transition: opacity 0.12s ease-in-out; +} +.navbar a:hover.navbar-brand span { + opacity: 1; +} +.navbar li > a, +.navbar-text { + font-family: "montserratregular", sans-serif; + text-shadow: none; + font-size: 14px; + padding: 28px 20px; + transition: all 0.15s; + -webkit-transition: all 0.15s; + -moz-transition: all 0.15s; + -o-transition: all 0.15s; + -ms-transition: all 0.15s; +} +.navbar li > a { + text-transform: uppercase; +} +.navbar .navbar-text { + margin-top: 0; + margin-bottom: 0; +} +.navbar li:hover > a { + color: #eeeeee; + background-color: #6db33f; +} +.navbar-toggle { + border-width: 0; +} +.navbar-toggle .icon-bar + .icon-bar { + margin-top: 3px; +} +.navbar-toggle .icon-bar { + width: 19px; + height: 3px; +} +@media (max-width: 768px) { + .navbar-toggle { + position: absolute; + z-index: 9999; + left: 0px; + top: 0px; + } + .navbar a.navbar-brand { + display: block; + margin: 0 auto 0 auto; + width: 200px; + height: 50px; + float: none; + background: url("../images/spring-logo-eureka-mobile.png") 0 center no-repeat; + } + .homepage-billboard .homepage-subtitle { + font-size: 21px; + line-height: 21px; + } + .navbar a.navbar-brand span { + display: none; + } + .navbar { + border-top-width: 0; + } + .xd-container { + margin-top: 20px; + margin-bottom: 30px; + } + .index-page--subtitle { + margin-top: 10px; + margin-bottom: 30px; + } +} +.table > thead > tr > th { + background-color: #3c3834; + color: #f1f1f1; +} +.table-filter { + background-color: #34302D; + padding: 9px 12px; +} +.nav > li > a { + color: #838789; +} +.btn-default { + border-width: 2px; + transition: border 0.15s; + -webkit-transition: border 0.15s; + -moz-transition: border 0.15s; + -o-transition: border 0.15s; + -ms-transition: border 0.15s; +} +.btn-default:hover, +.btn-default:focus, +.btn-default:active, +.btn-default.active, +.open .dropdown-toggle.btn-default { + background-color: #34302D; + border-color: #34302D; +} +.container .text-muted { + margin: 20px 0; +} +code { + font-size: 80%; +} +.xd-container { + margin-top: 40px; + margin-bottom: 100px; +} +h1 { + margin-bottom: 15px; +} +.index-page--subtitle { + font-size: 16px; + line-height: 24px; + margin: 0 0 30px; +} +.form-horizontal button.btn-inverse { + margin-left: 32px; +} +#job-params-modal .modal-dialog { + width: 90%; + margin-left: auto; + margin-right: auto; +} +[ng-cloak].splash { + display: block !important; +} +[ng-cloak] { + display: none; +} +.splash { + background: #6db33f; + color: #34302D; + display: none; +} +.error-page { + margin-top: 100px; + text-align: center; +} +.error-page .error-title { + font-size: 24px; + line-height: 24px; + margin: 30px 0 0; +} +table td { + vertical-align: middle !important; +} +table td .progress { + margin-bottom: 0; +} +table td.action-column { + width: 1px; +} +.help-block { + color: #f1f1f1; +} diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.eot b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.eot new file mode 100644 index 0000000000..0caea9169a Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.eot differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.svg b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.svg new file mode 100644 index 0000000000..7bd96bdfdc --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.svg @@ -0,0 +1,1283 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.ttf b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.ttf new file mode 100644 index 0000000000..9953fe62e0 Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.ttf differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.woff b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.woff new file mode 100644 index 0000000000..eb49333f71 Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/montserrat-webfont.woff differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.eot b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.eot new file mode 100644 index 0000000000..dfee0c26e7 Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.eot differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.svg b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.svg new file mode 100644 index 0000000000..3280e2c43c --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.svg @@ -0,0 +1,7875 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.ttf b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.ttf new file mode 100644 index 0000000000..3ca0666937 Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.ttf differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.woff b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.woff new file mode 100644 index 0000000000..77ba16614b Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/fonts/varela_round-webfont.woff differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/404-icon.png b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/404-icon.png new file mode 100644 index 0000000000..912f456bfc Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/404-icon.png differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/homepage-bg.jpg b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/homepage-bg.jpg new file mode 100644 index 0000000000..0318437663 Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/homepage-bg.jpg differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/platform-bg.png b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/platform-bg.png new file mode 100644 index 0000000000..512185839b Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/platform-bg.png differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/platform-spring-xd.png b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/platform-spring-xd.png new file mode 100644 index 0000000000..0cb2662d7b Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/platform-spring-xd.png differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/spring-logo-eureka-mobile.png b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/spring-logo-eureka-mobile.png new file mode 100644 index 0000000000..fc59a236b1 Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/spring-logo-eureka-mobile.png differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/spring-logo-eureka.png b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/spring-logo-eureka.png new file mode 100644 index 0000000000..b22de1f2a9 Binary files /dev/null and b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/images/spring-logo-eureka.png differ diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/js/wro.js b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/js/wro.js new file mode 100644 index 0000000000..c3ae5c5f37 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/main/resources/static/eureka/js/wro.js @@ -0,0 +1,2 @@ + +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="
",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*\s*$/g,ib={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("