private static String getKarafVersion() {
    String karafVersion = System.getProperty(PROP_KARAF_VERSION);
    if (karafVersion == null) {
      if (System.getProperty(PROP_KARAF_DISTRIBUTION_FILE) != null) {
        throw new RuntimeException(
            "When you are running against custom container "
                + "it is necessary to define Karaf version by defining system property karaf.version.");
      }

      // set the Karaf version defined by Maven
      VersionResolver versionResolver = MavenUtils.asInProject();
      karafVersion = versionResolver.getVersion(KARAF_GROUP_ID, KARAF_ARTIFACT_ID);
    }
    return karafVersion;
  }
예제 #2
0
 public static Option codeCoverageOption() {
   String coverageCommand = System.getProperty(COVERAGE_COMMAND);
   if (coverageCommand != null) {
     return vmOption(coverageCommand);
   }
   return null;
 }
 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()));
 }
예제 #4
0
  public static Option unoMinimalConfiguration() {
    String logLevel = System.getProperty(TEST_LOGLEVEL);
    if (logLevel != null) {
      logLevel = "-" + logLevel;
    } else {
      logLevel = "";
    }
    // @formatter:off
    return composite(
        systemProperty(EXAM_SYSTEM_KEY).value(EXAM_SYSTEM_DEFAULT),
        defaultTestSystemOptions(),
        systemProperty("org.ops4j.pax.url.mvn.repositories")
            .value(
                "+http://repository.springsource.com/maven/bundles/release,http://repository.springsource.com/maven/bundles/external"),
        systemProperty("org.eclipse.equinox.http.jetty.http.port").value("8080"),
        systemProperty("osgi.resolveOptional").value("true"),
        systemProperty("osgi.framework.extensions").value("org.eclipse.equinox.weaving.hook"),
        systemProperty("eclipse.consoleLog").value("true"),
        systemProperty("osgi.debug").value("src/test/resources/equinox.options"),
        mavenBundle("org.aspectj", "com.springsource.org.aspectj.runtime")
            .version("1.6.12.RELEASE")
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.aspectj", "com.springsource.org.aspectj.weaver")
            .version("1.6.12.RELEASE")
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.openeos.external", "org.eclipse.equinox.weaving.hook")
            .version("1.0.200.I20130319-1000")
            .noStart(),
        mavenBundle("org.openeos.external", "org.eclipse.equinox.weaving.aspectj")
            .version("1.0.300.I20130319-1000")
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.slf4j", "slf4j-api")
            .versionAsInProject()
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("ch.qos.logback", "logback-core")
            .versionAsInProject()
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("ch.qos.logback", "logback-classic")
            .versionAsInProject()
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.slf4j", "jcl-over-slf4j")
            .versionAsInProject()
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.slf4j", "log4j-over-slf4j")
            .versionAsInProject()
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.slf4j", "jul-to-slf4j")
            .versionAsInProject()
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        systemProperty("logback.configurationFile")
            .value(
                "file:"
                    + PathUtils.getBaseDir()
                    + "/src/test/resources/logback"
                    + logLevel
                    + ".xml"),
        systemProperty("logback.statusListenerClass")
            .value("ch.qos.logback.core.status.OnConsoleStatusListener"),
        mavenBundle("javax.persistence", "com.springsource.javax.persistence")
            .version("2.0.0")
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.antlr", "com.springsource.antlr")
            .version("2.7.7")
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.antlr", "com.springsource.org.antlr.runtime")
            .version("3.1.3")
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.dom4j", "com.springsource.org.dom4j")
            .version("1.6.1")
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("javax.xml.stream", "com.springsource.javax.xml.stream")
            .version("1.0.1")
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.jboss.javassist", "com.springsource.javassist")
            .version("3.15.0.GA")
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.openeos", "org.openeos.logging")
            .versionAsInProject()
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.openeos", "org.openeos.aspectj.config")
            .versionAsInProject()
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        mavenBundle("org.openeos", "org.openeos.utils")
            .versionAsInProject()
            .startLevel(START_LEVEL_SYSTEM_BUNDLES),
        bundleStartLevel(5),
        frameworkStartLevel(5),
        bootDelegationPackages(
            "org.eclipse.equinox.weaving.adaptors",
            "org.eclipse.equinox.weaving.hooks",
            "org.eclipse.equinox.service.weaving,org.xml.sax.helpers",
            "org.xml.sax,com.sun.source.tree",
            "com.sun.source.util"),
        systemPackages(
            "org.eclipse.equinox.service.weaving", "com.sun.source.tree", "com.sun.source.util"),
        bootClasspathLibrary(
            maven("org.openeos.external", "org.eclipse.equinox.weaving.hook")
                .version("1.0.200.I20130319-1000")));

    // @formatter:on
  }
  public static Option getKarafDistributionOption() {

    List<Option> options = new ArrayList<Option>();

    String karafVersion = getKarafVersion();
    logger.info("*** The karaf version is " + karafVersion + " ***");

    KarafDistributionBaseConfigurationOption karafConfiguration = karafDistributionConfiguration();

    /* Use default or custom container */
    if (System.getProperty(PROP_KARAF_DISTRIBUTION_FILE) == null) {
      karafConfiguration.frameworkUrl(
          maven()
              .groupId(KARAF_GROUP_ID)
              .artifactId(KARAF_ARTIFACT_ID)
              .type("tar.gz")
              .versionAsInProject());
    } else {
      File fuseDistributionFile = new File(System.getProperty(PROP_KARAF_DISTRIBUTION_FILE));
      karafConfiguration.frameworkUrl("file:" + fuseDistributionFile.getAbsolutePath());
    }

    karafConfiguration
        .karafVersion(karafVersion)
        .name("Apache Karaf")
        .useDeployFolder(false)
        .unpackDirectory(new File("target/paxexam/unpack/"));
    options.add(karafConfiguration);

    /* Set maximal perm space size */
    if (System.getProperty(PROP_KARAF_MAXPERMSIZE) != null) {
      options.add(vmOption("-XX:MaxPermSize=" + System.getProperty(PROP_KARAF_MAXPERMSIZE)));
    }

    /* Keep pax exam runtime folder after the test execution is completed */
    if (System.getProperty(PROP_KEEP_RUNTIME_FOLDER) != null) {
      options.add(keepRuntimeFolder());
    }

    options.add(localMavenRepoOption());

    /* Add aditional Maven repositories */
    String additionalMavenRepositories = "";
    if (System.getProperty(PROP_ADDITIONAL_MAVEN_REPOS) != null) {
      additionalMavenRepositories = "," + System.getProperty(PROP_ADDITIONAL_MAVEN_REPOS);
    }
    options.add(
        editConfigurationFilePut(
            "etc/org.ops4j.pax.url.mvn.cfg",
            "org.ops4j.pax.url.mvn.repositories",
            "http://repo1.maven.org/maven2@id=central,"
                + "https://repository.jboss.org/nexus/content/groups/public@id=jboss-public"
                + additionalMavenRepositories));

    if (System.getProperty(PROP_KARAF_FRAMEWORK) != null) {
      options.add(
          editConfigurationFilePut(
              CustomProperties.KARAF_FRAMEWORK, System.getProperty(PROP_KARAF_FRAMEWORK)));
    }
    return new DefaultCompositeOption(options.toArray(new Option[1]));
  }
예제 #6
0
파일: UnitHelp.java 프로젝트: hustfxj/netty
 /** Concatenate generic arrays. */
 public static <T> T[] concat(final T[] first, final T[] second) {
   final T[] result = Arrays.copyOf(first, first.length + second.length);
   System.arraycopy(second, 0, result, first.length, second.length);
   return result;
 }