1 57 58 package util; 59 60 import junit.framework.Test; 61 import junit.framework.TestCase; 62 import junit.framework.TestSuite; 63 64 import org.apache.wsif.WSIFOperation; 65 import org.apache.wsif.base.WSIFDefaultPort; 66 67 72 public class PortFinalizeTest extends TestCase { 73 74 public PortFinalizeTest(String name) { 75 super(name); 76 } 77 78 public static void main(String [] args) { 79 junit.textui.TestRunner.run(suite()); 80 } 81 82 public static Test suite() { 83 return new TestSuite(PortFinalizeTest.class); 84 } 85 86 public void setUp() { 87 TestUtilities.setUpExtensionsAndProviders(); 88 } 89 90 public void testFinalize() throws Throwable { 91 DummyPort p = new DummyPort(); 92 assertTrue( "freshly created port should not be closed!", !DummyPort.isClosed() ); 93 p.finalize(); 99 assertTrue( "port should now be closed!", DummyPort.isClosed() ); 100 } 101 102 } 103 104 class DummyPort extends WSIFDefaultPort { 105 106 static private boolean closed; 107 108 public DummyPort() { 109 closed = false; 110 } 111 112 public WSIFOperation createOperation(String s1) { 113 return null; 114 } 115 116 public WSIFOperation createOperation(String s1, String s2, String s3) { 117 return null; 118 } 119 120 public void close() { 121 closed = true; 122 } 123 124 static public boolean isClosed() { 125 return closed; 126 } 127 128 } 129 | Popular Tags |