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
60c818ae
Commit
60c818ae
authored
13 years ago
by
cramakri
Browse files
Options
Downloads
Patches
Plain Diff
LMS-2382 Added new test.
SVN: 22168
parent
b183f269
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/collections/PersistentExtendedBlockingQueueDecoratorTest.java
+40
-2
40 additions, 2 deletions
...ections/PersistentExtendedBlockingQueueDecoratorTest.java
with
40 additions
and
2 deletions
common/sourceTest/java/ch/systemsx/cisd/common/collections/PersistentExtendedBlockingQueueDecoratorTest.java
+
40
−
2
View file @
60c818ae
...
...
@@ -31,6 +31,8 @@ import org.testng.annotations.BeforeMethod;
import
org.testng.annotations.BeforeTest
;
import
org.testng.annotations.Test
;
import
ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked
;
/**
* Test cases for the {@link PersistentExtendedBlockingQueueDecorator}.
*
...
...
@@ -39,8 +41,8 @@ import org.testng.annotations.Test;
public
class
PersistentExtendedBlockingQueueDecoratorTest
{
private
static
final
File
workingDirectory
=
new
File
(
"targets"
+
File
.
separator
+
"unit-test-wd"
);
private
static
final
File
workingDirectory
=
new
File
(
"targets"
+
File
.
separator
+
"unit-test-wd"
);
private
static
final
File
queueFile
=
new
File
(
workingDirectory
,
"persistentQueue.dat"
);
...
...
@@ -230,4 +232,40 @@ public class PersistentExtendedBlockingQueueDecoratorTest
assertTrue
(
createQueue
().
isEmpty
());
}
@Test
(
expectedExceptions
=
{
IOExceptionUnchecked
.
class
})
public
void
testAddLotsOfItems
()
{
PersistentExtendedBlockingQueueDecorator
<
String
>
persistentQueue
=
createQueue
();
final
List
<
String
>
items
=
new
ArrayList
<
String
>();
for
(
int
i
=
0
;
i
<
64
;
++
i
)
{
items
.
add
(
createItemOfLength
(
i
));
persistentQueue
.
add
(
items
.
get
(
i
));
}
queueFile
.
delete
();
// Running through this will throw an exception at some point when it tries to grow the
// persistent queue's record size.
for
(
int
i
=
64
;
i
<
128
;
++
i
)
{
items
.
add
(
createItemOfLength
(
i
));
persistentQueue
.
add
(
items
.
get
(
i
));
}
assertEquals
(
items
,
asList
(
createQueue
()));
}
private
String
createItemOfLength
(
int
itemLength
)
{
String
item
=
""
;
for
(
int
j
=
0
;
j
<
itemLength
;
++
j
)
{
item
+=
"1"
;
}
return
item
;
}
}
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