Package org.ops4j.pax.exam.options

Examples of org.ops4j.pax.exam.options.DefaultCompositeOption


        final String httpPort = System.getProperty(PROP_HTTP_PORT, String.valueOf(getAvailablePort()));
       
        log.info("{}={}", PROP_TELNET_PORT, telnetPort);
        log.info("{}={}", PROP_HTTP_PORT, httpPort);
               
        return new DefaultCompositeOption(
                junitBundles(),
                systemProperty( "org.ops4j.pax.logging.DefaultServiceLog.level" ).value(paxLogLevel),
                SlingPaxOptions.felixRemoteShellBundles(),
                SlingPaxOptions.slingBootstrapBundles(),
                SlingPaxOptions.slingLaunchpadBundles(launchpadVersion),
View Full Code Here


        );
    }
   
    public static CompositeOption slingBundleList(String groupId, String artifactId, String version, String type, String classifier) {
       
        final DefaultCompositeOption result = new DefaultCompositeOption();
       
        final String paxUrl = new StringBuilder()
        .append("mvn:")
        .append(groupId)
        .append("/")
        .append(artifactId)
        .append("/")
        .append(version == null ? "" : version)
        .append("/")
        .append(type == null ? "" : type)
        .append("/")
        .append(classifier == null ? "" : classifier)
        .toString();
       
        // TODO BundleList should take an InputStream - for now copy to a tmp file for parsing
        log.info("Getting bundle list {}", paxUrl);
        File tmp = null;
        final Collection<String> testRunModes = getTestRunModes();
        try {
            tmp = dumpMvnUrlToTmpFile(paxUrl);
            final BundleList list = BundleListUtils.readBundleList(tmp);
            int counter = 0;
            for(StartLevel s : list.getStartLevels()) {
               
                // Start level < 0 means bootstrap in our bundle lists
                final int startLevel = s.getStartLevel() < 0 ? 1 : s.getStartLevel();
               
                for(Bundle b : s.getBundles()) {
                    counter++;
                   
                    // TODO need better fragment detection
                    // (but pax exam should really detect that by itself?)
                    final List<String> KNOWN_FRAGMENTS = new ArrayList<String>();
                    KNOWN_FRAGMENTS.add("org.apache.sling.extensions.webconsolebranding");
                    final boolean isFragment = b.getArtifactId().contains("fragment") || KNOWN_FRAGMENTS.contains(b.getArtifactId());
                   
                    // Ignore bundles with run modes that do not match ours
                    final String bundleRunModes = b.getRunModes();
                    if(bundleRunModes != null && bundleRunModes.length() > 0) {
                        boolean active = false;
                        for(String m : bundleRunModes.split(",")) {
                            if(testRunModes.contains(m)) {
                                active = true;
                                break;
                            }
                        }
                        if(!active) {
                            log.info("Ignoring bundle {} as none of its run modes [{}] are active in this test run {}",
                                    new Object[] { b.getArtifactId(), bundleRunModes, testRunModes} );
                            continue;
                        }
                    }
                   
                    if(isFragment) {
                        result.add(mavenBundle(b.getGroupId(), b.getArtifactId(), b.getVersion()).noStart());
                    } else if(startLevel == 0){
                        result.add(mavenBundle(b.getGroupId(), b.getArtifactId(), b.getVersion()));
                    } else {
                        result.add(mavenBundle(b.getGroupId(), b.getArtifactId(), b.getVersion()).startLevel(startLevel));
                    }
                   
                    log.info("Bundle added: {}/{}/{}", new Object [] { b.getGroupId(), b.getArtifactId(), b.getVersion()});
                }
            }
View Full Code Here

       
        return result;
    }

    public static CompositeOption slingBootstrapBundles() {
        return new DefaultCompositeOption(
                mavenBundle("org.apache.felix", "org.apache.felix.http.jetty", "2.2.0"),
               
                // TODO: why is this needed?
                mavenBundle("org.apache.sling", "org.apache.sling.launchpad.api", "1.1.0")
        );
View Full Code Here

    }
   
    /** @param version can be null, to use default */
    public static CompositeOption felixRemoteShellBundles() {
        final String gogoVersion = "0.10.0";
        return new DefaultCompositeOption(
                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.gogo.runtime").version(gogoVersion),
                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.gogo.shell").version(gogoVersion),
                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.gogo.command").version(gogoVersion),
                mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.shell.remote").version("1.1.2")
        );
View Full Code Here

        return composite(mavenBundle("org.apache.felix", "org.apache.felix.http.bundle").versionAsInProject(),
            systemProperty("org.osgi.service.http.port").value(getServerPort()));
    }

    protected Option addExtraOptions() {
        return new DefaultCompositeOption();
    }
View Full Code Here

    @org.ops4j.pax.exam.Configuration
    public Option[] config() {
        final File thisProjectsBundle = new File(System.getProperty( "bundle.file.name", "BUNDLE_FILE_NOT_SET" ));
        final String launchpadVersion = System.getProperty("sling.launchpad.version", "LAUNCHPAD_VERSION_NOT_SET");
        return new DefaultCompositeOption(
                SlingPaxOptions.defaultLaunchpadOptions(launchpadVersion),
                CoreOptions.provision(CoreOptions.bundle(thisProjectsBundle.toURI().toString()))
                ).getOptions();
    }
View Full Code Here

                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
        );
    }

    public static Option junitAndMockitoBundles() {
        return new DefaultCompositeOption(
                // Repository required to load harmcrest (OSGi-fied version).
                repository("http://repository.springsource.com/maven/bundles/external").id(
                        "com.springsource.repository.bundles.external"),

                // Hamcrest with a version matching the range expected by Mockito
View Full Code Here

        ipojoHelper.dispose();
        osgiHelper.dispose();
    }

    public static CompositeOption ipojoBundles() {
        return new DefaultCompositeOption(
                mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(),
                mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(),
                // The tested handler
                mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.jmx").versionAsInProject()
        );
View Full Code Here

                eventadmin()
        };
    }

    public CompositeOption eventadmin() {
        return new DefaultCompositeOption(
                mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.3.0"),
                mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.eventadmin").versionAsInProject());
    }
View Full Code Here

    return debugModeOn;
  }

  protected CompositeOption packApamConflictManager() {
    CompositeOption apamObrmanConfig = new DefaultCompositeOption(
        mavenBundle("fr.imag.adele.apam", "manager.conflict")
            .versionAsInProject());

    return apamObrmanConfig;
  }
View Full Code Here

TOP

Related Classes of org.ops4j.pax.exam.options.DefaultCompositeOption

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.