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
2bb2bce5
Commit
2bb2bce5
authored
15 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
LMS-1231 testDoGetThumbnail improved
SVN: 13003
parent
56afd876
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/openbis/dss/generic/server/DatasetDownloadServletTest.java
+8
-6
8 additions, 6 deletions
...penbis/dss/generic/server/DatasetDownloadServletTest.java
with
8 additions
and
6 deletions
datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/generic/server/DatasetDownloadServletTest.java
+
8
−
6
View file @
2bb2bce5
...
@@ -390,10 +390,10 @@ public class DatasetDownloadServletTest
...
@@ -390,10 +390,10 @@ public class DatasetDownloadServletTest
@Test
@Test
public
void
testDoGetThumbnail
()
throws
Exception
public
void
testDoGetThumbnail
()
throws
Exception
{
{
BufferedImage
image
=
new
BufferedImage
(
10
,
20
,
BufferedImage
.
TYPE_INT_RGB
);
BufferedImage
image
=
new
BufferedImage
(
10
0
,
20
0
,
BufferedImage
.
TYPE_INT_RGB
);
ImageIO
.
write
(
image
,
"png"
,
EXAMPLE_FILE
);
ImageIO
.
write
(
image
,
"png"
,
EXAMPLE_FILE
);
final
ExternalData
externalData
=
createExternalData
();
final
ExternalData
externalData
=
createExternalData
();
prepareParseRequestURLForThumbnail
();
prepareParseRequestURLForThumbnail
(
100
,
50
);
prepareForObtainingDataSetFromServer
(
externalData
);
prepareForObtainingDataSetFromServer
(
externalData
);
final
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
final
ByteArrayOutputStream
outputStream
=
new
ByteArrayOutputStream
();
context
.
checking
(
new
Expectations
()
context
.
checking
(
new
Expectations
()
...
@@ -411,7 +411,7 @@ public class DatasetDownloadServletTest
...
@@ -411,7 +411,7 @@ public class DatasetDownloadServletTest
will
(
returnValue
(
map
));
will
(
returnValue
(
map
));
one
(
response
).
setContentType
(
"image/png"
);
one
(
response
).
setContentType
(
"image/png"
);
one
(
response
).
setContentLength
(
72
);
one
(
response
).
setContentLength
(
84
);
one
(
response
).
setHeader
(
"Content-Disposition"
,
one
(
response
).
setHeader
(
"Content-Disposition"
,
"inline; filename="
+
EXAMPLE_FILE_NAME
);
"inline; filename="
+
EXAMPLE_FILE_NAME
);
one
(
response
).
getOutputStream
();
one
(
response
).
getOutputStream
();
...
@@ -428,7 +428,9 @@ public class DatasetDownloadServletTest
...
@@ -428,7 +428,9 @@ public class DatasetDownloadServletTest
DatasetDownloadServlet
servlet
=
createServlet
();
DatasetDownloadServlet
servlet
=
createServlet
();
servlet
.
doGet
(
request
,
response
);
servlet
.
doGet
(
request
,
response
);
ImageIO
.
read
(
new
ByteArrayInputStream
(
outputStream
.
toByteArray
()));
BufferedImage
thumbnail
=
ImageIO
.
read
(
new
ByteArrayInputStream
(
outputStream
.
toByteArray
()));
assertEquals
(
25
,
thumbnail
.
getWidth
());
assertEquals
(
50
,
thumbnail
.
getHeight
());
assertEquals
(
LOG_INFO
+
"Data set '1234-1' obtained from openBIS server."
assertEquals
(
LOG_INFO
+
"Data set '1234-1' obtained from openBIS server."
+
OSUtilities
.
LINE_SEPARATOR
+
LOG_INFO
+
OSUtilities
.
LINE_SEPARATOR
+
LOG_INFO
+
"For data set '1234-1' deliver file <wd>/data set #123/read me @home.txt "
+
"For data set '1234-1' deliver file <wd>/data set #123/read me @home.txt "
...
@@ -603,7 +605,7 @@ public class DatasetDownloadServletTest
...
@@ -603,7 +605,7 @@ public class DatasetDownloadServletTest
});
});
}
}
private
void
prepareParseRequestURLForThumbnail
()
private
void
prepareParseRequestURLForThumbnail
(
final
int
width
,
final
int
height
)
{
{
context
.
checking
(
new
Expectations
()
context
.
checking
(
new
Expectations
()
{
{
...
@@ -612,7 +614,7 @@ public class DatasetDownloadServletTest
...
@@ -612,7 +614,7 @@ public class DatasetDownloadServletTest
will
(
returnValue
(
EXAMPLE_SESSION_ID
));
will
(
returnValue
(
EXAMPLE_SESSION_ID
));
one
(
request
).
getParameter
(
DatasetDownloadServlet
.
DISPLAY_MODE_KEY
);
one
(
request
).
getParameter
(
DatasetDownloadServlet
.
DISPLAY_MODE_KEY
);
will
(
returnValue
(
"thumbnail
20x30"
));
will
(
returnValue
(
"thumbnail
"
+
width
+
"x"
+
height
));
}
}
});
});
}
}
...
...
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