Package org.jboss.arquillian.container.test.api

Examples of org.jboss.arquillian.container.test.api.OperateOnDeployment


    // We can't instantiate class with wildcard generic parameter directly, so we delegate it through parameter <T>
    static <T> DronePoint<T> createInjectionPoint(DroneContext context, Class<T> droneType,
                                                  Annotation[] annotations,
                                                  DronePoint.Lifecycle defaultLifecycle) {
        Class<? extends Annotation> scopeAnnotation = SecurityActions.getScope(annotations);
        OperateOnDeployment operateOnDeployment = SecurityActions.findAnnotation(annotations,
                OperateOnDeployment.class);

        DronePoint.Lifecycle lifecycle = scopeForAnnotation(scopeAnnotation, operateOnDeployment, defaultLifecycle);


        DronePoint<T> dronePoint = new DronePointImpl<T>(droneType, lifecycle, annotations);
        // We register the drone point into context immediately
        context.get(dronePoint);
        if (lifecycle == DronePoint.Lifecycle.DEPLOYMENT) {
            String deployment = operateOnDeployment.value();
            context.get(dronePoint).setMetadata(DeploymentNameKey.class, deployment);
        }
        return dronePoint;
    }
View Full Code Here


    static InjectionPoint<?> resolveInjectionPoint(Field field) {
        Class<?> droneType = field.getType();
        Class<? extends Annotation> qualifier = SecurityActions.getQualifier(field);
        Class<? extends Annotation> scopeAnnotation = SecurityActions.getScope(field);
        OperateOnDeployment operateOnDeployment = SecurityActions.getAnnotation(field, OperateOnDeployment.class);

        return createInjectionPoint(droneType, qualifier, scopeAnnotation, InjectionPoint.Lifecycle.CLASS,
                operateOnDeployment);
    }
View Full Code Here

    }

    static <T> InjectionPoint<T> resolveInjectionPoint(Class<T> droneType, Annotation[] parameterAnnotations) {
        Class<? extends Annotation> qualifier = SecurityActions.getQualifier(parameterAnnotations);
        Class<? extends Annotation> scopeAnnotation = SecurityActions.getScope(parameterAnnotations);
        OperateOnDeployment operateOnDeployment = SecurityActions.findAnnotation(parameterAnnotations,
                OperateOnDeployment.class);

        return createInjectionPoint(droneType, qualifier, scopeAnnotation, InjectionPoint.Lifecycle.METHOD,
                operateOnDeployment);
    }
View Full Code Here

        if (scenario == null) {
            return;
        }
       
        boolean contextActivated = false;
        OperateOnDeployment deploymentSpecifier = getOperateOnDeployment(qualifiers);
        Deployment specificDeployment = null;
        if (deploymentSpecifier != null) {
            specificDeployment = scenario.deployment(new DeploymentTargetDescription(deploymentSpecifier.value()));
            if (specificDeployment == null) {
                throw new IllegalArgumentException("@" + OperateOnDeployment.class.getSimpleName() + " specified an unknown deployment '" + deploymentSpecifier.value());
            }
           
            deploymentContext.get().activate(specificDeployment);
            contextActivated = true;
        }
View Full Code Here

    }

    private Bundle getTestBundle(BundleContext syscontext, Class<?> testClass, String methodName) {
        Bundle bundle = ((BundleReference) testClass.getClassLoader()).getBundle();
        for (Method method : testClass.getMethods()) {
            OperateOnDeployment opon = method.getAnnotation(OperateOnDeployment.class);
            if (opon != null && methodName.equals(method.getName())) {
                for (Bundle aux : syscontext.getBundles()) {
                    if (aux.getLocation().equals(opon.value())) {
                        bundle = aux;
                        break;
                    }
                }
            }
View Full Code Here

            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());
            }
            context.activate(deployment);
            contextActivated = true;
         }
         return runInContainerContext(deployment == null ? null:deployment.getDescription().getTarget(), resource, qualifiers);
View Full Code Here

    }

    private Bundle getTestBundle(BundleContext syscontext, Class<?> testClass, String methodName) {
        Bundle bundle = ((BundleReference) testClass.getClassLoader()).getBundle();
        for (Method method : testClass.getMethods()) {
            OperateOnDeployment opon = method.getAnnotation(OperateOnDeployment.class);
            if (opon != null && methodName.equals(method.getName())) {
                for (Bundle aux : syscontext.getBundles()) {
                    if (aux.getLocation().equals(opon.value())) {
                        bundle = aux;
                        break;
                    }
                }
            }
View Full Code Here

    public void observeBeforeTest(@Observes(precedence = Integer.MAX_VALUE) Before event) {
        TestMethodReport testMethodReport = new TestMethodReport();
        testMethodReport.setName(event.getTestMethod().getName());

        if (event.getTestMethod().isAnnotationPresent(OperateOnDeployment.class)) {
            OperateOnDeployment ood = event.getTestMethod().getAnnotation(OperateOnDeployment.class);
            testMethodReport.setOperateOnDeployment(ood.value());
        } else {
            testMethodReport.setOperateOnDeployment("_DEFAULT_");
        }

        testMethodReport.setRunAsClient(event.getTestMethod().isAnnotationPresent(RunAsClient.class));
View Full Code Here

    }

    private Bundle getTestBundle(BundleContext syscontext, Class<?> testClass, String methodName) {
        Bundle bundle = ((BundleReference) testClass.getClassLoader()).getBundle();
        for (Method method : testClass.getMethods()) {
            OperateOnDeployment opon = method.getAnnotation(OperateOnDeployment.class);
            if (opon != null && methodName.equals(method.getName())) {
                for (Bundle aux : syscontext.getBundles()) {
                    if (aux.getLocation().equals(opon.value())) {
                        bundle = aux;
                        break;
                    }
                }
            }
View Full Code Here

    }

    private Bundle getTestBundle(BundleContext syscontext, Class<?> testClass, String methodName) {
        Bundle bundle = ((BundleReference) testClass.getClassLoader()).getBundle();
        for (Method method : testClass.getMethods()) {
            OperateOnDeployment opon = method.getAnnotation(OperateOnDeployment.class);
            if (opon != null && methodName.equals(method.getName())) {
                for (Bundle aux : syscontext.getBundles()) {
                    if (aux.getLocation().equals(opon.value())) {
                        bundle = aux;
                        break;
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.container.test.api.OperateOnDeployment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.