}
private Object runInDeploymentContext(ArquillianResource resource, Annotation... qualifiers)
{
DeploymentContext context = null;
DeploymentScenario scenario = null;
boolean activateContext = containsOperatesOnDeployment(qualifiers);
boolean contextActivated = false;
try
{
Deployment deployment = null;
if(activateContext)
{
context = deploymentContext.get();
scenario = deploymentScenario.get();
if(scenario == null)
{
throw new IllegalStateException("No " + DeploymentScenario.class.getSimpleName() + " found. " +
"Possible cause, @" + OperateOnDeployment.class.getSimpleName() + " is currently only supported on the client side. (@" + RunAsClient.class.getSimpleName() + ")");
}
OperateOnDeployment operatesOn = getOperatesOnDeployment(qualifiers);
deployment = scenario.deployment(new DeploymentTargetDescription(operatesOn.value()));
if(deployment == null)
{
throw new IllegalArgumentException(
"Could not operate on deployment (@" + OperateOnDeployment.class.getSimpleName() + "), " +
"no deployment found with name: " + operatesOn.value());