Package com.xebialabs.overthere

Examples of com.xebialabs.overthere.OverthereFile.copyTo()


      motd1.renameTo(motd2);
      System.err.println("Exists #1: " + motd1.exists());
      System.err.println("Exists #2: " + motd2.exists());

      motd2.copyTo(motd1);
      System.err.println("Exists #1: " + motd1.exists());
      System.err.println("Exists #2: " + motd2.exists());

      motd1.delete();
      motd2.delete();
View Full Code Here


                return tempFile.getOutputStream();
            }
        });
        BaseOverthereFile spy = mock(BaseOverthereFile.class);
        when(spy.getConnection()).thenReturn((BaseOverthereConnection) connection);
        tempFile.copyTo(spy);
        verify(spy, times(1)).shortCircuitCopyFrom(tempFile);
    }

    @Test
    public void shouldNotDoLocalCopyIfDifferentConnection() throws IOException {
View Full Code Here

                return tempFile.getOutputStream();
            }
        });
        BaseOverthereFile spy = mock(BaseOverthereFile.class);
        when(spy.getConnection()).thenReturn((BaseOverthereConnection) otherConnection);
        tempFile.copyTo(spy);
        verify(spy, times(1)).copyFrom(tempFile);
    }

    protected static byte[] generateRandomBytes(final int size) {
        byte[] randomBytes = new byte[size];
View Full Code Here

        File smallFile = temp.newFile("small.dat");
        byte[] contentsWritten = writeRandomBytes(smallFile, 1024);
        OverthereFile smallLocalFile = LocalFile.valueOf(smallFile);

        // copy local file to file in home dir
        smallLocalFile.copyTo(fileInHomeDir);

        assertThat(fileInHomeDir.exists(), equalTo(true));

        // restrict access to file in home dir
        connection.execute(sysoutHandler(), syserrHandler(), CmdLine.build("chmod", "0600", fileInHomeDir.getPath()));
View Full Code Here

        writeData(existingDestination, "**********\n**********\n**********\n**********\n**********\n".getBytes());

        final OverthereFile newSource = getLocalConnection().getTempFile("newContents");
        writeData(newSource, "++++++++++".getBytes());

        newSource.copyTo(existingDestination);

        byte[] bytes = readFile(existingDestination);
        assertThat(bytes.length, equalTo(10));
        assertThat(bytes, equalTo("++++++++++".getBytes()));
    }
View Full Code Here

      logs1.renameTo(logs2);
      System.err.println("Exists #1: " + logs1.exists());
      System.err.println("Exists #2: " + logs2.exists());

      logs2.copyTo(logs1);
      System.err.println("Exists #1: " + logs1.exists());
      System.err.println("Exists #2: " + logs2.exists());

      logs1.deleteRecursively();
      logs2.deleteRecursively();
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.