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
4631f3c1
Commit
4631f3c1
authored
14 years ago
by
buczekp
Browse files
Options
Downloads
Patches
Plain Diff
[LMS-1761] fixed and extended sample batch update tests
SVN: 17893
parent
6fbaf444
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/plugin/generic/client/web/server/parser/UpdatedSampleParserObjectFactoryTest.java
+24
-11
24 additions, 11 deletions
...b/server/parser/UpdatedSampleParserObjectFactoryTest.java
with
24 additions
and
11 deletions
openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/parser/UpdatedSampleParserObjectFactoryTest.java
+
24
−
11
View file @
4631f3c1
...
...
@@ -18,7 +18,6 @@ package ch.systemsx.cisd.openbis.plugin.generic.client.web.server.parser;
import
static
org
.
testng
.
AssertJUnit
.
assertEquals
;
import
static
org
.
testng
.
AssertJUnit
.
assertFalse
;
import
static
org
.
testng
.
AssertJUnit
.
assertTrue
;
import
java.util.Set
;
...
...
@@ -71,22 +70,36 @@ public final class UpdatedSampleParserObjectFactoryTest
return
new
Object
[][]
{
{
new
String
[]
{
""
,
""
,
""
,
""
},
0
},
{
""
,
""
,
""
,
""
},
0
,
0
},
{
new
String
[]
{
"id1"
,
"cont1"
,
"1"
,
"hello"
},
2
},
};
{
"id1"
,
"cont1"
,
"1"
,
"hello"
},
2
,
2
},
{
new
String
[]
{
"id1"
,
""
,
"1"
,
""
},
1
,
1
},
{
new
String
[]
{
""
,
"cont1"
,
""
,
"hello"
},
1
,
1
},
{
new
String
[]
{
"id1"
,
"cont1"
,
"--DELETE--"
,
"--DELETE--"
},
0
,
2
},
{
new
String
[]
{
"--DELETE--"
,
"--DELETE--"
,
"--DELETE--"
,
"hello"
},
1
,
2
}
};
}
@Test
(
dataProvider
=
"getLineTokens"
)
public
final
void
testCreateObject
(
final
String
[]
lineTokens
,
final
int
numberOfProperties
)
public
final
void
testCreateObject
(
final
String
[]
lineTokens
,
final
int
numberOfProperties
,
final
int
numOfPropertiestoUpdate
)
{
final
String
identifierToken
=
lineTokens
[
0
];
final
String
containerToken
=
lineTokens
[
1
];
final
String
p1Token
=
lineTokens
[
2
];
final
String
p2Token
=
lineTokens
[
3
];
final
UpdatedSampleParserObjectFactory
parserObjectFactory
=
createUpdatedSampleParserObjectFactory
(
createPropertyMapper
(),
true
);
final
UpdatedSample
objectCreated
=
(
UpdatedSample
)
parserObjectFactory
.
createObject
(
lineTokens
);
// assert that all NewSample properties are set properly
assertEquals
(
objectCreated
.
getIdentifier
(),
lineTokens
[
0
]);
assertEquals
(
objectCreated
.
getContainerIdentifier
(),
StringUtils
.
isEmpty
(
lineTokens
[
1
])
?
null
:
lineTokens
[
1
]);
assertEquals
(
identifierToken
,
objectCreated
.
getIdentifier
());
assertEquals
(
StringUtils
.
isEmpty
(
containerToken
)
||
"--DELETE--"
.
equals
(
containerToken
)
?
null
:
containerToken
,
objectCreated
.
getContainerIdentifier
());
final
IEntityProperty
[]
properties
=
objectCreated
.
getProperties
();
assertEquals
(
numberOfProperties
,
properties
.
length
);
int
index
=
2
;
...
...
@@ -97,10 +110,10 @@ public final class UpdatedSampleParserObjectFactoryTest
// assert that SampleBatchUpdateDetails contains proper data
final
SampleBatchUpdateDetails
batchUpdateDetails
=
objectCreated
.
getBatchUpdateDetails
();
final
Set
<
String
>
propertiesToUpdate
=
batchUpdateDetails
.
getPropertiesToUpdate
();
assertEquals
(
2
,
propertiesToUpdate
.
size
());
assert
True
(
propertiesToUpdate
.
contains
(
PROPERTY_1
));
assert
True
(
propertiesToUpdate
.
contains
(
PROPERTY_2
));
assertEquals
(
StringUtils
.
isBlank
(
l
ineToken
s
[
2
]
)
==
false
,
batchUpdateDetails
assertEquals
(
numOfPropertiestoUpdate
,
propertiesToUpdate
.
size
());
assert
Equals
(
StringUtils
.
isBlank
(
p1Token
)
==
false
,
propertiesToUpdate
.
contains
(
PROPERTY_1
));
assert
Equals
(
StringUtils
.
isBlank
(
p2Token
)
==
false
,
propertiesToUpdate
.
contains
(
PROPERTY_2
));
assertEquals
(
StringUtils
.
isBlank
(
conta
ine
r
Token
)
==
false
,
batchUpdateDetails
.
isContainerUpdateRequested
());
assertFalse
(
batchUpdateDetails
.
isParentUpdateRequested
());
assertFalse
(
batchUpdateDetails
.
isExperimentUpdateRequested
());
...
...
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