Search in sources :

Example 1 with ForeignSourceRepository

use of org.opennms.netmgt.provision.persist.ForeignSourceRepository in project opennms by OpenNMS.

the class RequisitionImplementationTest method runTest.

protected <T> void runTest(final RepositoryTest<ForeignSourceRepository> rt, final Class<? extends Throwable> expected) {
    m_repositories.entrySet().stream().forEach(entry -> {
        final String bundleName = entry.getKey();
        final ForeignSourceRepository fsr = entry.getValue();
        LOG.info("=== " + bundleName + " ===");
        fsr.resetDefaultForeignSource();
        fsr.flush();
        try {
            rt.test(fsr);
        } catch (final Throwable t) {
            if (expected == null) {
                throw t;
            } else {
                LOG.debug("expected: {}, got: {}", expected, t);
                if (t.getClass().getCanonicalName().equals(expected.getCanonicalName())) {
                } else {
                    throw new RuntimeException("Expected throwable " + expected.getName() + " when running test against " + bundleName + ", but got " + t.getClass() + " instead!", t);
                }
            }
        }
    });
}
Also used : ForeignSourceRepository(org.opennms.netmgt.provision.persist.ForeignSourceRepository)

Example 2 with ForeignSourceRepository

use of org.opennms.netmgt.provision.persist.ForeignSourceRepository in project opennms by OpenNMS.

the class RequisitionImplementationTest method cleanUp.

@Before
@After
public void cleanUp() throws Exception {
    if (m_repositories != null) {
        resetDirectories();
        for (final ForeignSourceRepository fsr : m_repositories.values()) {
            fsr.flush();
            fsr.clear();
        }
    }
    LOG.info("Test context prepared.");
}
Also used : ForeignSourceRepository(org.opennms.netmgt.provision.persist.ForeignSourceRepository) Before(org.junit.Before) After(org.junit.After)

Aggregations

ForeignSourceRepository (org.opennms.netmgt.provision.persist.ForeignSourceRepository)2 After (org.junit.After)1 Before (org.junit.Before)1