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
6df63950
Commit
6df63950
authored
16 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
fix: - Unit test on Mac.
SVN: 6307
parent
0d67dad9
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
datamover/sourceTest/java/ch/systemsx/cisd/datamover/IncomingProcessorTest.java
+21
-16
21 additions, 16 deletions
...ava/ch/systemsx/cisd/datamover/IncomingProcessorTest.java
with
21 additions
and
16 deletions
datamover/sourceTest/java/ch/systemsx/cisd/datamover/IncomingProcessorTest.java
+
21
−
16
View file @
6df63950
...
@@ -42,9 +42,11 @@ import ch.systemsx.cisd.datamover.filesystem.intf.IPathRemover;
...
@@ -42,9 +42,11 @@ import ch.systemsx.cisd.datamover.filesystem.intf.IPathRemover;
import
ch.systemsx.cisd.datamover.utils.LocalBufferDirs
;
import
ch.systemsx.cisd.datamover.utils.LocalBufferDirs
;
/**
/**
* Test cases for the {@link IncomingProcessor} class.
*
* @author Franz-Josef Elmer
* @author Franz-Josef Elmer
*/
*/
public
class
IncomingProcessorTest
public
final
class
IncomingProcessorTest
{
{
private
static
final
String
LOG_DEBUG_MACHINE_PREFIX
=
private
static
final
String
LOG_DEBUG_MACHINE_PREFIX
=
"DEBUG MACHINE.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
;
"DEBUG MACHINE.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
;
...
@@ -136,9 +138,9 @@ public class IncomingProcessorTest
...
@@ -136,9 +138,9 @@ public class IncomingProcessorTest
}
}
});
});
DataMoverProcess
process
=
final
DataMoverProcess
process
=
createProcess
(
"--"
+
PropertyNames
.
INCOMING_DIR
,
incomingDir
.
toString
(),
"-q"
,
"1"
);
createProcess
(
"--"
+
PropertyNames
.
INCOMING_DIR
,
incomingDir
.
toString
(),
"-q"
,
"1"
);
TimerTask
dataMoverTimerTask
=
process
.
getDataMoverTimerTask
();
final
TimerTask
dataMoverTimerTask
=
process
.
getDataMoverTimerTask
();
dataMoverTimerTask
.
run
();
// 1. round finds a file to process
dataMoverTimerTask
.
run
();
// 1. round finds a file to process
dataMoverTimerTask
.
run
();
// 2. round finds that quiet period is over
dataMoverTimerTask
.
run
();
// 2. round finds that quiet period is over
...
@@ -165,10 +167,10 @@ public class IncomingProcessorTest
...
@@ -165,10 +167,10 @@ public class IncomingProcessorTest
}
}
});
});
DataMoverProcess
process
=
final
DataMoverProcess
process
=
createProcess
(
"--"
+
PropertyNames
.
INCOMING_DIR
,
incomingDir
.
toString
(),
"-q"
,
"1"
,
createProcess
(
"--"
+
PropertyNames
.
INCOMING_DIR
,
incomingDir
.
toString
(),
"-q"
,
"1"
,
"--"
+
PropertyNames
.
DATA_COMPLETED_SCRIPT
,
exampleScript
.
toString
());
"--"
+
PropertyNames
.
DATA_COMPLETED_SCRIPT
,
exampleScript
.
toString
());
TimerTask
dataMoverTimerTask
=
process
.
getDataMoverTimerTask
();
final
TimerTask
dataMoverTimerTask
=
process
.
getDataMoverTimerTask
();
dataMoverTimerTask
.
run
();
// 1. round finds a file to process
dataMoverTimerTask
.
run
();
// 1. round finds a file to process
dataMoverTimerTask
.
run
();
// 2. round finds that quiet period is over
dataMoverTimerTask
.
run
();
// 2. round finds that quiet period is over
dataMoverTimerTask
.
run
();
// 3. round does not change status, thus no log
dataMoverTimerTask
.
run
();
// 3. round does not change status, thus no log
...
@@ -216,17 +218,18 @@ public class IncomingProcessorTest
...
@@ -216,17 +218,18 @@ public class IncomingProcessorTest
}
}
});
});
DataMoverProcess
process
=
final
DataMoverProcess
process
=
createProcess
(
"--"
+
PropertyNames
.
INCOMING_DIR
,
incomingDir
.
toString
(),
"-q"
,
"1"
,
createProcess
(
"--"
+
PropertyNames
.
INCOMING_DIR
,
incomingDir
.
toString
(),
"-q"
,
"1"
,
"--"
+
PropertyNames
.
DATA_COMPLETED_SCRIPT
,
exampleScript
.
toString
());
"--"
+
PropertyNames
.
DATA_COMPLETED_SCRIPT
,
exampleScript
.
toString
());
TimerTask
dataMoverTimerTask
=
process
.
getDataMoverTimerTask
();
final
TimerTask
dataMoverTimerTask
=
process
.
getDataMoverTimerTask
();
dataMoverTimerTask
.
run
();
// 1. round finds a file to process
dataMoverTimerTask
.
run
();
// 1. round finds a file to process
dataMoverTimerTask
.
run
();
// 2. round finds that quiet period is over
dataMoverTimerTask
.
run
();
// 2. round finds that quiet period is over
dataMoverTimerTask
.
run
();
// 3. round does not change status, thus no log
dataMoverTimerTask
.
run
();
// 3. round does not change status, thus no log
TEST_FILE
.
createNewFile
();
TEST_FILE
.
createNewFile
();
dataMoverTimerTask
.
run
();
// 4. round finds changed status, thus log
dataMoverTimerTask
.
run
();
// 4. round finds changed status, thus log
boolean
terminated
=
OSUtilities
.
isWindows
();
final
boolean
isWindows
=
OSUtilities
.
isWindows
();
final
boolean
isMac
=
OSUtilities
.
isMacOS
();
assertEquals
(
assertEquals
(
LOG_DEBUG_PREFIX
LOG_DEBUG_PREFIX
+
"Executing command: [sh, targets/unit-test/IncomingProcessorTest/example-script.sh, "
+
"Executing command: [sh, targets/unit-test/IncomingProcessorTest/example-script.sh, "
...
@@ -235,14 +238,14 @@ public class IncomingProcessorTest
...
@@ -235,14 +238,14 @@ public class IncomingProcessorTest
+
"ERROR NOTIFY.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
+
"ERROR NOTIFY.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
+
"Processing status of data completed script has changed to "
+
"Processing status of data completed script has changed to "
+
"DataCompletedFilter.Status{ok=false,run=true,terminated="
+
"DataCompletedFilter.Status{ok=false,run=true,terminated="
+
terminated
+
isWindows
+
",exitValue=1,blocked=false}. "
+
",exitValue=1,blocked=false}. "
+
"Command line: [sh, targets/unit-test/IncomingProcessorTest/example-script.sh, "
+
"Command line: [sh, targets/unit-test/IncomingProcessorTest/example-script.sh, "
+
"<wd>/targets/unit-test/IncomingProcessorTest/incoming/test-data.txt]"
+
"<wd>/targets/unit-test/IncomingProcessorTest/incoming/test-data.txt]"
+
OSUtilities
.
LINE_SEPARATOR
+
OSUtilities
.
LINE_SEPARATOR
+
"WARN OPERATION.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
+
"WARN OPERATION.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
+
"[sh] process "
+
"[sh] process "
+
(
terminated
?
"was destroyed."
:
"returned with exit value 1."
)
+
(
isWindows
?
"was destroyed."
:
"returned with exit value 1."
)
+
OSUtilities
.
LINE_SEPARATOR
+
OSUtilities
.
LINE_SEPARATOR
+
"WARN MACHINE.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
+
"WARN MACHINE.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
+
"[sh] output:"
+
"[sh] output:"
...
@@ -251,8 +254,9 @@ public class IncomingProcessorTest
...
@@ -251,8 +254,9 @@ public class IncomingProcessorTest
+
"\"hello world\""
+
"\"hello world\""
+
OSUtilities
.
LINE_SEPARATOR
+
OSUtilities
.
LINE_SEPARATOR
+
"WARN MACHINE.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
+
"WARN MACHINE.ch.systemsx.cisd.datamover.utils.DataCompletedFilter - "
+
"\"rm: cannot remove `targets/unit-test/IncomingProcessorTest/blabla.txt': "
+
(
isMac
==
false
?
"\"rm: cannot remove `targets/unit-test/IncomingProcessorTest/blabla.txt':"
+
"No such file or directory\""
:
"\"rm: targets/unit-test/IncomingProcessorTest/blabla.txt:"
)
+
" No such file or directory\""
+
OSUtilities
.
LINE_SEPARATOR
+
OSUtilities
.
LINE_SEPARATOR
+
LOG_DEBUG_PREFIX
+
LOG_DEBUG_PREFIX
+
"Executing command: [sh, targets/unit-test/IncomingProcessorTest/example-script.sh, "
+
"Executing command: [sh, targets/unit-test/IncomingProcessorTest/example-script.sh, "
...
@@ -274,7 +278,8 @@ public class IncomingProcessorTest
...
@@ -274,7 +278,8 @@ public class IncomingProcessorTest
+
"\"hello world\""
+
"\"hello world\""
+
OSUtilities
.
LINE_SEPARATOR
+
OSUtilities
.
LINE_SEPARATOR
+
LOG_DEBUG_MACHINE_PREFIX
+
LOG_DEBUG_MACHINE_PREFIX
+
"\"removed `targets/unit-test/IncomingProcessorTest/blabla.txt'\""
+
(
isMac
==
false
?
"\"removed `targets/unit-test/IncomingProcessorTest/blabla.txt'\""
:
"\"targets/unit-test/IncomingProcessorTest/blabla.txt\""
)
+
OSUtilities
.
LINE_SEPARATOR
+
OSUtilities
.
LINE_SEPARATOR
+
"DEBUG OPERATION.ch.systemsx.cisd.common.utilities.DirectoryScanningTimerTask - Following store item 'test-data.txt' has been handled."
+
"DEBUG OPERATION.ch.systemsx.cisd.common.utilities.DirectoryScanningTimerTask - Following store item 'test-data.txt' has been handled."
+
OSUtilities
.
LINE_SEPARATOR
+
OSUtilities
.
LINE_SEPARATOR
...
@@ -293,10 +298,10 @@ public class IncomingProcessorTest
...
@@ -293,10 +298,10 @@ public class IncomingProcessorTest
return
content
;
return
content
;
}
}
private
DataMoverProcess
createProcess
(
String
...
args
)
private
DataMoverProcess
createProcess
(
final
String
...
args
)
{
{
Parameters
parameters
=
new
Parameters
(
args
,
exitHandler
);
final
Parameters
parameters
=
new
Parameters
(
args
,
exitHandler
);
LocalBufferDirs
localBufferDirs
=
final
LocalBufferDirs
localBufferDirs
=
new
LocalBufferDirs
(
new
FileWithHighwaterMark
(
TEST_FOLDER
),
COPY_IN_PROGRESS_DIR
,
new
LocalBufferDirs
(
new
FileWithHighwaterMark
(
TEST_FOLDER
),
COPY_IN_PROGRESS_DIR
,
COPY_COMPLETE_DIR
,
READY_TO_MOVE_DIR
,
TEMP_DIR
);
COPY_COMPLETE_DIR
,
READY_TO_MOVE_DIR
,
TEMP_DIR
);
context
.
checking
(
new
Expectations
()
context
.
checking
(
new
Expectations
()
...
...
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