This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/master by this push: new dd21f68 CLOUDSTACK-10210: cleanup testfile (#2384) dd21f68 is described below commit dd21f68926f7fb65a65318618479e7f9e7874da2 Author: dahn <daan.hoogl...@gmail.com> AuthorDate: Thu Jan 4 12:46:28 2018 +0100 CLOUDSTACK-10210: cleanup testfile (#2384) Removes a test file created as part of the unit test. --- .../resource/NfsSecondaryStorageResourceTest.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/services/secondary-storage/server/test/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java b/services/secondary-storage/server/test/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java index e437a0f..44d762f 100644 --- a/services/secondary-storage/server/test/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java +++ b/services/secondary-storage/server/test/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java @@ -32,6 +32,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import java.io.BufferedWriter; +import java.io.File; import java.io.FileWriter; import java.io.StringWriter; @@ -52,15 +53,21 @@ public class NfsSecondaryStorageResourceTest { @Test @PrepareForTest(NfsSecondaryStorageResource.class) public void testSwiftWriteMetadataFile() throws Exception { - String expected = "uniquename=test\nfilename=testfile\nsize=100\nvirtualsize=1000"; + String filename = "testfile"; + try { + String expected = "uniquename=test\nfilename=" + filename + "\nsize=100\nvirtualsize=1000"; - StringWriter stringWriter = new StringWriter(); - BufferedWriter bufferWriter = new BufferedWriter(stringWriter); - PowerMockito.whenNew(BufferedWriter.class).withArguments(any(FileWriter.class)).thenReturn(bufferWriter); + StringWriter stringWriter = new StringWriter(); + BufferedWriter bufferWriter = new BufferedWriter(stringWriter); + PowerMockito.whenNew(BufferedWriter.class).withArguments(any(FileWriter.class)).thenReturn(bufferWriter); - resource.swiftWriteMetadataFile("testfile", "test", "testfile", 100, 1000); + resource.swiftWriteMetadataFile(filename, "test", filename, 100, 1000); - Assert.assertEquals(expected, stringWriter.toString()); + Assert.assertEquals(expected, stringWriter.toString()); + } finally { + File remnance = new File(filename); + remnance.delete(); + } } @Test -- To stop receiving notification emails like this one, please contact ['"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>'].