Examples of FileWrapper


Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

     mockHelper.verifyAll();
   }
  
   @Test (expected = IllegalArgumentException.class)
   public void testCopyDir_fromDirNotADir() throws Exception {
     FileWrapper mockFromDir = mockHelper.createMock("mockFromFile", FileWrapper.class);
     expect(mockFromDir.getAbsolutePath()).andStubReturn("/absolute/path/to/mockFromFile");
    FileWrapper mockToDir = mockHelper.createMock("mockToDir", FileWrapper.class);
    expect(mockToDir.getAbsolutePath()).andStubReturn("/absolute/path/to/mockToDir");
   
     expect(mockFromDir.isDirectory()).andStubReturn(false);
   
     mockHelper.replayAll();
    underTest.copyDir(mockFromDir, mockToDir);
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

    mockHelper.verifyAll();
   }

   @Test (expected = IllegalArgumentException.class)
   public void testCopyDir_ToDirNotADir() throws Exception {
     FileWrapper mockFromDir = mockHelper.createMock("mockFromFile", FileWrapper.class);
     expect(mockFromDir.getAbsolutePath()).andStubReturn("/absolute/path/to/mockFromFile");
    FileWrapper mockToDir = mockHelper.createMock("mockToDir", FileWrapper.class);
    expect(mockToDir.getAbsolutePath()).andStubReturn("/absolute/path/to/mockToDir");
   
     expect(mockFromDir.isDirectory()).andStubReturn(true);
     expect(mockToDir.isDirectory()).andStubReturn(false);
   
     mockHelper.replayAll();
    underTest.copyDir(mockFromDir, mockToDir);
    mockHelper.verifyAll();
   }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

   
    expect(mockIOUtilities.constructHttpUrl(host, port, fileToGet)).andReturn(url);
   
    
     expect(mockPathUtils.getFileFromPath(fileToGet)).andReturn(fileFromPath);
     FileWrapper destFile = mockHelper.createMock(FileWrapper.class);
     expect(destFile.getAbsolutePath()).andReturn(absPath);
     expect(mockFileWrapperFactory.create(destDir, fileFromPath)).andReturn(destFile);
     if (simulateSuccess) {
       expect(mockIOUtilities.downloadHttpFile(url, destFile, mockProxySettings)).andReturn(fileSize);
     } else {
       expect(mockIOUtilities.downloadHttpFile(url, destFile, mockProxySettings)).andReturn(fileSize-1);
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

     }
    
   }
  
   private FileWrapper getDirectoryMock(String name) {
     FileWrapper result = mockHelper.createMock(name, FileWrapper.class);
     expect(result.isDirectory()).andStubReturn(true);
     return result;
   }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

     expect(result.isDirectory()).andStubReturn(true);
     return result;
   }
  
   private FileWrapper getFileMock(String name, String path) {
     FileWrapper result = mockHelper.createMock(name, FileWrapper.class);
     expect(result.isDirectory()).andStubReturn(false);
     expect(result.getAbsolutePath()).andStubReturn(path);
     return result;    
   }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

    final String destDir, final long fileSize, final long checksum, final IProxySettings proxySettings)
    throws Exception
  {
    URL url = _iou.constructHttpUrl(host, port, fileToGet);
    String result = null;
    FileWrapper resultFile = _fileWrapperFactory.create(destDir, _pathUtils.getFileFromPath(fileToGet));
    result = resultFile.getAbsolutePath();

    if (s_log.isDebugEnabled())
    {
      s_log.debug("downloadHttpFile: writing http response body to file: " + resultFile);
    }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

   * @see net.sourceforge.squirrel_sql.client.update.UpdateUtil#
   *      getDownloadFileLocation(net.sourceforge.squirrel_sql.client.update.gui.ArtifactStatus)
   */
  public FileWrapper getDownloadFileLocation(ArtifactStatus status)
  {
    FileWrapper result = null;
    if (CORE_ARTIFACT_ID.equals(status.getType()))
    {
      result = getFile(getCoreDownloadsDir(), status.getName());
    }
    if (PLUGIN_ARTIFACT_ID.equals(status.getType()))
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

   */
  public boolean isPresentInDownloadsDirectory(ArtifactStatus status)
  {
    boolean result = false;

    FileWrapper downloadFile = getDownloadFileLocation(status);

    if (downloadFile.exists())
    {
      long checkSum = getCheckSum(downloadFile);
      if (status.getChecksum() == checkSum)
      {
        if (downloadFile.length() == status.getSize())
        {
          result = true;
        }
      }
    }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

   * @param create
   * @return
   */
  private FileWrapper getDir(FileWrapper parent, String dirName, boolean create)
  {
    FileWrapper result = null;
    if (dirName != null)
    {
      result = _fileWrapperFactory.create(parent, dirName);
    }
    else
    {
      result = parent;
    }
    if (!result.isDirectory())
    {
      if (result.exists())
      {
        // If the update dir, is actually a file, log an error.
        s_log.error(dirName + " directory (" + result.getAbsolutePath()
          + ") doesn't appear to be a directory");
      }
      else
      {
        // If the downloads dir doesn't already exist, just create it.
        if (create)
        {
          result.mkdir();
        }
      }
    }
    return result;
  }
View Full Code Here

Examples of net.sourceforge.squirrel_sql.fw.util.FileWrapper

      // We set expected and checksum to -1 here, since we don't have that information for release.xml file
      // TODO: Can HttpClient be used to get the byte-size of release.xml so we can perform this check?
      String filename =
        downloadHttpUpdateFile(host, port, fileToGet, getDownloadsDir().getAbsolutePath(), -1, -1,
          proxySettings);
      FileWrapper releaseXmlFile = _fileWrapperFactory.create(filename);
      if (releaseXmlFile.exists())
      {
        result = _serializer.readChannelBean(releaseXmlFile);
      }
      else
      {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.