Package org.ops4j.pax.exam

Examples of org.ops4j.pax.exam.ExamSystem


public class Main {

    static Logger log = LoggerFactory.getLogger(Main.class.getName());

    public static void main(String[] args) throws Exception {
        ExamSystem system = createServerSystem(options(
            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN"),
            mavenBundle().groupId("org.ops4j.pax.tinybundles").artifactId("pax-tinybundles-core")
                .version("1.0.0-SNAPSHOT"), workingDirectory("/Users/tonit/server")));
        TestContainer container = createContainer(system);
        container.start();
View Full Code Here


            LOGGER.debug("using RMI registry at port {}", port);
            rgstry = LocateRegistry.createRegistry(port);

            String host = InetAddress.getLocalHost().getHostName();

            ExamSystem subsystem = system
                .fork(options(
                    systemProperty(RMI_HOST_PROPERTY).value(host),
                    systemProperty(RMI_PORT_PROPERTY).value(Integer.toString(port)),
                    systemProperty(RMI_NAME_PROPERTY).value(name),
                    invokerConfiguration,
                    systemProperty(EXAM_INJECT_PROPERTY).value("true"),
                    editConfigurationFileExtend("etc/system.properties", "jline.shutdownhook",
                        "true")));
            target = new RBCRemoteTarget(name, port, subsystem.getTimeout());

            System.setProperty("java.protocol.handler.pkgs", "org.ops4j.pax.url");

            URL sourceDistribution = new URL(framework.getFrameworkURL());
            targetFolder = retrieveFinalTargetFolder(subsystem);
            ArchiveExtractor.extract(sourceDistribution, targetFolder);

            File karafBase = searchKarafBase(targetFolder);
            File karafHome = karafBase;

            versionAdaptions = createVersionAdapter(karafBase);
            DependenciesDeployer deployer = new DependenciesDeployer(subsystem, karafBase,
                karafHome);
            deployer.copyBootClasspathLibraries();

            updateLogProperties(karafHome, subsystem);
            setupSystemProperties(karafHome, subsystem);

            List<KarafDistributionConfigurationFileOption> options = new ArrayList<KarafDistributionConfigurationFileOption>(
                Arrays.asList(subsystem.getOptions(KarafDistributionConfigurationFileOption.class)));
            options.addAll(fromFeatureOptions(subsystem.getOptions(KarafFeaturesOption.class)));
            options.addAll(fromFeatureOptions(KarafDistributionOption.features(EXAM_REPO_URL,
                "exam")));

            if (framework.isUseDeployFolder()) {
                deployer.copyReferencedArtifactsToDeployFolder();
View Full Code Here

     * Create a new system based on *this*. The forked System remembers the forked instances in
     * order to clear resources up (if desired).
     */
    public ExamSystem fork(Option[] options) {
        try {
            ExamSystem sys = new DefaultExamSystem(combine(combinedOptions, options));
            subsystems.add(sys);
            return sys;
        }
        catch (IOException exc) {
            throw new TestContainerException(exc);
View Full Code Here

    }

    @Override
    protected void before() throws Exception {
        Option[] options = getConfigurationOptions();
        ExamSystem system = DefaultExamSystem.create(options);
        testContainer = PaxExamRuntime.createContainer(system);
        testContainer.start();
    }
View Full Code Here

            options.add(CoreOptions.bootClasspathLibrary(url));
        }
        options.add(CoreOptions.systemPackages("org.kohsuke.metainf_services"));

        Option[] opts = options.toArray(new Option[options.size()]);
        ExamSystem system = PaxExamRuntime.createServerSystem(opts);
        ForkedTestContainerFactory factory = new ForkedTestContainerFactory();
        TestContainer[] containers = factory.create(system);

        Assert.assertNotNull(containers);
        Assert.assertNotNull(containers[0]);
View Full Code Here

     * @return started test container
     * @throws Exception when options cannot be parsed
     */
    public static TestContainer createContainer(String configurationClassName) throws Exception {
        Option[] options = getConfigurationOptions(configurationClassName);
        ExamSystem system = DefaultExamSystem.create(options);
        TestContainer testContainer = PaxExamRuntime.createContainer(system);
        testContainer.start();
        return testContainer;
    }
View Full Code Here

public class NativeContainerTest {

    @Test
    public void emptySetup() throws IOException {
        FrameworkFactory ff = mock(FrameworkFactory.class);
        ExamSystem system = mock(ExamSystem.class);
        NativeTestContainer container = new NativeTestContainer(system, ff);
        assertThat(container, is(notNullValue()));
        verifyNoMoreInteractions(ff);
    }
View Full Code Here

    // @Test
    public void starting() throws IOException {
        FrameworkFactory ff = mock(FrameworkFactory.class);
        Framework fw = mock(Framework.class);
        when(ff.newFramework(Matchers.<Map<String, String>> anyObject())).thenReturn(fw);
        ExamSystem system = mock(ExamSystem.class);

        NativeTestContainer container = new NativeTestContainer(system, ff);
        container.start();
        verifyNoMoreInteractions(ff);
        verifyNoMoreInteractions(fw);
View Full Code Here

public class TomcatTestContainerTest {

    @Test
    public void launchTomcat() throws IOException {
        ExamSystem system = DefaultExamSystem.create(options());
        TomcatTestContainer container = new TomcatTestContainer(system);
        container.start();
        container.stop();
    }
View Full Code Here

    }

    @Test
    public void deployWebapp() throws IOException {
        System.setProperty("java.protocol.handler.pkgs", "org.ops4j.pax.url");
        ExamSystem system = DefaultExamSystem.create(options(war(
            "mvn:org.apache.wicket/wicket-examples/1.5.3/war").name("wicket-examples")));
        TomcatTestContainer container = new TomcatTestContainer(system);
        container.start();
        container.deployModules();
        container.stop();
View Full Code Here

TOP

Related Classes of org.ops4j.pax.exam.ExamSystem

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.