public class DefaultReplicationAgents extends Object implements org.junit.rules.TestRule
Adapts the default replication agents on the author to target the provided publish.
WARNING: make sure the input Instance rules (authorRule and publishRule) are applied
before this one, otherwise it will fail to retrieve the urls of the two instances.
The easiest way is to use a RuleChain
, where this rule is the last one
Usually this is applied at class level to avoid stressing the target instance for each test
Constructor and Description |
---|
DefaultReplicationAgents(org.apache.sling.testing.junit.rules.instance.Instance authorRule,
org.apache.sling.testing.junit.rules.instance.Instance publishRule) |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
protected void |
cleanup()
Performs the cleanup after evaluating the statement.
|
protected boolean |
configure()
Whether to configure the agents or not.
|
protected void |
configureReplicationAgents()
Configure the replication agents to
getReplicationAgent() and getReverseReplicationAgent() |
protected String |
getReplicationAgent()
Returns the path to the replication agent on the publishRule instance.
|
protected String |
getReverseReplicationAgent()
Returns the path to the reverse replication agent on the publishRule instance.
|
public DefaultReplicationAgents(org.apache.sling.testing.junit.rules.instance.Instance authorRule, org.apache.sling.testing.junit.rules.instance.Instance publishRule)
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
protected boolean configure()
Whether to configure the agents or not.
Used to ensure that the agents are configured only if a certain condition is met. This default implementation always returns true, but subclasses can override it.
protected void configureReplicationAgents() throws org.apache.sling.testing.clients.ClientException, InterruptedException
getReplicationAgent()
and getReverseReplicationAgent()
org.apache.sling.testing.clients.ClientException
- if an error happened during configurationInterruptedException
- to mark this operation as waiting; the exception should be thrown up the stackprotected void cleanup()
protected String getReplicationAgent()
ReplicationClient.PUBLISH_REPLICATION_DEFAULT_AGENT
protected String getReverseReplicationAgent()
ReplicationClient.PUBLISH_REVERSE_REPLICATION_DEFAULT_AGENT
Copyright © 2018. All rights reserved.