private DeploymentTargetDescription locateDeployment(Method method) { DeploymentTargetDescription target = null; if (method.isAnnotationPresent(OperateOnDeployment.class)) { target = new DeploymentTargetDescription(method.getAnnotation(OperateOnDeployment.class).value()); } else { target = DeploymentTargetDescription.DEFAULT; } return target; }
private DeploymentTargetDescription locateDeployment(Method method) { DeploymentTargetDescription target = null; if (method.isAnnotationPresent(OperateOnDeployment.class)) { target = new DeploymentTargetDescription(method.getAnnotation(OperateOnDeployment.class).value()); } else { target = DeploymentTargetDescription.DEFAULT; } return target; }
/** * Returns a deployment name of a deployment the given {@link DronePoint} is tied to * * @param dronePoint * a {@link DronePoint} * * @return a deployment name of a deployment the given {@link DronePoint} is tied to */ private String getDeploymentName(DronePoint<?> dronePoint) { Annotation[] annotations = dronePoint.getAnnotations(); OperateOnDeployment operateOnDeployment = SecurityActions.findAnnotation(annotations, OperateOnDeployment.class); return operateOnDeployment.value(); } }
/** * Returns a deployment name of a deployment the given {@link DronePoint} is tied to * * @param dronePoint * a {@link DronePoint} * * @return a deployment name of a deployment the given {@link DronePoint} is tied to */ private String getDeploymentName(DronePoint<?> dronePoint) { Annotation[] annotations = dronePoint.getAnnotations(); OperateOnDeployment operateOnDeployment = SecurityActions.findAnnotation(annotations, OperateOnDeployment.class); return operateOnDeployment.value(); } }
RunAsClient.class)) { OperateOnDeployment onDeployment = testClass.getAnnotation(OperateOnDeployment.class); String deploymentName = onDeployment == null ? "_DEFAULT_" : onDeployment.value();
RunAsClient.class)) { OperateOnDeployment onDeployment = testClass.getAnnotation(OperateOnDeployment.class); String deploymentName = onDeployment == null ? "_DEFAULT_" : onDeployment.value();
public void observeBeforeTest(@Observes(precedence = Integer.MAX_VALUE) BeforeTestLifecycleEvent event) { Integer c = lifecycleCountRegister.get(event.getTestMethod()); int count = (c != null ? c.intValue() : 0); if (count == 0) { 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)); reporter.get().getLastTestClassReport().getTestMethodReports().add(testMethodReport); reporter.get().setTestMethodReport(testMethodReport); } lifecycleCountRegister.put(event.getTestMethod(), ++count); }
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; }
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; }