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
d1af4135
Commit
d1af4135
authored
13 years ago
by
cramakri
Browse files
Options
Downloads
Patches
Plain Diff
LMS-2382 Added new test.
SVN: 22169
parent
60c818ae
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
datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/RollbackStackTest.java
+71
-1
71 additions, 1 deletion
.../etlserver/registrator/api/v1/impl/RollbackStackTest.java
with
71 additions
and
1 deletion
datastore_server/sourceTest/java/ch/systemsx/cisd/etlserver/registrator/api/v1/impl/RollbackStackTest.java
+
71
−
1
View file @
d1af4135
...
...
@@ -200,6 +200,32 @@ public class RollbackStackTest extends AbstractTestWithRollbackStack
assertEquals
(
TrackingCommandStatus
.
ROLLEDBACK
,
cmdN
.
status
);
}
@Test
public
void
testIncreasingSerializedCommandSize
()
{
// Create some commands
// Add them to the stack
for
(
int
i
=
0
;
i
<
129
;
++
i
)
{
StringTrackingCommand
cmd
=
new
StringTrackingCommand
(
createStringOfLength
(
i
));
rollbackStack
.
pushAndExecuteCommand
(
cmd
);
assertEquals
(
TrackingCommandStatus
.
EXECUTED
,
cmd
.
status
);
}
// Rollback and check that the rollback occurred correctly
rollbackStack
.
rollbackAll
();
}
private
String
createStringOfLength
(
int
length
)
{
String
item
=
""
;
for
(
int
j
=
0
;
j
<
length
;
++
j
)
{
item
+=
"1"
;
}
return
item
;
}
private
static
enum
TrackingCommandStatus
{
PENDING_EXECUTE
,
EXECUTED
,
ROLLEDBACK
...
...
@@ -209,7 +235,7 @@ public class RollbackStackTest extends AbstractTestWithRollbackStack
{
private
static
final
long
serialVersionUID
=
1L
;
pr
ivate
TrackingCommandStatus
status
=
TrackingCommandStatus
.
PENDING_EXECUTE
;
pr
otected
TrackingCommandStatus
status
=
TrackingCommandStatus
.
PENDING_EXECUTE
;
private
final
TrackingCommand
predecessor
;
...
...
@@ -291,5 +317,49 @@ public class RollbackStackTest extends AbstractTestWithRollbackStack
return
true
;
}
@Override
public
String
toString
()
{
return
"EqualityTrackingCommand [id="
+
id
+
",status="
+
status
+
"]"
;
}
}
private
static
class
StringTrackingCommand
extends
TrackingCommand
{
private
static
final
long
serialVersionUID
=
1L
;
private
final
String
text
;
private
StringTrackingCommand
(
String
text
)
{
super
();
this
.
text
=
text
;
}
@Override
public
int
hashCode
()
{
return
text
.
hashCode
();
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
StringTrackingCommand
other
=
(
StringTrackingCommand
)
obj
;
return
text
.
equals
(
other
.
text
);
}
@Override
public
String
toString
()
{
return
"StringTrackingCommand [text="
+
text
+
", status="
+
status
+
"]"
;
}
}
}
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