Search in sources :

Example 1 with PaintTarget

use of com.vaadin.server.PaintTarget in project opennms by OpenNMS.

the class OpenlayersWidgetCompontentTest method testGeolocation.

@Test
@Ignore
public void testGeolocation() throws Exception {
    final OnmsNode node = new OnmsNode();
    final OnmsAssetRecord asset = new OnmsAssetRecord();
    final OnmsGeolocation geo = new OnmsGeolocation();
    node.setId(1);
    node.setAssetRecord(asset);
    asset.setGeolocation(geo);
    geo.setAddress1("220 Chatham Business Dr.");
    geo.setCity("Pittsboro");
    geo.setState("NC");
    geo.setZip("27312");
    assertEquals("220 Chatham Business Dr., Pittsboro, NC 27312", geo.asAddressString());
    EasyMock.expect(m_geocoder.getCoordinates(geo.asAddressString())).andReturn(new Coordinates(-1.0f, 1.0f)).times(1);
    final PaintTarget target = EasyMock.createMock(PaintTarget.class);
    m_assetDao.saveOrUpdate(EasyMock.isA(OnmsAssetRecord.class));
    target.startTag(EasyMock.eq("1"));
    target.addAttribute(EasyMock.eq("longitude"), EasyMock.eq("-1.0"));
    target.addAttribute(EasyMock.eq("latitude"), EasyMock.eq("1.0"));
    target.endTag(EasyMock.eq("1"));
    EasyMock.replay(m_nodeDao, m_assetDao, m_geocoder, target);
    // m_component.paintNode(target, node);
    EasyMock.verify(m_nodeDao, m_assetDao, m_geocoder, target);
}
Also used : OnmsNode(org.opennms.netmgt.model.OnmsNode) OnmsAssetRecord(org.opennms.netmgt.model.OnmsAssetRecord) Coordinates(org.opennms.features.geocoder.Coordinates) PaintTarget(com.vaadin.server.PaintTarget) OnmsGeolocation(org.opennms.netmgt.model.OnmsGeolocation) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

PaintTarget (com.vaadin.server.PaintTarget)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 Coordinates (org.opennms.features.geocoder.Coordinates)1 OnmsAssetRecord (org.opennms.netmgt.model.OnmsAssetRecord)1 OnmsGeolocation (org.opennms.netmgt.model.OnmsGeolocation)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1