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
77c088a3
Commit
77c088a3
authored
16 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
[LMS-587] add: - Small Unit test for the BDS read-only mode.
SVN: 8596
parent
0bc3a282
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bds/sourceTest/java/ch/systemsx/cisd/bds/v1_1/DataStructureV1_1Test.java
+33
-0
33 additions, 0 deletions
...java/ch/systemsx/cisd/bds/v1_1/DataStructureV1_1Test.java
with
33 additions
and
0 deletions
bds/sourceTest/java/ch/systemsx/cisd/bds/v1_1/DataStructureV1_1Test.java
+
33
−
0
View file @
77c088a3
...
...
@@ -22,6 +22,7 @@ import static org.testng.AssertJUnit.assertTrue;
import
static
org
.
testng
.
AssertJUnit
.
fail
;
import
java.io.IOException
;
import
java.util.List
;
import
org.testng.annotations.BeforeMethod
;
import
org.testng.annotations.Test
;
...
...
@@ -35,6 +36,7 @@ import ch.systemsx.cisd.bds.Version;
import
ch.systemsx.cisd.bds.IDataStructure.Mode
;
import
ch.systemsx.cisd.bds.exception.DataStructureException
;
import
ch.systemsx.cisd.bds.storage.IDirectory
;
import
ch.systemsx.cisd.bds.storage.IFile
;
import
ch.systemsx.cisd.bds.storage.filesystem.FileStorage
;
import
ch.systemsx.cisd.bds.v1_0.DataStructureV1_0Test
;
import
ch.systemsx.cisd.common.filesystem.AbstractFileSystemTestCase
;
...
...
@@ -196,4 +198,35 @@ public final class DataStructureV1_1Test extends AbstractFileSystemTestCase
dataStructure
.
open
(
Mode
.
READ_ONLY
);
assertEquals
(
new
Version
(
1
,
1
),
dataStructure
.
getVersion
());
}
@Test
public
final
void
testReadOnly
()
{
DataStructureV1_0Test
.
createExampleDataStructure
(
storage
,
new
Version
(
1
,
0
));
// IDirectory.addKeyValuePair
dataStructure
.
open
(
Mode
.
READ_ONLY
);
try
{
dataStructure
.
getStandardData
().
addKeyValuePair
(
"key"
,
"value"
);
fail
(
"Should not be allowed as we are in read-only mode."
);
}
catch
(
final
UnsupportedOperationException
ex
)
{
}
dataStructure
.
open
(
Mode
.
READ_WRITE
);
dataStructure
.
getStandardData
().
addKeyValuePair
(
"key"
,
"value"
);
// IDirectory.listFiles
dataStructure
.
open
(
Mode
.
READ_ONLY
);
List
<
IFile
>
files
=
dataStructure
.
getOriginalData
().
listFiles
(
null
,
true
);
assertTrue
(
files
.
size
()
>
0
);
try
{
files
.
get
(
0
).
moveTo
(
workingDirectory
);
fail
(
"Should not be allowed as we are in read-only mode."
);
}
catch
(
final
UnsupportedOperationException
ex
)
{
}
dataStructure
.
open
(
Mode
.
READ_WRITE
);
files
=
dataStructure
.
getOriginalData
().
listFiles
(
null
,
true
);
files
.
get
(
0
).
moveTo
(
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