Пример #1
0
  public void test_addRoleToComposite_automaticSelection() throws Exception {
    initNoRole();

    roleTab.getGuiManager().addRole(new RoleComposite("new-composite"));
    getCompositeList().clearSelection();

    roleTab
        .getGuiManager()
        .addRoleToComposite(new Role("guest"), new RoleComposite("new-composite"));

    assertTrue(getCompositeList().selectionEquals("new-composite"));
  }
Пример #2
0
  public void test_addComposite_fromModel() throws Exception {
    initNoRole();

    roleTab.getGuiManager().addRole(new RoleComposite("new-composite"));

    assertTrue(getCompositeList().contentEquals(new String[] {"new-composite"}));
  }
Пример #3
0
  public void test_searchAssignableRoleUpdate() {
    roleTab =
        create(
            new ModelBuilder()
                .addRole("role1")
                .addRole("role2")
                .addRoleComposite("composite_B")
                .addRoleComposite("composite_A", "composite_B"));

    getCompositeList().select("composite_A");
    assertTrue(getUnassignedList().contentEquals(new String[] {"role1", "role2"}));

    getAssignableSearchField().setText("role1");
    assertTrue(getUnassignedList().contentEquals(new String[] {"role1"}));

    roleTab
        .getGuiManager()
        .removeRoleToComposite(new Role("composite_B"), new RoleComposite("composite_A"));
    assertTrue(getUnassignedList().contentEquals(new String[] {"role1"}));

    getCompositeList().select("composite_B");

    assertEquals("role1", getAssignableSearchField().getText());
    assertTrue(getUnassignedList().contentEquals(new String[] {"role1"}));

    getAssignableSearchField().setText("");
    assertTrue(getUnassignedList().contentEquals(new String[] {"composite_A", "role1", "role2"}));
  }
Пример #4
0
  public void test_search_notCanceledWhenModifiedRole() throws Exception {
    roleTab =
        create(
            new ModelBuilder()
                .addRole("role1")
                .addRole("role2")
                .addRoleComposite("composite_B")
                .addRoleComposite("composite_A", "composite_B"));

    getCompositeSearchField().setText("role1");
    assertTrue(getCompositeList().contentEquals(new String[] {}));

    roleTab.getGuiManager().addRoleToComposite(new Role("role1"), new RoleComposite("composite_A"));

    assertTrue(getCompositeList().contentEquals(new String[] {"composite_A"}));
    assertEquals("role1", getCompositeSearchField().getText());
  }
Пример #5
0
 private Panel getMainPanel() {
   return new Panel(roleTab.getMainPanel());
 }
Пример #6
0
 private static RoleTab create(ModelBuilder modelBuilder) {
   RoleTab tab = new RoleTab();
   tab.initialize(new GuiModelManager(modelBuilder.get()));
   return tab;
 }