@Override public void evaluate() throws Throwable { boolean runInContainer = getDeploymentMethod(target).getAnnotation(Deployment.class).testable(); if (runInContainer) { evaluateParametersInContainer(base, target); } else { evaluateParametersInClient(base, target); } } };
@Override public void evaluate() throws Throwable { boolean runInContainer = getDeploymentMethod(target).getAnnotation(Deployment.class).testable(); if (runInContainer) { evaluateParametersInContainer(base, target); } else { evaluateParametersInClient(base, target); } } };
/** * Checks if the given test class has a testable deployment * * @param testClass to be checked * @return whether the given test class has a testable deployment */ public static boolean hasTestableDeployment(TestClass testClass) { Method[] methods = testClass.getMethods(Deployment.class); for (Method method : methods) { if (method.getAnnotation(Deployment.class).testable()) { return true; } } return false; }
if (method.isAnnotationPresent(ShouldThrowException.class) || !method.getAnnotation(Deployment.class).testable()) { setAsClientMode(true);
/** * Verifies that all client-side only tests does not have @Deployment that is testable. */ public void verifyThatRunAsClientClassIsNotTestable(@Observes BeforeClass event) { TestClass testClass = event.getTestClass(); // run-as-client class if (testClass.getAnnotation(RunAsClient.class) != null) { // get Deployment annotation Deployment deployment = testClass.getMethod(Deployment.class).getAnnotation(Deployment.class); // Deployment is testable if (deployment.testable()) { throw new IllegalArgumentException("Test that is marked as @RunAsClient should not use @Deployment(testable=true): " + testClass.getJavaClass().getName()); } } } }
@Override public void enrich(Object testCase) { // Process {@link StartLevelAware} on the {@link Deployment} Class<? extends Object> testClass = testCase.getClass(); for (Method method : testClass.getDeclaredMethods()) { if (method.isAnnotationPresent(Deployment.class)) { Deployment andep = method.getAnnotation(Deployment.class); if (andep.managed() && andep.testable() && method.isAnnotationPresent(StartLevelAware.class)) { StartLevelAware startLevelAware = method.getAnnotation(StartLevelAware.class); int bundleStartLevel = startLevelAware.startLevel(); Bundle bundle = getBundle(testCase); log.fine("Setting bundle start level of " + bundle + " to: " + bundleStartLevel); BundleStartLevel startLevel = bundle.adapt(BundleStartLevel.class); startLevel.setStartLevel(bundleStartLevel); if (startLevelAware.autostart()) { try { bundle.start(); } catch (BundleException ex) { log.log(Level.SEVERE, ex.getMessage(), ex); } } } } } }
@Override public void enrich(Object testCase) { // Process {@link StartLevelAware} on the {@link Deployment} Class<? extends Object> testClass = testCase.getClass(); for (Method method : testClass.getDeclaredMethods()) { if (method.isAnnotationPresent(Deployment.class)) { Deployment andep = method.getAnnotation(Deployment.class); if (andep.managed() && andep.testable() && method.isAnnotationPresent(StartLevelAware.class)) { StartLevelAware startLevelAware = method.getAnnotation(StartLevelAware.class); Bundle bundle = getBundle(testCase); if (bundle != null) { int bundleStartLevel = startLevelAware.startLevel(); log.fine("Setting bundle start level of " + bundle + " to: " + bundleStartLevel); BundleStartLevel startLevel = bundle.adapt(BundleStartLevel.class); startLevel.setStartLevel(bundleStartLevel); if (startLevelAware.autostart()) { try { bundle.start(); } catch (BundleException ex) { log.log(Level.SEVERE, ex.getMessage(), ex); } } } } } } }
@Override public void enrich(Object testCase) { // Process {@link StartLevelAware} on the {@link Deployment} Class<? extends Object> testClass = testCase.getClass(); for (Method method : testClass.getDeclaredMethods()) { if (method.isAnnotationPresent(Deployment.class)) { Deployment andep = method.getAnnotation(Deployment.class); if (andep.managed() && andep.testable() && method.isAnnotationPresent(StartLevelAware.class)) { StartLevelAware startLevelAware = method.getAnnotation(StartLevelAware.class); Bundle bundle = getBundle(testCase); if (bundle != null) { int bundleStartLevel = startLevelAware.startLevel(); log.fine("Setting bundle start level of " + bundle + " to: " + bundleStartLevel); BundleStartLevel startLevel = bundle.adapt(BundleStartLevel.class); startLevel.setStartLevel(bundleStartLevel); if (startLevelAware.autostart()) { try { bundle.start(); } catch (BundleException ex) { log.log(Level.SEVERE, ex.getMessage(), ex); } } } } } } }
m.getAnnotation(org.jboss.arquillian.container.test.api.Deployment.class); if (deploymentAnnotation.name().equals(deploymentName) && deploymentAnnotation.testable()) { log.warning( "The test method "
m.getAnnotation(org.jboss.arquillian.container.test.api.Deployment.class); if (deploymentAnnotation.name().equals(deploymentName) && deploymentAnnotation.testable()) { log.warning( "The test method "
/** * @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(); }
deployment.shouldBeTestable(deploymentAnnotation.testable());
deployment.shouldBeTestable(deploymentAnnotation.testable());
deploymentDescription = new DeploymentDescription(deployment.name(), manipulateArchive(testClass, deployment.name(), deploymentConfiguration.getArchive())); deploymentDescription.shouldBeTestable(deployment.testable()); } else if (deploymentConfiguration.getDescriptor() != null) { deploymentDescription = new DeploymentDescription(deployment.name(), deploymentConfiguration.getDescriptor());
deploymentDescription = new DeploymentDescription(deployment.name(), manipulateArchive(testClass, deployment.name(), deploymentConfiguration.getArchive())); deploymentDescription.shouldBeTestable(deployment.testable()); } else if (deploymentConfiguration.getDescriptor() != null) { deploymentDescription = new DeploymentDescription(deployment.name(), deploymentConfiguration.getDescriptor());