Examples of TestContainerException


Examples of org.ops4j.pax.exam.TestContainerException

            tx = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
            tx.begin();
            callBack.runTestMethod(testResult);
        }
        catch (NamingException | NotSupportedException | SystemException exc) {
            throw new TestContainerException(exc);
        }
        finally {
            rollback(tx);
        }
    }
View Full Code Here

Examples of org.ops4j.pax.exam.TestContainerException

        if (tx != null) {
            try {
                tx.rollback();
            }
            catch (IllegalStateException | SecurityException | SystemException exc) {
                throw new TestContainerException(exc);
            }
        }
    }
View Full Code Here

Examples of org.ops4j.pax.exam.TestContainerException

            field.setAccessible(true);
            field.set(instance, value);
        }
        catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException
            | SecurityException exc) {
            throw new TestContainerException(exc);
        }
    }
View Full Code Here

Examples of org.ops4j.pax.exam.TestContainerException

                     * need to investigate why. OTOH, it may be better to kill the process as we're doing
                     * now, just to be on the safe side.
                     */
                }
                catch (NoSuchObjectException exc) {
                    throw new TestContainerException(exc);
                }

            }
            else {
                throw new RuntimeException("Container never came up");
View Full Code Here

Examples of org.ops4j.pax.exam.TestContainerException

        prefs.putInt("numMessages", ++numMessages);
        try {
            prefs.sync();
        }
        catch (BackingStoreException exc) {
            throw new TestContainerException(exc);
        }
    }
View Full Code Here

Examples of org.ops4j.pax.exam.TestContainerException

        ObjectOutputStream os;
        try {
            os = new ObjectOutputStream(outputStream);
        }
        catch (IOException e) {
            throw new TestContainerException("can't write stream headers", e);
        }
        String id = configOption.getId();
        if (id == null) {
            throw new TestContainerException("ConfigurationOption id can't be null");
        }
        try {
            os.writeObject(id);
            os.writeBoolean(configOption.isCreate());
            os.writeBoolean(configOption.isOverride());
            os.writeBoolean(configOption.isFactory());
            Map<String, ?> properties = configOption.getProperties();
            if (properties == null) {
                throw new TestContainerException("ConfigurationOption properties can't be null");
            }
            try {
                os.writeObject(new HashMap<String, Object>(properties));
            }
            catch (NotSerializableException e) {
                throw new TestContainerException(
                    "One of the values of the ConfigurationOption properties are not serializable",
                    e);
            }
            os.flush();
            os.close();
        }
        catch (IOException e) {
            throw new TestContainerException("Writing object data failed", e);
        }
        ByteArrayInputStream stream = new ByteArrayInputStream(outputStream.toByteArray());
        TinyBundle bundle = TinyBundles.bundle();
        bundle.add(ConfigurationOptionConfigurationListener.class);
        bundle.add(ConfigurationOptionActivator.class).add("override.obj", stream);
View Full Code Here

Examples of org.ops4j.pax.exam.TestContainerException

     *            the file extension to scan for (eg .cfg)
     * @return an option containing all the read configurations
     */
    public static Option configurationFolder(File folder, String extension) {
        if (!folder.exists()) {
            throw new TestContainerException("folder " + folder + " does not exits");
        }
        List<Option> options = new ArrayList<Option>();
        File[] files = folder.listFiles();

        for (File file : files) {
            if (file.isDirectory()) {
                continue;
            }
            String name = file.getName();
            if (!name.endsWith(extension)) {
                continue;
            }
            else {
                name = name.substring(0, name.length() - extension.length());
            }
            String[] split = name.split("-");
            ConfigurationProvisionOption cfg = new ConfigurationProvisionOption(split[0],
                new HashMap<String, Object>());
            cfg.factory(split.length > 1);
            Properties properties = new Properties();
            try {
                FileInputStream stream = new FileInputStream(file);
                try {
                    properties.load(stream);
                }
                finally {
                    stream.close();
                }
            }
            catch (IOException e) {
                throw new TestContainerException("can't read configuration file " + file, e);
            }
            Set<String> names = properties.stringPropertyNames();
            for (String key : names) {
                cfg.put(key, properties.getProperty(key));
            }
View Full Code Here

Examples of org.ops4j.pax.exam.TestContainerException

            instance = new SingletonStagedReactor(containers, mProbes);
        }
        else {
            if ( /* ! instance.testContainers.equals( containers ) || */
            !instance.probes.equals(mProbes)) {
                throw new TestContainerException(
                    "using the PerSuite reactor strategy, all test classes must share the same probes");
            }
        }
        return instance;
    }
View Full Code Here

Examples of org.ops4j.pax.exam.TestContainerException

                try {
                    container.installProbe(builder.build().getStream());
                }
                catch (IOException e) {
                    throw new TestContainerException("Unable to build the probe.", e);
                }
            }
        }
    }
View Full Code Here

Examples of org.ops4j.pax.exam.TestContainerException

                return null;
            }
        }
        // CHECKSTYLE:SKIP : catch all wanted
        catch (Throwable e) {
            throw new TestContainerException("Problem delegating to test.", e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.