Search in sources :

Example 66 with ForeignSource

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

the class CachingForeignSourceRepositoryTest method createForeignSource.

private ForeignSource createForeignSource(String foreignSource) throws Exception {
    ForeignSource fs = new ForeignSource(foreignSource);
    fs.addDetector(new PluginConfig("HTTP", "org.opennms.netmgt.provision.detector.simple.HttpDetector"));
    fs.addPolicy(new PluginConfig("all-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.InclusiveInterfacePolicy"));
    m_foreignSourceRepository.save(fs);
    m_foreignSourceRepository.flush();
    return fs;
}
Also used : PluginConfig(org.opennms.netmgt.provision.persist.foreignsource.PluginConfig) ForeignSource(org.opennms.netmgt.provision.persist.foreignsource.ForeignSource)

Example 67 with ForeignSource

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

the class FilesystemForeignSourceRepositoryTest method testGetRequisition.

@Test
public void testGetRequisition() throws Exception {
    Requisition requisition = createRequisition();
    ForeignSource foreignSource = createForeignSource(m_defaultForeignSourceName);
    assertRequisitionsMatch("requisitions must match", m_foreignSourceRepository.getRequisition(m_defaultForeignSourceName), m_foreignSourceRepository.getRequisition(foreignSource));
    assertRequisitionsMatch("foreign source is the expected one", requisition, m_foreignSourceRepository.getRequisition(foreignSource));
}
Also used : ForeignSource(org.opennms.netmgt.provision.persist.foreignsource.ForeignSource) Requisition(org.opennms.netmgt.provision.persist.requisition.Requisition) Test(org.junit.Test)

Example 68 with ForeignSource

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

the class FusedForeignSourceRepositoryTest method tearDown.

@After
public final void tearDown() {
    /* 
         * since we share the filesystem with other tests, best
         * to make sure it's totally clean here.
         */
    for (ForeignSource fs : m_pending.getForeignSources()) {
        m_pending.delete(fs);
    }
    for (ForeignSource fs : m_active.getForeignSources()) {
        m_active.delete(fs);
    }
    for (Requisition r : m_pending.getRequisitions()) {
        m_pending.delete(r);
    }
    for (Requisition r : m_active.getRequisitions()) {
        m_active.delete(r);
    }
    m_pending.flush();
    m_active.flush();
}
Also used : ForeignSource(org.opennms.netmgt.provision.persist.foreignsource.ForeignSource) Requisition(org.opennms.netmgt.provision.persist.requisition.Requisition) After(org.junit.After)

Example 69 with ForeignSource

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

the class MockForeignSourceRepository method getForeignSource.

@Override
public ForeignSource getForeignSource(final String foreignSourceName) {
    Assert.notNull(foreignSourceName);
    final ForeignSource foreignSource = m_foreignSources.get(foreignSourceName);
    if (foreignSource == null) {
        if (foreignSourceName == "default") {
            return super.getDefaultForeignSource();
        } else {
            return getDefaultForeignSource();
        }
    }
    return foreignSource;
}
Also used : ForeignSource(org.opennms.netmgt.provision.persist.foreignsource.ForeignSource)

Example 70 with ForeignSource

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

the class QueueingForeignSourceRepositoryTest method createForeignSource.

private ForeignSource createForeignSource(String foreignSource) throws Exception {
    ForeignSource fs = new ForeignSource(foreignSource);
    fs.addDetector(new PluginConfig("HTTP", "org.opennms.netmgt.provision.detector.simple.HttpDetector"));
    fs.addPolicy(new PluginConfig("all-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.InclusiveInterfacePolicy"));
    m_foreignSourceRepository.save(fs);
    m_foreignSourceRepository.flush();
    return fs;
}
Also used : PluginConfig(org.opennms.netmgt.provision.persist.foreignsource.PluginConfig) ForeignSource(org.opennms.netmgt.provision.persist.foreignsource.ForeignSource)

Aggregations

ForeignSource (org.opennms.netmgt.provision.persist.foreignsource.ForeignSource)72 PluginConfig (org.opennms.netmgt.provision.persist.foreignsource.PluginConfig)31 Test (org.junit.Test)23 Requisition (org.opennms.netmgt.provision.persist.requisition.Requisition)11 Before (org.junit.Before)10 MockForeignSourceRepository (org.opennms.netmgt.provision.persist.MockForeignSourceRepository)9 ArrayList (java.util.ArrayList)8 Path (javax.ws.rs.Path)8 Transactional (org.springframework.transaction.annotation.Transactional)8 TreeSet (java.util.TreeSet)6 File (java.io.File)4 DELETE (javax.ws.rs.DELETE)4 Date (java.util.Date)3 Consumes (javax.ws.rs.Consumes)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 GET (javax.ws.rs.GET)2 POST (javax.ws.rs.POST)2 Produces (javax.ws.rs.Produces)2 DateTime (org.joda.time.DateTime)2 Duration (org.joda.time.Duration)2