Exemplo n.º 1
0
  @Test
  public void testEventProcessingModeStreamChange() throws Exception {
    KBaseModel config = new KBaseModel();

    form.setModel(config);

    // Default
    assertEquals(EventProcessingOption.STREAM, config.getEventProcessingMode());

    // Toggle
    presenter.onEventProcessingModeCloudSelect();
    assertEquals(EventProcessingOption.CLOUD, config.getEventProcessingMode());

    presenter.onEventProcessingModeStreamSelect();
    assertEquals(EventProcessingOption.STREAM, config.getEventProcessingMode());
  }
Exemplo n.º 2
0
  @Test
  public void testEqualsBehaviorChange() throws Exception {
    KBaseModel config = new KBaseModel();

    form.setModel(config);

    // Default
    assertEquals(AssertBehaviorOption.IDENTITY, config.getEqualsBehavior());

    // Toggle
    presenter.onEqualsBehaviorEqualitySelect();
    assertEquals(AssertBehaviorOption.EQUALITY, config.getEqualsBehavior());

    presenter.onEqualsBehaviorIdentitySelect();
    assertEquals(AssertBehaviorOption.IDENTITY, config.getEqualsBehavior());
  }
Exemplo n.º 3
0
  @Test
  public void testShowSimpleData() throws Exception {
    KBaseModel config = new KBaseModel();
    config.setName("Name");

    config.setEqualsBehavior(AssertBehaviorOption.EQUALITY);
    config.setEventProcessingMode(EventProcessingOption.CLOUD);

    config.getStatelessSessions().put("1", createStatelessKSession("1"));
    config.getStatelessSessions().put("2", createStatelessKSession("2"));
    config.getStatelessSessions().put("3", createStatelessKSession("3"));

    config.getStatefulSessions().put("4,", createStatefulKSession("4"));
    config.getStatefulSessions().put("5,", createStatefulKSession("5"));

    form.setModel(config);
    verify(view).setName("Name");

    ArgumentCaptor<Map> statelessSessionModelArgumentCaptor = ArgumentCaptor.forClass(Map.class);
    ArgumentCaptor<Map> statefulModelArgumentCaptor = ArgumentCaptor.forClass(Map.class);

    verify(view).setStatefulSessions(statefulModelArgumentCaptor.capture());
    verify(view).setStatelessSessions(statelessSessionModelArgumentCaptor.capture());

    verify(view, never()).setEventProcessingModeStream();
    verify(view).setEventProcessingModeCloud();
    verify(view, never()).setEqualsBehaviorIdentity();
    verify(view).setEqualsBehaviorEquality();

    assertEquals(3, statelessSessionModelArgumentCaptor.getValue().size());
    assertEquals(2, statefulModelArgumentCaptor.getValue().size());
  }