org.ops4j.pax.exam.Option Java Examples

The following examples show how to use org.ops4j.pax.exam.Option. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NexusPaxExamTestFactory.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public TestContainer[] create(final ExamSystem system) {
  return new KarafTestContainerFactory().create(
      // Pax-Exam ITs call fork just before unpacking each container instance
      new DelegatingExamSystem(system)
      {
        @Override
        public ExamSystem fork(final Option[] options) {
          final File installDir = nextInstallDirectory();
          return new DelegatingExamSystem(super.fork(options))
          {
            @Override
            public File getConfigFolder() {
              return installDir;
            }
          };
        }
      });
}
 
Example #2
Source File: OsgiBundleTest.java    From netty4.0.27Learn with Apache License 2.0 6 votes vote down vote up
@Configuration
public final Option[] config() {
    final Collection<Option> options = new ArrayList<Option>();

    options.add(systemProperty("pax.exam.osgi.unresolved.fail").value("true"));
    options.addAll(Arrays.asList(junitBundles()));

    options.add(mavenBundle("com.barchart.udt", "barchart-udt-bundle").versionAsInProject());
    options.add(wrappedBundle(mavenBundle("org.rxtx", "rxtx").versionAsInProject()));

    for (String name : BUNDLES) {
        options.add(mavenBundle(GROUP, name).versionAsInProject());
    }

    return options.toArray(new Option[0]);
}
 
Example #3
Source File: ConanProxyIT.java    From nexus-repository-conan with Eclipse Public License 1.0 5 votes vote down vote up
@Configuration
public static Option[] configureNexus() {
  return NexusPaxExamSupport.options(
      NexusITSupport.configureNexusBase(),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-conan")
  );
}
 
Example #4
Source File: P2RestoreBlobIT.java    From nexus-repository-p2 with Eclipse Public License 1.0 5 votes vote down vote up
@Configuration
public static Option[] configureNexus() {
  return NexusPaxExamSupport.options(
      NexusITSupport.configureNexusBase(),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-p2"),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-restore-p2")
  );
}
 
Example #5
Source File: P2RoutingRuleIT.java    From nexus-repository-p2 with Eclipse Public License 1.0 5 votes vote down vote up
@Configuration
public static Option[] configureNexus() {
  return NexusPaxExamSupport.options(
      NexusITSupport.configureNexusBase(),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-p2")
  );
}
 
Example #6
Source File: P2ProxyIT.java    From nexus-repository-p2 with Eclipse Public License 1.0 5 votes vote down vote up
@Configuration
public static Option[] configureNexus() {
  return NexusPaxExamSupport.options(
      NexusITSupport.configureNexusBase(),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-p2")
  );
}
 
Example #7
Source File: RGroupIT.java    From nexus-repository-r with Eclipse Public License 1.0 5 votes vote down vote up
@Configuration
public static Option[] configureNexus() {
  return NexusPaxExamSupport.options(
      NexusITSupport.configureNexusBase(),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-r"),
      editConfigurationFileExtend(NEXUS_PROPERTIES_FILE, "nexus.r.packagesBuilder.interval",
          String.valueOf(METADATA_PROCESSING_DELAY_MILLIS))
  );
}
 
Example #8
Source File: ArtemisOpenwireClientFeatureIT.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() throws IOException {
   return options(
           KARAF.option(),
           ARTEMIS_OPENWIRE_CLIENT.option(),
           ARTEMIS_TRANSACTION_MANAGER.option(),
           when(false)
                   .useOptions(
                           debugConfiguration("5005", true))
   );
}
 
Example #9
Source File: ApiOsgiTestBase.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() throws IOException
{
    List<Option> dependencies = new ArrayList<Option>();

    URL resource = getClass().getResource( "/" );
    File targetTestClassesDir = new File( resource.getFile() );
    File targetDependenciesDir = new File( targetTestClassesDir.getParent(), "dependency" );
    File[] files = targetDependenciesDir.listFiles();
    for ( File file : files )
    {
        if ( !skips.contains( file.getName() ) )
        {
            dependencies.add( url( file.toURI().toString() ) );
        }
    }

    // shuffle dependencies, there mustn't be any dependency on order
    Collections.shuffle( dependencies );

    return options(
        systemProperty( "org.ops4j.pax.logging.DefaultServiceLog.level" ).value( "WARN" ),
        systemProperty( "logback.configurationFile" ).value(
            "file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml" ),
        systemPackages( "javax.xml.stream;version=1.0.0", "javax.xml.stream.util;version=1.0.0",
            "javax.xml.stream.events;version=1.0.0" ), mavenBundle( "ch.qos.logback", "logback-classic", "1.0.6" ),
        mavenBundle( "ch.qos.logback", "logback-core", "1.0.6" ), junitBundles(),
        composite( dependencies.toArray( new Option[0] ) ) );
}
 
Example #10
Source File: AbstractKarafIntegrationTest.java    From jbpm-work-items with Apache License 2.0 5 votes vote down vote up
public static Option localMavenRepoOption() {
    String localRepo = System.getProperty("maven.repo.local",
                                          "");
    if (localRepo.length() > 0) {
        logger.info("Using alternative local Maven repository in {}.",
                    new File(localRepo).getAbsolutePath());
    }
    return when(localRepo.length() > 0).useOptions(
            //                systemProperty("org.ops4j.pax.url.mvn.localRepository").value(new File(localRepo).getAbsolutePath()));
            editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
                                     "org.ops4j.pax.url.mvn.localRepository",
                                     new File(localRepo).getAbsolutePath()),
            systemProperty(SYSTEM_PROP_MAVEN_CUSTOM_SETTINGS).value(kieCustomMavenSettingsXML()));
}
 
Example #11
Source File: AbstractKarafIntegrationTest.java    From jbpm-work-items with Apache License 2.0 5 votes vote down vote up
public static Option loadKieFeaturesRepo() {
    String classifier = "features";
    if (System.getProperty("kie.features.classifier") != null) {
        classifier = System.getProperty("kie.features.classifier");
    }
    return features(maven().groupId("org.kie")
                            .artifactId("kie-karaf-features")
                            .type("xml")
                            .classifier(classifier)
                            .versionAsInProject().getURL());
}
 
Example #12
Source File: AbstractKarafIntegrationTest.java    From jbpm-work-items with Apache License 2.0 5 votes vote down vote up
public static Option loadKieFeatures(String... features) {
    MavenArtifactProvisionOption featuresUrl = getFeaturesUrl("org.kie",
                                                              "kie-karaf-features",
                                                              KIE_VERSION);
    return features(featuresUrl,
                    features);
}
 
Example #13
Source File: ConanResourceIT.java    From nexus-repository-conan with Eclipse Public License 1.0 5 votes vote down vote up
@Configuration
public static Option[] configureNexus() {
  return options(
      configureNexusBase(),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-conan")
  );
}
 
Example #14
Source File: ConanProxySearchIT.java    From nexus-repository-conan with Eclipse Public License 1.0 5 votes vote down vote up
@Configuration
public static Option[] configureNexus() {
  return NexusPaxExamSupport.options(
      NexusITSupport.configureNexusBase(),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-conan")
  );
}
 
Example #15
Source File: ConanRoutingRuleIT.java    From nexus-repository-conan with Eclipse Public License 1.0 5 votes vote down vote up
@Configuration
public static Option[] configureNexus() {
  return NexusPaxExamSupport.options(
      NexusITSupport.configureNexusBase(),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-conan")
  );
}
 
Example #16
Source File: CleanupTaskConanProxyIT.java    From nexus-repository-conan with Eclipse Public License 1.0 5 votes vote down vote up
@Configuration
public static Option[] configureNexus() {
  return NexusPaxExamSupport.options(
      NexusITSupport.configureNexusBase(),
      nexusFeature("org.sonatype.nexus.plugins", "nexus-repository-conan")
  );
}
 
Example #17
Source File: BaseITest.java    From osgi-best-practices with Apache License 2.0 5 votes vote down vote up
public Option[] config() {
    return new Option[] //
            {
                    debug(),
                    karafDistributionConfiguration().frameworkUrl(karafUrl).unpackDirectory(new File("target", "exam"))
                            .useDeployFolder(false),
                    systemTimeout(30000),
                    systemProperty("karaf.log").value("log"), // Workaround for karaf 4.2.7 in exam
                    keepRuntimeFolder(), // Allows to easily introspect after run. Beware: Consumes lot of disk space over time
                    configureConsole().ignoreLocalConsole(),
                    localRepo(),
                    awaitility(),
                    features(osgibpRepo, "osgibp-backend")
            };
}
 
Example #18
Source File: HealthCheckSmokeIT.java    From sling-whiteboard with Apache License 2.0 5 votes vote down vote up
@Override
protected Option[] specificOptions() {
    return options(
        frameworkProperty("org.apache.felix.http.enable").value("false"),
        mavenBundle("org.apache.felix", "org.apache.felix.healthcheck.api", "2.0.3-SNAPSHOT"),
        mavenBundle("org.apache.felix", "org.apache.felix.healthcheck.core", "2.0.7-SNAPSHOT"),
        mavenBundle("org.apache.felix", "org.apache.felix.healthcheck.generalchecks", "2.0.4"),
        mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api", "1.1.2"),
        mavenBundle("org.apache.felix", "org.apache.felix.http.jetty", "4.0.18"),
        mavenBundle("org.apache.commons", "commons-lang3", "3.9"),
        mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.5.0"),
        mavenBundle("org.apache.felix", "org.apache.felix.rootcause", "0.1.0")
    );
}
 
Example #19
Source File: SystemReadySmokeIT.java    From sling-whiteboard with Apache License 2.0 5 votes vote down vote up
@Override
protected Option[] specificOptions() {
    return options(
        mavenBundle("org.apache.felix", "org.apache.felix.systemready", "0.4.2"),
        mavenBundle("org.apache.felix", "org.apache.felix.rootcause", "0.1.0")
    );
}
 
Example #20
Source File: AbstractIT.java    From sling-whiteboard with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {
    return options(
        // lower timeout, we don't have bounces
        frameworkProperty(StartupTimeCalculator.PROPERTY_READINESS_DELAY).value("100"),
        bundle(TESTED_BUNDLE_LOCATION),
        junitBundles(),
        mavenBundle("org.apache.felix", "org.apache.felix.scr", "2.1.16"),
        mavenBundle("org.osgi", "org.osgi.util.promise", "1.1.1"),
        mavenBundle("org.osgi", "org.osgi.util.function", "1.1.0"),
        composite(specificOptions())
    );
}
 
Example #21
Source File: OsgiTFilterRowTestIT.java    From components with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {

    return options(composite(ComponentsPaxExamOptions.getOptions()), //
            linkBundle("org.talend.components-components-common-bundle"), //
            linkBundle("org.talend.components-components-filterrow-bundle"));
}
 
Example #22
Source File: RewriterTestSupport.java    From sling-whiteboard with Apache License 2.0 5 votes vote down vote up
protected Option quickstart() {
    final int httpPort = findFreePort();
    final String workingDirectory = workingDirectory();
    return composite(
        slingQuickstartOakTar(workingDirectory, httpPort),
        slingScriptingJavascript()
    );
}
 
Example #23
Source File: OSGiTest.java    From trellis with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {
    final ConfigurationManager cm = new ConfigurationManager();
    final String rmiRegistryPort = cm.getProperty("karaf.rmiRegistry.port");
    final String rmiServerPort = cm.getProperty("karaf.rmiServer.port");
    final String sshPort = cm.getProperty("karaf.ssh.port");
    final String jenaVersion = cm.getProperty("jena.version");
    final String activemqVersion = cm.getProperty("activemq.version");

    return new Option[] {
        karafDistributionConfiguration()
            .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf")
                    .version(cm.getProperty("karaf.version")).type("zip"))
            .unpackDirectory(new File("build", "exam"))
            .useDeployFolder(false),
        logLevel(LogLevel.INFO),
        keepRuntimeFolder(),
        configureConsole().ignoreLocalConsole(),

        features(maven().groupId("org.apache.karaf.features").artifactId("standard")
                    .versionAsInProject().classifier("features").type("xml"), "scr"),
        features(maven().groupId("org.apache.karaf.features").artifactId("spring-legacy")
                    .versionAsInProject().classifier("features").type("xml"), "spring"),
        features(maven().groupId("org.apache.activemq").artifactId("activemq-karaf")
                    .version(activemqVersion).classifier("features").type("xml")),
        features(maven().groupId("org.apache.jena").artifactId("jena-osgi-features")
                    .version(jenaVersion).classifier("features").type("xml")),
        features(maven().groupId("org.trellisldp").artifactId("trellis-karaf")
                    .type("xml").classifier("features").versionAsInProject(),
                    "trellis-jena"),

        editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.repositories",
                "https://repo1.maven.org/maven2@id=central"),
        editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
        editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
        editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort)
   };
}
 
Example #24
Source File: KarafTestSupport.java    From mobi with GNU Affero General Public License v3.0 5 votes vote down vote up
@Configuration
public Option[] config() throws IOException, URISyntaxException {
    MavenArtifactUrlReference karafUrl = CoreOptions.maven()
            .groupId("com.mobi")
            .artifactId("mobi-distribution")
            .version(MavenUtils.getArtifactVersion("com.mobi", "mobi-distribution"))
            .type("tar.gz");

    List<Option> options = new ArrayList<>(Arrays.asList(
            KarafDistributionOption.karafDistributionConfiguration()
                    .frameworkUrl(karafUrl)
                    .unpackDirectory(new File("target/exam"))
                    .useDeployFolder(false),
            KarafDistributionOption.keepRuntimeFolder(),
            KarafDistributionOption.logLevel(LogLevel.INFO),
            KarafDistributionOption.replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg", getFileResource("/etc/org.ops4j.pax.logging.cfg")),
            KarafDistributionOption.editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", HTTP_PORT),
            KarafDistributionOption.editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port.secure", HTTPS_PORT),
            KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", RMI_REG_PORT),
            KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", SSH_PORT),
            KarafDistributionOption.editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", RMI_SERVER_PORT),
            CoreOptions.mavenBundle()
                    .groupId("com.mobi")
                    .artifactId("itests-support")
                    .version(MavenUtils.getArtifactVersion("com.mobi", "itests-support"))
    ));

    Files.list(getFileResource("/etc").toPath()).forEach(path ->
            options.add(KarafDistributionOption.replaceConfigurationFile("etc/" + path.getFileName(), path.toFile())));

    return options.toArray(new Option[options.size()]);
}
 
Example #25
Source File: ArtemisAMQPClientFeatureIT.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() throws IOException {
   return options(
           KARAF.option(),
           ARTEMIS_AMQP_CLIENT.option(),
           when(false)
                   .useOptions(
                           debugConfiguration("5005", true))
   );
}
 
Example #26
Source File: NexusITSupport.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Configure Nexus base with out-of-the box settings (no HTTPS).
 */
public static Option[] configureNexusBase() {
  return options(
      nexusDistribution("org.sonatype.nexus.assemblies", "nexus-base-template"),

      editConfigurationFileExtend(SYSTEM_PROPERTIES_FILE, "nexus.loadAsOSS", "true"),
      editConfigurationFileExtend(SYSTEM_PROPERTIES_FILE, "nexus.security.randompassword", "false"),
      editConfigurationFileExtend(NEXUS_PROPERTIES_FILE, "nexus.scripts.allowCreation", "true"),
      // install common test-support features
      nexusFeature("org.sonatype.nexus.testsuite", "nexus-repository-testsupport"),
      wrappedBundle(maven("com.jayway.awaitility", "awaitility").versionAsInProject())
  );
}
 
Example #27
Source File: FormatClientITSupport.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * We are doing an override of the {@link NexusITSupport#}
 */
@Configuration
public static Option[] configureNexus() {
  return options(RepositoryITSupport.configureNexus(),
      nexusFeature("org.sonatype.nexus.testsuite", "nexus-docker-testsupport"),
      withHttps(resolveBaseFile(format("target/it-resources/ssl/%s.jks", DOCKER_HOST_NAME))));
}
 
Example #28
Source File: OsgiMarkLogicInputTestIT.java    From components with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {

    return options(composite(ComponentsPaxExamOptions.getOptions()), //
            linkBundle("org.talend.components-components-common-bundle"), //
            linkBundle("org.talend.components-components-marklogic-definition"));
}
 
Example #29
Source File: NexusITSupport.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Configure Nexus base with out-of-the box settings (no HTTPS).
 */
public static Option[] configureNexusBase() {
  return options(
      nexusDistribution("org.sonatype.nexus.assemblies", "nexus-base-template"),

      editConfigurationFileExtend(SYSTEM_PROPERTIES_FILE, "nexus.loadAsOSS", "true"),
      editConfigurationFileExtend(SYSTEM_PROPERTIES_FILE, "nexus.security.randompassword", "false"),
      editConfigurationFileExtend(NEXUS_PROPERTIES_FILE, "nexus.scripts.allowCreation", "true"),
      editConfigurationFileExtend(NEXUS_PROPERTIES_FILE, "nexus.orient.enabled", "false"),
      // install common test-support features
      nexusFeature("org.sonatype.nexus.testsuite", "nexus-repository-content-testsupport"),
      wrappedBundle(maven("com.jayway.awaitility", "awaitility").versionAsInProject())
  );
}
 
Example #30
Source File: ArtemisTransactionalJMSClientFeatureIT.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() throws IOException {
   return options(
           KARAF.option(),
           ARTEMIS_JMS_CLIENT.option(),
           ARTEMIS_TRANSACTION_MANAGER.option(),
           when(false)
                   .useOptions(
                           debugConfiguration("5005", true))
   );
}