public boolean shouldStart() { return delegate.shouldStart(); }
public boolean shouldStart() { return delegate.shouldStart(); }
/** * Returns common scanner options. Ment to be used by subclasses when building the url. * * @param provision provision options to be used (cannot be null) * * @return common scanner options (cannot be null) */ static String getOptions( final ProvisionOption provision ) { final StringBuilder options = new StringBuilder(); if( provision.shouldUpdate() ) { options.append( SEPARATOR_OPTION ).append( OPTION_UPDATE ); } if( !provision.shouldStart() ) { options.append( SEPARATOR_OPTION ).append( OPTION_NO_START ); } if( provision.getStartLevel() != null ) { options.append( SEPARATOR_OPTION ).append( provision.getStartLevel() ); } return options.toString(); }
private void installAndStartBundles() throws BundleException, RemoteException, ExamConfigurationException { File workDir = new File(system.getTempFolder(), "pax-exam-downloads"); workDir.mkdirs(); List<Long> bundleIds = new ArrayList<Long>(); ProvisionOption<?>[] options = system.getOptions(ProvisionOption.class); bundlesById = new HashMap<Long, String>(); for (ProvisionOption<?> bundle : options) { String localUrl = downloadBundle(workDir, bundle.getURL()); long id = remoteFramework.installBundle(localUrl, bundle.shouldStart(),getStartLevel(bundle)); bundlesById.put(id,bundle.getURL()); if (bundle.shouldStart()) { bundleIds.add(id); } } remoteFramework.start(); setFrameworkStartLevel(); verifyThatBundlesAreResolved(bundleIds); }
startLevel = defaultStartLevel; if (bundle.shouldStart()) { bundles.append('@'); bundles.append(startLevel);
/** * Wrap provision options that are not already scanner provision bundles with a {@link org.ops4j.pax.exam.options.extra.BundleScannerProvisionOption} * in order to force update. * * @param options options to be wrapped (can be null or an empty array) * * @return eventual wrapped bundles */ private List<ProvisionOption<?>> wrap( ProvisionOption<?>[] options ) { final List<ProvisionOption<?>> processed = new ArrayList<ProvisionOption<?>>(); for( final ProvisionOption<?> provisionOption : options ) { if( !( provisionOption instanceof Scanner ) ) { processed.add( scanBundle( provisionOption ).start( provisionOption.shouldStart() ).startLevel( provisionOption.getStartLevel() ).update( provisionOption.shouldUpdate() ) ); } else { processed.add( provisionOption ); } } return processed; }
private void installAndStartBundle(ProvisionOption<?> bundle) { try { Bundle b = framework.getBundleContext().installBundle(bundle.getURL()); int startLevel = getStartLevel(bundle); BundleStartLevel sl = b.adapt(BundleStartLevel.class); sl.setStartLevel(startLevel); if (bundle.shouldStart()) { b.start(); LOG.debug("+ Install (start@{}) {}", startLevel, bundle); } else { LOG.debug("+ Install (no start) {}", bundle); } } catch (BundleException exc) { throw new TestContainerException("Error starting bundle " + bundle.getURL(), exc); } }
private void installAndStartBundles(BundleContext context) throws BundleException { List<Bundle> bundles = new ArrayList<Bundle>(); for (ProvisionOption<?> bundle : system.getOptions(ProvisionOption.class)) { Bundle b = context.installBundle(bundle.getURL()); bundles.add(b); int startLevel = getStartLevel(bundle); BundleStartLevel sl = b.adapt(BundleStartLevel.class); sl.setStartLevel(startLevel); if (bundle.shouldStart()) { try { b.start(); } catch (BundleException e) { throw new BundleException("Error starting bundle " + b.getSymbolicName() + ". " + e.getMessage(), e); } LOG.debug("+ Install (start@{}) {}", startLevel, bundle); } else { LOG.debug("+ Install (no start) {}", bundle); } } // All bundles are installed, we can now start the framework... framework.start(); FrameworkStartLevel fsl = framework.adapt(FrameworkStartLevel.class); setFrameworkStartLevel(context, fsl); verifyThatBundlesAreResolved(bundles); }
processed.add( scanBundle( provisionOption ).start( provisionOption.shouldStart() ).startLevel( provisionOption.getStartLevel() ).update( provisionOption.shouldUpdate() ) );