Author: ieb
Date: Thu Nov 1 00:52:43 2012
New Revision: 1404435
URL: http://svn.apache.org/viewvc?rev=1404435&view=rev
Log:
SLING-2643 Patch from Dan Klco that disables the tests if the OS and user that
is running the tests can still write after they have been denied. ie Windows7 +
Administrator user. Thanks for the patch and the analysis.
Modified:
sling/trunk/bundles/commons/log/src/test/java/org/apache/sling/commons/log/internal/slf4j/SlingLogWriterTest.java
Modified:
sling/trunk/bundles/commons/log/src/test/java/org/apache/sling/commons/log/internal/slf4j/SlingLogWriterTest.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/commons/log/src/test/java/org/apache/sling/commons/log/internal/slf4j/SlingLogWriterTest.java?rev=1404435&r1=1404434&r2=1404435&view=diff
==============================================================================
---
sling/trunk/bundles/commons/log/src/test/java/org/apache/sling/commons/log/internal/slf4j/SlingLogWriterTest.java
(original)
+++
sling/trunk/bundles/commons/log/src/test/java/org/apache/sling/commons/log/internal/slf4j/SlingLogWriterTest.java
Thu Nov 1 00:52:43 2012
@@ -245,12 +245,18 @@ public class SlingLogWriterTest extends
}
}
try{
- assertFalse(protectedParent.canWrite());
- SlingLoggerWriter writer =
createLogWriter(loggingParent.getAbsolutePath(), -1, 10);
- assertNotNull(writer);
- assertNull(writer.getFile());
- assertNull(writer.getPath());
- writer.append("Testing Stdout");
+ if (!protectedParent.canWrite()) {
+ SlingLoggerWriter writer = createLogWriter(
+ loggingParent.getAbsolutePath(), -1, 10);
+ assertNotNull(writer);
+ assertNull(writer.getFile());
+ assertNull(writer.getPath());
+ writer.append("Testing Stdout");
+ } else {
+ return;
+ // If the folder isn't made unwriteable, the test is invalid
+ // This happens on certain versions of windows when running as
an administrative user.
+ }
} finally {
try {
// these methods are JDK 1.6 and later so we have introspect
to invoke
@@ -277,12 +283,18 @@ public class SlingLogWriterTest extends
}
}
try {
- assertFalse(loggingParent.canWrite());
- SlingLoggerWriter writer =
createLogWriter(loggingParent.getAbsolutePath(), -1, 10);
- assertNotNull(writer);
- assertNull(writer.getFile());
- assertNull(writer.getPath());
- writer.append("Testing Stdout");
+ if (!loggingParent.canWrite()) {
+ SlingLoggerWriter writer = createLogWriter(
+ loggingParent.getAbsolutePath(), -1, 10);
+ assertNotNull(writer);
+ assertNull(writer.getFile());
+ assertNull(writer.getPath());
+ writer.append("Testing Stdout");
+ } else {
+ return;
+ // If the folder isn't made unwriteable, the test is invalid
+ // This happens on certain versions of windows when running as
an administrative user.
+ }
} finally {
try {
// these methods are JDK 1.6 and later so we have introspect
to invoke