You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/05/05 15:42:14 UTC
svn commit: r1099796 -
/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestAddress.java
Author: mturk
Date: Thu May 5 13:42:14 2011
New Revision: 1099796
URL: http://svn.apache.org/viewvc?rev=1099796&view=rev
Log:
Add address test class
Added:
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestAddress.java (with props)
Added: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestAddress.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestAddress.java?rev=1099796&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestAddress.java (added)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestAddress.java Thu May 5 13:42:14 2011
@@ -0,0 +1,64 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.commons.runtime.net;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import org.testng.annotations.*;
+import org.testng.Assert;
+
+public class TestAddress extends Assert
+{
+
+ @Test(groups = { "posix" })
+ public void posixLocalAddress()
+ throws IOException
+ {
+ LocalSocketAddress la = new LocalSocketAddress("foo/bar");
+ assertNotNull(la);
+ assertEquals(la.getHostName(), "/var/run/foo_bar");
+ assertEquals(la.getFamily(), AddressFamily.LOCAL);
+ la = null;
+ System.gc();
+ }
+
+ @Test(groups = { "windows" })
+ public void windowsLocalAddress()
+ throws IOException
+ {
+ LocalSocketAddress la = new LocalSocketAddress("foo/bar");
+ assertNotNull(la);
+ assertEquals(la.getHostName(), "\\\\.\\pipe\\foo_bar");
+ la = null;
+ System.gc();
+ }
+
+ @Test(groups = { "core" })
+ public void serviceName()
+ throws IOException
+ {
+ Service s1 = new Service("http", "tcp");
+ System.out.println("Port is " + s1.getPort());
+// assertEquals(s1.getPort(), 80);
+ Service s2 = new Service(80);
+ System.out.println("Name is " + s2.getName());
+ System.out.println("Port is " + s2.getPort());
+// assertEquals(s2.getName(), "http");
+ }
+}
Propchange: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestAddress.java
------------------------------------------------------------------------------
svn:eol-style = native