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")); }
public void test_addComposite_fromModel() throws Exception { initNoRole(); roleTab.getGuiManager().addRole(new RoleComposite("new-composite")); assertTrue(getCompositeList().contentEquals(new String[] {"new-composite"})); }
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"})); }
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()); }
private Panel getMainPanel() { return new Panel(roleTab.getMainPanel()); }
private static RoleTab create(ModelBuilder modelBuilder) { RoleTab tab = new RoleTab(); tab.initialize(new GuiModelManager(modelBuilder.get())); return tab; }