You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by re...@apache.org on 2009/10/16 05:18:28 UTC

svn commit: r825753 - in /harmony/enhanced/classlib/trunk/modules/nio: make/ src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/ src/test/java/windows/org/ src/test/java/windows/org/apache/ src/test/java/windows/org/apache/harmony/ src...

Author: regisxu
Date: Fri Oct 16 03:18:26 2009
New Revision: 825753

URL: http://svn.apache.org/viewvc?rev=825753&view=rev
Log:
move Windows specific test to right directory and remove it from exclude list on Linux and zos

Added:
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/java/
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/java/nio/
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/java/nio/channels/
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java   (with props)
Removed:
    harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java
Modified:
    harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.drl
    harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.ibm
    harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.drl
    harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.ibm
    harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390.ibm
    harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390x.ibm

Modified: harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.drl?rev=825753&r1=825752&r2=825753&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.drl Fri Oct 16 03:18:26 2009
@@ -1,2 +1,2 @@
-org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java
+
 

Modified: harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.ibm?rev=825753&r1=825752&r2=825753&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86.ibm Fri Oct 16 03:18:26 2009
@@ -1,2 +1,2 @@
-org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java
+
 

Modified: harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.drl?rev=825753&r1=825752&r2=825753&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.drl (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.drl Fri Oct 16 03:18:26 2009
@@ -1,2 +1,2 @@
-org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java
+
 

Modified: harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.ibm?rev=825753&r1=825752&r2=825753&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/make/exclude.linux.x86_64.ibm Fri Oct 16 03:18:26 2009
@@ -1,2 +1,2 @@
-org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java
+
 

Modified: harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390.ibm?rev=825753&r1=825752&r2=825753&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390.ibm Fri Oct 16 03:18:26 2009
@@ -1,2 +1,2 @@
-org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java
+
 

Modified: harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390x.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390x.ibm?rev=825753&r1=825752&r2=825753&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390x.ibm (original)
+++ harmony/enhanced/classlib/trunk/modules/nio/make/exclude.zos.s390x.ibm Fri Oct 16 03:18:26 2009
@@ -1,2 +1,2 @@
-org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java
+
 

Added: harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java?rev=825753&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java Fri Oct 16 03:18:26 2009
@@ -0,0 +1,81 @@
+/*
+ *  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.nio.tests.java.nio.channels;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+
+import junit.framework.TestCase;
+
+public class FileChannelWin32OnlyTest extends TestCase {
+    // Regression test for harmony-2476
+    public void test_lock() throws Exception {
+        FileChannel fc = null, anotherfc = null;
+        String testFileName = "testLockAndTryLock";
+        File f = File.createTempFile(testFileName, "txt");
+        f.deleteOnExit();
+        FileOutputStream out = new FileOutputStream(f);
+        out.write(1);
+        out.close();
+
+        fc = new RandomAccessFile(f, "rw").getChannel();
+        anotherfc = new RandomAccessFile(f, "rw").getChannel();
+
+        assertNotNull(fc.lock());
+
+        ByteBuffer readBuf = ByteBuffer.allocate(100);
+        ByteBuffer writeBuf = ByteBuffer.wrap("bytes".getBytes());
+        try {
+            try {
+                anotherfc.read(readBuf);
+                fail("should throw IOException.");
+            } catch (IOException e) {
+                // expected;
+            }
+
+            try {
+                anotherfc.read(new ByteBuffer[] { readBuf }, 0, 1);
+                fail("should throw IOException.");
+            } catch (IOException e) {
+                // expected;
+            }
+
+            try {
+                anotherfc.write(writeBuf);
+                fail("should throw IOException.");
+            } catch (IOException e) {
+                // expected;
+            }
+
+            try {
+                anotherfc.write(new ByteBuffer[] { writeBuf }, 0, 1);
+                fail("should throw IOException.");
+            } catch (IOException e) {
+                // expected;
+            }
+        } finally {
+            fc.close();
+            anotherfc.close();
+        }
+    }
+
+}

Propchange: harmony/enhanced/classlib/trunk/modules/nio/src/test/java/windows/org/apache/harmony/nio/tests/java/nio/channels/FileChannelWin32OnlyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native