Search in sources :

Example 21 with PublicAtsApi

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

the class RegistryOperations method setIntValue.

/**
     * Applies a Integer(REG_DWORD) value on the specified key.
     *
     * The key will be created if does not exist.
     * The key type will be changed if needed.
     *
     * @param keyPath path to the key
     * @param keyName name of the key
     * @param keyValue the new key value
     */
@PublicAtsApi
public void setIntValue(@Validate(name = "keyPath", type = ValidationType.STRING_NOT_EMPTY) String keyPath, @Validate(name = "keyName", type = ValidationType.STRING_NOT_EMPTY) String keyName, @Validate(name = "keyValue", type = ValidationType.NONE) int keyValue) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
    registryOperationsImpl.setIntValue(rootKey, keyPath, keyName, keyValue);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 22 with PublicAtsApi

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

the class FileSystemSnapshotException method getFilesPresentInOneSnapshotOnly.

/**
     * Get the all files which are present in just one of the snapshots.
     * </br>Note that <b>null</b> is returned if provide a not existing snapshot name.
     *
     * @param snapshot snapshot name
     * @return list of matching files
     */
@PublicAtsApi
public List<String> getFilesPresentInOneSnapshotOnly(String snapshot) {
    DifferenceType searchedDiffType;
    if (equality.getFirstSnapshotName().equals(snapshot)) {
        searchedDiffType = DifferenceType.FILE_PRESENT_IN_FIRST_SNAPSHOT_ONLY;
    } else if (equality.getSecondSnapshotName().equals(snapshot)) {
        searchedDiffType = DifferenceType.FILE_PRESENT_IN_SECOND_SNAPSHOT_ONLY;
    } else {
        return null;
    }
    List<String> files = new ArrayList<String>();
    for (FileTrace diff : equality.getDifferences()) {
        if (diff.getDifferenceType() == searchedDiffType) {
            files.add(diff.toString());
        }
    }
    return files;
}
Also used : ArrayList(java.util.ArrayList) FileTrace(com.axway.ats.common.filesystem.snapshot.equality.FileTrace) DifferenceType(com.axway.ats.common.filesystem.snapshot.equality.DifferenceType) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 23 with PublicAtsApi

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

the class FileEnvironmentUnit method backup.

@Override
@PublicAtsApi
public void backup() throws EnvironmentCleanupException {
    try {
        String backupFileAsString = getBackupFile();
        createDirIfNotExist(backupFileAsString);
        if (new File(origFileName).exists()) {
            copyFile(origFileName, backupFileAsString);
            // fix the modification date of the backup file
            File origFile = new File(origFileName);
            File backupFile = new File(backupFileAsString);
            backupFile.setLastModified(origFile.lastModified());
        } else if (new File(backupFileAsString).exists()) {
            if (!new File(backupFileAsString).delete()) {
                throw new EnvironmentCleanupException("File " + backupFileAsString + " must be removed, but the delete operation fails.");
            }
        }
    } catch (FileNotFoundException fnfe) {
        log.warn("Cannot backup file: " + origFileName + " Skipping it.", fnfe);
    } catch (IOException ioe) {
        throw new EnvironmentCleanupException("Could not backup file " + origFileName, ioe);
    } finally {
        setTempBackupDir(null);
    }
}
Also used : EnvironmentCleanupException(com.axway.ats.environment.EnvironmentCleanupException) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) File(java.io.File) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 24 with PublicAtsApi

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

the class FileSystemVerification method checkMd5.

/**
     * Add rule to check that the MD5 sum of the received file is the same
     * as the MD5 sum of the source file in the selected mode - binary or ASCII
     *
     * @param srcAtsAgent       the remote ATS agent address on which the source file is located
     * @param srcFile           the full name of the file
     * @param binaryMode        true to check in binary mode, false to check in ASCII mode
     * @throws RbvException     thrown on error
     */
@PublicAtsApi
public void checkMd5(String srcAtsAgent, String srcFile, boolean binaryMode) throws RbvException {
    FileMd5Rule rule = new FileMd5Rule(srcAtsAgent, srcFile, binaryMode, "checkMd5", true);
    rootRule.addRule(rule);
}
Also used : FileMd5Rule(com.axway.ats.rbv.filesystem.rules.FileMd5Rule) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 25 with PublicAtsApi

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

the class FileSystemVerification method checkOwnerName.

/**
     * Add rule to check that the owner name of the received file is the same
     * as the owner name of the source file (NOT SUPPORTED ON WINDOWS)
     * 
     * @param owner             the owner name
     * @throws RbvException     thrown on error
     */
@PublicAtsApi
public void checkOwnerName(String owner) throws RbvException {
    FileOwnerNameRule rule = new FileOwnerNameRule(owner, "checkOwnerName", true);
    rootRule.addRule(rule);
}
Also used : FileOwnerNameRule(com.axway.ats.rbv.filesystem.rules.FileOwnerNameRule) 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