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
b9b9cf6e
Commit
b9b9cf6e
authored
16 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
[LMS-531] fix: - Database instance code is never empty in 'SampleWithOwner'.
SVN: 7831
parent
2af8f5f3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bds/source/java/ch/systemsx/cisd/bds/SampleWithOwner.java
+4
-11
4 additions, 11 deletions
bds/source/java/ch/systemsx/cisd/bds/SampleWithOwner.java
bds/sourceTest/java/ch/systemsx/cisd/bds/SampleWithOwnerTest.java
+3
-6
3 additions, 6 deletions
...ceTest/java/ch/systemsx/cisd/bds/SampleWithOwnerTest.java
with
7 additions
and
17 deletions
bds/source/java/ch/systemsx/cisd/bds/SampleWithOwner.java
+
4
−
11
View file @
b9b9cf6e
...
@@ -64,23 +64,16 @@ public final class SampleWithOwner extends Sample
...
@@ -64,23 +64,16 @@ public final class SampleWithOwner extends Sample
super
(
code
,
typeCode
,
typeDescription
);
super
(
code
,
typeCode
,
typeDescription
);
assert
groupCode
!=
null
:
"Undefined group code."
;
assert
groupCode
!=
null
:
"Undefined group code."
;
assert
databaseInstanceCode
!=
null
:
"Undefined database instance code."
;
assert
databaseInstanceCode
!=
null
:
"Undefined database instance code."
;
assert
One
NonEmpty
(
group
Code
,
databaseInstanceCode
);
assertNonEmpty
DatabaseInstance
Code
(
databaseInstanceCode
);
this
.
groupCode
=
groupCode
;
this
.
groupCode
=
groupCode
;
this
.
databaseInstanceCode
=
databaseInstanceCode
;
this
.
databaseInstanceCode
=
databaseInstanceCode
;
}
}
private
final
static
void
assertOneNonEmpty
(
final
String
groupCode
,
private
final
static
void
assertNonEmptyDatabaseInstanceCode
(
final
String
databaseInstanceCode
)
final
String
databaseInstanceCode
)
{
{
if
(
groupCode
.
length
()
==
0
&&
databaseInstanceCode
.
length
()
==
0
)
if
(
databaseInstanceCode
.
length
()
==
0
)
{
throw
new
DataStructureException
(
"Both, group code and database instance code, are empty."
);
}
if
(
groupCode
.
length
()
>
0
&&
databaseInstanceCode
.
length
()
>
0
)
{
{
throw
new
DataStructureException
(
"At most one, the group code OR the database "
throw
new
DataStructureException
(
"Empty database instance code."
);
+
"instance code, must be non empty."
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
bds/sourceTest/java/ch/systemsx/cisd/bds/SampleWithOwnerTest.java
+
3
−
6
View file @
b9b9cf6e
...
@@ -66,15 +66,12 @@ public final class SampleWithOwnerTest extends AbstractFileSystemTestCase
...
@@ -66,15 +66,12 @@ public final class SampleWithOwnerTest extends AbstractFileSystemTestCase
}
}
try
try
{
{
new
SampleWithOwner
(
CODE
,
TYPE_CODE
,
TYPE_DESCRIPTION
,
GROUP_CODE
,
new
SampleWithOwner
(
CODE
,
TYPE_CODE
,
TYPE_DESCRIPTION
,
GROUP_CODE
,
""
);
DATABASE_INSTANCE_CODE
);
fail
();
fail
();
}
catch
(
final
DataStructureException
e
)
}
catch
(
final
DataStructureException
e
)
{
{
// Nothing to do here.
// Nothing to do here.
}
}
assertEquals
(
false
,
fail
);
new
SampleWithOwner
(
CODE
,
TYPE_CODE
,
TYPE_DESCRIPTION
,
GROUP_CODE
,
""
);
}
}
@DataProvider
@DataProvider
...
@@ -82,7 +79,7 @@ public final class SampleWithOwnerTest extends AbstractFileSystemTestCase
...
@@ -82,7 +79,7 @@ public final class SampleWithOwnerTest extends AbstractFileSystemTestCase
{
{
return
new
Object
[][]
return
new
Object
[][]
{
{
{
GROUP_CODE
,
""
},
{
GROUP_CODE
,
DATABASE_INSTANCE_CODE
},
{
""
,
DATABASE_INSTANCE_CODE
},
};
{
""
,
DATABASE_INSTANCE_CODE
},
};
}
}
...
@@ -98,7 +95,7 @@ public final class SampleWithOwnerTest extends AbstractFileSystemTestCase
...
@@ -98,7 +95,7 @@ public final class SampleWithOwnerTest extends AbstractFileSystemTestCase
if
(
groupCode
.
length
()
>
0
)
if
(
groupCode
.
length
()
>
0
)
{
{
assertEquals
(
GROUP_CODE
,
newSample
.
getGroupCode
());
assertEquals
(
GROUP_CODE
,
newSample
.
getGroupCode
());
assertEquals
(
""
,
newSample
.
getDatabaseInstanceCode
());
assertEquals
(
DATABASE_INSTANCE_CODE
,
newSample
.
getDatabaseInstanceCode
());
}
else
}
else
{
{
assertEquals
(
""
,
newSample
.
getGroupCode
());
assertEquals
(
""
,
newSample
.
getGroupCode
());
...
...
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