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
8ab91aa0
Commit
8ab91aa0
authored
13 years ago
by
gpawel
Browse files
Options
Downloads
Patches
Plain Diff
[LMS-2415] fixed broken tests
SVN: 22281
parent
4116b8f2
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
openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java
+37
-10
37 additions, 10 deletions
.../cisd/openbis/generic/server/business/bo/TrashBOTest.java
with
37 additions
and
10 deletions
openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java
+
37
−
10
View file @
8ab91aa0
...
@@ -161,8 +161,10 @@ public final class TrashBOTest extends AbstractBOTest
...
@@ -161,8 +161,10 @@ public final class TrashBOTest extends AbstractBOTest
List
<
TechId
>
sampleIds
=
TechId
.
createList
(
50
,
51
);
List
<
TechId
>
sampleIds
=
TechId
.
createList
(
50
,
51
);
one
(
sampleDAO
).
listSampleIdsByExperimentIds
(
experimentIds
);
one
(
sampleDAO
).
listSampleIdsByExperimentIds
(
experimentIds
);
will
(
returnValue
(
sampleIds
));
will
(
returnValue
(
sampleIds
));
one
(
deletionDAO
).
trash
(
EntityKind
.
SAMPLE
,
new
ArrayList
<
TechId
>(
sampleIds
),
RecordingMatcher
<
List
<
TechId
>>
sampleIdsMatcher
=
deletion
);
new
RecordingMatcher
<
List
<
TechId
>>();
one
(
deletionDAO
).
trash
(
with
(
same
(
EntityKind
.
SAMPLE
)),
with
(
sampleIdsMatcher
),
with
(
same
(
deletion
)));
will
(
returnValue
(
0
));
will
(
returnValue
(
0
));
// trash dependent data sets
// trash dependent data sets
...
@@ -183,6 +185,10 @@ public final class TrashBOTest extends AbstractBOTest
...
@@ -183,6 +185,10 @@ public final class TrashBOTest extends AbstractBOTest
final
DeletionPE
deletion
=
createDeletion
();
final
DeletionPE
deletion
=
createDeletion
();
final
List
<
TechId
>
experimentIds
=
EXAMPLE_ID_LIST
;
final
List
<
TechId
>
experimentIds
=
EXAMPLE_ID_LIST
;
final
List
<
TechId
>
sampleIds
=
TechId
.
createList
(
50
,
51
);
final
List
<
TechId
>
sampleIds
=
TechId
.
createList
(
50
,
51
);
final
RecordingMatcher
<
List
<
TechId
>>
dataSetIdsMatcher
=
new
RecordingMatcher
<
List
<
TechId
>>();
final
List
<
TechId
>
dataSetIds
=
TechId
.
createList
(
60
,
61
);
context
.
checking
(
new
Expectations
()
context
.
checking
(
new
Expectations
()
{
{
{
{
...
@@ -194,15 +200,17 @@ public final class TrashBOTest extends AbstractBOTest
...
@@ -194,15 +200,17 @@ public final class TrashBOTest extends AbstractBOTest
will
(
returnValue
(
sampleIds
));
will
(
returnValue
(
sampleIds
));
// trash dependent data sets
// trash dependent data sets
List
<
TechId
>
dataSetIds
=
TechId
.
createList
(
60
,
61
);
one
(
dataDAO
).
listDataSetIdsByExperimentIds
(
experimentIds
);
one
(
dataDAO
).
listDataSetIdsByExperimentIds
(
experimentIds
);
will
(
returnValue
(
dataSetIds
));
will
(
returnValue
(
dataSetIds
));
one
(
deletionDAO
).
trash
(
EntityKind
.
DATA_SET
,
dataSetIds
,
deletion
);
one
(
deletionDAO
).
trash
(
with
(
same
(
EntityKind
.
DATA_SET
)),
with
(
dataSetIdsMatcher
),
with
(
same
(
deletion
)));
will
(
returnValue
(
dataSetIds
.
size
()));
will
(
returnValue
(
dataSetIds
.
size
()));
}
}
});
});
prepareDeletionOfSamplesWithDependencies
(
deletion
,
sampleIds
);
prepareDeletionOfSamplesWithDependencies
(
deletion
,
sampleIds
);
trashBO
.
trashExperiments
(
experimentIds
);
trashBO
.
trashExperiments
(
experimentIds
);
verifyRecordedLists
(
dataSetIds
,
dataSetIdsMatcher
);
context
.
assertIsSatisfied
();
context
.
assertIsSatisfied
();
}
}
...
@@ -238,13 +246,17 @@ public final class TrashBOTest extends AbstractBOTest
...
@@ -238,13 +246,17 @@ public final class TrashBOTest extends AbstractBOTest
context
.
checking
(
new
Expectations
()
context
.
checking
(
new
Expectations
()
{
{
{
{
one
(
deletionDAO
).
trash
(
EntityKind
.
SAMPLE
,
sampleIds
,
deletion
);
RecordingMatcher
<
List
<
TechId
>>
sampleIdsMatcher
=
new
RecordingMatcher
<
List
<
TechId
>>();
one
(
deletionDAO
).
trash
(
with
(
same
(
EntityKind
.
SAMPLE
)),
with
(
sampleIdsMatcher
),
with
(
same
(
deletion
)));
will
(
returnValue
(
sampleIds
.
size
()));
will
(
returnValue
(
sampleIds
.
size
()));
// trash dependent children
// trash dependent children
List
<
TechId
>
childrenIds
=
TechId
.
createList
(
50
,
51
);
List
<
TechId
>
childrenIds
=
TechId
.
createList
(
50
,
51
);
Set
<
TechId
>
childrenIdSet
=
new
HashSet
<
TechId
>(
childrenIds
);
Set
<
TechId
>
childrenIdSet
=
new
HashSet
<
TechId
>(
childrenIds
);
one
(
sampleDAO
).
listSampleIdsByParentIds
(
sampleIds
);
one
(
sampleDAO
).
listSampleIdsByParentIds
(
with
(
sampleIds
Matcher
)
);
will
(
returnValue
(
childrenIdSet
));
will
(
returnValue
(
childrenIdSet
));
one
(
deletionDAO
).
trash
(
EntityKind
.
SAMPLE
,
new
ArrayList
<
TechId
>(
childrenIdSet
),
one
(
deletionDAO
).
trash
(
EntityKind
.
SAMPLE
,
new
ArrayList
<
TechId
>(
childrenIdSet
),
deletion
);
deletion
);
...
@@ -252,16 +264,22 @@ public final class TrashBOTest extends AbstractBOTest
...
@@ -252,16 +264,22 @@ public final class TrashBOTest extends AbstractBOTest
// trash dependent components
// trash dependent components
List
<
TechId
>
componentIds
=
TechId
.
createList
(
60
,
61
);
List
<
TechId
>
componentIds
=
TechId
.
createList
(
60
,
61
);
one
(
sampleDAO
).
listSampleIdsByContainerIds
(
sampleIds
);
one
(
sampleDAO
).
listSampleIdsByContainerIds
(
with
(
sampleIds
Matcher
)
);
will
(
returnValue
(
componentIds
));
will
(
returnValue
(
componentIds
));
one
(
deletionDAO
).
trash
(
EntityKind
.
SAMPLE
,
componentIds
,
deletion
);
RecordingMatcher
<
List
<
TechId
>>
componentIdsMatcher
=
new
RecordingMatcher
<
List
<
TechId
>>();
one
(
deletionDAO
).
trash
(
with
(
same
(
EntityKind
.
SAMPLE
)),
with
(
componentIdsMatcher
),
with
(
same
(
deletion
)));
will
(
returnValue
(
0
));
will
(
returnValue
(
0
));
// trash dependent data sets
// trash dependent data sets
List
<
TechId
>
dataSetIds
=
TechId
.
createList
(
70
,
71
,
72
);
List
<
TechId
>
dataSetIds
=
TechId
.
createList
(
70
,
71
,
72
);
one
(
dataDAO
).
listDataSetIdsBySampleIds
(
sampleIds
);
one
(
dataDAO
).
listDataSetIdsBySampleIds
(
with
(
sampleIds
Matcher
)
);
will
(
returnValue
(
dataSetIds
));
will
(
returnValue
(
dataSetIds
));
one
(
deletionDAO
).
trash
(
EntityKind
.
DATA_SET
,
dataSetIds
,
deletion
);
RecordingMatcher
<
List
<
TechId
>>
dataSetIdsMatcher
=
new
RecordingMatcher
<
List
<
TechId
>>();
one
(
deletionDAO
).
trash
(
with
(
same
(
EntityKind
.
DATA_SET
)),
with
(
dataSetIdsMatcher
),
with
(
same
(
deletion
)));
will
(
returnValue
(
2
));
will
(
returnValue
(
2
));
}
}
});
});
...
@@ -283,4 +301,13 @@ public final class TrashBOTest extends AbstractBOTest
...
@@ -283,4 +301,13 @@ public final class TrashBOTest extends AbstractBOTest
context
.
assertIsSatisfied
();
context
.
assertIsSatisfied
();
}
}
private
static
void
verifyRecordedLists
(
List
<
TechId
>
expected
,
RecordingMatcher
<
List
<
TechId
>>
matcher
)
{
for
(
List
<
TechId
>
recorded
:
matcher
.
getRecordedObjects
())
{
assertTrue
(
recorded
.
containsAll
(
expected
));
assertTrue
(
expected
.
containsAll
(
recorded
));
}
}
}
}
\ No newline at end of file
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