Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
d6918885
Commit
d6918885
authored
17 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
[LMS-107]
- Separation of concerns. SVN: 3010
parent
2df20ffb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/sourceTest/java/ch/systemsx/cisd/common/utilities/AbstractFileSystemTestCase.java
+24
-8
24 additions, 8 deletions
...msx/cisd/common/utilities/AbstractFileSystemTestCase.java
with
24 additions
and
8 deletions
common/sourceTest/java/ch/systemsx/cisd/common/utilities/AbstractFileSystemTestCase.java
+
24
−
8
View file @
d6918885
...
...
@@ -20,6 +20,7 @@ import java.io.File;
import
java.io.IOException
;
import
org.apache.commons.io.FileUtils
;
import
org.testng.annotations.AfterClass
;
import
org.testng.annotations.BeforeMethod
;
import
ch.systemsx.cisd.common.logging.LogInitializer
;
...
...
@@ -38,27 +39,42 @@ public abstract class AbstractFileSystemTestCase
protected
final
File
workingDirectory
;
private
final
boolean
cleanAfterMethod
;
protected
AbstractFileSystemTestCase
()
{
this
(
true
);
}
protected
AbstractFileSystemTestCase
(
final
boolean
deleteOnExit
)
protected
AbstractFileSystemTestCase
(
final
boolean
cleanAfterMethod
)
{
workingDirectory
=
new
File
(
UNIT_TEST_ROOT_DIRECTORY
,
getClass
().
getSimpleName
());
if
(
deleteOnExit
)
{
workingDirectory
.
deleteOnExit
();
}
workingDirectory
=
createWorkingDirectory
();
LogInitializer
.
init
();
this
.
cleanAfterMethod
=
cleanAfterMethod
;
}
private
final
File
createWorkingDirectory
()
{
final
File
directory
=
new
File
(
UNIT_TEST_ROOT_DIRECTORY
,
getClass
().
getSimpleName
());
directory
.
mkdirs
();
directory
.
deleteOnExit
();
return
directory
;
}
@BeforeMethod
public
void
set
u
p
()
throws
IOException
public
void
set
U
p
()
throws
IOException
{
workingDirectory
.
mkdirs
();
FileUtils
.
cleanDirectory
(
workingDirectory
);
assert
workingDirectory
.
isDirectory
()
&&
workingDirectory
.
listFiles
().
length
==
0
;
}
@AfterClass
public
void
afterClass
()
throws
IOException
{
if
(
cleanAfterMethod
==
false
)
{
return
;
}
FileUtils
.
deleteDirectory
(
workingDirectory
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment