harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r481858 - in /harmony/enhanced/classlib/trunk/modules/sql/src: main/java/javax/sql/rowset/serial/ main/java/org/apache/harmony/sql/internal/nls/ test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/
Date Sun, 03 Dec 2006 19:03:02 GMT
Author: ndbeyer
Date: Sun Dec  3 11:03:01 2006
New Revision: 481858

URL: http://svn.apache.org/viewvc?view=rev&rev=481858
Log:
Apply modified patch for HARMONY-2397: [classlib][sql] javax.sql.rowset.serial.SerialDatalink
is not implemented yet in Harmony.

Added:
    harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/serial/SerialDatalink.java
  (with props)
    harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialDatalinkTest.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties

Added: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/serial/SerialDatalink.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/serial/SerialDatalink.java?view=auto&rev=481858
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/serial/SerialDatalink.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/serial/SerialDatalink.java
Sun Dec  3 11:03:01 2006
@@ -0,0 +1,68 @@
+/*
+ *  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 javax.sql.rowset.serial;
+
+import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.harmony.sql.internal.nls.Messages;
+
+public class SerialDatalink implements Serializable, Cloneable {
+    private static final long serialVersionUID = 2826907821828733626L;
+
+    private URL url;
+
+    @SuppressWarnings("unused")
+    // Required by serialized form
+    private int baseType;
+
+    @SuppressWarnings("unused")
+    // Required by serialized form
+    private String baseTypeName;
+
+    /**
+     * Constructor.
+     * 
+     * @param url The URL to link to.
+     * @throws SerialException if <code>url</code> is null
+     */
+    public SerialDatalink(URL url) throws SerialException {
+        if (url == null) {
+            throw new SerialException(Messages.getString("sql.12")); // $NON-NLS-1$
+        }
+        this.url = url;
+    }
+
+    /**
+     * Gets a copied url object of this SerialDatalink object.
+     * 
+     * @return a url object in the java programming language which represents this
+     *         SerialDatalink object.
+     * @throws SerialException if <code>url</code> can not be copied.
+     */
+    public URL getDatalink() throws SerialException {
+        URL copyUrl;
+        try {
+            copyUrl = new URL(url.toString());
+        } catch (MalformedURLException e) {
+            throw new SerialException();
+        }
+        return copyUrl;
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/serial/SerialDatalink.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties?view=diff&rev=481858&r1=481857&r2=481858
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
(original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
Sun Dec  3 11:03:01 2006
@@ -27,3 +27,4 @@
 sql.9=Cannot instantiate a SerialRef object with a null Ref object
 sql.10=Cannot instantiate a SerialRef object that returns a null base type name
 sql.11=SQLException: {0}
+sql.12=Cannot serialize empty URL instance

Added: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialDatalinkTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialDatalinkTest.java?view=auto&rev=481858
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialDatalinkTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialDatalinkTest.java
Sun Dec  3 11:03:01 2006
@@ -0,0 +1,48 @@
+/*
+ *  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.harmony.sql.tests.javax.sql.rowset.serial;
+
+import java.net.URL;
+
+import javax.sql.rowset.serial.SerialDatalink;
+import javax.sql.rowset.serial.SerialException;
+
+import junit.framework.TestCase;
+
+public class SerialDatalinkTest extends TestCase {
+    public void testConstructor() throws Exception {
+
+        URL url = new URL("http://www.someurl.com");
+        new SerialDatalink(url);
+
+        try {
+            new SerialDatalink(null);
+            fail("should throw SerialException");
+        } catch (SerialException e) {
+            // expected
+        }
+    }
+
+    public void testGetDatalink() throws Exception {
+        URL url = new URL("http://www.someurl.com");
+        SerialDatalink sdl = new SerialDatalink(url);
+        URL dataLink = sdl.getDatalink();
+        assertEquals(url, dataLink);
+        assertNotSame(url, dataLink);
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialDatalinkTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message