Search in sources :

Example 16 with PublicAtsApi

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

the class MimePackage method getAllStreams.

@PublicAtsApi
public List<InputStream> getAllStreams() throws PackageException {
    boolean storeReconnected = false;
    try {
        // store should be opened for actions including getting InputStream.
        storeReconnected = reconnectStoreIfClosed();
        ArrayList<InputStream> streams = new ArrayList<InputStream>();
        try {
            for (MimePart part : parts) {
                streams.add(part.getInputStream());
            }
        } finally {
            closeStoreConnection(storeReconnected);
        }
        return streams;
    } catch (MessagingException me) {
        throw new PackageException("Could not read mime parts", me);
    } catch (IOException ioe) {
        throw new PackageException("Could not read mime parts", ioe);
    }
}
Also used : MessagingException(javax.mail.MessagingException) CheckedInputStream(java.util.zip.CheckedInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) SeekInputStream(com.axway.ats.core.io.SeekInputStream) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) MimePart(javax.mail.internet.MimePart) NoSuchMimePackageException(com.axway.ats.action.objects.model.NoSuchMimePackageException) PackageException(com.axway.ats.action.objects.model.PackageException) IOException(java.io.IOException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 17 with PublicAtsApi

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

the class MimePackage method setAttachmentFileName.

/**
     * Set/modify attachment file name
     *
     * @param attachmentPartIndex index among attachment parts only
     * @param fileName the file name. Add one or reset existing one
     * @throws NoSuchMimePartException if not such attachment part is found
     * @throws PackageException in case of other mail messaging exception
     */
@PublicAtsApi
public void setAttachmentFileName(int attachmentPartIndex, String fileName) throws PackageException {
    // first check if there is part at this position at all
    if (attachmentPartIndex >= attachmentPartIndices.size()) {
        throw new NoSuchMimePartException("No attachment at position '" + attachmentPartIndex + "'");
    }
    try {
        MimePart part = getPart(attachmentPartIndices.get(attachmentPartIndex));
        // set the attachment file name
        part.setFileName(fileName);
        // must save now
        this.message.saveChanges();
    } catch (MessagingException me) {
        throw new PackageException(me);
    }
}
Also used : MessagingException(javax.mail.MessagingException) NoSuchMimePartException(com.axway.ats.action.objects.model.NoSuchMimePartException) MimePart(javax.mail.internet.MimePart) NoSuchMimePackageException(com.axway.ats.action.objects.model.NoSuchMimePackageException) PackageException(com.axway.ats.action.objects.model.PackageException) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 18 with PublicAtsApi

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

the class RegistryOperations method setLongValue.

/**
     * Applies a Long(REG_QWORD) 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 setLongValue(@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) long keyValue) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
    registryOperationsImpl.setLongValue(rootKey, keyPath, keyName, keyValue);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 19 with PublicAtsApi

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

the class RegistryOperations method setBinaryValue.

/**
     * Applies a Binary(REG_BINARY) 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 setBinaryValue(@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.NOT_NULL) byte[] keyValue) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
    registryOperationsImpl.setBinaryValue(rootKey, keyPath, keyName, keyValue);
}
Also used : Validator(com.axway.ats.core.validation.Validator) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 20 with PublicAtsApi

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

the class RegistryOperations method setStringValue.

/**
     * Applies a String(REG_SZ) 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 setStringValue(@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.NOT_NULL) String keyValue) {
    // validate input parameters
    new Validator().validateMethodParameters(new Object[] { keyPath, keyName, keyValue });
    registryOperationsImpl.setStringValue(rootKey, keyPath, keyName, keyValue);
}
Also used : 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