you changed a test changing jndi names: why removing java:app/jdbc/?

Also LocalFileHandler is now broken cause we can't use any dependency for
this one (it is likely used before common.loader).

Since it is not setup by default it is ok IMO to have to build this part
with java 7 since the main runtime will stay java 6 and most of users are
using java 7/8 IMO - wouldnt be different from what tomcat and us do for
websockets since few years.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

---------- Forwarded message ----------
From: <[email protected]>
Date: 2015-11-02 15:51 GMT-08:00
Subject: tomee git commit: JDK 6
To: [email protected]


Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x 5b9a12fc6 -> a783e6dea


JDK 6

LocalFileHandlerTest needs attention


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/a783e6de
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/a783e6de
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/a783e6de

Branch: refs/heads/tomee-1.7.x
Commit: a783e6deac7f5ea15c378d2585c7cdff3f5a88b7
Parents: 5b9a12f
Author: AndyGee <[email protected]>
Authored: Tue Nov 3 00:50:51 2015 +0100
Committer: AndyGee <[email protected]>
Committed: Tue Nov 3 00:50:51 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/superbiz/dsdef/Persister.java |  4 ++--
 .../dsdef/DataSourceDefinitionTest.java         |  2 +-
 pom.xml                                         |  4 ++--
 tomee/tomee-juli/pom.xml                        |  9 ++++----
 .../jul/handler/rotating/LocalFileHandler.java  | 23 ++++++++++----------
 .../handler/rotating/LocalFileHandlerTest.java  |  5 ++---
 6 files changed, 22 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
----------------------------------------------------------------------
diff --git
a/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
b/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
index 4b70bd3..df4f4ae 100644
---
a/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
+++
b/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
@@ -26,14 +26,14 @@ import javax.sql.DataSource;
                       className = "org.h2.jdbcx.JdbcDataSource",
                       user = "sa",
                       password = "",
-                      name = "java:app/jdbc/persister",
+                      name = "persister",
                       initialPoolSize = 1,
                       maxPoolSize = 3
 )
 @Named
 public class Persister {

-    @Resource(lookup = "java:app/jdbc/persister")
+    @Resource(name = "persister")
     private DataSource ds;

     public DataSource getDs() {

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
----------------------------------------------------------------------
diff --git
a/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
b/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
index ba9c3f2..1b392e2 100644
---
a/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
+++
b/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
@@ -99,7 +99,7 @@ public class DataSourceDefinitionTest {

     @Test
     public void lookup() throws NamingException {
-        final Object o =
container.getContext().lookup("java:app/jdbc/persister");
+        final Object o = container.getContext().lookup("java:persister");
         assertNotNull(o);
         assertEquals(persister.getDs(), o);
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ea81a76..0a18f15 100644
--- a/pom.xml
+++ b/pom.xml
@@ -237,12 +237,12 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.1</version>
+          <version>3.2</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.17</version>
+          <version>2.18.1</version>
         </plugin>
         <plugin> <!-- maven-dependency-plugin:properties doesn't work as
well as this one for us -->
           <groupId>org.apache.geronimo.buildsupport</groupId>

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/tomee/tomee-juli/pom.xml
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/pom.xml b/tomee/tomee-juli/pom.xml
index bc578f8..9550a1c 100644
--- a/tomee/tomee-juli/pom.xml
+++ b/tomee/tomee-juli/pom.xml
@@ -36,6 +36,10 @@
       <optional>true</optional>
     </dependency>
     <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency>
+    <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <scope>provided</scope>
@@ -63,11 +67,6 @@
       <version>${jmh.version}</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>

   <properties>

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
----------------------------------------------------------------------
diff --git
a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
index 6850f1c..ffa61aa 100644
---
a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
+++
b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
@@ -16,6 +16,8 @@
  */
 package org.apache.tomee.jul.handler.rotating;

+import org.apache.commons.io.FileUtils;
+
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -27,8 +29,6 @@ import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.UnsupportedEncodingException;
-import java.nio.file.Files;
-import java.nio.file.attribute.BasicFileAttributes;
 import java.sql.Timestamp;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
@@ -377,14 +377,13 @@ public class LocalFileHandler extends Handler {
             if (archives != null) {
                 for (final File archive : archives) {
                     try {
-                        final BasicFileAttributes attr =
Files.readAttributes(archive.toPath(), BasicFileAttributes.class);
-                        if (now - attr.creationTime().toMillis() >
purgeExpiryDuration) {
-                            if (!Files.deleteIfExists(archive.toPath())) {
+                        if (FileUtils.isFileOlder(archive, now -
purgeExpiryDuration)) {
+                            if (!FileUtils.deleteQuietly(archive)) {
                                 // Do not try to delete on exit cause we
will find it again
-                                reportError("Can't delete " +
archive.getAbsolutePath() + ".", null, ErrorManager.GENERIC_FAILURE);
+                                reportError("Failed to delete " +
archive.getAbsolutePath() + ".", null, ErrorManager.GENERIC_FAILURE);
                             }
                         }
-                    } catch (final IOException e) {
+                    } catch (final Exception e) {
                         throw new IllegalStateException(e);
                     }
                 }
@@ -402,11 +401,11 @@ public class LocalFileHandler extends Handler {
             if (logs != null) {
                 for (final File file : logs) {
                     try {
-                        final BasicFileAttributes attr =
Files.readAttributes(file.toPath(), BasicFileAttributes.class);
-                        if (attr.creationTime().toMillis() < now && now -
attr.lastModifiedTime().toMillis() > archiveExpiryDuration) {
+                        final boolean older = FileUtils.isFileOlder(file,
now);
+                        if (older && now - file.lastModified() >
archiveExpiryDuration) {
                             createArchive(file);
                         }
-                    } catch (final IOException e) {
+                    } catch (final Exception e) {
                         throw new IllegalStateException(e);
                     }
                 }
@@ -497,10 +496,10 @@ public class LocalFileHandler extends Handler {
             }
         }
         try {
-            if (!Files.deleteIfExists(source.toPath())) {
+            if (!FileUtils.deleteQuietly(source)) {
                 reportError("Can't delete " + source.getAbsolutePath() +
".", null, ErrorManager.GENERIC_FAILURE);
             }
-        } catch (final IOException e) {
+        } catch (final Exception e) {
             throw new IllegalStateException(e);
         }
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
----------------------------------------------------------------------
diff --git
a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
index 6279b11..3bc872d 100644
---
a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
+++
b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
@@ -34,7 +34,6 @@ import java.util.logging.Formatter;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;

-import static java.lang.System.lineSeparator;
 import static java.util.Arrays.asList;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -99,7 +98,7 @@ public class LocalFileHandlerTest {

         final InputStream is = new FileInputStream(new File(out,
"test.day1.1.log"));
         final List<String> lines = IOUtils.readLines(is);
-        assertEquals(19, lines.size());
+        //TODO - Why is this 96 on my machine? assertEquals(19,
lines.size());
         assertEquals(string10chars, lines.iterator().next());
         is.close();

@@ -122,7 +121,7 @@ public class LocalFileHandlerTest {
     public static class MessageOnlyFormatter extends Formatter {
         @Override
         public String format(final LogRecord record) {
-            return record.getMessage() + lineSeparator();
+            return record.getMessage() + String.format("%n");
         }
     }
 }

Reply via email to