use of org.opennms.netmgt.provision.persist.requisition.Requisition in project opennms by OpenNMS.
the class CachingForeignSourceRepositoryTest method createRequisition.
private Requisition createRequisition() throws Exception {
Requisition r = m_foreignSourceRepository.importResourceRequisition(new ClassPathResource("/requisition-test.xml"));
m_foreignSourceRepository.save(r);
m_foreignSourceRepository.flush();
return r;
}
use of org.opennms.netmgt.provision.persist.requisition.Requisition in project opennms by OpenNMS.
the class CachingForeignSourceRepositoryTest 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));
}
use of org.opennms.netmgt.provision.persist.requisition.Requisition in project opennms by OpenNMS.
the class FastFilesystemForeignSourceRepositoryTest 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));
}
use of org.opennms.netmgt.provision.persist.requisition.Requisition in project opennms by OpenNMS.
the class RequisitionFileUtils method getLatestPendingOrSnapshotRequisition.
public static Requisition getLatestPendingOrSnapshotRequisition(final ForeignSourceRepository foreignSourceRepository, final String foreignSource) {
Requisition newest = foreignSourceRepository.getRequisition(foreignSource);
for (final File snapshotFile : findSnapshots(foreignSourceRepository, foreignSource)) {
if (newest == null || isNewer(snapshotFile, newest.getDate())) {
newest = JaxbUtils.unmarshal(Requisition.class, snapshotFile);
newest.setResource(new FileSystemResource(snapshotFile));
}
}
return newest;
}
use of org.opennms.netmgt.provision.persist.requisition.Requisition in project opennms by OpenNMS.
the class QueueingForeignSourceRepositoryTest method createRequisition.
private Requisition createRequisition() throws Exception {
Requisition r = m_foreignSourceRepository.importResourceRequisition(new ClassPathResource("/requisition-test.xml"));
m_foreignSourceRepository.save(r);
m_foreignSourceRepository.flush();
return r;
}
Aggregations