@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); 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); } } } } } } }
/** * @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.shouldBeManaged(deploymentAnnotation.managed()); deployment.setOrder(deploymentAnnotation.order()); if (target != null)
deployment.shouldBeManaged(deploymentAnnotation.managed()); deployment.setOrder(deploymentAnnotation.order()); if (target != null)
deploymentDescription.shouldBeManaged(deployment.managed()); deploymentDescription.setOrder(deployment.order());
deploymentDescription.shouldBeManaged(deployment.managed()); deploymentDescription.setOrder(deployment.order());