Search in sources :

Example 1 with NCSComponentRepository

use of org.opennms.netmgt.model.ncs.NCSComponentRepository in project opennms by OpenNMS.

the class NCSRestServiceIT method testPostAService.

@Test
public void testPostAService() throws Exception {
    setupLogging("DEBUG");
    anticipateEvents(EventConstants.COMPONENT_ADDED_UEI);
    sendPost("/NCS", m_serviceXML, 200, null);
    final NCSComponentRepository repo = m_webApplicationContext.getBean("ncsComponentRepository", NCSComponentRepository.class);
    for (final NCSComponent component : repo.findAll()) {
        LOG.debug("Found Component: {}/{}/{}", component.getType(), component.getForeignSource(), component.getForeignId());
    }
    String url = "/NCS/ServiceElementComponent/NA-SvcElemComp:9876%2Cvcid(50)";
    // Testing GET Collection
    System.err.println("GET!!!");
    String xml = sendRequest(GET, url, 200);
    assertTrue(xml.contains("jnxVpnPwVpnName"));
}
Also used : NCSComponent(org.opennms.netmgt.model.ncs.NCSComponent) NCSComponentRepository(org.opennms.netmgt.model.ncs.NCSComponentRepository) Test(org.junit.Test)

Example 2 with NCSComponentRepository

use of org.opennms.netmgt.model.ncs.NCSComponentRepository in project opennms by OpenNMS.

the class ComponentCommand method doExecute.

@Override
protected Object doExecute() throws Exception {
    final ServiceReference<NCSComponentRepository> sr = this.bundleContext.getServiceReference(NCSComponentRepository.class);
    if (sr == null)
        return null;
    final NCSComponentRepository repository = this.bundleContext.getService(sr);
    for (final NCSComponent component : repository.findAll()) {
        System.out.println("    " + component.toString());
    }
    System.out.println();
    return null;
}
Also used : NCSComponent(org.opennms.netmgt.model.ncs.NCSComponent) NCSComponentRepository(org.opennms.netmgt.model.ncs.NCSComponentRepository)

Aggregations

NCSComponent (org.opennms.netmgt.model.ncs.NCSComponent)2 NCSComponentRepository (org.opennms.netmgt.model.ncs.NCSComponentRepository)2 Test (org.junit.Test)1