diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-18 17-36-38File1.txt b/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File1.txt similarity index 100% rename from spring-apache-camel/src/test/destination-folder/2016-12-18 17-36-38File1.txt rename to spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File1.txt diff --git a/spring-apache-camel/src/test/destination-folder/2016-12-18 17-36-38File2.txt b/spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File2.txt similarity index 100% rename from spring-apache-camel/src/test/destination-folder/2016-12-18 17-36-38File2.txt rename to spring-apache-camel/src/test/destination-folder/2016-12-18 22-00-11File2.txt diff --git a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorTest.java b/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorTest.java deleted file mode 100644 index c4a3ced84f..0000000000 --- a/spring-apache-camel/src/test/java/com/apache/camel/file/processor/FileProcessorTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.apache.camel.file.processor; - -import java.io.File; - -import org.apache.camel.CamelContext; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.impl.DefaultCamelContext; -import org.junit.Before; -import org.junit.Test; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.baeldung.camel.file.FileProcessor; - - -public class FileProcessorTest { - - private static final long DURATION_MILIS = 10000; - private static final String SOURCE_FOLDER = "src/test/source-folder"; - private static final String DESTINATION_FOLDER = "src/test/destination-folder"; - - @Before - public void setUp() throws Exception { - File sourceFolder = new File(SOURCE_FOLDER); - File destinationFolder = new File(DESTINATION_FOLDER); - - cleanFolder(sourceFolder); - cleanFolder(destinationFolder); - - sourceFolder.mkdirs(); - File file1 = new File(SOURCE_FOLDER + "/File1.txt"); - File file2 = new File(SOURCE_FOLDER + "/File2.txt"); - file1.createNewFile(); - file2.createNewFile(); - } - - private void cleanFolder(File folder) { - File[] files = folder.listFiles(); - if (files != null) { - for (File file : files) { - if (file.isFile()) { - file.delete(); - } - } - } - } - - @Test - public void moveFolderContentJavaDSLTest() throws Exception { - final CamelContext camelContext = new DefaultCamelContext(); - camelContext.addRoutes(new RouteBuilder() { - @Override - public void configure() throws Exception { - from("file://" + SOURCE_FOLDER + "?delete=true").process(new FileProcessor()).to("file://" + DESTINATION_FOLDER); - } - }); - camelContext.start(); - Thread.sleep(DURATION_MILIS); - camelContext.stop(); - } - - @Test - public void moveFolderContentSpringDSLTest() throws InterruptedException { - ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context-test.xml"); - Thread.sleep(DURATION_MILIS); - applicationContext.close(); - - } -} \ No newline at end of file diff --git a/spring-integration/pom.xml b/spring-integration/pom.xml index 6083afcf76..2fe7e1ad37 100644 --- a/spring-integration/pom.xml +++ b/spring-integration/pom.xml @@ -1,135 +1,132 @@ - 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 - com.baeldung.samples.spring.integration - spring-integration - 1.0.0.BUILD-SNAPSHOT - jar + com.baeldung.samples.spring.integration + spring-integration + 1.0.0.BUILD-SNAPSHOT + jar - spring-integration - http://www.springsource.org/spring-integration + spring-integration + http://www.springsource.org/spring-integration - - 2.2.1 - + + UTF-8 + 4.3.5.RELEASE + 1.1.4.RELEASE + 1.4.7 + 1.1.1 + 1.2.17 + 4.12 - - UTF-8 - 4.3.5.RELEASE - 1.1.4.RELEASE - 1.4.7 - 1.1.1 - 1.2.17 - 4.12 - - 2.10 - 3.6.0 - 1.5.0 - + 2.10 + 3.6.0 + 1.5.0 + - - - repo.springsource.org.milestone - Spring Framework Maven Milestone Repository - https://repo.springsource.org/milestone - - + + + repo.springsource.org.milestone + Spring Framework Maven Milestone Repository + https://repo.springsource.org/milestone + + - - - - maven-eclipse-plugin - ${maven-eclipse-plugin.version} - - - org.springframework.ide.eclipse.core.springnature - - - org.springframework.ide.eclipse.core.springbuilder - - true - true - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - 1.8 - 1.8 - -Xlint:all - true - true - - - - org.codehaus.mojo - exec-maven-plugin - ${exec-maven-plugin.version} - - com.baeldung.samples.Main - - - - + + + + maven-eclipse-plugin + ${maven-eclipse-plugin.version} + + + org.springframework.ide.eclipse.core.springnature + + + org.springframework.ide.eclipse.core.springbuilder + + true + true + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.8 + 1.8 + -Xlint:all + true + true + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + com.baeldung.samples.Main + + + + - + - + - - junit - junit - ${junit.version} - test - - - org.springframework.integration - spring-integration-core - ${spring.integration.version} - - - javax.activation - activation - ${javax-activation.version} - true - - - javax.mail - mail - ${javax-mail.version} - - - log4j - log4j - ${log4j.version} - - - org.springframework.integration - spring-integration-twitter - ${spring.integration.version} - - - org.springframework.integration - spring-integration-mail - ${spring.integration.version} - - - org.springframework.integration - spring-integration-ftp - ${spring.integration.version} - - - org.springframework.social - spring-social-core - ${spring-social.version} - - - org.springframework.integration - spring-integration-file - ${spring.integration.version} - - + + junit + junit + ${junit.version} + test + + + org.springframework.integration + spring-integration-core + ${spring.integration.version} + + + javax.activation + activation + ${javax-activation.version} + true + + + javax.mail + mail + ${javax-mail.version} + + + log4j + log4j + ${log4j.version} + + + org.springframework.integration + spring-integration-twitter + ${spring.integration.version} + + + org.springframework.integration + spring-integration-mail + ${spring.integration.version} + + + org.springframework.integration + spring-integration-ftp + ${spring.integration.version} + + + org.springframework.social + spring-social-core + ${spring-social.version} + + + org.springframework.integration + spring-integration-file + ${spring.integration.version} + + + diff --git a/spring-integration/src/test/java/com/baeldung/samples/FileCopyTest.java b/spring-integration/src/test/java/com/baeldung/samples/FileCopyIntegrationTest.java similarity index 52% rename from spring-integration/src/test/java/com/baeldung/samples/FileCopyTest.java rename to spring-integration/src/test/java/com/baeldung/samples/FileCopyIntegrationTest.java index 567d181972..55c0916e60 100644 --- a/spring-integration/src/test/java/com/baeldung/samples/FileCopyTest.java +++ b/spring-integration/src/test/java/com/baeldung/samples/FileCopyIntegrationTest.java @@ -15,40 +15,27 @@ */ package com.baeldung.samples; -import org.apache.log4j.Logger; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +public final class FileCopyIntegrationTest { -/** - * Starts the Spring Context and will initialize the Spring Integration routes. - * - * @author Baeldung - * @since 1.0 - * - */ -public final class FileCopyTest { + // - private static final Logger LOGGER = Logger.getLogger(FileCopyTest.class); + @Test + public void whenFileCopyConfiguration_thanFileCopiedSuccessfully() throws InterruptedException { + final AbstractApplicationContext context = new AnnotationConfigApplicationContext(FileCopyConfig.class.getCanonicalName()); + context.registerShutdownHook(); + Thread.sleep(5000); + } - @Test - public void whenFileCopyConfiguration_thanFileCopiedSuccessfully() throws InterruptedException { - final AbstractApplicationContext context = new AnnotationConfigApplicationContext(FileCopyConfig.class.getCanonicalName()); - context.registerShutdownHook(); - Thread.sleep(5000); - } + @Test + public void publish() throws InterruptedException { + final AbstractApplicationContext context = new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/spring-integration-file-publish-context.xml"); - @Test - public void publish() throws InterruptedException { + Thread.sleep(15000); + } - - final AbstractApplicationContext context = - new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/spring-integration-file-publish-context.xml"); - - Thread.sleep(15000); - - - } } diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 3c1e44d13a..b507a1c629 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -203,6 +203,7 @@ **/*IntegrationTest.java + true diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitLiveTest.java b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitLiveTest.java new file mode 100644 index 0000000000..c9c23f267b --- /dev/null +++ b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitLiveTest.java @@ -0,0 +1,32 @@ +package com.baeldung.htmlunit; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlPage; + +public class HtmlUnitAndJUnitLiveTest { + + private WebClient webClient; + + @Before + public void init() throws Exception { + webClient = new WebClient(); + } + + @After + public void close() throws Exception { + webClient.close(); + } + + @Test + public void givenAClient_whenEnteringBaeldung_thenPageTitleIsOk() throws Exception { + webClient.getOptions().setThrowExceptionOnScriptError(false); + HtmlPage page = webClient.getPage("http://www.baeldung.com/"); + Assert.assertEquals("Baeldung | Java, Spring and Web Development tutorials", page.getTitleText()); + } + +} diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitTest.java b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitTest.java deleted file mode 100644 index 46a95ae694..0000000000 --- a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndJUnitTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung.htmlunit; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class HtmlUnitAndJUnitTest { - - private WebClient webClient; - - @Before - public void init() throws Exception { - webClient = new WebClient(); - } - - @After - public void close() throws Exception { - webClient.close(); - } - - @Test - public void givenAClient_whenEnteringBaeldung_thenPageTitleIsOk() - throws Exception { - webClient.getOptions().setThrowExceptionOnScriptError(false); - HtmlPage page = webClient.getPage("http://www.baeldung.com/"); - Assert.assertEquals( - "Baeldung | Java, Spring and Web Development tutorials", - page.getTitleText()); - } - -} diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringLiveTest.java similarity index 97% rename from spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java rename to spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringLiveTest.java index da1b0e484a..ba66e7ac13 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitAndSpringLiveTest.java @@ -20,7 +20,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlTextInput; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(classes = { TestConfig.class }) -public class HtmlUnitAndSpringTest { +public class HtmlUnitAndSpringLiveTest { @Autowired private WebApplicationContext wac; diff --git a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebScraping.java b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebLiveScraping.java similarity index 97% rename from spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebScraping.java rename to spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebLiveScraping.java index 327bfc4596..e8869e8232 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebScraping.java +++ b/spring-mvc-java/src/test/java/com/baeldung/htmlunit/HtmlUnitWebLiveScraping.java @@ -12,7 +12,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlAnchor; import com.gargoylesoftware.htmlunit.html.HtmlHeading1; import com.gargoylesoftware.htmlunit.html.HtmlPage; -public class HtmlUnitWebScraping { +public class HtmlUnitWebLiveScraping { private WebClient webClient;