private synchronized StagedExamReactor prepareReactor() throws Exception {
    ConfigurationManager cm = new ConfigurationManager();
    String systemType = cm.getProperty(Constants.EXAM_SYSTEM_KEY);
    if (Constants.EXAM_SYSTEM_DEFAULT.equals(systemType)) {
      m_system = DefaultExamSystem.create(new Option[0]);
    } else {
      m_system = PaxExamRuntime.createTestSystem();
    }
    Class<?> testClass = getTestClass().getJavaClass();
    Object testClassInstance = testClass.newInstance();
    ExamReactor reactor = getReactor(testClass);

    addConfigurationsToReactor(reactor, testClass, testClassInstance);
    addTestsToReactor(reactor, testClass, testClassInstance);
    return reactor.stage(getFactory(testClass));
  }
Exemplo n.º 2
0
  @Configuration
  public Option[] config() {
    final ConfigurationManager cm = new ConfigurationManager();
    final String fcrepoPort = cm.getProperty("fcrepo.dynamic.test.port");
    final String jmsPort = cm.getProperty("fcrepo.dynamic.jms.port");
    final String reindexingPort = cm.getProperty("fcrepo.dynamic.reindexing.port");
    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 fcrepoBaseUrl = "localhost:" + fcrepoPort + "/fcrepo/rest";

    final String version = cm.getProperty("project.version");
    final String fcrepoAudit = getBundleUri("fcrepo-audit-triplestore", version);
    final String fcrepoFixity = getBundleUri("fcrepo-fixity", version);
    final String fcrepoReindexing = getBundleUri("fcrepo-reindexing", version);
    final String fcrepoSerialization = getBundleUri("fcrepo-serialization", version);
    final String fcrepoIndexingSolr = getBundleUri("fcrepo-indexing-solr", version);
    final String fcrepoIndexingTriplestore = getBundleUri("fcrepo-indexing-triplestore", version);
    final String fcrepoServiceAmq = getBundleUri("fcrepo-service-activemq", version);
    final String fcrepoService = getBundleUri("fcrepo-service-camel", version);

    return new Option[] {
      karafDistributionConfiguration()
          .frameworkUrl(
              maven()
                  .groupId("org.apache.karaf")
                  .artifactId("apache-karaf")
                  .versionAsInProject()
                  .type("zip"))
          .unpackDirectory(new File("target", "exam"))
          .useDeployFolder(false),
      logLevel(LogLevel.WARN),
      keepRuntimeFolder(),
      configureConsole().ignoreLocalConsole(),
      features(
          maven()
              .groupId("org.apache.karaf.features")
              .artifactId("standard")
              .versionAsInProject()
              .classifier("features")
              .type("xml"),
          "scr"),
      features(
          maven()
              .groupId("org.apache.camel.karaf")
              .artifactId("apache-camel")
              .type("xml")
              .classifier("features")
              .versionAsInProject(),
          "camel-mustache",
          "camel-blueprint",
          "camel-http4",
          "camel-spring",
          "camel-exec",
          "camel-jetty9",
          "camel-jacksonxml"),
      features(
          maven()
              .groupId("org.apache.activemq")
              .artifactId("activemq-karaf")
              .type("xml")
              .classifier("features")
              .versionAsInProject(),
          "activemq-camel"),
      features(
          maven()
              .groupId("org.fcrepo.camel")
              .artifactId("fcrepo-camel")
              .type("xml")
              .classifier("features")
              .versionAsInProject(),
          "fcrepo-camel"),
      mavenBundle()
          .groupId("org.codehaus.woodstox")
          .artifactId("woodstox-core-asl")
          .versionAsInProject(),
      CoreOptions.systemProperty("o.f.c.serialization-bundle").value(fcrepoSerialization),
      CoreOptions.systemProperty("o.f.c.fixity-bundle").value(fcrepoFixity),
      CoreOptions.systemProperty("o.f.c.reindexing-bundle").value(fcrepoReindexing),
      CoreOptions.systemProperty("o.f.c.a.triplestore-bundle").value(fcrepoAudit),
      CoreOptions.systemProperty("o.f.c.i.triplestore-bundle").value(fcrepoIndexingTriplestore),
      CoreOptions.systemProperty("o.f.c.i.solr-bundle").value(fcrepoIndexingSolr),
      CoreOptions.systemProperty("o.f.c.s.activemq-bundle").value(fcrepoServiceAmq),
      CoreOptions.systemProperty("o.f.c.s.camel-bundle").value(fcrepoService),
      bundle(fcrepoAudit).start(),
      bundle(fcrepoIndexingSolr).start(),
      bundle(fcrepoIndexingTriplestore).start(),
      bundle(fcrepoFixity).start(),
      bundle(fcrepoSerialization).start(),
      bundle(fcrepoReindexing).start(),
      bundle(fcrepoServiceAmq).start(),
      bundle(fcrepoService).start(),
      CoreOptions.systemProperty("fcrepo.port").value(fcrepoPort),
      CoreOptions.systemProperty("karaf.reindexing.port").value(reindexingPort),
      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),
      editConfigurationFilePut(
          "etc/org.fcrepo.camel.serialization.cfg",
          "serialization.descriptions",
          "data/tmp/descriptions"),
      editConfigurationFilePut("etc/org.fcrepo.camel.reindexing.cfg", "rest.port", reindexingPort),
      editConfigurationFilePut("etc/org.fcrepo.camel.service.cfg", "fcrepo.baseUrl", fcrepoBaseUrl),
      editConfigurationFilePut(
          "etc/org.fcrepo.camel.service.activemq.cfg",
          "jms.brokerUrl",
          "tcp://localhost:" + jmsPort),
      editConfigurationFilePut(
          "etc/org.ops4j.pax.logging.cfg",
          "log4j.logger.org.apache.camel.impl.converter",
          "ERROR, stdout")
    };
  }