Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Dehm
briar
Commits
2ce8d2a4
Commit
2ce8d2a4
authored
13 years ago
by
akwizgran
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a race condition: start the monitor before creating files.
parent
a773bbc3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/build.xml
+1
-0
1 addition, 0 deletions
test/build.xml
test/net/sf/briar/plugins/file/UnixRemovableDriveMonitorTest.java
+4
-4
4 additions, 4 deletions
.../sf/briar/plugins/file/UnixRemovableDriveMonitorTest.java
with
5 additions
and
4 deletions
test/build.xml
+
1
−
0
View file @
2ce8d2a4
...
...
@@ -13,6 +13,7 @@
<path
refid=
'test-classes'
/>
<path
refid=
'util-classes'
/>
</classpath>
<jvmarg
value=
'-Djava.library.path=../lib'
/>
<test
name=
'net.sf.briar.LockFairnessTest'
/>
<test
name=
'net.sf.briar.ProtocolIntegrationTest'
/>
<test
name=
'net.sf.briar.crypto.CounterModeTest'
/>
...
...
This diff is collapsed.
Click to expand it.
test/net/sf/briar/plugins/file/UnixRemovableDriveMonitorTest.java
+
4
−
4
View file @
2ce8d2a4
...
...
@@ -36,15 +36,14 @@ public class UnixRemovableDriveMonitorTest extends TestCase {
final
CountDownLatch
latch
=
new
CountDownLatch
(
1
);
final
List
<
File
>
detected
=
new
ArrayList
<
File
>();
// Create a monitor that will wait for two files before stopping
final
RemovableDriveMonitor
monitor
=
createMonitor
(
testDir
);
monitor
.
start
();
new
Thread
()
{
@Override
public
void
run
()
{
try
{
RemovableDriveMonitor
monitor
=
createMonitor
(
testDir
);
monitor
.
start
();
detected
.
add
(
monitor
.
waitForInsertion
());
detected
.
add
(
monitor
.
waitForInsertion
());
monitor
.
stop
();
latch
.
countDown
();
}
catch
(
IOException
e
)
{
fail
();
...
...
@@ -57,7 +56,8 @@ public class UnixRemovableDriveMonitorTest extends TestCase {
assertTrue
(
file1
.
createNewFile
());
assertTrue
(
file2
.
createNewFile
());
// Wait for the monitor to detect the files
latch
.
await
(
1
,
TimeUnit
.
SECONDS
);
assertTrue
(
latch
.
await
(
2
,
TimeUnit
.
SECONDS
));
monitor
.
stop
();
// Check that both files were detected
assertEquals
(
2
,
detected
.
size
());
assertTrue
(
detected
.
contains
(
file1
));
...
...
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