blob: 8440a62c9caf838016bb61a5f2ce95a4dfdd32e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/****************************************************************************
* Copyright (c) 2007 Composent, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Composent, Inc. - initial API and implementation
*****************************************************************************/
package org.eclipse.ecf.tests.filetransfer;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URL;
/**
*
*/
public class FileSendTest extends AbstractSendTestCase {
File inputFile = null;
File outputFile = null;
/* (non-Javadoc)
* @see org.eclipse.ecf.tests.filetransfer.AbstractSendTestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
URL url = this.getClass().getResource("/test.txt");
inputFile = File.createTempFile("ECFTest", "input.txt");
FileOutputStream fos = new FileOutputStream(inputFile);
InputStream ins = url.openStream();
byte [] buf = new byte[1024];
int l;
while ((l = ins.read(buf)) != -1) fos.write(buf);
fos.close();
ins.close();
outputFile = File.createTempFile("ECFTest", "test.txt");
}
/* (non-Javadoc)
* @see org.eclipse.ecf.tests.filetransfer.AbstractSendTestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
inputFile = null;
outputFile = null;
}
public void testSend() throws Exception {
testSendForFile(outputFile.toURI().toURL(), inputFile);
waitForDone(10000);
assertEquals(outputFile.length(), inputFile.length());
}
}
|