From 7400fdff984533c320730b7613cde94b3eb42262 Mon Sep 17 00:00:00 2001 From: eugenp Date: Thu, 18 Sep 2014 17:33:26 +0300 Subject: [PATCH] cleanup work --- core-java/src/main/resources/targetFile.tmp | 2 -- .../java/io/JavaInputStreamToXUnitTest.java | 18 +++++++++++++- ...rnalPropertiesWithJavaIntegrationTest.java | 2 ++ ...ertiesWithMultipleXmlsIntegrationTest.java | 2 ++ ...ernalPropertiesWithXmlIntegrationTest.java | 2 ++ .../baeldung/test/IntegrationTestSuite.java | 24 +++++++++++++++++++ 6 files changed, 47 insertions(+), 3 deletions(-) delete mode 100644 core-java/src/main/resources/targetFile.tmp create mode 100644 spring-all/src/test/java/org/baeldung/test/IntegrationTestSuite.java diff --git a/core-java/src/main/resources/targetFile.tmp b/core-java/src/main/resources/targetFile.tmp deleted file mode 100644 index 20f137b416..0000000000 --- a/core-java/src/main/resources/targetFile.tmp +++ /dev/null @@ -1,2 +0,0 @@ -line 1 -a second line \ No newline at end of file diff --git a/core-java/src/test/java/org/baeldung/java/io/JavaInputStreamToXUnitTest.java b/core-java/src/test/java/org/baeldung/java/io/JavaInputStreamToXUnitTest.java index e587bfcf18..982b84df36 100644 --- a/core-java/src/test/java/org/baeldung/java/io/JavaInputStreamToXUnitTest.java +++ b/core-java/src/test/java/org/baeldung/java/io/JavaInputStreamToXUnitTest.java @@ -149,7 +149,7 @@ public class JavaInputStreamToXUnitTest { // tests - InputStream to File @Test - public final void givenUsingPlainJava_whenConvertingAnInputStreamToAFile_thenCorrect() throws IOException { + public final void givenUsingPlainJava_whenConvertingAnFullInputStreamToAFile_thenCorrect() throws IOException { final InputStream initialStream = new FileInputStream(new File("src/main/resources/sample.txt")); final byte[] buffer = new byte[initialStream.available()]; initialStream.read(buffer); @@ -162,6 +162,22 @@ public class JavaInputStreamToXUnitTest { IOUtils.closeQuietly(outStream); } + @Test + public final void givenUsingPlainJava_whenConvertingAnInProgressInputStreamToAFile_thenCorrect() throws IOException { + final InputStream initialStream = new FileInputStream(new File("src/main/resources/sample.txt")); + final File targetFile = new File("src/main/resources/targetFile.tmp"); + final OutputStream outStream = new FileOutputStream(targetFile); + + final byte[] buffer = new byte[8 * 1024]; + int bytesRead; + while ((bytesRead = initialStream.read(buffer)) != -1) { + outStream.write(buffer, 0, bytesRead); + } + + IOUtils.closeQuietly(initialStream); + IOUtils.closeQuietly(outStream); + } + @Test public final void givenUsingGuava_whenConvertingAnInputStreamToAFile_thenCorrect() throws IOException { final InputStream initialStream = new FileInputStream(new File("src/main/resources/sample.txt")); diff --git a/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithJavaIntegrationTest.java b/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithJavaIntegrationTest.java index bfc2f52579..1cf9c774f4 100644 --- a/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithJavaIntegrationTest.java +++ b/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithJavaIntegrationTest.java @@ -2,6 +2,7 @@ package org.baeldung.properties.core; import org.baeldung.properties.spring.PropertiesWithJavaConfig; import org.baeldung.properties.spring.PropertiesWithJavaConfigOther; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -13,6 +14,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { PropertiesWithJavaConfig.class, PropertiesWithJavaConfigOther.class }, loader = AnnotationConfigContextLoader.class) +@Ignore("manual only") public class ExternalPropertiesWithJavaIntegrationTest { @Autowired diff --git a/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithMultipleXmlsIntegrationTest.java b/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithMultipleXmlsIntegrationTest.java index 6391b8d655..98654ee4b6 100644 --- a/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithMultipleXmlsIntegrationTest.java +++ b/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithMultipleXmlsIntegrationTest.java @@ -2,6 +2,7 @@ package org.baeldung.properties.core; import org.baeldung.properties.spring.PropertiesWithXmlConfigOne; import org.baeldung.properties.spring.PropertiesWithXmlConfigTwo; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -13,6 +14,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { PropertiesWithXmlConfigOne.class, PropertiesWithXmlConfigTwo.class }, loader = AnnotationConfigContextLoader.class) +@Ignore("manual only") public class ExternalPropertiesWithMultipleXmlsIntegrationTest { @Autowired diff --git a/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithXmlIntegrationTest.java b/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithXmlIntegrationTest.java index 0d437842e6..b77aac63d8 100644 --- a/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithXmlIntegrationTest.java +++ b/spring-all/src/test/java/org/baeldung/properties/core/ExternalPropertiesWithXmlIntegrationTest.java @@ -1,6 +1,7 @@ package org.baeldung.properties.core; import org.baeldung.properties.spring.PropertiesWithXmlConfig; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -12,6 +13,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { PropertiesWithXmlConfig.class }, loader = AnnotationConfigContextLoader.class) +@Ignore("manual only") public class ExternalPropertiesWithXmlIntegrationTest { @Autowired diff --git a/spring-all/src/test/java/org/baeldung/test/IntegrationTestSuite.java b/spring-all/src/test/java/org/baeldung/test/IntegrationTestSuite.java new file mode 100644 index 0000000000..9957b19516 --- /dev/null +++ b/spring-all/src/test/java/org/baeldung/test/IntegrationTestSuite.java @@ -0,0 +1,24 @@ +package org.baeldung.test; + +import org.baeldung.properties.core.ExternalPropertiesWithJavaIntegrationTest; +import org.baeldung.properties.core.ExternalPropertiesWithMultipleXmlsIntegrationTest; +import org.baeldung.properties.core.ExternalPropertiesWithXmlIntegrationTest; +import org.baeldung.properties.core.PropertiesWithJavaIntegrationTest; +import org.baeldung.properties.core.PropertiesWithMultipleXmlsIntegrationTest; +import org.baeldung.properties.core.PropertiesWithXmlIntegrationTest; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({//@formatter:off + PropertiesWithXmlIntegrationTest.class, + ExternalPropertiesWithJavaIntegrationTest.class, + ExternalPropertiesWithMultipleXmlsIntegrationTest.class, + ExternalPropertiesWithXmlIntegrationTest.class, + PropertiesWithJavaIntegrationTest.class, + PropertiesWithMultipleXmlsIntegrationTest.class, +})// @formatter:on +public final class IntegrationTestSuite { + // +}