Package org.ops4j.pax.exam

Examples of org.ops4j.pax.exam.TestContainerException


                .set(Constants.BUNDLE_SYMBOLICNAME, "org.ops4j.pax.exam.sample9.fragment")
                .add("messages.properties", getClass().getResource("/messages.properties"));
            return bundle.build();
        }
        catch (IOException e) {
            throw new TestContainerException(e);
        }

    }
View Full Code Here


            Store<InputStream> store = StoreFactory.anonymousStore();
            Handle handle = store.store(bundle.build());
            return store.getLocation(handle).toURL();
        }
        catch (IOException e) {
            throw new TestContainerException(e);
        }
    }
View Full Code Here

            disableConfigurationMethods(suite);
            Object testClassInstance = testClass.newInstance();
            return stageReactorForClass(testClass, testClassInstance);
        }
        catch (InstantiationException | IllegalAccessException exc) {
            throw new TestContainerException(exc);
        }
    }
View Full Code Here

                addTestsToReactor(examReactor, testClassInstance, methods);
            }
            return manager.stageReactor();
        }
        catch (IOException | ExamConfigurationException exc) {
            throw new TestContainerException(exc);
        }
    }
View Full Code Here

            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

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

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

                     * 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

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

        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

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.