Modified: 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java?rev=631304&r1=631303&r2=631304&view=diff
==============================================================================
--- 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java
 (original)
+++ 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java
 Tue Feb 26 09:17:41 2008
@@ -1,133 +1,133 @@
-package org.apache.commons.net.time;
-
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.net.InetAddress;
-import java.util.Calendar;
-import java.io.IOException;
-import java.util.TimeZone;
-
-import junit.framework.TestCase;
-
-public class TimeTCPClientTest extends TestCase
-{
-    private TimeTestSimpleServer server1;
-
-    private int _port = 3333; // default test port
-
-    /***
-     * main for running the test.
-     ***/
-    public static void main(String[] args)
-    {
-        junit.textui.TestRunner.run(TimeTCPClientTest.class);
-    }
-
-    /***
-     * open connections needed for the tests for the test.
-     ***/
-    protected void openConnections() throws Exception
-    {
-       try {
-            server1 = new TimeTestSimpleServer(_port);
-            server1.connect();
-       } catch (IOException ioe)
-       {
-           // try again on another port
-           _port = 4000;
-            server1 = new TimeTestSimpleServer(_port);
-            server1.connect();
-       }
-        server1.start();
-    }
-
-    /***
-     *  tests the constant basetime used by TimeClient against tha
-     *  computed from Calendar class.
-     */
-    public void testInitial() {
-        TimeZone utcZone = TimeZone.getTimeZone("UTC");
-        Calendar calendar = Calendar.getInstance(utcZone);
-        calendar.set(1900, Calendar.JANUARY, 1, 0, 0, 0);
-        calendar.set(Calendar.MILLISECOND, 0);
-        long baseTime = calendar.getTime().getTime() / 1000L;
-
-        assertTrue(baseTime == -TimeTCPClient.SECONDS_1900_TO_1970);
-    }
-
-    /***
-     * tests the times retrieved via the Time protocol implementation.
-     ***/
-    public void testCompareTimes() throws Exception
-    {
-        openConnections();
-
-        long time, time2;
-        long clientTime, clientTime2;
-        try
-        {
-            TimeTCPClient client = new TimeTCPClient();
-            try
-            {
-                // We want to timeout if a response takes longer than 60 
seconds
-                client.setDefaultTimeout(60000);
-                client.connect(InetAddress.getLocalHost(), _port);
-                clientTime = client.getDate().getTime();
-                time = System.currentTimeMillis();
-            } finally
-            {
-              if(client.isConnected())
-                client.disconnect();
-            }
-
-            try
-            {
-                // We want to timeout if a response takes longer than 60 
seconds
-                client.setDefaultTimeout(60000);
-                client.connect(InetAddress.getLocalHost(), _port);
-                clientTime2 = (client.getTime() - 
TimeTCPClient.SECONDS_1900_TO_1970)*1000L;
-                time2 = System.currentTimeMillis();
-            } finally
-            {
-              if(client.isConnected())
-                client.disconnect();
-            }
-
-        } finally
-        {
-            closeConnections();
-        }
-
-      // current time shouldn't differ from time reported via network by 5 
seconds
-      assertTrue(Math.abs(time - clientTime) < 5000);
-      assertTrue(Math.abs(time2 - clientTime2) < 5000);
-    }
-
-    /***
-     * closes all the connections
-     ***/
-    protected void closeConnections()
-    {
-        try
-        {
-            server1.stop();
-            Thread.sleep(1000);
-        } catch (Exception e)
-        {
-        }
-    }
-}
-
+package org.apache.commons.net.time;
+
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.net.InetAddress;
+import java.util.Calendar;
+import java.io.IOException;
+import java.util.TimeZone;
+
+import junit.framework.TestCase;
+
+public class TimeTCPClientTest extends TestCase
+{
+    private TimeTestSimpleServer server1;
+
+    private int _port = 3333; // default test port
+
+    /***
+     * main for running the test.
+     ***/
+    public static void main(String[] args)
+    {
+        junit.textui.TestRunner.run(TimeTCPClientTest.class);
+    }
+
+    /***
+     * open connections needed for the tests for the test.
+     ***/
+    protected void openConnections() throws Exception
+    {
+       try {
+            server1 = new TimeTestSimpleServer(_port);
+            server1.connect();
+       } catch (IOException ioe)
+       {
+           // try again on another port
+           _port = 4000;
+            server1 = new TimeTestSimpleServer(_port);
+            server1.connect();
+       }
+        server1.start();
+    }
+
+    /***
+     *  tests the constant basetime used by TimeClient against tha
+     *  computed from Calendar class.
+     */
+    public void testInitial() {
+        TimeZone utcZone = TimeZone.getTimeZone("UTC");
+        Calendar calendar = Calendar.getInstance(utcZone);
+        calendar.set(1900, Calendar.JANUARY, 1, 0, 0, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        long baseTime = calendar.getTime().getTime() / 1000L;
+
+        assertTrue(baseTime == -TimeTCPClient.SECONDS_1900_TO_1970);
+    }
+
+    /***
+     * tests the times retrieved via the Time protocol implementation.
+     ***/
+    public void testCompareTimes() throws Exception
+    {
+        openConnections();
+
+        long time, time2;
+        long clientTime, clientTime2;
+        try
+        {
+            TimeTCPClient client = new TimeTCPClient();
+            try
+            {
+                // We want to timeout if a response takes longer than 60 
seconds
+                client.setDefaultTimeout(60000);
+                client.connect(InetAddress.getLocalHost(), _port);
+                clientTime = client.getDate().getTime();
+                time = System.currentTimeMillis();
+            } finally
+            {
+              if(client.isConnected())
+                client.disconnect();
+            }
+
+            try
+            {
+                // We want to timeout if a response takes longer than 60 
seconds
+                client.setDefaultTimeout(60000);
+                client.connect(InetAddress.getLocalHost(), _port);
+                clientTime2 = (client.getTime() - 
TimeTCPClient.SECONDS_1900_TO_1970)*1000L;
+                time2 = System.currentTimeMillis();
+            } finally
+            {
+              if(client.isConnected())
+                client.disconnect();
+            }
+
+        } finally
+        {
+            closeConnections();
+        }
+
+      // current time shouldn't differ from time reported via network by 5 
seconds
+      assertTrue(Math.abs(time - clientTime) < 5000);
+      assertTrue(Math.abs(time2 - clientTime2) < 5000);
+    }
+
+    /***
+     * closes all the connections
+     ***/
+    protected void closeConnections()
+    {
+        try
+        {
+            server1.stop();
+            Thread.sleep(1000);
+        } catch (Exception e)
+        {
+        }
+    }
+}
+

Propchange: 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTCPClientTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTestSimpleServer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTestSimpleServer.java?rev=631304&r1=631303&r2=631304&view=diff
==============================================================================
--- 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTestSimpleServer.java
 (original)
+++ 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTestSimpleServer.java
 Tue Feb 26 09:17:41 2008
@@ -36,7 +36,7 @@
  *
  * @author Jason Mathews, MITRE Corporation
  *
- * @version $Revision: 1.1 $ $Date: 2003/09/24 21:51:48 $
+ * @version $Revision$ $Date$
  */
 public class TimeTestSimpleServer implements Runnable
 {

Propchange: 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTestSimpleServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/net/branches/NET_2_0/src/test/java/org/apache/commons/net/time/TimeTestSimpleServer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL


Reply via email to