コード例 #1
0
  @Test
  public void testVertexRefSelectedUpdate() {
    MockEventProxy mockEventProxy = new MockEventProxy();
    OnmsServiceManager serviceManager = new DummyOnmsServiceManager();
    VaadinApplicationContext vaadinApplicationContext =
        new DummyVaadinApplicationContext(mockEventProxy);
    OsgiVerticesUpdateManager updateManager =
        new OsgiVerticesUpdateManager(serviceManager, vaadinApplicationContext);

    updateManager.selectionChanged(createContextWithVertRefIds(1, 2, 3, 4));

    assertEquals(1, mockEventProxy.getFireEventCalls());
    VerticesUpdateManager.VerticesUpdateEvent event = mockEventProxy.getLastFiredEvent();
    assertEquals(4, event.getVertexRefs().size());

    updateManager.selectionChanged(createContextWithVertRefIds(1, 2, 3, 4));

    assertEquals(1, mockEventProxy.getFireEventCalls());
    VerticesUpdateManager.VerticesUpdateEvent event2 = mockEventProxy.getLastFiredEvent();
    assertNull(event2);

    updateManager.selectionChanged(createContextWithVertRefIds(2, 3, 4, 5));

    assertEquals(2, mockEventProxy.getFireEventCalls());
    VerticesUpdateManager.VerticesUpdateEvent event3 = mockEventProxy.getLastFiredEvent();
    assertEquals(4, event3.getVertexRefs().size());

    updateManager.selectionChanged(createContextWithVertRefIds(5, 6));

    assertEquals(3, mockEventProxy.getFireEventCalls());
    VerticesUpdateManager.VerticesUpdateEvent event4 = mockEventProxy.getLastFiredEvent();
    assertEquals(2, event4.getVertexRefs().size());
  }
コード例 #2
0
  @Test
  public void testGraphUpdated() {
    MockEventProxy mockEventProxy = new MockEventProxy();
    OnmsServiceManager serviceManager = new DummyOnmsServiceManager();
    VaadinApplicationContext vaadinApplicationContext =
        new DummyVaadinApplicationContext(mockEventProxy);
    OsgiVerticesUpdateManager updateManager =
        new OsgiVerticesUpdateManager(serviceManager, vaadinApplicationContext);

    updateManager.graphChanged(createGraph(1, 2, 3, 4, 5, 6, 7));

    assertEquals(1, mockEventProxy.getFireEventCalls());

    updateManager.selectionChanged(createContextWithVertRefIds(1, 2, 3, 4));

    assertEquals(2, mockEventProxy.getFireEventCalls());

    updateManager.graphChanged(createGraph(1, 2, 3, 4, 5, 6, 7));

    assertEquals(2, mockEventProxy.getFireEventCalls());
  }