/** * @param targetsContainer * @return */ private TargetDescription generateTarget(TargetsContainer targetsContainer) { if (targetsContainer != null) { return new TargetDescription(targetsContainer.value()); } return TargetDescription.DEFAULT; }
/** * @param targetsContainer * @return */ private TargetDescription generateTarget(TargetsContainer targetsContainer) { if (targetsContainer != null) { return new TargetDescription(targetsContainer.value()); } return TargetDescription.DEFAULT; }
/** * @param deploymentMethod * @return */ private TargetDescription generateTarget(Method deploymentMethod) { if (deploymentMethod.isAnnotationPresent(TargetsContainer.class)) { return new TargetDescription(deploymentMethod.getAnnotation(TargetsContainer.class).value()); } return TargetDescription.DEFAULT; }
/** * @param deploymentMethod * @return */ private TargetDescription generateTarget(Method deploymentMethod) { if (deploymentMethod.isAnnotationPresent(TargetsContainer.class)) { return new TargetDescription(deploymentMethod.getAnnotation(TargetsContainer.class).value()); } return TargetDescription.DEFAULT; }
protected HTTPContext locateHTTPContext(Method method) { TargetsContainer targetContainer = method.getAnnotation(TargetsContainer.class); if (targetContainer != null) { String targetName = targetContainer.value(); for (HTTPContext context : contexts) { if (targetName.equals(context.getName())) { return context; } } throw new IllegalArgumentException("Could not determin HTTPContext from ProtocolMetadata for target: " + targetName + ". Verify that the given target name in @" + TargetsContainer.class.getSimpleName() + " match a name returned by the deployment container"); } return contexts.toArray(new HTTPContext[] {})[0]; } }
private HTTPContext locateHTTPContext(Method method, Collection<HTTPContext> contexts) { TargetsContainer targetContainer = method.getAnnotation(TargetsContainer.class); if (targetContainer != null) { String targetName = targetContainer.value(); for (HTTPContext context : contexts) { if (targetName.equals(context.getName())) { return context; } } throw new IllegalArgumentException("Could not determin HTTPContext from ProtocolMetadata for target: " + targetName + ". Verify that the given target name in @" + TargetsContainer.class.getSimpleName() + " match a name returned by the deployment container"); } return contexts.toArray(new HTTPContext[] {})[0]; }
private HTTPContext locateHTTPContext(Method method, Collection<HTTPContext> contexts) { TargetsContainer targetContainer = method.getAnnotation(TargetsContainer.class); if (targetContainer != null) { String targetName = targetContainer.value(); for (HTTPContext context : contexts) { if (targetName.equals(context.getName())) { return context; } } throw new IllegalArgumentException("Could not determin HTTPContext from ProtocolMetadata for target: " + targetName + ". Verify that the given target name in @" + TargetsContainer.class.getSimpleName() + " match a name returned by the deployment container"); } return contexts.toArray(new HTTPContext[] {})[0]; }
protected HTTPContext locateHTTPContext(Method method) { TargetsContainer targetContainer = method.getAnnotation(TargetsContainer.class); if (targetContainer != null) { String targetName = targetContainer.value(); for (HTTPContext context : contexts) { if (targetName.equals(context.getName())) { return context; } } throw new IllegalArgumentException("Could not determin HTTPContext from ProtocolMetadata for target: " + targetName + ". Verify that the given target name in @" + TargetsContainer.class.getSimpleName() + " match a name returned by the deployment container"); } return contexts.toArray(new HTTPContext[] {})[0]; } }
private HTTPContext locateHTTPContext(Method method, Collection<HTTPContext> contexts) { TargetsContainer targetContainer = method.getAnnotation(TargetsContainer.class); if (targetContainer != null) { String targetName = targetContainer.value(); for (HTTPContext context : contexts) { if (targetName.equals(context.getName())) { return context; } } throw new IllegalArgumentException( "Could not determin HTTPContext from ProtocolMetadata for target: " + targetName + ". Verify that the given target name in @" + TargetsContainer.class.getSimpleName() + " match a name returned by the deployment container"); } return contexts.toArray(new HTTPContext[] {})[0]; }
/** * Looks up the object in the containers context. The container used is provided by the {@link TargetsContainer} * annotation. * * @param targetsContainer the target container * @param resource the resource annotation * @param qualifiers any qualifier annotations * * @return the object found in the context */ private Object lookupInContainerContext(final TargetsContainer targetsContainer, final ArquillianResource resource, final Annotation... qualifiers) { final ContainerRegistry registry = containerRegistryInstance.get(); final ContainerContext context = containerContext.get(); boolean contextActivated = false; try { final String name = targetsContainer.value(); final Container container = registry.getContainer(name); if (container == null) { throw new IllegalArgumentException(String.format("No container named %s found in the registry.", name)); } context.activate(name); contextActivated = true; return doLookup(resource, qualifiers); } finally { if (contextActivated) { context.deactivate(); } } }
/** * Looks up the object in the containers context. The container used is provided by the {@link TargetsContainer} * annotation. * * @param targetsContainer the target container * @param resource the resource annotation * @param qualifiers any qualifier annotations * * @return the object found in the context */ protected Object lookupInContainerContext(final TargetsContainer targetsContainer, final ArquillianResource resource, final Annotation... qualifiers) { final ContainerRegistry registry = containerRegistryInstance.get(); final ContainerContext context = containerContext.get(); boolean contextActivated = false; try { final String name = targetsContainer.value(); final Container container = registry.getContainer(name); if (container == null) { throw new IllegalArgumentException(String.format("No container named %s found in the registry.", name)); } context.activate(name); contextActivated = true; return doLookup(resource, qualifiers); } finally { if (contextActivated) { context.deactivate(); } } }
/** * Looks up the object in the containers context. The container used is provided by the {@link TargetsContainer} * annotation. * * @param targetsContainer the target container * @param resource the resource annotation * @param qualifiers any qualifier annotations * * @return the object found in the context */ private Object lookupInContainerContext(final TargetsContainer targetsContainer, final ArquillianResource resource, final Annotation... qualifiers) { final ContainerRegistry registry = containerRegistryInstance.get(); final ContainerContext context = containerContext.get(); boolean contextActivated = false; try { final String name = targetsContainer.value(); final Container container = registry.getContainer(name); if (container == null) { throw new IllegalArgumentException(String.format("No container named %s found in the registry.", name)); } context.activate(name); contextActivated = true; return doLookup(resource, qualifiers); } finally { if (contextActivated) { context.deactivate(); } } }
/** * @param deploymentMethod * @return */ private DeploymentConfiguration generateDeploymentContent(Method deploymentMethod) { Deployment deploymentAnnotation = deploymentMethod.getAnnotation(Deployment.class); DeploymentConfiguration.DeploymentContentBuilder deploymentContentBuilder = null; if (Archive.class.isAssignableFrom(deploymentMethod.getReturnType())) { deploymentContentBuilder = new DeploymentConfiguration.DeploymentContentBuilder(invoke(Archive.class, deploymentMethod)); } else if (Descriptor.class.isAssignableFrom(deploymentMethod.getReturnType())) { deploymentContentBuilder = new DeploymentConfiguration.DeploymentContentBuilder(invoke(Descriptor.class, deploymentMethod)); } if (deploymentMethod.isAnnotationPresent(OverProtocol.class)) { deploymentContentBuilder.withOverProtocol(deploymentMethod.getAnnotation(OverProtocol.class).value()); } if (deploymentMethod.isAnnotationPresent(TargetsContainer.class)) { deploymentContentBuilder.withTargetsContainer(deploymentMethod.getAnnotation(TargetsContainer.class).value()); } if (deploymentMethod.isAnnotationPresent(ShouldThrowException.class)) { final ShouldThrowException shouldThrowException = deploymentMethod.getAnnotation(ShouldThrowException.class); deploymentContentBuilder.withShouldThrowException(shouldThrowException.value(), shouldThrowException.testable()); } deploymentContentBuilder = deploymentContentBuilder.withDeployment() .withManaged(deploymentAnnotation.managed()) .withName(deploymentAnnotation.name()) .withOrder(deploymentAnnotation.order()) .withTestable(deploymentAnnotation.testable()) .build(); return deploymentContentBuilder.get(); }
/** * @param deploymentMethod * @return */ private DeploymentConfiguration generateDeploymentContent(Method deploymentMethod) { Deployment deploymentAnnotation = deploymentMethod.getAnnotation(Deployment.class); DeploymentConfiguration.DeploymentContentBuilder deploymentContentBuilder = null; if (Archive.class.isAssignableFrom(deploymentMethod.getReturnType())) { deploymentContentBuilder = new DeploymentConfiguration.DeploymentContentBuilder(invoke(Archive.class, deploymentMethod)); } else if (Descriptor.class.isAssignableFrom(deploymentMethod.getReturnType())) { deploymentContentBuilder = new DeploymentConfiguration.DeploymentContentBuilder(invoke(Descriptor.class, deploymentMethod)); } if (deploymentMethod.isAnnotationPresent(OverProtocol.class)) { deploymentContentBuilder.withOverProtocol(deploymentMethod.getAnnotation(OverProtocol.class).value()); } if (deploymentMethod.isAnnotationPresent(TargetsContainer.class)) { deploymentContentBuilder.withTargetsContainer(deploymentMethod.getAnnotation(TargetsContainer.class).value()); } if (deploymentMethod.isAnnotationPresent(ShouldThrowException.class)) { final ShouldThrowException shouldThrowException = deploymentMethod.getAnnotation(ShouldThrowException.class); deploymentContentBuilder.withShouldThrowException(shouldThrowException.value(), shouldThrowException.testable()); } deploymentContentBuilder = deploymentContentBuilder.withDeployment() .withManaged(deploymentAnnotation.managed()) .withName(deploymentAnnotation.name()) .withOrder(deploymentAnnotation.order()) .withTestable(deploymentAnnotation.testable()) .build(); return deploymentContentBuilder.get(); }
HTTPContext context = null; if (targets != null) { context = locateNamedHttpContext(metaData, targets.value()); } else { context = metaData.getContexts(HTTPContext.class).iterator().next();
HTTPContext context = null; if (targets != null) { context = locateNamedHttpContext(metaData, targets.value()); } else { context = metaData.getContexts(HTTPContext.class).iterator().next();