Search in sources :

Example 91 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class FileSystemOperations method copyDirectoryTo.

/**
     * Copies the contents of a directory to a new one
     *
     * @param fromDirName the source file to copy
     * @param toDirName the destination file to copy to
     * @param isRecursive whether to copy recursively or not
     */
@PublicAtsApi
public void copyDirectoryTo(@Validate(name = "fromDirName", type = ValidationType.STRING_NOT_EMPTY) String fromDirName, @Validate(name = "toDirName", type = ValidationType.STRING_NOT_EMPTY) String toDirName, @Validate(name = "isRecursive", type = ValidationType.NONE) boolean isRecursive) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { fromDirName, toDirName, isRecursive });
    // execute action
    IFileSystemOperations operations = getOperationsImplementationFor(this.atsAgent);
    if (operations instanceof LocalFileSystemOperations) {
        ((LocalFileSystemOperations) operations).copyDirectory(fromDirName, toDirName, isRecursive, this.failOnError);
        log.info("Successfully copied directory " + fromDirName + " to " + toDirName);
    } else {
        ((RemoteFileSystemOperations) operations).copyDirectory(fromDirName, toDirName, isRecursive, this.failOnError);
        log.info("Successfully copied directory " + fromDirName + " from local host to " + toDirName + " on " + this.atsAgent);
    }
}
Also used : LocalFileSystemOperations(com.axway.ats.core.filesystem.LocalFileSystemOperations) IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 92 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class FileSystemOperations method createFile.

/**
     * Creates a file. The content of the file is the letters of the English alphabet.
     * The letters themselves are either alphabetically sorted, or randomly generated,
     * depending on the value of the randomContent parameter.
     * The end of line character will be the default one for the system where this action is run.
     *
     * @param filePath the file to work with
     * @param size the size of the generated file
     * @param randomContent if true the method would generate a file with a random content
     */
@PublicAtsApi
public void createFile(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath, @Validate(name = "size", type = ValidationType.NUMBER_POSITIVE) long size, boolean randomContent) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { filePath, size, randomContent });
    // execute action
    IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
    operations.createFile(filePath, size, randomContent);
    // log the result of the operation
    log.info("Successfully created file by the name of " + filePath + " with size " + size);
}
Also used : IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 93 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class FileSystemOperations method getFileUID.

/**
     * Get the UID of a file or directory
     *
     * @param filePath the file to work with
     * @return the UID number
     */
@PublicAtsApi
public long getFileUID(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { filePath });
    long uid = -1L;
    // execute action
    IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
    uid = operations.getFileUID(filePath);
    // log the result of the operation
    log.debug("Successfully got the UID of " + filePath + getHostDescriptionSuffix());
    return uid;
}
Also used : IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 94 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class FileSystemOperations method readFile.

/**
     * Read file from specific byte position. Used for file tail.<br/>
     * <b>NOTE:</b> If the file is replaced with the same byte content, then no change is assumed and 'null' is returned
     *
     * @param fileName file name
     * @param fromBytePosition byte offset. Example: for already read 100 bytes next method call is expected to have 100 as value for this parameter
     * @return {@link FileTailInfo} object
     */
@PublicAtsApi
public FileTailInfo readFile(@Validate(name = "fileName", type = ValidationType.STRING_NOT_EMPTY) String fileName, @Validate(name = "fromBytePosition", type = ValidationType.NONE) long fromBytePosition) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { fileName, fromBytePosition });
    // execute action
    IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
    return operations.readFile(fileName, fromBytePosition);
}
Also used : IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 95 with PublicAtsApi

use of com.axway.ats.common.PublicAtsApi in project ats-framework by Axway.

the class FileSystemOperations method getLastLinesFromFile.

/**
     * Get the last lines from a file
     *
     * @param filePath the file to work with
     * @param numberOfLinesToRead the number of lines to read
     * @return the last lines
     */
@PublicAtsApi
public String[] getLastLinesFromFile(@Validate(name = "filePath", type = ValidationType.STRING_NOT_EMPTY) String filePath, @Validate(name = "numLinesToRead", type = ValidationType.NUMBER_GREATER_THAN_ZERO) int numberOfLinesToRead) {
    String[] lastLines = null;
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { filePath, numberOfLinesToRead });
    // execute action
    IFileSystemOperations operations = getOperationsImplementationFor(atsAgent);
    lastLines = operations.getLastLinesFromFile(filePath, numberOfLinesToRead);
    // log the result of the operation
    log.debug("Successfully got the last " + numberOfLinesToRead + " lines of '" + filePath + "'" + getHostDescriptionSuffix());
    return lastLines;
}
Also used : IFileSystemOperations(com.axway.ats.core.filesystem.model.IFileSystemOperations) Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

PublicAtsApi (com.axway.ats.common.PublicAtsApi)409 Validator (com.axway.ats.core.validation.Validator)66 SwingElementState (com.axway.ats.uiengine.utilities.swing.SwingElementState)60 WebElement (org.openqa.selenium.WebElement)57 IFileSystemOperations (com.axway.ats.core.filesystem.model.IFileSystemOperations)44 HiddenHtmlElementState (com.axway.ats.uiengine.utilities.hiddenbrowser.HiddenHtmlElementState)32 NoSuchMimePackageException (com.axway.ats.action.objects.model.NoSuchMimePackageException)31 PackageException (com.axway.ats.action.objects.model.PackageException)31 RealHtmlElementState (com.axway.ats.uiengine.utilities.realbrowser.html.RealHtmlElementState)31 MessagingException (javax.mail.MessagingException)31 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)24 ArrayList (java.util.ArrayList)18 SeleniumOperationException (com.axway.ats.uiengine.exceptions.SeleniumOperationException)16 UiElementException (com.axway.ats.uiengine.exceptions.UiElementException)16 IOException (java.io.IOException)16 JTableFixture (org.fest.swing.fixture.JTableFixture)16 Actions (org.openqa.selenium.interactions.Actions)16 NotSupportedOperationException (com.axway.ats.uiengine.exceptions.NotSupportedOperationException)15 VerifyNotEqualityException (com.axway.ats.uiengine.exceptions.VerifyNotEqualityException)15 XMLException (com.axway.ats.common.xml.XMLException)14