summaryrefslogtreecommitdiff
path: root/qpid/java/qpid-test-utils
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2014-10-01 23:48:14 +0000
committerAlex Rudyy <orudyy@apache.org>2014-10-01 23:48:14 +0000
commita638bc903339cac26e522df787ad4fcbca2344aa (patch)
tree94a5bae92749b96c229ca36590e681032f6aa752 /qpid/java/qpid-test-utils
parentf84ed512e919a6c717cbdbcc22e8139bc64bc205 (diff)
downloadqpid-python-a638bc903339cac26e522df787ad4fcbca2344aa.tar.gz
QPID-6126: Add ability to validate CO attributes on creation, transit COs into ERRORED state if exception occurs on recovery, allow ERRORED CO restart after remediation of configuration problem
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1628867 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/qpid-test-utils')
-rw-r--r--qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/TestFileUtils.java49
1 files changed, 27 insertions, 22 deletions
diff --git a/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/TestFileUtils.java b/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/TestFileUtils.java
index 26bbe151d2..00231039c3 100644
--- a/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/TestFileUtils.java
+++ b/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/TestFileUtils.java
@@ -121,33 +121,38 @@ public class TestFileUtils
File file = createTempFile(testcase, suffix);
if (content != null)
{
- FileOutputStream fos = null;
- try
- {
- fos = new FileOutputStream(file);
- fos.write(content.getBytes("UTF-8"));
- fos.flush();
- }
- catch (Exception e)
- {
- throw new RuntimeException("Cannot add the content into temp file " + file.getAbsolutePath(), e);
- }
- finally
+ saveTextContentInFile(content, file);
+ }
+ return file;
+ }
+
+ public static void saveTextContentInFile(String content, File file)
+ {
+ FileOutputStream fos = null;
+ try
+ {
+ fos = new FileOutputStream(file);
+ fos.write(content.getBytes("UTF-8"));
+ fos.flush();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Cannot add the content into temp file " + file.getAbsolutePath(), e);
+ }
+ finally
+ {
+ if (fos != null)
{
- if (fos != null)
+ try
{
- try
- {
- fos.close();
- }
- catch (IOException e)
- {
- throw new RuntimeException("Cannot close output stream into temp file " + file.getAbsolutePath(), e);
- }
+ fos.close();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Cannot close output stream into temp file " + file.getAbsolutePath(), e);
}
}
}
- return file;
}
/**