Search in sources :

Example 1 with InstanceConfigException

use of org.apache.sling.testing.clients.util.config.InstanceConfigException in project sling by apache.

the class OsgiInstanceConfig method restore.

/**
     * Restore the current OSGi configuration for the PID defined in the constructor
     *
     * @throws InstanceConfigException if the config cannot be restored
     */
public InstanceConfig restore() throws InstanceConfigException, InterruptedException {
    try {
        osgiClient.waitEditConfiguration(WAIT_TIMEOUT, this.configPID, null, config);
        LOG.info("restored OSGi config for {}. It is now this: {}", this.configPID, this.config);
    } catch (ClientException e) {
        throw new InstanceConfigException("Could not edit OSGi configuration", e);
    } catch (TimeoutException e) {
        throw new InstanceConfigException("Timeout of " + WAIT_TIMEOUT + " ms was reached while waiting for the configuration", e);
    }
    return this;
}
Also used : InstanceConfigException(org.apache.sling.testing.clients.util.config.InstanceConfigException) ClientException(org.apache.sling.testing.clients.ClientException) TimeoutException(java.util.concurrent.TimeoutException)

Example 2 with InstanceConfigException

use of org.apache.sling.testing.clients.util.config.InstanceConfigException in project sling by apache.

the class OsgiInstanceConfig method save.

/**
     * Save the current OSGi configuration for the PID defined in the constructor
     *
     * @throws InstanceConfigException if the config cannot be saved
     */
public InstanceConfig save() throws InstanceConfigException, InterruptedException {
    try {
        this.config = osgiClient.waitGetConfiguration(WAIT_TIMEOUT, this.configPID);
        LOG.info("Saved OSGi config for {}. It is currently this: {}", this.configPID, this.config);
    } catch (ClientException e) {
        throw new InstanceConfigException("Error getting config", e);
    } catch (TimeoutException e) {
        throw new InstanceConfigException("Timeout of " + WAIT_TIMEOUT + " ms was reached while waiting for the configuration", e);
    }
    return this;
}
Also used : InstanceConfigException(org.apache.sling.testing.clients.util.config.InstanceConfigException) ClientException(org.apache.sling.testing.clients.ClientException) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

TimeoutException (java.util.concurrent.TimeoutException)2 ClientException (org.apache.sling.testing.clients.ClientException)2 InstanceConfigException (org.apache.sling.testing.clients.util.config.InstanceConfigException)2