Revision: 8478
Author: gwt.mirror...@gmail.com
Date: Thu Aug  5 21:23:00 2010
Log: Reintroduce changes from r8440, with a fix to ZipFileResource and update related tests.

Review at http://gwt-code-reviews.appspot.com/728801

Review by: sco...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=8478

Added:
 /trunk/dev/core/test/com/google/gwt/dev/resource/impl/testdata/cpe1.zip
 /trunk/dev/core/test/com/google/gwt/dev/resource/impl/testdata/cpe2.zip
Deleted:
 /trunk/dev/core/src/com/google/gwt/dev/cfg/PublicOracle.java
Modified:
 /trunk/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java
 /trunk/dev/core/src/com/google/gwt/dev/resource/ResourceOracle.java
 /trunk/dev/core/src/com/google/gwt/dev/resource/impl/AbstractResource.java
/trunk/dev/core/src/com/google/gwt/dev/resource/impl/DirectoryClassPathEntry.java
 /trunk/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java
/trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java
 /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java
/trunk/dev/core/test/com/google/gwt/dev/resource/impl/AbstractResourceOrientedTestBase.java /trunk/dev/core/test/com/google/gwt/dev/resource/impl/ClassPathEntryTest.java
 /trunk/dev/core/test/com/google/gwt/dev/resource/impl/FileResourceTest.java
/trunk/dev/core/test/com/google/gwt/dev/resource/impl/MockAbstractResource.java /trunk/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplRealClasspathTest.java /trunk/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplTest.java
 /trunk/dev/core/test/com/google/gwt/dev/resource/impl/testdata/rebuild_jars

=======================================
--- /dev/null
+++ /trunk/dev/core/test/com/google/gwt/dev/resource/impl/testdata/cpe1.zip Thu Aug 5 21:23:00 2010
@@ -0,0 +1,31 @@
+PK + •Vü<Ákdò com/google/gwt/user/User.gwt.xmlUT :DPL&„XLUx }œˆ test filePK •Vü<úy2¯b | ' com/google/gwt/user/client/Command.javaUT :DPLkXXLUx }œˆ ]Ì1
+Ã0@ÑݧР       2wìI Y S92–œ%w ¥[æÿø øCE€­a1+*XÎÀ,  q›ƒ këŠ!
+™‚ »¬øàÓe k•=^)õ¹ie`%wx[k´gø&€e ßæ_Òu PK •Vü<Që±¼b z % com/google/gwt/user/client/Timer.javaUT :DPLkXXLUx }œˆ ]Ì1
+Ã0FáݧР       2÷ ½€¢ü S96–œ¥w/¥[ÖÇÇë¢/É m•skÙÀù
+Þqò€·9 \j7 xì ÂÚ±ò OÇ`µ‚#
+)õ¹YQR wz–ŠAïD´,ô›ü{ú| PK •Vü<5¿·Ãb ~ ) com/google/gwt/user/client/ui/Widget.javaUT :DPLkXXLUx }œˆ ]Œ1 1 û¼Â/ð‰š‡P geEøH ;P þ è:º‘f4Cô& Ò¾³õn ¶grŃ'¢¯©à¶ çDd• Ö ÿå+0Y½áþåv.e¬«7%u‰ K«†¤W!Ú6ú QÞ PK + •Vü< % org/example/bar/client/BarClient1.txtUT :DPL:DPLUx }œˆ PK + •Vü< % org/example/bar/client/BarClient2.txtUT :DPL:DPLUx }œˆ PK + •Vü< % org/example/bar/client/etc/BarEtc.txtUT :DPL:DPLUx }œˆ PK •Vü<6
+FÑe   z   %   org/example/foo/client/FooClient.javaUT    :DPLkXXLUx  }œˆ %ÌM
+Â@ Ðýœ"'øŠk—‚÷HÓ  Óf˜IU ïîßúÁk,W6%‰  a®°{bÑ ºŽØ»(êÚ
+©# N†4= ºA ü Å% âU·<–ÒöÙ« 8 AçˆÓ èYˆ¦‰¾ÉßÊë
+PK •Vü<°{œ¨f z % org/example/foo/server/FooServer.javaUT :DPLkXXLUx }œˆ %ÌK Â0 À}Ná ¼Š5{.À Œû°*R9rÒ‚„¸;¿õHÓÔnê ‹ +á•ðûÀÌ
+[ ±¬­b° Y‡Â ˆtð¡ ® èÌ y,¥m—º˜XÕÞå qþ <‹È4É7ù[y½ PK + •Vü<Ákdò +   com/google/gwt/user/User.gwt.xmlUT :DPLUx PK •Vü<úy2¯b | ' +   \ com/google/gwt/user/client/Command.javaUT :DPLUx PK •Vü<Që±¼b z % +   com/google/gwt/user/client/Timer.javaUT :DPLUx PK •Vü<5¿·Ãb ~ ) +   Ò com/google/gwt/user/client/ui/Widget.javaUT :DPLUx PK + •Vü< % +   org/example/bar/client/BarClient1.txtUT :DPLUx PK + •Vü< % +   è org/example/bar/client/BarClient2.txtUT :DPLUx PK + •Vü< % +   @ org/example/bar/client/etc/BarEtc.txtUT :DPLUx PK •Vü<6 +FÑe z % +   ˜ org/example/foo/client/FooClient.javaUT :DPLUx PK •Vü<°{œ¨f z % +   U org/example/foo/server/FooServer.javaUT :DPLUx PK a =======================================
--- /dev/null
+++ /trunk/dev/core/test/com/google/gwt/dev/resource/impl/testdata/cpe2.zip Thu Aug 5 21:23:00 2010
@@ -0,0 +1,23 @@
+PK + •Vü<Ákdò com/google/gwt/i18n/I18N.gwt.xmlUT :DPL&„XLUx }œˆ test filePK •Vü<Ól öd } ( com/google/gwt/i18n/client/Messages.javaUT :DPLkXXLUx }œˆ ] 1 Â@ û{
+_° TH¼ G gu:áäN±  âï€è¨g43ÔnZ)Ö ÔÞ« õ‘˜yÇÆèûfD[†# 9k*lðˆ?½
+N+Ì ×<—2ö«7 s #>ƒ g ™&ùv~¨¼ÞPK •Vü<X¿jÓm Š 4 com/google/gwt/i18n/rebind/LocalizableGenerator.javaUT :DPLkXXLUx }œˆ ]ÌA
+ 1 À{_‘ dÑ“à ¼ø‰4
+%˜mJ›UPüû*Þ¼ Ó‰oT ØW¬îÕ ë#°È
+‡Lß  êÚ
+Cf +BîrÄ?®‡Sûø¬­œSê[6e`£9áêL¦OÊ& i2(|À+ , |Ï Kï´ PK + •Vü< % org/example/bar/client/BarClient2.txtUT :DPL:DPLUx }œˆ PK + •Vü< % org/example/bar/client/BarClient3.txtUT :DPL:DPLUx }œˆ PK + •Vü<“ ×2 % org/example/foo/client/BarClient1.txtUT :DPL&„XLUx }œˆ +PK + •Vü<Ákdò +   com/google/gwt/i18n/I18N.gwt.xmlUT :DPLUx PK •Vü<Ól öd } ( +   \ com/google/gwt/i18n/client/Messages.javaUT :DPLUx PK •Vü<X¿jÓm Š 4 +   com/google/gwt/i18n/rebind/LocalizableGenerator.javaUT :DPLUx PK + •Vü< % +   ï org/example/bar/client/BarClient2.txtUT :DPLUx PK + •Vü< % +   G org/example/bar/client/BarClient3.txtUT :DPLUx PK + •Vü<“ ×2 % +   Ÿ org/example/foo/client/BarClient1.txtUT :DPLUx PK M ø ======================================= --- /trunk/dev/core/src/com/google/gwt/dev/cfg/PublicOracle.java Tue Aug 3 08:08:39 2010
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2008 Google Inc.
- *
- * Licensed 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 com.google.gwt.dev.cfg;
-
-import com.google.gwt.dev.resource.Resource;
-
-/**
- * Abstracts the process of querying for public files.
- *
- * @deprecated with no replacement, just use {...@link ModuleDef} directly
- */
-...@deprecated
-public interface PublicOracle {
-
-  /**
-   * Finds a file on the public path.
-   *
- * @param partialPath a file path relative to the root of any public package - * @return the url of the file, or <code>null</code> if no such file exists
-   */
-  Resource findPublicFile(String partialPath);
-
-  /**
-   * Returns all available public files.
-   *
- * @return an array containing the partial path to each available public file
-   */
-  String[] getAllPublicFiles();
-}
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/cfg/ModuleDef.java Wed Aug 4 09:54:49 2010
@@ -28,6 +28,7 @@
 import com.google.gwt.dev.resource.impl.DefaultFilters;
 import com.google.gwt.dev.resource.impl.PathPrefix;
 import com.google.gwt.dev.resource.impl.PathPrefixSet;
+import com.google.gwt.dev.resource.impl.ResourceFilter;
 import com.google.gwt.dev.resource.impl.ResourceOracleImpl;
 import com.google.gwt.dev.util.Empty;
 import com.google.gwt.dev.util.Util;
@@ -51,8 +52,13 @@
* Represents a module specification. In principle, this could be built without
  * XML for unit tests.
  */
-...@suppresswarnings("deprecation")
-public class ModuleDef implements PublicOracle {
+public class ModuleDef {
+
+ private static final ResourceFilter NON_JAVA_RESOURCES = new ResourceFilter() {
+    public boolean allows(String path) {
+      return !path.endsWith(".java") && !path.endsWith(".class");
+    }
+  };

private static final Comparator<Map.Entry<String, ?>> REV_NAME_CMP = new Comparator<Map.Entry<String, ?>>() { public int compare(Map.Entry<String, ?> entry1, Map.Entry<String, ?> entry2) {
@@ -115,6 +121,7 @@
private final Map<String, String> servletClassNamesByPath = new HashMap<String, String>();

   private PathPrefixSet sourcePrefixSet = new PathPrefixSet();
+
   private final Styles styles = new Styles();

   public ModuleDef(String name) {
@@ -327,8 +334,8 @@
       PathPrefixSet pathPrefixes = lazySourceOracle.getPathPrefixes();
       PathPrefixSet newPathPrefixes = new PathPrefixSet();
       for (PathPrefix pathPrefix : pathPrefixes.values()) {
-        newPathPrefixes.add(new PathPrefix(pathPrefix.getPrefix(), null,
-            pathPrefix.shouldReroot()));
+        newPathPrefixes.add(new PathPrefix(pathPrefix.getPrefix(),
+            NON_JAVA_RESOURCES, pathPrefix.shouldReroot()));
       }
       lazyResourcesOracle.setPathPrefixes(newPathPrefixes);
       lazyResourcesOracle.refresh(TreeLogger.NULL);
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/ResourceOracle.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/ResourceOracle.java Wed Aug 4 09:54:49 2010
@@ -27,37 +27,15 @@
  * <code>com/google/gwt/blah.txt</code>.
  *
  * <p>
- * The identity of the returned sets and maps will change exactly when the
- * underlying module is refreshed.
+ * The identity of the returned sets and maps will change when the underlying
+ * module is refreshed.
  * </p>
- *
- * <p>
- * Even when the identity of a returned set changes, the identity of any
- * contained {...@link Resource} values is guaranteed to differ from a previous
- * result exactly when that particular resource becomes invalid.
- * </p>
- *
- * <p>
- * A resource could become invalid for various reasons, including:
- * <ul>
- * <li>the underlying file was deleted or modified</li>
- * <li>another file with the same logical name superceded it on the classpath</li> - * <li>the underlying module changed to exclude this file or supercede it with
- * another file</li>
- * </ul>
- * </p>
- *
- * <p>
- * After a refresh, a client can reliably detect changes by checking which of
- * its cached resource is still contained in the new result of
- * {...@link #getResources()}.
- * </p>
  */
 public interface ResourceOracle {

   /**
* Frees up all existing resources and transient internal state. All returned
-   * collections will be empty after this call until this ResoruceOracle is
+   * collections will be empty after this call until this ResourceOracle is
    * refreshed.
    */
   void clear();
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/AbstractResource.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/AbstractResource.java Wed Aug 4 09:54:49 2010
@@ -27,7 +27,5 @@
    * within this package.
    */
   public abstract ClassPathEntry getClassPathEntry();
-
-  public abstract boolean isStale();
 }

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/DirectoryClassPathEntry.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/DirectoryClassPathEntry.java Wed Aug 4 09:54:49 2010
@@ -23,7 +23,7 @@
 import java.util.Map;

 /**
- * TODO(bruce): write me.
+ * A {...@link ClassPathEntry} for a directory on the file system.
  */
 public class DirectoryClassPathEntry extends ClassPathEntry {

@@ -41,10 +41,20 @@
         TreeLogger.DEBUG, "Including file: $0");
   }

+  /**
+   * Absolute directory.
+   */
   private final File dir;

+  private final String location;
+
+  /**
+   * @param dir an absolute directory
+   */
   public DirectoryClassPathEntry(File dir) {
+    assert (dir.isAbsolute());
     this.dir = dir;
+    this.location = dir.toURI().toString();
   }

   @Override
@@ -57,7 +67,7 @@

   @Override
   public String getLocation() {
-    return dir.getAbsoluteFile().toURI().toString();
+    return location;
   }

   /**
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/FileResource.java Wed Aug 4 09:54:49 2010
@@ -28,7 +28,6 @@
   private final String abstractPathName;
   private final DirectoryClassPathEntry classPathEntry;
   private final File file;
-  private final long modificationSeconds;

   public FileResource(DirectoryClassPathEntry classPathEntry,
       String abstractPathName, File file) {
@@ -36,7 +35,6 @@
     this.classPathEntry = classPathEntry;
     this.abstractPathName = abstractPathName;
     this.file = file;
-    this.modificationSeconds = lastModifiedSeconds(file);
   }

   @Override
@@ -51,28 +49,13 @@

   @Override
   public String getLocation() {
-    return file.getAbsoluteFile().toURI().toString();
+    return file.toURI().toString();
   }

   @Override
   public String getPath() {
     return abstractPathName;
   }
-
-  @Override
-  public boolean isStale() {
-    if (!file.exists()) {
-      // File was deleted. Always stale.
-      return true;
-    }
-
-    long currentModificationSeconds = lastModifiedSeconds(file);
-    /*
- * We use != instead of > because the point is to reflect what's actually on
-     * the file system, not to worry about freshness per se.
-     */
-    return (currentModificationSeconds != modificationSeconds);
-  }

   @Override
   public InputStream openContents() {
@@ -87,9 +70,4 @@
   public boolean wasRerooted() {
     return false;
   }
-
-  private long lastModifiedSeconds(File file) {
-    return file.lastModified() / 1000;
-  }
-
-}
+}
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ResourceOracleImpl.java Wed Aug 4 09:54:49 2010
@@ -41,8 +41,6 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.Map.Entry;
-import java.util.jar.JarFile;
-import java.util.zip.ZipFile;

 /**
  * The normal implementation of {...@link ResourceOracle}.
@@ -103,11 +101,6 @@
     public String getPath() {
       return path;
     }
-
-    @Override
-    public boolean isStale() {
-      return resource.isStale();
-    }

     @Override
     public InputStream openContents() {
@@ -170,20 +163,16 @@
       if (f.isDirectory()) {
         return new DirectoryClassPathEntry(f);
       } else if (f.isFile() && lowerCaseFileName.endsWith(".jar")) {
-        return new ZipFileClassPathEntry(new JarFile(f));
+        return new ZipFileClassPathEntry(f);
       } else if (f.isFile() && lowerCaseFileName.endsWith(".zip")) {
-        return new ZipFileClassPathEntry(new ZipFile(f));
+        return new ZipFileClassPathEntry(f);
       } else {
         // It's a file ending in neither jar nor zip, speculatively try to
         // open as jar/zip anyway.
         try {
-          return new ZipFileClassPathEntry(new JarFile(f));
+          return new ZipFileClassPathEntry(f);
         } catch (Exception ignored) {
         }
-        try {
-          return new ZipFileClassPathEntry(new ZipFile(f));
-        } catch (Exception ignored) {
-        }
         logger.log(TreeLogger.TRACE, "Unexpected entry in classpath; " + f
             + " is neither a directory nor an archive (.jar or .zip)");
         return null;
@@ -258,8 +247,6 @@

   private Set<Resource> exposedResources = Collections.emptySet();

-  private Map<String, ResourceData> internalMap = Collections.emptyMap();
-
   private PathPrefixSet pathPrefixSet = new PathPrefixSet();

   /**
@@ -295,7 +282,6 @@
     exposedPathNames = Collections.emptySet();
     exposedResourceMap = Collections.emptyMap();
     exposedResources = Collections.emptySet();
-    internalMap = Collections.emptyMap();
   }

   public Set<String> getPathNames() {
@@ -362,40 +348,10 @@
         }
       }
     }
-
-    /*
- * Update the newInternalMap to preserve identity for any resources that
-     * have not changed; also record whether or not there are ANY changes.
-     *
- * There's definitely a change if the sizes don't match; even if the sizes - * do match, every new resource must match an old resource for there to be
-     * no changes.
-     */
-    boolean didChange = internalMap.size() != newInternalMap.size();
- for (Map.Entry<String, ResourceData> entry : newInternalMap.entrySet()) {
-      String resourcePath = entry.getKey();
-      ResourceData newData = entry.getValue();
-      ResourceData oldData = internalMap.get(resourcePath);
-      if (shouldUseNewResource(logger, oldData, newData)) {
-        didChange = true;
-      } else {
-        if (oldData.resource != newData.resource) {
-          newInternalMap.put(resourcePath, oldData);
-        }
-      }
-    }
-
-    if (!didChange) {
-      // Nothing to do, keep the same identities.
-      SpeedTracerLogger.end(CompilerEventType.RESOURCE_ORACLE);
-      return;
-    }
-
-    internalMap = newInternalMap;

     Map<String, Resource> externalMap = new HashMap<String, Resource>();
     Set<Resource> externalSet = new HashSet<Resource>();
-    for (Entry<String, ResourceData> entry : internalMap.entrySet()) {
+    for (Entry<String, ResourceData> entry : newInternalMap.entrySet()) {
       String path = entry.getKey();
       ResourceData data = entry.getValue();
       externalMap.put(path, data.resource);
@@ -417,31 +373,4 @@
   List<ClassPathEntry> getClassPath() {
     return classPath;
   }
-
- private boolean shouldUseNewResource(TreeLogger logger, ResourceData oldData,
-      ResourceData newData) {
-    AbstractResource newResource = newData.resource;
-    String resourcePath = newResource.getPath();
-    if (oldData != null) {
-      // Test 1: Is the resource found in a different location than before?
-      AbstractResource oldResource = oldData.resource;
- if (oldResource.getClassPathEntry() == newResource.getClassPathEntry()) {
-        // Test 2: Has the resource changed since we last found it?
-        if (!oldResource.isStale()) {
-          // The resource has not changed.
-          return false;
-        } else {
-          Messages.RESOURCE_BECAME_INVALID_BECAUSE_IT_IS_STALE.log(logger,
-              resourcePath, null);
-        }
-      } else {
-        Messages.RESOURCE_BECAME_INVALID_BECAUSE_IT_MOVED.log(logger,
-            resourcePath, null);
-      }
-    } else {
-      Messages.NEW_RESOURCE_FOUND.log(logger, resourcePath, null);
-    }
-
-    return true;
-  }
-}
+}
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java Wed Aug 4 09:54:49 2010
@@ -23,10 +23,12 @@
 import com.google.gwt.dev.util.msg.Message1String;

 import java.io.File;
+import java.io.IOException;
 import java.util.Enumeration;
 import java.util.Map;
 import java.util.Set;
 import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
 import java.util.zip.ZipFile;

 /**
@@ -55,8 +57,8 @@
   }

   private static class ZipFileSnapshot {
-    private final int prefixSetSize;
     private final Map<AbstractResource, PathPrefix> cachedAnswers;
+    private final int prefixSetSize;

     ZipFileSnapshot(int prefixSetSize,
         Map<AbstractResource, PathPrefix> cachedAnswers) {
@@ -72,11 +74,14 @@
    */
private final Map<PathPrefixSet, ZipFileSnapshot> cachedSnapshots = new IdentityHashMap<PathPrefixSet, ZipFileSnapshot>();

-  private String cachedLocation;
+  private final String location;
+
   private final ZipFile zipFile;

-  public ZipFileClassPathEntry(ZipFile zipFile) {
-    this.zipFile = zipFile;
+ public ZipFileClassPathEntry(File zipFile) throws ZipException, IOException {
+    assert zipFile.isAbsolute();
+    this.zipFile = new ZipFile(zipFile);
+    this.location = zipFile.toURI().toString();
   }

   /**
@@ -101,10 +106,7 @@

   @Override
   public String getLocation() {
-    if (cachedLocation == null) {
-      cachedLocation = new File(zipFile.getName()).toURI().toString();
-    }
-    return cachedLocation;
+    return location;
   }

   public ZipFile getZipFile() {
@@ -127,7 +129,7 @@
         continue;
       }
       ZipFileResource zipResource = new ZipFileResource(this,
-          zipEntry.getName());
+          zipEntry.getName(), zipEntry.getTime());
       results.add(zipResource);
       Messages.READ_ZIP_ENTRY.log(logger, zipEntry.getName(), null);
     }
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java Wed Aug 4 09:54:49 2010
@@ -17,7 +17,6 @@

 import java.io.IOException;
 import java.io.InputStream;
-import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;

 /**
@@ -27,10 +26,13 @@

   private final ZipFileClassPathEntry classPathEntry;
   private final String path;
-
- public ZipFileResource(ZipFileClassPathEntry classPathEntry, String path) {
+  private long lastModified;
+
+  public ZipFileResource(ZipFileClassPathEntry classPathEntry, String path,
+      long lastModified) {
     this.classPathEntry = classPathEntry;
     this.path = path;
+    this.lastModified = lastModified;
   }

   @Override
@@ -40,16 +42,12 @@

   @Override
   public long getLastModified() {
-    return getEntry().getTime();
+    return lastModified;
   }

   @Override
   public String getLocation() {
-    // CHECKSTYLE_OFF
-    String proto = classPathEntry.getZipFile() instanceof JarFile ? "jar:"
-        : "zip:";
-    // CHECKSTYLE_ON
-    return proto + classPathEntry.getLocation() + "!/" + path;
+    return "jar:" + classPathEntry.getLocation() + "!/" + path;
   }

   @Override
@@ -57,19 +55,10 @@
     return path;
   }

-  /**
- * Since we don't dynamically reload zips during a run, zip-based resources
-   * cannot become stale.
-   */
-  @Override
-  public boolean isStale() {
-    return false;
-  }
-
   @Override
   public InputStream openContents() {
     try {
-      return classPathEntry.getZipFile().getInputStream(getEntry());
+ return classPathEntry.getZipFile().getInputStream(new ZipEntry(path));
     } catch (IOException e) {
       // The spec for this method says it can return null.
       return null;
@@ -80,8 +69,4 @@
   public boolean wasRerooted() {
     return false;
   }
-
-  private ZipEntry getEntry() {
-    return classPathEntry.getZipFile().getEntry(path);
-  }
-}
+}
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/resource/impl/AbstractResourceOrientedTestBase.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/resource/impl/AbstractResourceOrientedTestBase.java Wed Aug 4 09:54:49 2010
@@ -28,7 +28,6 @@
 import java.util.IdentityHashMap;
 import java.util.Map;
 import java.util.Set;
-import java.util.jar.JarFile;

 /**
  * Shared abstract class for tests that rely on well-known test data.
@@ -154,8 +153,8 @@
     return file;
   }

-  protected File findJarFile(String name) throws URISyntaxException {
-    URL url = findJarUrl(name);
+  protected File findFile(String name) throws URISyntaxException {
+    URL url = findUrl(name);
     assertNotNull(
         "Expecting on the classpath: "
             + name
@@ -170,7 +169,7 @@
    * @param name
    * @return
    */
-  protected URL findJarUrl(String name) {
+  protected URL findUrl(String name) {
     ClassLoader classLoader = getClass().getClassLoader();
     return classLoader.getResource(name);
   }
@@ -193,9 +192,13 @@

   protected ClassPathEntry getClassPathEntry1AsJar() throws IOException,
       URISyntaxException {
- File file = findJarFile("com/google/gwt/dev/resource/impl/testdata/cpe1.jar"); - return new ExcludeSvnClassPathEntry(new ZipFileClassPathEntry(new JarFile(
-        file)));
+ File file = findFile("com/google/gwt/dev/resource/impl/testdata/cpe1.jar");
+    return new ExcludeSvnClassPathEntry(new ZipFileClassPathEntry(file));
+  }
+
+ protected ClassPathEntry getClassPathEntry1AsZip() throws IOException, URISyntaxException { + File file = findFile("com/google/gwt/dev/resource/impl/testdata/cpe1.zip");
+    return new ExcludeSvnClassPathEntry(new ZipFileClassPathEntry(file));
   }

   protected ClassPathEntry getClassPathEntry1AsMock() {
@@ -210,9 +213,13 @@

protected ClassPathEntry getClassPathEntry2AsJar() throws URISyntaxException,
       IOException {
- File file = findJarFile("com/google/gwt/dev/resource/impl/testdata/cpe2.jar"); - return new ExcludeSvnClassPathEntry(new ZipFileClassPathEntry(new JarFile(
-        file)));
+ File file = findFile("com/google/gwt/dev/resource/impl/testdata/cpe2.jar");
+    return new ExcludeSvnClassPathEntry(new ZipFileClassPathEntry(file));
+  }
+
+ protected ClassPathEntry getClassPathEntry2AsZip() throws URISyntaxException, IOException { + File file = findFile("com/google/gwt/dev/resource/impl/testdata/cpe2.zip");
+    return new ExcludeSvnClassPathEntry(new ZipFileClassPathEntry(file));
   }

   protected ClassPathEntry getClassPathEntry2AsMock() {
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/resource/impl/ClassPathEntryTest.java Fri Feb 6 13:06:24 2009 +++ /trunk/dev/core/test/com/google/gwt/dev/resource/impl/ClassPathEntryTest.java Wed Aug 4 09:54:49 2010
@@ -26,49 +26,80 @@
public void testAllCpe1FilesFound() throws URISyntaxException, IOException {
     testAllCpe1FilesFound(getClassPathEntry1AsJar());
     testAllCpe1FilesFound(getClassPathEntry1AsDirectory());
+    testAllCpe1FilesFound(getClassPathEntry1AsZip());
   }

public void testAllCpe2FilesFound() throws URISyntaxException, IOException {
     testAllCpe2FilesFound(getClassPathEntry2AsJar());
     testAllCpe2FilesFound(getClassPathEntry2AsDirectory());
+    testAllCpe2FilesFound(getClassPathEntry2AsZip());
   }

public void testPathPrefixSetChanges() throws IOException, URISyntaxException {
     ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
     ClassPathEntry cpe1dir = getClassPathEntry1AsDirectory();
+    ClassPathEntry cpe1zip = getClassPathEntry1AsZip();
     ClassPathEntry cpe2jar = getClassPathEntry2AsJar();
     ClassPathEntry cpe2dir = getClassPathEntry2AsDirectory();
+    ClassPathEntry cpe2zip = getClassPathEntry2AsZip();

     testPathPrefixSetChanges(cpe1jar, cpe2jar);
+    testPathPrefixSetChanges(cpe1dir, cpe2jar);
+    testPathPrefixSetChanges(cpe1zip, cpe2jar);
+
     testPathPrefixSetChanges(cpe1dir, cpe2dir);
     testPathPrefixSetChanges(cpe1jar, cpe2dir);
-    testPathPrefixSetChanges(cpe1dir, cpe2jar);
+    testPathPrefixSetChanges(cpe1zip, cpe2dir);
+
+    testPathPrefixSetChanges(cpe1dir, cpe2zip);
+    testPathPrefixSetChanges(cpe1jar, cpe2zip);
+    testPathPrefixSetChanges(cpe1zip, cpe2zip);
   }

   public void testUseOfPrefixesWithFiltering() throws IOException,
       URISyntaxException {
     ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
     ClassPathEntry cpe1dir = getClassPathEntry1AsDirectory();
+    ClassPathEntry cpe1zip = getClassPathEntry1AsZip();
     ClassPathEntry cpe2jar = getClassPathEntry2AsJar();
     ClassPathEntry cpe2dir = getClassPathEntry2AsDirectory();
-
+    ClassPathEntry cpe2zip = getClassPathEntry2AsZip();
+
+    testUseOfPrefixesWithFiltering(cpe1dir, cpe2jar);
     testUseOfPrefixesWithFiltering(cpe1jar, cpe2jar);
+    testUseOfPrefixesWithFiltering(cpe1dir, cpe2jar);
+    testUseOfPrefixesWithFiltering(cpe1zip, cpe2jar);
+
     testUseOfPrefixesWithFiltering(cpe1dir, cpe2dir);
     testUseOfPrefixesWithFiltering(cpe1jar, cpe2dir);
-    testUseOfPrefixesWithFiltering(cpe1dir, cpe2jar);
+    testUseOfPrefixesWithFiltering(cpe1zip, cpe2dir);
+
+    testUseOfPrefixesWithFiltering(cpe1dir, cpe2zip);
+    testUseOfPrefixesWithFiltering(cpe1jar, cpe2zip);
+    testUseOfPrefixesWithFiltering(cpe1zip, cpe2zip);
   }

public void testUseOfPrefixesWithoutFiltering() throws URISyntaxException,
       IOException {
     ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
     ClassPathEntry cpe1dir = getClassPathEntry1AsDirectory();
+    ClassPathEntry cpe1zip = getClassPathEntry1AsZip();
     ClassPathEntry cpe2jar = getClassPathEntry2AsJar();
     ClassPathEntry cpe2dir = getClassPathEntry2AsDirectory();
-
+    ClassPathEntry cpe2zip = getClassPathEntry2AsZip();
+
+    testUseOfPrefixesWithoutFiltering(cpe1dir, cpe2jar);
     testUseOfPrefixesWithoutFiltering(cpe1jar, cpe2jar);
+    testUseOfPrefixesWithoutFiltering(cpe1dir, cpe2jar);
+    testUseOfPrefixesWithoutFiltering(cpe1zip, cpe2jar);
+
     testUseOfPrefixesWithoutFiltering(cpe1dir, cpe2dir);
     testUseOfPrefixesWithoutFiltering(cpe1jar, cpe2dir);
-    testUseOfPrefixesWithoutFiltering(cpe1dir, cpe2jar);
+    testUseOfPrefixesWithoutFiltering(cpe1zip, cpe2dir);
+
+    testUseOfPrefixesWithoutFiltering(cpe1dir, cpe2zip);
+    testUseOfPrefixesWithoutFiltering(cpe1jar, cpe2zip);
+    testUseOfPrefixesWithoutFiltering(cpe1zip, cpe2zip);
   }

   public void testUseOfPrefixesWithoutFiltering(ClassPathEntry cpe1,
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/resource/impl/FileResourceTest.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/resource/impl/FileResourceTest.java Wed Aug 4 09:54:49 2010
@@ -24,7 +24,7 @@

 public class FileResourceTest extends TestCase {

-  public void testDeletion() {
+  public void testBasic() {
     File f = null;
     try {
f = File.createTempFile("com.google.gwt.dev.javac.impl.FileResourceTest",
@@ -45,22 +45,9 @@
      * simple filename.
      */
     assertEquals(f.getName(), r.getPath());
-
-    // Shouldn't be stale yet.
-    assertFalse(r.isStale());
-
-    /*
- * Touch the file at more than one second to ensure there's a noticeable
-     * difference on every platform.
-     */
-    // Ignore failure of setLastModified
-    f.setLastModified(f.lastModified() + 1500);
-
-    // Should be stale now.
-    assertTrue(r.isStale());
   }

-  public void testModification() {
+  public void testDeletion() {
     File f = null;
     try {
f = File.createTempFile("com.google.gwt.dev.javac.impl.FileResourceTest",
@@ -82,15 +69,9 @@
      */
     assertEquals(f.getName(), r.getPath());

-    // Shouldn't be stale yet.
-    assertFalse(r.isStale());
-
     // Delete the file.
     f.delete();

-    // Should be stale now.
-    assertTrue(r.isStale());
-
     // Get can't contents anymore, either.
     assertNull(r.openContents());
   }
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/resource/impl/MockAbstractResource.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/resource/impl/MockAbstractResource.java Wed Aug 4 09:54:49 2010
@@ -48,11 +48,6 @@
   public String getPath() {
     return path;
   }
-
-  @Override
-  public boolean isStale() {
-    return isStale;
-  }

   @Override
   public InputStream openContents() {
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplRealClasspathTest.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplRealClasspathTest.java Wed Aug 4 09:54:49 2010
@@ -20,6 +20,8 @@

 import java.util.Map;

+import static com.google.gwt.dev.resource.impl.ResourceOracleImplTest.assertResourcesEqual;
+
 /**
  * Tests {...@link ResourceOracleImpl} using the real class path.
  *
@@ -56,6 +58,7 @@
       });

   private final TreeLogger logger = createTestTreeLogger();
+
   private final ResourceOracleImpl resourceOracle = new ResourceOracleImpl(
       logger);

@@ -80,12 +83,12 @@

     // Plain refresh should have no effect.
     resourceOracle.refresh(logger);
-    assertSame(resourceMap, resourceOracle.getResourceMap());
+    assertResourcesEqual(resourceMap, resourceOracle.getResourceMap());

     // Setting same path entries should have no effect.
     resourceOracle.setPathPrefixes(pathPrefixSet);
     resourceOracle.refresh(logger);
-    assertSame(resourceMap, resourceOracle.getResourceMap());
+    assertResourcesEqual(resourceMap, resourceOracle.getResourceMap());

     // Setting identical path entries should have no effect.
     pathPrefixSet = new PathPrefixSet();
@@ -93,18 +96,16 @@
     pathPrefixSet.add(THIS_CLASS_PREFIX);
     resourceOracle.setPathPrefixes(pathPrefixSet);
     resourceOracle.refresh(logger);
-    assertSame(resourceMap, resourceOracle.getResourceMap());
+    assertResourcesEqual(resourceMap, resourceOracle.getResourceMap());

     // Setting identical result should have no effect.
     pathPrefixSet.add(JUNIT_PREFIX_DUP);
     resourceOracle.refresh(logger);
-    assertSame(resourceMap, resourceOracle.getResourceMap());
+    assertResourcesEqual(resourceMap, resourceOracle.getResourceMap());

     // Actually change the working set.
     pathPrefixSet.add(THIS_CLASS_PREFIX_PLUS);
     resourceOracle.refresh(logger);
-    Map<String, Resource> newResourceMap = resourceOracle.getResourceMap();
-    assertNotSame(resourceMap, newResourceMap);
-    assertEquals(3, newResourceMap.size());
+    assertEquals(3, resourceOracle.getResourceMap().size());
   }
 }
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplTest.java Tue Aug 3 08:08:39 2010 +++ /trunk/dev/core/test/com/google/gwt/dev/resource/impl/ResourceOracleImplTest.java Wed Aug 4 09:54:49 2010
@@ -17,9 +17,11 @@

 import com.google.gwt.core.ext.TreeLogger;
 import com.google.gwt.dev.resource.Resource;
+import com.google.gwt.dev.util.Util;
 import com.google.gwt.util.tools.Utility;

 import java.io.BufferedReader;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -29,6 +31,8 @@
 import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -117,9 +121,9 @@
     }

     public void assertSameCollections(ResourceOracleSnapshot other) {
-      assertSame(resourceMap, other.resourceMap);
-      assertSame(resources, other.resources);
-      assertSame(pathNames, other.pathNames);
+      assertResourcesEqual(resourceMap, other.resourceMap);
+      assertResourcesEqual(resources, other.resources);
+      assertEquals(pathNames, other.pathNames);
     }

     public AbstractResource findResourceWithPath(String path) {
@@ -130,13 +134,47 @@
       }
       return null;
     }
+
+    public void assertResourcesGetURL() {
+      for (Resource resource : resources) {
+        URL url = resource.getURL();
+ assertNotNull("Resource " + resource + " had a null getURL()", url);
+
+        InputStream is = resource.openContents();
+        assertNotNull(is);
+
+        String urlString = Util.readURLAsString(url);
+        String inputString = Util.readStreamAsString(is);
+        assertEquals(urlString, inputString);
+        assertNotNull(urlString);
+        assertNotNull(inputString);
+      }
+    }
+  }
+
+  public static void assertResourcesEqual(Collection<Resource> expected,
+      Collection<Resource> actual) {
+    Set<String> expectedLocs = new HashSet<String>();
+    for (Resource resource : expected) {
+      expectedLocs.add(resource.getLocation());
+    }
+    Set<String> actualLocs = new HashSet<String>();
+    for (Resource resource : actual) {
+      actualLocs.add(resource.getLocation());
+    }
+    assertEquals(expectedLocs, actualLocs);
+  }
+
+  public static void assertResourcesEqual(Map<String, Resource> expected,
+      Map<String, Resource> actual) {
+    assertResourcesEqual(expected.values(), actual.values());
   }

   public void testCachingOfJarResources() throws IOException,
       URISyntaxException {
     TreeLogger logger = createTestTreeLogger();
-    ClassPathEntry cpe1jar = new ZipFileClassPathEntry(new JarFile(
- findJarFile("com/google/gwt/dev/resource/impl/testdata/cpe1.jar"))); + File jarFile = findFile("com/google/gwt/dev/resource/impl/testdata/cpe1.jar");
+    ClassPathEntry cpe1jar = new ZipFileClassPathEntry(jarFile);

     // test basic caching
     PathPrefixSet pps1 = new PathPrefixSet();
@@ -162,6 +200,31 @@
assertSame(resourceMap2, cpe1jar.findApplicableResources(logger, pps1)); assertSame(resourceMap3, cpe1jar.findApplicableResources(logger, pps2));
   }
+
+ public void testGetUrlOnResources() throws URISyntaxException, IOException {
+    ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
+    ClassPathEntry cpe1dir = getClassPathEntry1AsDirectory();
+    ClassPathEntry cpe1zip = getClassPathEntry1AsZip();
+
+    ClassPathEntry cpe2jar = getClassPathEntry2AsJar();
+    ClassPathEntry cpe2dir = getClassPathEntry2AsDirectory();
+    ClassPathEntry cpe2zip = getClassPathEntry2AsZip();
+
+    testGetURLOnResourcesInCPE(cpe1jar);
+    testGetURLOnResourcesInCPE(cpe1dir);
+    testGetURLOnResourcesInCPE(cpe1zip);
+    testGetURLOnResourcesInCPE(cpe2jar);
+    testGetURLOnResourcesInCPE(cpe2dir);
+    testGetURLOnResourcesInCPE(cpe2zip);
+  }
+
+  private void testGetURLOnResourcesInCPE(ClassPathEntry cpe) {
+    TreeLogger logger = createTestTreeLogger();
+
+    ResourceOracleImpl oracle = createResourceOracle(cpe);
+    ResourceOracleSnapshot s = refreshAndSnapshot(logger, oracle);
+    s.assertResourcesGetURL();
+  }

   /**
* Test that ResourceOracleImpl preserves the order in which the same logical
@@ -176,8 +239,8 @@
     ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
     ClassPathEntry cpe2jar = getClassPathEntry2AsJar();

-    ClassPathEntry[] cp12 = new ClassPathEntry[] {cpe1jar, cpe2jar};
-    ClassPathEntry[] cp21 = new ClassPathEntry[] {cpe2jar, cpe1jar};
+    ClassPathEntry[] cp12 = new ClassPathEntry[]{cpe1jar, cpe2jar};
+    ClassPathEntry[] cp21 = new ClassPathEntry[]{cpe2jar, cpe1jar};
     String resKeyNormal = "org/example/bar/client/BarClient2.txt";
     String resKeyReroot = "/BarClient2.txt";
     PathPrefix pathPrefixNormal = new PathPrefix("org/example/bar/client",
@@ -214,8 +277,8 @@
     ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
     ClassPathEntry cpe2jar = getClassPathEntry2AsJar();

-    ClassPathEntry[] cp12 = new ClassPathEntry[] {cpe1jar, cpe2jar};
-    ClassPathEntry[] cp21 = new ClassPathEntry[] {cpe2jar, cpe1jar};
+    ClassPathEntry[] cp12 = new ClassPathEntry[]{cpe1jar, cpe2jar};
+    ClassPathEntry[] cp21 = new ClassPathEntry[]{cpe2jar, cpe1jar};

     String keyReroot = "/BarClient1.txt";

@@ -242,15 +305,23 @@
public void testReadingResource() throws IOException, URISyntaxException {
     ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
     ClassPathEntry cpe1dir = getClassPathEntry1AsDirectory();
+    ClassPathEntry cpe1zip = getClassPathEntry1AsZip();

     ClassPathEntry cpe2jar = getClassPathEntry2AsJar();
     ClassPathEntry cpe2dir = getClassPathEntry2AsDirectory();
+    ClassPathEntry cpe2zip = getClassPathEntry2AsZip();

     testReadingResource(cpe1jar, cpe2jar);
     testReadingResource(cpe1dir, cpe2jar);
-
+    testReadingResource(cpe1zip, cpe2jar);
+
     testReadingResource(cpe1jar, cpe2dir);
     testReadingResource(cpe1dir, cpe2dir);
+    testReadingResource(cpe1zip, cpe2dir);
+
+    testReadingResource(cpe1jar, cpe2zip);
+    testReadingResource(cpe1dir, cpe2zip);
+    testReadingResource(cpe1zip, cpe2zip);
   }

   /**
@@ -262,15 +333,15 @@
    */
   public void testRemoveDuplicates() throws MalformedURLException {
     TreeLogger logger = createTestTreeLogger();
- URL cpe1 = findJarUrl("com/google/gwt/dev/resource/impl/testdata/cpe1.jar"); - URL cpe2 = findJarUrl("com/google/gwt/dev/resource/impl/testdata/cpe2.jar");
-    URLClassLoader classLoader = new URLClassLoader(new URL[] {
+ URL cpe1 = findUrl("com/google/gwt/dev/resource/impl/testdata/cpe1.jar"); + URL cpe2 = findUrl("com/google/gwt/dev/resource/impl/testdata/cpe2.zip");
+    URLClassLoader classLoader = new URLClassLoader(new URL[]{
         cpe1, cpe2, cpe2, cpe1, cpe2,}, null);
ResourceOracleImpl oracle = new ResourceOracleImpl(logger, classLoader);
     List<ClassPathEntry> classPath = oracle.getClassPath();
     assertEquals(2, classPath.size());
     assertJarEntry(classPath.get(0), "cpe1.jar");
-    assertJarEntry(classPath.get(1), "cpe2.jar");
+    assertJarEntry(classPath.get(1), "cpe2.zip");
     oracle = new ResourceOracleImpl(logger, classLoader);
     List<ClassPathEntry> classPath2 = oracle.getClassPath();
     assertEquals(2, classPath2.size());
@@ -283,66 +354,96 @@
     ClassPathEntry cpe1mock = getClassPathEntry1AsMock();
     ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
     ClassPathEntry cpe1dir = getClassPathEntry1AsDirectory();
+    ClassPathEntry cpe1zip = getClassPathEntry1AsZip();

     ClassPathEntry cpe2mock = getClassPathEntry2AsMock();
     ClassPathEntry cpe2jar = getClassPathEntry2AsJar();
     ClassPathEntry cpe2dir = getClassPathEntry2AsDirectory();
+    ClassPathEntry cpe2zip = getClassPathEntry2AsZip();

     testResourceAddition(cpe1jar, cpe2jar);
     testResourceAddition(cpe1dir, cpe2jar);
     testResourceAddition(cpe1mock, cpe2jar);
+    testResourceAddition(cpe1zip, cpe2jar);

     testResourceAddition(cpe1jar, cpe2dir);
     testResourceAddition(cpe1dir, cpe2dir);
     testResourceAddition(cpe1mock, cpe2dir);
+    testResourceAddition(cpe1zip, cpe2dir);

     testResourceAddition(cpe1jar, cpe2mock);
     testResourceAddition(cpe1dir, cpe2mock);
     testResourceAddition(cpe1mock, cpe2mock);
+    testResourceAddition(cpe1zip, cpe2mock);
+
+    testResourceAddition(cpe1jar, cpe2zip);
+    testResourceAddition(cpe1dir, cpe2zip);
+    testResourceAddition(cpe1mock, cpe2zip);
+    testResourceAddition(cpe1zip, cpe2zip);
   }

public void testResourceDeletion() throws IOException, URISyntaxException {
     ClassPathEntry cpe1mock = getClassPathEntry1AsMock();
     ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
     ClassPathEntry cpe1dir = getClassPathEntry1AsDirectory();
+    ClassPathEntry cpe1zip = getClassPathEntry1AsZip();

     ClassPathEntry cpe2mock = getClassPathEntry2AsMock();
     ClassPathEntry cpe2jar = getClassPathEntry2AsJar();
     ClassPathEntry cpe2dir = getClassPathEntry2AsDirectory();
+    ClassPathEntry cpe2zip = getClassPathEntry2AsZip();

     testResourceDeletion(cpe1jar, cpe2jar);
     testResourceDeletion(cpe1dir, cpe2jar);
     testResourceDeletion(cpe1mock, cpe2jar);
+    testResourceDeletion(cpe1zip, cpe2jar);

     testResourceDeletion(cpe1jar, cpe2dir);
     testResourceDeletion(cpe1dir, cpe2dir);
     testResourceDeletion(cpe1mock, cpe2dir);
+    testResourceDeletion(cpe1zip, cpe2dir);

     testResourceDeletion(cpe1jar, cpe2mock);
     testResourceDeletion(cpe1dir, cpe2mock);
     testResourceDeletion(cpe1mock, cpe2mock);
+    testResourceDeletion(cpe1zip, cpe2mock);
+
+    testResourceDeletion(cpe1jar, cpe2zip);
+    testResourceDeletion(cpe1dir, cpe2zip);
+    testResourceDeletion(cpe1mock, cpe2zip);
+    testResourceDeletion(cpe1zip, cpe2zip);
   }

public void testResourceModification() throws IOException, URISyntaxException {
     ClassPathEntry cpe1mock = getClassPathEntry1AsMock();
     ClassPathEntry cpe1jar = getClassPathEntry1AsJar();
     ClassPathEntry cpe1dir = getClassPathEntry1AsDirectory();
+    ClassPathEntry cpe1zip = getClassPathEntry1AsZip();

     ClassPathEntry cpe2mock = getClassPathEntry2AsMock();
     ClassPathEntry cpe2jar = getClassPathEntry2AsJar();
     ClassPathEntry cpe2dir = getClassPathEntry2AsDirectory();
+    ClassPathEntry cpe2zip = getClassPathEntry2AsZip();

     testResourceModification(cpe1jar, cpe2jar);
     testResourceModification(cpe1dir, cpe2jar);
     testResourceModification(cpe1mock, cpe2jar);
+    testResourceModification(cpe1zip, cpe2jar);

     testResourceModification(cpe1jar, cpe2dir);
     testResourceModification(cpe1dir, cpe2dir);
     testResourceModification(cpe1mock, cpe2dir);
+    testResourceModification(cpe1zip, cpe2dir);

     testResourceModification(cpe1jar, cpe2mock);
     testResourceModification(cpe1dir, cpe2mock);
     testResourceModification(cpe1mock, cpe2mock);
+    testResourceModification(cpe1zip, cpe2mock);
+
+    testResourceModification(cpe1jar, cpe2zip);
+    testResourceModification(cpe1dir, cpe2zip);
+    testResourceModification(cpe1mock, cpe2zip);
+    testResourceModification(cpe1zip, cpe2zip);

     /*
* TODO(bruce): figure out a good way to test real resource modifications of
@@ -361,7 +462,7 @@
     PathPrefix pp1 = new PathPrefix("org/example/bar/client", null, false);
     PathPrefix pp2 = new PathPrefix("org/example/bar", null, false);
testResourceInCPE(logger, "org/example/bar/client/BarClient2.txt", cpe1,
-        new ClassPathEntry[] {cpe1, cpe2}, pp1, pp2);
+        new ClassPathEntry[]{cpe1, cpe2}, pp1, pp2);
   }

   /**
@@ -382,15 +483,15 @@

// Ensure the translatable overrides the basic despite swapping CPE order.
     testResourceInCPE(logger, "java/lang/Object.java", cpe2,
-        new ClassPathEntry[] {cpe1, cpe2}, pp1, pp2);
+        new ClassPathEntry[]{cpe1, cpe2}, pp1, pp2);
     testResourceInCPE(logger, "java/lang/Object.java", cpe2,
-        new ClassPathEntry[] {cpe2, cpe1}, pp1, pp2);
+        new ClassPathEntry[]{cpe2, cpe1}, pp1, pp2);

// Ensure the translatable overrides the basic despite swapping PPS order.
     testResourceInCPE(logger, "java/lang/Object.java", cpe2,
-        new ClassPathEntry[] {cpe1, cpe2}, pp2, pp1);
+        new ClassPathEntry[]{cpe1, cpe2}, pp2, pp1);
     testResourceInCPE(logger, "java/lang/Object.java", cpe2,
-        new ClassPathEntry[] {cpe2, cpe1}, pp2, pp1);
+        new ClassPathEntry[]{cpe2, cpe1}, pp2, pp1);
   }

   /**
=======================================
--- /trunk/dev/core/test/com/google/gwt/dev/resource/impl/testdata/rebuild_jars Fri May 9 14:33:56 2008 +++ /trunk/dev/core/test/com/google/gwt/dev/resource/impl/testdata/rebuild_jars Wed Aug 4 09:54:49 2010
@@ -1,7 +1,9 @@
 cd cpe1
 find . -type f | grep -v "\.svn" | xargs jar cvf ../cpe1.jar
+find . -type f | grep -v "\.svn" | xargs zip ../cpe1.zip
 cd ..
 cd cpe2
 find . -type f | grep -v "\.svn" | xargs jar cvf ../cpe2.jar
+find . -type f | grep -v "\.svn" | xargs zip ../cpe2.zip
 cd ..

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to