Package org.ops4j.pax.exam

Examples of org.ops4j.pax.exam.TestContainerException


    public void uninstallProbe() {
        try {
            remoteFramework.uninstallBundle(probeId);
        }
        catch (RemoteException | BundleException exc) {
            throw new TestContainerException(exc);
        }
    }
View Full Code Here


        Class<?> testClass;
        try {
            testClass = getClass().getClassLoader().loadClass(clazz);
        }
        catch (ClassNotFoundException e) {
            throw new TestContainerException(e);
        }

        if (!(findAndInvoke(testClass, args))) {
            throw new TestContainerException(" Test " + method + " not found in test class "
                + testClass.getName());
        }
    }
View Full Code Here

             * If args are present, we expect exactly one integer argument, defining the index of
             * the parameter set for a parameterized test.
             */
            if (args.length > 0) {
                if (!(args[0] instanceof Integer)) {
                    throw new TestContainerException("Integer argument expected");
                }
                index = (Integer) args[0];
            }

            // find matching method
            for (Method m : testClass.getMethods()) {
                if (m.getName().equals(method)) {
                    // we assume its correct:
                    invokeViaServletBridge(testClass, m, index);
                    return true;
                }
            }
        }
        catch (NoClassDefFoundError e) {
            throw new TestContainerException(e);
        }
        catch (IOException e) {
            throw new TestContainerException(e);
        }
        catch (ClassNotFoundException e) {
            throw new TestContainerException(e);
        }
        return false;
    }
View Full Code Here

        ObjectInputStream ois = new ObjectInputStream(is);
        Object object = ois.readObject();
        if (object instanceof Throwable) {
            Throwable t = (Throwable) object;
            throw new TestContainerException(t);
        }
        else if (object instanceof String) {
            // ok
        }
        else {
View Full Code Here

                    try {
                        configFile = contextXml.toURI().toURL();
                        break;
                    }
                    catch (MalformedURLException exc) {
                        throw new TestContainerException(exc);
                    }
                }
            }
           
        }
View Full Code Here

            framework = frameworkFactory.newFramework(p);
            framework.init();
            installAndStartBundles(framework.getBundleContext());
        }
        catch (BundleException e) {
            throw new TestContainerException("Problem starting test container.", e);
        }
        catch (IOException e) {
            throw new TestContainerException("Problem starting test container.", e);
        }
        return this;
    }
View Full Code Here

        // about stopping the worker thread.

        if (framework.getState() != Framework.RESOLVED) {
            String message = "Framework has not yet stopped after " + timeout
                + " ms. waitForStop did not return";
            throw new TestContainerException(message);
        }
    }
View Full Code Here

            if (!latch.await(timeout, TimeUnit.MILLISECONDS)) {
                // Before throwing an exception, do a last check
                if (startLevel != sl.getStartLevel()) {
                    String msg = String.format("start level %d has not been reached within %d ms",
                        startLevel, timeout);
                    throw new TestContainerException(msg);
                }
                else {
                    // We reached the requested start level.
                    LOG.debug("requested start level reached");
                }

            }
        }
        catch (InterruptedException e) {
            throw new TestContainerException(e);
        }
    }
View Full Code Here

        }
        ConfigurationManager cm = new ConfigurationManager();
        boolean failOnUnresolved = Boolean.parseBoolean(cm.getProperty(EXAM_FAIL_ON_UNRESOLVED_KEY,
            "false"));
        if (hasUnresolvedBundles && failOnUnresolved) {
            throw new TestContainerException(
                "There are unresolved bundles. See previous ERROR log messages for details.");
        }
    }
View Full Code Here

        try {
            bundle.uninstall();
            probeId = null;
        }
        catch (BundleException exc) {
            throw new TestContainerException(exc);
        }
    }
View Full Code Here

TOP

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

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.