1 /************************************************************************* |
|
2 /* jdk11.java -- java.io.FileDescriptor 1.1 tests |
|
3 /* |
|
4 /* Copyright (c) 2001, 2002 Free Software Foundation, Inc. |
|
5 /* |
|
6 /* This program is free software; you can redistribute it and/or modify |
|
7 /* it under the terms of the GNU General Public License as published |
|
8 /* by the Free Software Foundation, either version 2 of the License, or |
|
9 /* (at your option) any later version. |
|
10 /* |
|
11 /* This program is distributed in the hope that it will be useful, but |
|
12 /* WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 /* GNU General Public License for more details. |
|
15 /* |
|
16 /* You should have received a copy of the GNU General Public License |
|
17 /* along with this program; if not, write to the Free Software Foundation |
|
18 /* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA |
|
19 /*************************************************************************/ |
|
20 |
|
21 // Tags: JDK1.1 |
|
22 |
|
23 package gnu.testlet.java.io.FileDescriptor; |
|
24 |
|
25 import gnu.testlet.Testlet; |
|
26 import gnu.testlet.TestHarness; |
|
27 import java.io.FileDescriptor; |
|
28 import java.io.FileOutputStream; |
|
29 import java.io.FileNotFoundException; |
|
30 import java.io.IOException; |
|
31 import java.io.SyncFailedException; |
|
32 |
|
33 public class jdk11 implements Testlet |
|
34 { |
|
35 |
|
36 public void test (TestHarness harness) |
|
37 { |
|
38 try { |
|
39 FileOutputStream fos = new FileOutputStream("tmpfile"); |
|
40 try { |
|
41 FileDescriptor fd = fos.getFD(); |
|
42 harness.check(fd.valid(), "valid()"); |
|
43 try { |
|
44 fd.sync(); |
|
45 harness.check(true, "sync()"); |
|
46 } |
|
47 catch (SyncFailedException e) { |
|
48 harness.debug(e); |
|
49 harness.fail("SyncFailedException thrown"); |
|
50 } |
|
51 } |
|
52 catch (IOException e) { |
|
53 harness.fail("Can't get FileDescriptor"); |
|
54 } |
|
55 } |
|
56 catch (FileNotFoundException e) { |
|
57 harness.fail("Can't make file 'tmpfile'"); |
|
58 } |
|
59 } |
|
60 } |
|
61 |
|
62 |
|