Examples of FileWrapper


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

    return result;
  }

  private void installFile(InstallFileOperationInfo info) throws IOException
  {
    FileWrapper installDir = info.getInstallDir();
    FileWrapper fileToCopy = info.getFileToInstall();

    if (fileToCopy.getAbsolutePath().endsWith(".zip"))
    {
      // This file is a zip; it needs to be extracted into the install directory. All zips are packaged
      // in such a way that the extraction beneath install directory is all that is required.
      _util.extractZipFile(fileToCopy, installDir);
    }
View Full Code Here

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

     expect(mockArtifactStatus.getName()).andReturn(coreJarFilename);
//     FileWrapper mockDownloadsDirectory = mockHelper.createMock("mockDownloadsDirectory", FileWrapper.class);
//     expect(mockDownloadsDirectory.isDirectory()).andStubReturn(true);
//     expect(mockFileWrapperFactory.create(mockUpdateDirectory, UpdateUtil.DOWNLOADS_DIR_NAME));
//     expectLastCall().andReturn(mockDownloadsDirectory);
     FileWrapper mockDownloadsCoreDirectory = mockHelper.createMock("mockDownloadsCoreDirectory", FileWrapper.class);
     expect(mockDownloadsCoreDirectory.isDirectory()).andReturn(true);
     expect(mockFileWrapperFactory.create(mockDownloadsDirectory, UpdateUtil.CORE_ARTIFACT_ID));
     expectLastCall().andReturn(mockDownloadsCoreDirectory);
     FileWrapper mockSomeCoreJarFile = mockHelper.createMock("mockSomeCoreJarFile", FileWrapper.class);
     expect(mockFileWrapperFactory.create(mockDownloadsCoreDirectory, coreJarFilename));
     expectLastCall().andReturn(mockSomeCoreJarFile);
    
     mockHelper.replayAll();
     FileWrapper result = underTest.getDownloadFileLocation(mockArtifactStatus);
     mockHelper.verifyAll();
    
     assertEquals(mockSomeCoreJarFile, result);
   }
View Full Code Here

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

   }
  
   @Test
   public void testGetCheckSum() throws IOException {
    
     FileWrapper mockFile = mockHelper.createMock("mockFile", FileWrapper.class);
     expect(mockFile.getAbsolutePath()).andReturn("/path/To/Mock/File");
     expect(mockIOUtilities.getCheckSum(mockFile)).andReturn(1000L);
     mockHelper.replayAll();
     long checksumResult = underTest.getCheckSum(mockFile);
     mockHelper.verifyAll();
    
View Full Code Here

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

    */
   @Test
   public void testCopyFile_scenario1() throws IOException {

     // setup source mock file
     FileWrapper fromFile = mockHelper.createMock("fromFile", FileWrapper.class);
     expect(fromFile.exists()).andReturn(true);
     expect(fromFile.getAbsolutePath()).andReturn("/path/to/from/file").atLeastOnce();
     expect(mockIOUtilities.getCheckSum(fromFile)).andReturn(1000L);
    
     // setup dest mock file
     FileWrapper toFile = mockHelper.createMock("toFile", FileWrapper.class);
     expect(toFile.isDirectory()).andReturn(false);
     expect(toFile.exists()).andReturn(true);
     expect(toFile.getAbsolutePath()).andReturn("/path/to/to/file").atLeastOnce();
     expect(mockIOUtilities.getCheckSum(toFile)).andReturn(1000L);
    
     mockHelper.replayAll();
    underTest.copyFile(fromFile, toFile);
     mockHelper.verifyAll();
View Full Code Here

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

   }
  
   @Test
   public void testCheckDir_exists() {

     FileWrapper mockUpdateCoreDirectory = mockHelper.createMock(FileWrapper.class);
     expect(mockUpdateCoreDirectory.exists()).andReturn(true);
    
     expect(mockFileWrapperFactory.create(mockUpdateDirectory, UpdateUtil.CORE_ARTIFACT_ID));
     expectLastCall().andReturn(mockUpdateCoreDirectory);
    
     mockHelper.replayAll();
View Full Code Here

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

   }
  
   @Test
   public void testCheckDir_notexists() {

     FileWrapper mockUpdateCoreDirectory = mockHelper.createMock(FileWrapper.class);
     expect(mockUpdateCoreDirectory.exists()).andReturn(false);
     expect(mockUpdateCoreDirectory.mkdir()).andReturn(true);
    
     expect(mockFileWrapperFactory.create(mockUpdateDirectory, UpdateUtil.CORE_ARTIFACT_ID));
     expectLastCall().andReturn(mockUpdateCoreDirectory);
    
    
View Full Code Here

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

   }

   @Test
   public void testCheckDir_notexists_failure() {

     FileWrapper mockUpdateCoreDirectory = mockHelper.createMock(FileWrapper.class);
     expect(mockUpdateCoreDirectory.exists()).andReturn(false);
     expect(mockUpdateCoreDirectory.mkdir()).andReturn(false);
     expect(mockUpdateCoreDirectory.getAbsolutePath()).andReturn("/path/to/directory/that/was/not/made");
    
     expect(mockFileWrapperFactory.create(mockUpdateDirectory, UpdateUtil.CORE_ARTIFACT_ID));
     expectLastCall().andReturn(mockUpdateCoreDirectory);
    
    
View Full Code Here

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

   public void testLoadUpdateFromFileSystem() throws IOException {

     String pathToDirectoryThatContainsReleaseXml = "/path/to/release.xml/file";
     String releaseXmlFilePath = "/path/to/release.xml/file/release.xml";
    
     FileWrapper releaseXmlFileDir = getDirectoryMock("releaseXmlFileDir");
     FileWrapper releaseXmlFile = getFileMock("releaseXmlFile", releaseXmlFilePath);

     expect(mockFileWrapperFactory.create(pathToDirectoryThatContainsReleaseXml));
     expectLastCall().andReturn(releaseXmlFileDir);
     expect(mockFileWrapperFactory.create(releaseXmlFileDir, UpdateUtil.RELEASE_XML_FILENAME));
     expectLastCall().andReturn(releaseXmlFile);
View Full Code Here

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

     expect(status.getType()).andStubReturn(UpdateUtil.PLUGIN_ARTIFACT_ID);
     expect(status.getName()).andReturn(pluginFilename);
    expect(status.getChecksum()).andReturn(pluginFileCheckSum);
    expect(status.getSize()).andReturn(pluginFileByteSize);
   
     FileWrapper fileInDownlodDir = mockHelper.createMock("fileInDownlodDir", FileWrapper.class);    
    expect(fileInDownlodDir.getAbsolutePath()).andReturn(pluginFileAbsPath);
     expect(fileInDownlodDir.exists()).andReturn(true);
     expect(fileInDownlodDir.length()).andReturn(pluginFileByteSize);
     expect(mockFileWrapperFactory.create(mockDownloadsPluginDirectory, pluginFilename));
     expectLastCall().andReturn(fileInDownlodDir);
     expect(mockIOUtilities.getCheckSum(fileInDownlodDir)).andReturn(pluginFileCheckSum);
    
     mockHelper.replayAll();
View Full Code Here

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

   }  
  
   @Test
   public void testCopyDir() throws Exception {
     FileWrapper[] listOfFiles = new FileWrapper[1];
     FileWrapper mockFwJarFileWrapper = mockHelper.createMock("mockFwJarFileWrapper",FileWrapper.class);
     listOfFiles[0] = mockFwJarFileWrapper;
     expect(mockFwJarFileWrapper.exists()).andStubReturn(true);
     expect(mockFwJarFileWrapper.getName()).andReturn("fw.jar");
     expect(mockFwJarFileWrapper.getAbsolutePath()).andStubReturn("/squirrellibdir/test/path/fw.jar");
     expect(mockSquiirelLibDir.listFiles()).andStubReturn(listOfFiles);
    
     FileWrapper mockFwJarFileInDownloadsWrapper =
       mockHelper.createMock("mockFwJarFileInDownloadsWrapper", FileWrapper.class);
     expect(mockFwJarFileInDownloadsWrapper.getAbsolutePath()).andStubReturn("/downloads/test/path/fw.jar");
     expect(mockFwJarFileInDownloadsWrapper.exists()).andReturn(false);
    
     expect(mockFileWrapperFactory.create(mockDownloadsCoreDirectory, "fw.jar"));
     expectLastCall().andReturn(mockFwJarFileInDownloadsWrapper);
    
     mockIOUtilities.copyFile(mockFwJarFileWrapper, mockFwJarFileInDownloadsWrapper);
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.