diff options
author | Olivier Lamy <olamy@apache.org> | 2012-12-04 18:19:38 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-12-04 18:19:38 +0000 |
commit | 5632f18c9c30777979024246aced7dc264558c6d (patch) | |
tree | 2b16bea9423e3e60d67619d0279643e7f47c35a4 /redback-data-management/src | |
parent | c5cb87b06f7904614476ce41fa9790c5178cdacf (diff) | |
download | archiva-5632f18c9c30777979024246aced7dc264558c6d.tar.gz archiva-5632f18c9c30777979024246aced7dc264558c6d.zip |
fix unit test
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1417085 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'redback-data-management/src')
-rw-r--r-- | redback-data-management/src/test/java/org/apache/archiva/redback/management/DataManagementTest.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/redback-data-management/src/test/java/org/apache/archiva/redback/management/DataManagementTest.java b/redback-data-management/src/test/java/org/apache/archiva/redback/management/DataManagementTest.java index 37fb1b031..01342ea80 100644 --- a/redback-data-management/src/test/java/org/apache/archiva/redback/management/DataManagementTest.java +++ b/redback-data-management/src/test/java/org/apache/archiva/redback/management/DataManagementTest.java @@ -46,6 +46,7 @@ import javax.inject.Inject; import javax.inject.Named; import java.io.File; import java.io.FileWriter; +import java.io.InputStream; import java.io.StringReader; import java.io.StringWriter; import java.text.SimpleDateFormat; @@ -245,7 +246,15 @@ public class DataManagementTest File backupFile = new File( targetDirectory, "rbac.xml" ); - IOUtils.copy( getClass().getResourceAsStream( "/expected-rbac.xml" ), new FileWriter( backupFile ) ); + InputStream is = getClass().getResourceAsStream( "/expected-rbac.xml" ); + + FileWriter fw = new FileWriter( backupFile ); + + IOUtils.copy( is, fw); + + is.close(); + + fw.close(); dataManagementTool.restoreRBACDatabase( manager, targetDirectory ); @@ -324,7 +333,11 @@ public class DataManagementTest File backupFile = new File( targetDirectory, "users.xml" ); - IOUtils.copy( getClass().getResourceAsStream( "/expected-users.xml" ), new FileWriter( backupFile ) ); + FileWriter fw = new FileWriter( backupFile ); + + IOUtils.copy( getClass().getResourceAsStream( "/expected-users.xml" ), fw ); + + fw.close(); dataManagementTool.restoreUsersDatabase( manager, targetDirectory ); @@ -377,7 +390,11 @@ public class DataManagementTest File backupFile = new File( targetDirectory, "keys.xml" ); - IOUtils.copy( getClass().getResourceAsStream( "/expected-keys.xml" ), new FileWriter( backupFile ) ); + FileWriter fw = new FileWriter( backupFile ); + + IOUtils.copy( getClass().getResourceAsStream( "/expected-keys.xml" ), fw); + + fw.close(); dataManagementTool.restoreKeysDatabase( manager, targetDirectory ); |