Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Verlässliche Systemsoftware
projects
osv
Commits
dfc9cd1b
Commit
dfc9cd1b
authored
11 years ago
by
Guy Zana
Browse files
Options
Downloads
Patches
Plain Diff
test: add a TCPDownloadFile test that downloads index.html from bbc.co.uk
uses Java nio.* for downloading a file, writing it to /tmp
parent
dc362c2c
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
java/cli/com/cloudius/cli/tests/TCPDownloadFile.java
+26
-0
26 additions, 0 deletions
java/cli/com/cloudius/cli/tests/TCPDownloadFile.java
java/cli/com/cloudius/cli/tests/TestRunner.java
+1
-0
1 addition, 0 deletions
java/cli/com/cloudius/cli/tests/TestRunner.java
with
27 additions
and
0 deletions
java/cli/com/cloudius/cli/tests/TCPDownloadFile.java
0 → 100644
+
26
−
0
View file @
dfc9cd1b
package
com.cloudius.cli.tests
;
import
java.io.FileOutputStream
;
import
java.net.URL
;
import
java.nio.channels.Channels
;
import
java.nio.channels.ReadableByteChannel
;
public
class
TCPDownloadFile
implements
Test
{
@Override
public
boolean
run
()
{
try
{
URL
website
=
new
URL
(
"http://212.58.244.66/"
);
ReadableByteChannel
rbc
=
Channels
.
newChannel
(
website
.
openStream
());
FileOutputStream
fos
=
new
FileOutputStream
(
"/tmp/bbc.co.uk.html"
);
fos
.
getChannel
().
transferFrom
(
rbc
,
0
,
1
<<
24
);
fos
.
close
();
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
return
(
false
);
}
return
(
true
);
}
}
This diff is collapsed.
Click to expand it.
java/cli/com/cloudius/cli/tests/TestRunner.java
+
1
−
0
View file @
dfc9cd1b
...
...
@@ -66,6 +66,7 @@ public class TestRunner extends ScriptableObject {
public
void
registerAllTests
()
{
this
.
register
(
"TCPEchoServerTest"
,
new
TCPEchoServerTest
());
this
.
register
(
"TCPExternalCommunication"
,
new
TCPExternalCommunication
());
this
.
register
(
"TCPDownloadFile"
,
new
TCPDownloadFile
());
this
.
registerELFTests
();
}
...
...
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