svn commit: r1354822 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math3/linear/ test/java/org/apache/commons/math3/linear/

2012-06-27 Thread celestin
Author: celestin
Date: Thu Jun 28 06:09:51 2012
New Revision: 1354822

URL: http://svn.apache.org/viewvc?rev=1354822&view=rev
Log:
MATH-795:
In org.apache.commons.math3.linear.RealVectorAbstractTest
  - factored out unit tests of RealVector RealVector.set(double),
  - created unit tests of double[] RealVector.toArray(),
  - factored out unit tests of RealVector RealVector.unitVector(),
  - factored out unit tests of void RealVector.unitize(),
  - created unit tests of Iterator RealVector.iterator().

In org.apache.commons.math3.linear.ArrayRealVector, removed unnecessary 
overrides of unitVector() and unitize().

In org.apache.commons.math3.linear.RealVector
  - unitVector() and unitize() now throw an ArithmeticException when the norm 
is 0 (as specified in the Javadoc),
  - the returned iterator() returns NoSuchElementException as specified in the 
general contract of iterators.


Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java

commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java

commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java

commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorTest.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java?rev=1354822&r1=1354821&r2=1354822&view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java
 Thu Jun 28 06:09:51 2012
@@ -568,26 +568,6 @@ public class ArrayRealVector extends Rea
 
 /** {@inheritDoc} */
 @Override
-public RealVector unitVector() {
-final double norm = getNorm();
-if (norm == 0) {
-throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-}
-return mapDivide(norm);
-}
-
-/** {@inheritDoc} */
-@Override
-public void unitize() {
-final double norm = getNorm();
-if (norm == 0) {
-throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-}
-mapDivideToSelf(norm);
-}
-
-/** {@inheritDoc} */
-@Override
 public RealVector projection(RealVector v) {
 return v.mapMultiply(dotProduct(v) / v.dotProduct(v));
 }

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java?rev=1354822&r1=1354821&r2=1354822&view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/linear/RealVector.java
 Thu Jun 28 06:09:51 2012
@@ -709,9 +709,11 @@ public abstract class RealVector {
  * @throws ArithmeticException if the norm is {@code null}.
  */
 public RealVector unitVector() {
-RealVector copy = copy();
-copy.unitize();
-return copy;
+final double norm = getNorm();
+if (norm == 0) {
+throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
+}
+return mapDivide(norm);
 }
 
 /**
@@ -722,6 +724,10 @@ public abstract class RealVector {
  * if the norm is zero.
  */
 public void unitize() {
+final double norm = getNorm();
+if (norm == 0) {
+throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
+}
 mapDivideToSelf(getNorm());
 }
 
@@ -771,8 +777,12 @@ public abstract class RealVector {
 
 /** {@inheritDoc} */
 public Entry next() {
-e.setIndex(i++);
-return e;
+if (i < dim) {
+e.setIndex(i++);
+return e;
+} else {
+throw new NoSuchElementException();
+}
 }
 
 /** {@inheritDoc} */

Modified: 
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java?rev=1354822&r1=1354821&r2=1354822&view=diff
==
--- 
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java
 (original)
+++ 
commons/proper/math/trunk/src/test/java/org/apache/commons/math3/li

svn commit: r1354803 - in /commons/proper/functor/trunk/src/test/java/org/apache/commons/functor: ./ core/algorithm/

2012-06-27 Thread kinow
Author: kinow
Date: Thu Jun 28 02:59:23 2012
New Revision: 1354803

URL: http://svn.apache.org/viewvc?rev=1354803&view=rev
Log:
Tests for functor core algorithms. Work related to FUNCTOR-12. 

A few algorithm classes weren't using BaseFunctorTest. It was changed in this 
commit. Some further work was needed to make test-objects serializable. And an 
extra test was included in BaseFunctorTest, to compare (using equals) a functor 
with a non-functor object.

Modified:

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/BaseFunctorTest.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestDoUntil.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestDoWhile.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestFoldLeft.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestFoldRight.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestInPlaceTransform.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestIndexOfInGenerator.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestRecursiveEvaluation.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestRemoveMatching.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestRetainMatching.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestUntilDo.java

commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestWhileDo.java

Modified: 
commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/BaseFunctorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/BaseFunctorTest.java?rev=1354803&r1=1354802&r2=1354803&view=diff
==
--- 
commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/BaseFunctorTest.java
 (original)
+++ 
commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/BaseFunctorTest.java
 Thu Jun 28 02:59:23 2012
@@ -55,6 +55,8 @@ public abstract class BaseFunctorTest {
 } else {
 assertTrue("equals must be symmetric",! obj2.equals(obj));
 }
+
+assertTrue("a functor is not equal to an integer", ! obj.equals(new 
Integer(1)));
 }
 
 @Test

Modified: 
commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestDoUntil.java
URL: 
http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestDoUntil.java?rev=1354803&r1=1354802&r2=1354803&view=diff
==
--- 
commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestDoUntil.java
 (original)
+++ 
commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/algorithm/TestDoUntil.java
 Thu Jun 28 02:59:23 2012
@@ -17,35 +17,28 @@
 package org.apache.commons.functor.core.algorithm;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
+import java.io.Serializable;
+
+import org.apache.commons.functor.BaseFunctorTest;
 import org.apache.commons.functor.Procedure;
 import org.apache.commons.functor.core.Offset;
-import org.apache.commons.functor.core.algorithm.DoUntil;
 import org.junit.Test;
 
 /**
  * Tests {@link DoUntil} algorithm.
  */
-public class TestDoUntil {
+public class TestDoUntil extends BaseFunctorTest {
 
-@Test
-public final void testObjectEquals() throws Exception {
+// Functor Testing Framework
+// 
+
+@Override
+protected Object makeFunctor() throws Exception {
 Counter counter = new Counter();
-Object obj = new DoUntil(counter, new Offset(10));
-assertEquals("equals must be reflexive",obj,obj);
-assertEquals("hashCode must be 
reflexive",obj.hashCode(),obj.hashCode());
-assertTrue(! obj.equals(null) ); // should be able to compare to null
-
-Object obj2 = new DoUntil(counter, new Offset(10));
-if (obj.equals(obj2)) {
-assertEquals("equals implies hash 
equals",obj.hashCode(),obj2.hashCode());
-assertEquals("equals must be symmetric",obj2,obj);
-} else {
-assertTrue("equals must be symmetric",! obj2.equals(obj));
-}
+return new DoUntil(counter, new Offset(10));
 }
-
+
 @Test
 public void testDoUntil() {
 for(int i=0;i<3;++i){
@@ -58,11 +51,32 @@ public class TestDoUntil {
 // Classes
 // ---

svn commit: r1354663 - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java

2012-06-27 Thread damjan
Author: damjan
Date: Wed Jun 27 18:47:35 2012
New Revision: 1354663

URL: http://svn.apache.org/viewvc?rev=1354663&view=rev
Log:
Fix BMP width and height DPI.
Also enable testing this.

Jira issue key: IMAGING-82
Submitted by: Piyush Kapoor 


Modified:

commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java

commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java?rev=1354663&r1=1354662&r2=1354663&view=diff
==
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
 Wed Jun 27 18:47:35 2012
@@ -622,10 +622,10 @@ public class BmpImageParser extends Imag
 // boolean isProgressive = (fPNGChunkIHDR.InterlaceMethod != 0);
 //
 // pixels per meter
-int physicalWidthDpi = (int) (bhi.hResolution * 1000.0 / 2.54);
+int physicalWidthDpi = (int) (bhi.hResolution * .0254);
 float physicalWidthInch = (float) ((double) width / (double) 
physicalWidthDpi);
 // int physicalHeightDpi = 72;
-int physicalHeightDpi = (int) (bhi.vResolution * 1000.0 / 2.54);
+int physicalHeightDpi = (int) (bhi.vResolution * .0254);
 float physicalHeightInch = (float) ((double) height / (double) 
physicalHeightDpi);
 
 String formatDetails = "Bmp (" + (char) bhi.identifier1

Modified: 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java?rev=1354663&r1=1354662&r2=1354663&view=diff
==
--- 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
 (original)
+++ 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java
 Wed Jun 27 18:47:35 2012
@@ -75,7 +75,7 @@ public class RoundtripTest extends Imagi
 new FormatInfo(ImageFormat.IMAGE_FORMAT_JPEG, true, false,
 COLOR_FULL_RGB, true, true), //
 new FormatInfo(ImageFormat.IMAGE_FORMAT_BMP, true, true,
-COLOR_FULL_RGB, true, false), //
+COLOR_FULL_RGB, true, true), //
 new FormatInfo(ImageFormat.IMAGE_FORMAT_PSD, true, false,
 COLOR_FULL_RGB, true, true), //
 new FormatInfo(ImageFormat.IMAGE_FORMAT_PBM, true, true,




svn commit: r1354661 - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/formats/dcx/ main/java/org/apache/commons/imaging/formats/ico/ main/java/org/apache/commons/imaging/fo

2012-06-27 Thread damjan
Author: damjan
Date: Wed Jun 27 18:42:22 2012
New Revision: 1354661

URL: http://svn.apache.org/viewvc?rev=1354661&view=rev
Log:
Add a pixel density test, and fix pixel density implementations in PCX, DCX and 
ICO formats.


Modified:

commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java

commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java

commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java

commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/roundtrip/RoundtripTest.java

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java?rev=1354661&r1=1354660&r2=1354661&view=diff
==
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
 Wed Jun 27 18:42:22 2012
@@ -33,6 +33,7 @@ import org.apache.commons.imaging.ImageI
 import org.apache.commons.imaging.ImageParser;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.PixelDensity;
 import org.apache.commons.imaging.common.BinaryOutputStream;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
@@ -217,6 +218,17 @@ public class DcxImageParser extends Imag
 .remove(PcxConstants.PARAM_KEY_PCX_COMPRESSION);
 pcxParams.put(PcxConstants.PARAM_KEY_PCX_COMPRESSION, value);
 }
+
+if (params.containsKey(PARAM_KEY_PIXEL_DENSITY)) {
+Object value = params.remove(PARAM_KEY_PIXEL_DENSITY);
+if (value != null) {
+if (!(value instanceof PixelDensity))
+throw new ImageWriteException(
+"Invalid pixel density parameter");
+pcxParams.put(PARAM_KEY_PIXEL_DENSITY, (PixelDensity) value);
+}
+}
+
 
 if (params.size() > 0) {
 Object firstKey = params.keySet().iterator().next();

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java?rev=1354661&r1=1354660&r2=1354661&view=diff
==
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
 Wed Jun 27 18:42:22 2012
@@ -36,6 +36,7 @@ import org.apache.commons.imaging.ImageP
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImageWriteException;
 import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.PixelDensity;
 import org.apache.commons.imaging.common.BinaryOutputStream;
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
@@ -719,6 +720,8 @@ public class IcoImageParser extends Imag
 // clear format key.
 if (params.containsKey(PARAM_KEY_FORMAT))
 params.remove(PARAM_KEY_FORMAT);
+
+PixelDensity pixelDensity = (PixelDensity) 
params.remove(PARAM_KEY_PIXEL_DENSITY);
 
 if (params.size() > 0) {
 Object firstKey = params.keySet().iterator().next();
@@ -785,8 +788,8 @@ public class IcoImageParser extends Imag
 bos.write2Bytes(bitCount);
 bos.write4Bytes(0); // compression
 bos.write4Bytes(0); // image size
-bos.write4Bytes(0); // x pixels per meter
-bos.write4Bytes(0); // y pixels per meter
+bos.write4Bytes(pixelDensity == null ? 0 : 
(int)Math.round(pixelDensity.horizontalDensityMetres())); // x pixels per meter
+bos.write4Bytes(pixelDensity == null ? 0 : 
(int)Math.round(pixelDensity.horizontalDensityMetres())); // y pixels per meter
 bos.write4Bytes(0); // colors used, 0 = (1 << bitCount) (ignored)
 bos.write4Bytes(0); // colors important
 

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java?rev=1354661&r1=1354660&r2=1354661&view=diff
=

svn commit: r1354616 - /commons/proper/lang/trunk/src/site/xdoc/article3_0.xml

2012-06-27 Thread mbenson
Author: mbenson
Date: Wed Jun 27 16:27:55 2012
New Revision: 1354616

URL: http://svn.apache.org/viewvc?rev=1354616&view=rev
Log:
[LANG-753] Document v3.x changes to Validate API

Modified:
commons/proper/lang/trunk/src/site/xdoc/article3_0.xml

Modified: commons/proper/lang/trunk/src/site/xdoc/article3_0.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/site/xdoc/article3_0.xml?rev=1354616&r1=1354615&r2=1354616&view=diff
==
--- commons/proper/lang/trunk/src/site/xdoc/article3_0.xml (original)
+++ commons/proper/lang/trunk/src/site/xdoc/article3_0.xml Wed Jun 27 16:27:55 
2012
@@ -185,6 +185,14 @@ available in the 

svn commit: r1354565 - in /commons/proper/vfs/trunk: core/src/main/java/org/apache/commons/vfs2/ core/src/main/java/org/apache/commons/vfs2/cache/ core/src/main/java/org/apache/commons/vfs2/impl/ core

2012-06-27 Thread ggregory
Author: ggregory
Date: Wed Jun 27 15:00:21 2012
New Revision: 1354565

URL: http://svn.apache.org/viewvc?rev=1354565&view=rev
Log:
[VFS-425] Add API FileObject.isExecutable().

Added:

commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/local/test/PermissionsTests.java
   (with props)
Modified:

commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java

commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/Resources.properties

commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java

commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java

commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java

commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/DelegateFileObject.java

commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java

commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/local/test/LocalProviderTestCase.java

commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavVersioningTests.java
commons/proper/vfs/trunk/src/changes/changes.xml

Modified: 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java?rev=1354565&r1=1354564&r2=1354565&view=diff
==
--- 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java
 Wed Jun 27 15:00:21 2012
@@ -102,6 +102,14 @@ public interface FileObject extends Comp
 boolean exists() throws FileSystemException;
 
 /**
+ * Determines if this file is executable.
+ *
+ * @return true if this file is executable, 
false if not.
+ * @throws FileSystemException On error determining if this file exists.
+ */
+boolean isExecutable() throws FileSystemException;
+
+/**
  * Determines if this file is hidden.
  *
  * @return true if this file is hidden, false if 
not.

Modified: 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/Resources.properties
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/Resources.properties?rev=1354565&r1=1354564&r2=1354565&view=diff
==
--- 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/Resources.properties
 (original)
+++ 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/Resources.properties
 Wed Jun 27 15:00:21 2012
@@ -53,6 +53,7 @@ vfs.provider/rename-filename.error=You c
 vfs.provider/copy-read-only.error=Could not copy {0} "{1}" to "{2}" because 
the destination file is read-only.
 vfs.provider/copy-missing-file.error=Could not copy "{0}" because it does not 
exist.
 vfs.provider/find-files.error=Could not find files in "{0}".
+vfs.provider/check-is-executable.error=Could not determine if file "{0}" is 
executable.
 vfs.provider/check-is-hidden.error=Could not determine if file "{0}" is hidden.
 vfs.provider/check-is-writeable.error=Could not determine if file "{0}" is 
writeable.
 vfs.provider/check-is-readable.error=Could not determine if file "{0}" is 
readable.

Modified: 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java?rev=1354565&r1=1354564&r2=1354565&view=diff
==
--- 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java
 Wed Jun 27 15:00:21 2012
@@ -129,6 +129,13 @@ public class OnCallRefreshFileObject ext
 }
 
 @Override
+public boolean isExecutable() throws FileSystemException
+{
+refresh();
+return super.isExecutable();
+}
+
+@Override
 public boolean isHidden() throws FileSystemException
 {
 refresh();

Modified: 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java?rev=1354565&r1=1354564&r2=1354565&view=diff
==
--- 
commons/proper/vfs/trunk/core/src/main/java/org

svn commit: r1354549 - /commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java

2012-06-27 Thread ggregory
Author: ggregory
Date: Wed Jun 27 14:48:45 2012
New Revision: 1354549

URL: http://svn.apache.org/viewvc?rev=1354549&view=rev
Log:
Tests FileObject isReadable(), isWriteable, and isHidden() APIs for all 
providers that implement the proper capabilities.

Modified:

commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java

Modified: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java?rev=1354549&r1=1354548&r2=1354549&view=diff
==
--- 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
 Wed Jun 27 14:48:45 2012
@@ -21,6 +21,8 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Set;
 
+import junit.framework.Assert;
+
 import org.apache.commons.vfs2.Capability;
 import org.apache.commons.vfs2.FileChangeEvent;
 import org.apache.commons.vfs2.FileContent;
@@ -37,6 +39,12 @@ import org.apache.commons.vfs2.Selectors
 public class ProviderWriteTests
 extends AbstractProviderTestCase
 {
+
+protected FileObject getReadFolderDir1() throws FileSystemException
+{
+return getReadFolder().resolveFile("dir1");
+}
+
 /**
  * Returns the capabilities required by the tests of this test case.
  */
@@ -487,6 +495,33 @@ public class ProviderWriteTests
 }
 
 /**
+ * Tests that test read folder is not hidden.
+ */
+public void testFolderIsHidden() throws Exception
+{
+FileObject folder = getReadFolderDir1();
+Assert.assertFalse(folder.isHidden());
+}
+
+/**
+ * Tests that test read folder is readable.
+ */
+public void testFolderIsReadable() throws Exception
+{
+FileObject folder = getReadFolderDir1();
+Assert.assertTrue(folder.isReadable());
+}
+
+/**
+ * Tests that test folder iswritable.
+ */
+public void testFolderIsWritable() throws Exception
+{
+FileObject folder = getWriteFolder().resolveFile("dir1");
+Assert.assertTrue(folder.isWriteable());
+}
+
+/**
  * Test that children are handled correctly by create and delete.
  */
 public void testListChildren() throws Exception
@@ -811,7 +846,6 @@ public class ProviderWriteTests
 outputStream.close();
 }
 assertSameContent(content, fileCopy);
-}
-
+   }
 
 }




svn commit: r1354521 - /commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java

2012-06-27 Thread ggregory
Author: ggregory
Date: Wed Jun 27 14:18:36 2012
New Revision: 1354521

URL: http://svn.apache.org/viewvc?rev=1354521&view=rev
Log:
Tests FileObject isReadable() and isHidden() APIs for all providers that 
implement the proper capabilites.

Modified:

commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java

Modified: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java?rev=1354521&r1=1354520&r2=1354521&view=diff
==
--- 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
 Wed Jun 27 14:18:36 2012
@@ -22,6 +22,8 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
+import junit.framework.Assert;
+
 import org.apache.commons.vfs2.Capability;
 import org.apache.commons.vfs2.FileObject;
 import org.apache.commons.vfs2.FileSystem;
@@ -35,6 +37,18 @@ import org.apache.commons.vfs2.FileType;
  */
 public class ProviderReadTests extends AbstractProviderTestCase
 {
+
+/**
+ * Returns the read folder named "dir1". 
+ * 
+ * @return the read folder named "dir1".
+ * @throws FileSystemException
+ */
+protected FileObject getReadFolderDir1() throws FileSystemException
+{
+return getReadFolder().resolveFile("dir1");
+}
+
 /**
  * Returns the capabilities required by the tests of this test case.
  */
@@ -131,7 +145,7 @@ public class ProviderReadTests extends A
 assertTrue(file.isFile());
 
 // Test a folder
-file = getReadFolder().resolveFile("dir1");
+file = getReadFolderDir1();
 assertSame(FileType.FOLDER, file.getType());
 assertTrue(file.isFolder());
 
@@ -198,7 +212,7 @@ public class ProviderReadTests extends A
 }
 
 // Try getting the content of a folder
-FileObject folder = getReadFolder().resolveFile("dir1");
+FileObject folder = getReadFolderDir1();
 try
 {
 folder.getContent().getInputStream();
@@ -210,13 +224,31 @@ public class ProviderReadTests extends A
 }
 
 /**
+ * Tests that test read folder is not hidden.
+ */
+public void testFolderIsHidden() throws Exception
+{
+FileObject folder = getReadFolderDir1();
+Assert.assertFalse(folder.isHidden());
+}
+
+/**
+ * Tests that test read folder is readable.
+ */
+public void testFolderIsReadable() throws Exception
+{
+FileObject folder = getReadFolderDir1();
+Assert.assertTrue(folder.isReadable());
+}
+
+/**
  * Tests can perform operations on a folder while reading from a different 
files.
  */
 public void testConcurrentReadFolder() throws Exception
 {
 final FileObject file = getReadFolder().resolveFile("file1.txt");
 assertTrue(file.exists());
-final FileObject folder = getReadFolder().resolveFile("dir1");
+final FileObject folder = getReadFolderDir1();
 assertTrue(folder.exists());
 
 // Start reading from the file