Java Code Examples for org.apache.wicket.util.tester.FormTester.select()

The following are Jave code examples for showing how to use select() of the org.apache.wicket.util.tester.FormTester class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Unicorn   File: DependenciesPanelTest.java   View Source Code Vote up 6 votes
public void testDropDowns() {
    // event type drop down
    DropDownChoice eventTypeDropDown = (DropDownChoice) tester.getComponentFromLastRenderedPage(formPath + ":eventTypeField");
    Assert.assertNotNull(eventTypeDropDown.getChoices());
    FormTester formTester = tester.newFormTester(formPath, false);
    formTester.select("eventTypeField", 0);
    Assert.assertEquals(eventType.getTypeName(), ((EapEventType) eventTypeDropDown.getChoices().get(0)).getTypeName());

    // attribute drop downs
    DropDownChoice baseDropDown = (DropDownChoice) tester.getComponentFromLastRenderedPage(formPath + ":baseAttributeField");
    Assert.assertEquals(2, baseDropDown.getChoices().size());
    Assert.assertEquals(attributes, baseDropDown.getChoices());
    DropDownChoice depDropDown = (DropDownChoice) tester.getComponentFromLastRenderedPage(formPath + ":dependentAttributeField");
    Assert.assertEquals(1, depDropDown.getChoices().size());
    Assert.assertEquals(depAttribute, depDropDown.getChoices().get(0));

    // shown type labels
    Label baseTypeLabel = (Label) tester.getComponentFromLastRenderedPage(formPath + ":selectedBaseAttributeType");
    Assert.assertEquals("String", baseTypeLabel.getDefaultModelObjectAsString());
    Label depTypeLabel = (Label) tester.getComponentFromLastRenderedPage(formPath + ":selectedDependentAttributeType");
    Assert.assertEquals("Integer", depTypeLabel.getDefaultModelObjectAsString());
}
 
Example 2
Project: elpaaso-core   File: CreateObjectsWithGUI.java   View Source Code Vote up 6 votes
public static void createRelationalDatabaseService(PaasWicketTester myTester, String name, String serviceName
        , LogicalRelationalServiceSqlDialectEnum sqlVersion,
                                                   int capacityMo) {

    selectService(myTester, LogicalRelationalService.class);

    FormTester creationForm = NavigationUtils.getParamsFormTester(myTester);
    creationForm.setValue("label", name);
    creationForm.setValue("serviceName", serviceName);
    int sqlIndex = sqlVersion.ordinal();

    myTester.assertVisible(paramsFormPath + ":sqlVersion");
    myTester.assertComponent(paramsFormPath + ":sqlVersion", DropDownChoice.class);
    creationForm.select("sqlVersion", sqlIndex);
    creationForm.setValue("capacityMo", String.valueOf(capacityMo));

    NavigationUtils.submitParamsForm(myTester);

}
 
Example 3
Project: pm-wicket-archetype   File: CreateUserPageTest.java   View Source Code Vote up 6 votes
@Test
public void testSubmitWithError3() {
	addPermission(Permissions.ACCESS_HOMEPAGE);
	expect(usersService.getProfiles()).andReturn(TestUtils.getProfiles(3)).times(2);
	replayAll();
	getTester().startPage(HomePage.class);
	getTester().clickLink("usersMenu:createUsers:link");
	getTester().assertRenderedPage(CreateUserPage.class);
	
	FormTester form = getTester().newFormTester("form");
	form.setValue("controls:controlGroup:1:controlGroup:inputBox:input", "nome");
	form.setValue("controls:controlGroup:2:controlGroup:inputBox:input", "mail");
	form.select("controls:controlGroup:3:controlGroup:inputBox:input", 1);
	getTester().executeAjaxEvent("form:submit", "onclick");
	getTester().assertVisible("form:feedbackError:feedbackul:messages");
	verifyAll();
}
 
Example 4
Project: pm-wicket-archetype   File: CreateUserPageTest.java   View Source Code Vote up 6 votes
@Test
public void testSubmit() throws UserAlreadyExistsException {
	addPermission(Permissions.ACCESS_HOMEPAGE);
	expect(usersService.getProfiles()).andReturn(TestUtils.getProfiles(3)).times(2);
	expect(usersService.getUsers()).andReturn(TestUtils.getUsers(3));
	usersService.createUser(anyObject(UserApplication.class), anyObject(String.class), anyObject(String.class));
	replayAll();
	getTester().startPage(HomePage.class);
	getTester().clickLink("usersMenu:createUsers:link");
	getTester().assertRenderedPage(CreateUserPage.class);
	
	FormTester form = getTester().newFormTester("form");
	form.setValue("controls:controlGroup:1:controlGroup:inputBox:input", "nome");
	form.setValue("controls:controlGroup:2:controlGroup:inputBox:input", "[email protected]");
	form.select("controls:controlGroup:3:controlGroup:inputBox:input", 1);
	getTester().executeAjaxEvent("form:submit", "onclick");
	getTester().assertRenderedPage(ListUsersPage.class);
	verifyAll();
}
 
Example 5
Project: syncope   File: BulkActionITCase.java   View Source Code Vote up 6 votes
@Test
public void usersBulkAction() {
    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");

    Component component = findComponentByProp("username", CONTAINER
            + "searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
    assertNotNull(component);

    FormTester formTester = TESTER.newFormTester(CONTAINER + "searchContainer:resultTable:tablePanel:groupForm");
    assertNotNull(formTester);

    formTester.select("checkgroup", 2);

    TESTER.executeAjaxEvent(CONTAINER + "searchContainer:resultTable:tablePanel:bulkActionLink",
            Constants.ON_CLICK);

    TESTER.assertComponent(CONTAINER
            + "searchContainer:resultTable:bulkModal:form:content:content:container", WebMarkupContainer.class);

    assertNotNull(findComponentByProp("username", CONTAINER
            + "searchContainer:resultTable:bulkModal:form:content:content:container", "rossini"));
}
 
Example 6
Project: syncope   File: BulkActionITCase.java   View Source Code Vote up 6 votes
@Test
public void executePropagationTask() {
    TESTER.clickLink("body:topologyLI:topology");

    Component component = findComponentByProp("key", "body:resources", "resource-testdb");
    assertNotNull(component);
    TESTER.executeAjaxEvent(component.getPageRelativePath() + ":res", Constants.ON_CLICK);
    TESTER.clickLink("body:toggle:container:content:togglePanelContainer:container:actions:propagation");

    FormTester formTester = TESTER.newFormTester(
            "body:toggle:outerObjectsRepeater:1:outer:form:content:tasks:firstLevelContainer:first:container:"
            + "content:searchContainer:resultTable:tablePanel:groupForm");
    assertNotNull(formTester);

    formTester.select("checkgroup", 0);

    TESTER.executeAjaxEvent("body:toggle:outerObjectsRepeater:1:outer:form:content:tasks:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:bulkActionLink",
            Constants.ON_CLICK);

    TESTER.assertComponent("body:toggle:outerObjectsRepeater:1:outer:form:content:tasks:secondLevelContainer:"
            + "second:container:selectedObjects:body:rows:1:cells:1:cell", Label.class);
}
 
Example 7
Project: openmeetings   File: TestLoginUI.java   View Source Code Vote up 5 votes
private void performForget(String uid) throws ReflectiveOperationException, SecurityException {
	int type = rnd.nextInt(2);
	FormTester forgetTester = showForget();
	forgetTester.select("type", type);
	forgetTester.setValue("name", type == 0 ? getEmail(uid) : getLogin(uid));
	forgetTester.setValue("captcha:captchaText", getCaptcha("forget:form:captcha:captcha"));
	forgetTester.submit("submit");
	checkErrors(0);
	tester.assertLabel("forget:confirmDialog:container:message", getEscapedString("321"));
}
 
Example 8
Project: elpaaso-core   File: CreateObjectsWithGUI.java   View Source Code Vote up 5 votes
public static void createSoapService(PaasWicketTester myTester,
                                     String label,
                                     String jndiPrefix,
                                     String serviceName,
                                     int serviceMajorVersion,
                                     int serviceMinorVersion,
                                     String description,
                                     LogicalAttachmentTypeEnum serviceAttachmentType,
                                     String contextRoot,
                                     MavenReference mavenReference,
                                     LogicalInboundAuthenticationPolicy inboundAuthenticationPolicy,
                                     LogicalOutboundAuthenticationPolicy outboundAuthenticationPolicy,
                                     LogicalIdentityPropagationEnum identityPropagationEnum, String servicePath) {

    selectService(myTester, LogicalSoapService.class);
    FormTester creationForm = NavigationUtils.getParamsFormTester(myTester);
    creationForm.setValue("label", label);
    creationForm.setValue("jndiPrefix", jndiPrefix);
    creationForm.setValue("serviceName", serviceName);
    creationForm.setValue("serviceMajorVersion", String.valueOf(serviceMajorVersion));
    creationForm.setValue("serviceMinorVersion", String.valueOf(serviceMinorVersion));
    creationForm.setValue("description", description);
    creationForm.select("serviceAttachmentType", serviceAttachmentType.ordinal());
    creationForm.setValue("contextRoot.value", contextRoot);
    creationForm.setValue("servicePath.value", servicePath);
    creationForm.setValue("serviceAttachments.groupId",mavenReference.getGroupId());
    creationForm.setValue("serviceAttachments.artifactId",mavenReference.getArtifactId());
    creationForm.setValue("serviceAttachments.version",mavenReference.getVersion());
    creationForm.select("inboundAuthenticationPolicy.accessZone", inboundAuthenticationPolicy.getAccessZone().ordinal());
    creationForm.select("inboundAuthenticationPolicy.authenticationType",inboundAuthenticationPolicy.getAuthenticationType().ordinal());
    creationForm.select("inboundAuthenticationPolicy.protocol",inboundAuthenticationPolicy.getProtocol().ordinal());
    creationForm.select("outboundAuthenticationPolicy.authenticationType",outboundAuthenticationPolicy.getAuthenticationType().ordinal());
    creationForm.select("outboundAuthenticationPolicy.protocol",outboundAuthenticationPolicy.getProtocol().ordinal());
    creationForm.select("identityPropagation",identityPropagationEnum.ordinal());
    NavigationUtils.submitParamsForm(myTester);

}
 
Example 9
Project: elpaaso-core   File: CreateObjectsWithGUI.java   View Source Code Vote up 5 votes
public static void createQueueSendService(PaasWicketTester myTester, String name, String target, String targetApplicationName, String targetApplicationVersion
, String targetServiceName, String targetServiceVersion, String jndiQueueName
, long msgMaxSizeKB, long maxNbMsgPerDay, long nbRetentionDay) {

    selectService(myTester, LogicalQueueSendService.class);
    
    List<String> applications = null;
    List<String> applicationVersions = null;
    List<String> services = null;
    List<String> serviceVersions = null;
    try {
        applications = ((ManageLogicalDeployment) myTester.getPaasApplication().getContext().getBean(ManageLogicalDeployment.class)).getQrsApplications(target);
        applicationVersions = ((ManageLogicalDeployment) myTester.getPaasApplication().getContext().getBean(ManageLogicalDeployment.class)).getQrsApplicationVersions(target, targetApplicationName);
        services = ((ManageLogicalDeployment) myTester.getPaasApplication().getContext().getBean(ManageLogicalDeployment.class)).getQrsServices(target, targetApplicationName, targetApplicationVersion);
        serviceVersions = ((ManageLogicalDeployment) myTester.getPaasApplication().getContext().getBean(ManageLogicalDeployment.class)).getQrsServicesVersions(target, targetApplicationName, targetApplicationVersion, targetServiceName);
    } catch (ObjectNotFoundException e) {
        Assert.fail("unable to fetch Qrs informations");
    }

    FormTester creationFormAjax = NavigationUtils.getParamsFormTester(myTester);
    simpleSelect(myTester, creationFormAjax, "targetApplicationName", applications.indexOf(targetApplicationName));
    simpleSelect(myTester, creationFormAjax, "targetApplicationVersion", applicationVersions.indexOf(targetApplicationVersion));
    simpleSelect(myTester, creationFormAjax, "targetServiceName", services.indexOf(targetServiceName));
    simpleSelect(myTester, creationFormAjax, "targetServiceVersion", serviceVersions.indexOf(targetServiceVersion));

    FormTester creationForm = NavigationUtils.getParamsFormTester(myTester);
    creationForm.setValue("label", name);
    creationForm.setValue("jndiQueueName", jndiQueueName);
    creationForm.select("targetApplicationName",applications.indexOf(targetApplicationName));
    creationForm.select("targetApplicationVersion",applicationVersions.indexOf(targetApplicationVersion));
    creationForm.select("targetServiceName",services.indexOf(targetServiceName));
    creationForm.select("targetServiceVersion",serviceVersions.indexOf(targetServiceVersion));
    selectItem(myTester, creationForm, msgMaxSizeKB, "msgMaxSizeKB");
    selectItem(myTester, creationForm, maxNbMsgPerDay, "maxNbMsgPerDay");
    selectItem(myTester, creationForm, nbRetentionDay, "nbRetentionDay");


    NavigationUtils.submitParamsForm(myTester);

}
 
Example 10
Project: elpaaso-core   File: CreateObjectsWithGUI.java   View Source Code Vote up 5 votes
/**
 * Selects a service in the ListChoice of services
 * @param index index of the service in the ListChoice
 */
private static void selectService(PaasWicketTester myTester, int index) {

    FormTester formTester = myTester.newFormTester(NavigationUtils.selectFormPath);
    formTester.select(NavigationUtils.selectServicePath, index);
    myTester.executeAjaxEvent(formPath + ":logicalServicesListSelect", "onchange");

    myTester.isVisible("firstPartContainer:serviceDefinitionPanel:container");
}
 
Example 11
Project: syncope   File: GroupsITCase.java   View Source Code Vote up 5 votes
@Test
public void read() {
    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");

    Component component = findComponentByProp("name", CONTAINER
            + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "artDirector");
    assertNotNull(component);

    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink(TAB_PANEL + "outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:"
            + "actions:actions:actionRepeater:3:action:action");

    FormTester formTester = TESTER.newFormTester(TAB_PANEL
            + "outerObjectsRepeater:7:outer:container:content:togglePanelContainer:membersForm");

    formTester.select("type:dropDownChoiceField", 0);
    formTester.submit("changeit");

    TESTER.assertModelValue(TAB_PANEL
            + "outerObjectsRepeater:6:outer:dialog:header:header-label", "USER members of artDirector");
    assertNotNull(findComponentByProp("username", TAB_PANEL
            + "outerObjectsRepeater:6:outer:form:content:searchResult:container:content:"
            + "searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "puccini"));

    TESTER.executeAjaxEvent(TAB_PANEL
            + "outerObjectsRepeater:6:outer:dialog:footer:buttons:0:button", Constants.ON_CLICK);
}
 
Example 12
Project: syncope   File: TopologyITCase.java   View Source Code Vote up 5 votes
@Test
public void createSchedTask() {
    TESTER.executeAjaxEvent("body:syncope", Constants.ON_CLICK);
    TESTER.clickLink("body:toggle:container:content:togglePanelContainer:container:actions:tasks");
    TESTER.clickLink(
            "body:toggle:outerObjectsRepeater:2:outer:form:content:tasks:firstLevelContainer:first:"
            + "container:content:add");

    FormTester formTester = TESTER.newFormTester(
            "body:toggle:outerObjectsRepeater:2:outer:form:content:tasks:firstLevelContainer:first:"
            + "container:content:wizard:form");
    formTester.setValue("view:name:textField", "test");
    formTester.select("view:jobDelegate:dropDownChoiceField", 0);

    formTester.submit("buttons:next");
    TESTER.cleanupFeedbackMessages();

    formTester = TESTER.newFormTester(
            "body:toggle:outerObjectsRepeater:2:outer:form:content:tasks:firstLevelContainer:first:"
            + "container:content:wizard:form");

    TESTER.assertComponent(
            "body:toggle:outerObjectsRepeater:2:outer:form:content:tasks:firstLevelContainer:"
            + "first:container:content:wizard:form:view:schedule:seconds:textField", TextField.class);

    formTester.submit("buttons:finish");
    TESTER.cleanupFeedbackMessages();
}
 
Example 13
Project: flex-ui   File: EnumDropDownChoiceTest.java   View Source Code Vote up 5 votes
@Test
public void submit_setsModelObjectSelectionCorrectly() throws Exception {
    EnumDropDownChoice<TestEnum> component = new EnumDropDownChoice<>("testEnum", TestEnum.class);
    page.getForm().add(component);

    startPage(page);

    FormTester formTester = wicketTester.newFormTester("form");
    formTester.select("testEnum", 1);
    formTester.submit();

    assertEquals(TestEnum.BAR_ED, page.getForm().getModelObject().getTestEnum());
}
 
Example 14
Project: openmeetings   File: TestInstall.java   View Source Code Vote up 4 votes
@Test
public void testInstall() {
	InstallWizardPage page = tester.startPage(InstallWizardPage.class);
	tester.assertRenderedPage(InstallWizardPage.class);
	InstallWizard wiz = (InstallWizard)page.get(WIZARD_PATH);
	assertNull("Model should be null", wiz.getWizardModel().getActiveStep());
	tester.executeBehavior((AbstractAjaxBehavior)page.getBehaviorById(0)); //welcome step
	assertNotNull("Model should NOT be null", wiz.getWizardModel().getActiveStep());

	ButtonAjaxBehavior prev = getButtonBehavior(tester, WIZARD_PATH, "PREV");
	 //check enabled, add check for other buttons on other steps
	assertFalse("Prev button should be disabled", prev.getButton().isEnabled());
	ButtonAjaxBehavior next = getButtonBehavior(tester, WIZARD_PATH, "NEXT");
	ButtonAjaxBehavior finish = getButtonBehavior(tester, WIZARD_PATH, SUBMIT);
	tester.executeBehavior(next); //DB step
	FormTester wizardTester = tester.newFormTester("wizard:form");
	wizardTester.select("view:form:dbType", 1);
	checkErrors(tester, 0);
	tester.executeBehavior(next); //user step
	checkErrors(tester, 0);
	wizardTester.setValue("view:username", adminUsername);
	wizardTester.setValue("view:password", userpass);
	wizardTester.setValue("view:email", email);
	String[] tzIds = TimeZone.getAvailableIDs();
	wizardTester.select("view:timeZone", rnd.nextInt(tzIds.length));
	wizardTester.setValue("view:group", group);
	tester.executeBehavior(next); //cfg+smtp step
	checkErrors(tester, 0);
	wizardTester.setValue("view:smtpPort", "25");
	wizardTester.select("view:defaultLangId", 0);
	tester.executeBehavior(next); //converters step
	checkErrors(tester, 0);
	wizardTester.setValue("view:docDpi", "150");
	wizardTester.setValue("view:docQuality", "90");
	tester.executeBehavior(next); //crypt step
	// not checking errors
	if (countErrors(tester) > 0) {
		tester.cleanupFeedbackMessages();
		wizardTester.setValue("view:docDpi", "150");
		wizardTester.setValue("view:docQuality", "90");
		tester.executeBehavior(next); //skip errors
	}
	wizardTester.setValue("view:cryptClassName", SCryptImplementation.class.getName());
	tester.executeBehavior(next); //install step
	checkErrors(tester, 0);
	tester.executeBehavior(finish);
	checkErrors(tester, 0);
}
 
Example 15
Project: elpaaso-core   File: ApplicationPagesTest.java   View Source Code Vote up 4 votes
@Test
public void update_application_should_update_application_details() throws Exception {
    prepareMocksForPublicApp();
    prepareMocksForAppUpdate();

    // go to application page
    myTester.startPage(ApplicationsPage.class);

    // test that we are on applications page
    myTester.assertRenderedPage(ApplicationsPage.class);

    // click on the first application link in the designer table
    myTester.clickLink(APPS_TABLE_PANEL_ACTION_CELL +":cell:app-edit");

    // test that we are on selected application page
    myTester.assertRenderedPage(SelectedAppPage.class);

    // test that selected app page breadcrumbs contains the selected application name
    myTester.assertContains("application : " + publicApp.getLabel());

    // test that selected application textfield in selected app page are disable
    myTester.assertEnabled("appInfoPanel:appForm:label");

    // test that update application button is visible
    myTester.assertVisible("appInfoPanel:appForm:buttonContainer:appUpdateLink");

    // modify values of each application parameters
    FormTester appformTester = myTester.newFormTester("appInfoPanel:appForm");

    appformTester.select("isPublic", 1); // set private

    appformTester.setValue("label", publicApp.getLabel() + "_modify");
    appformTester.setValue("code", publicApp.getCode() + "_modify");
    appformTester.setValue("description", publicApp.getDescription() + "_modify");

    appformTester.setValue("members", "homer marge lisa bart");

    // click on update application button
    myTester.executeAjaxEvent("appInfoPanel:appForm:buttonContainer:appUpdateLink", "onclick");
    
    ArgumentCaptor<Application> argument = ArgumentCaptor.forClass(Application.class);
    Mockito.verify(manageApplication).updateApplication(argument.capture());
    assertApplicationEquals(updatedApp, argument.getValue());

    // test no error message
    myTester.assertNoErrorMessage();

    // test application modifications display
    myTester.assertContains(publicApp.getLabel() + "_modify");
    myTester.assertContains(publicApp.getCode() + "_modify");
    myTester.assertContains(publicApp.getDescription() + "_modify");

    // test that modify application button is visible
    myTester.assertVisible("appInfoPanel:appForm:buttonContainer:appModifyLink");
}
 
Example 16
Project: elpaaso-core   File: ReleasePagesTest.java   View Source Code Vote up 4 votes
@Test
public void shouldDisplayErrorMessageWhenBusinessException() throws BusinessException {

    // go to application page
    myTester.startPage(ApplicationsPage.class);

    // test that we are on applications page
    myTester.assertRenderedPage(ApplicationsPage.class);

    // click on edit button of the first application in the designer table
    myTester.clickLink("appsTablePanel:refreshApplication:applicationsDataTable:body:rows:1:cells:1:cell:appDetailsLink");

    // test that we are on selected application page
    myTester.assertRenderedPage(SelectedAppPage.class);

    // test that selected app page breadcrumbs contains the selected application name
    myTester.assertContains("application : "+appLabel);

    // click on edit button of the first release in the releases table
    myTester.clickLink("releasesTablePanel:refreshRealese:releasesDataTable:body:rows:1:cells:1:cell:releaseLink");

    // check we are on SelectedReleasesPage
    myTester.assertRenderedPage(SelectedReleasePage.class);

    //click on new environment button
    myTester.executeAjaxEvent("newEnvLink", "onclick");
         
    //GIVEN there is no error message
    myTester.assertNoErrorMessage(); 
    
    //GIVEN environment to be created does not exist
    when(manageEnvironment.isEnvironmentLabelUniqueForRelease(anyString(), anyString(), anyString())).thenReturn(true);
    //GIVEN projection fail
    when(manageEnvironment.createEnvironment(anyString(), any(EnvironmentTypeEnum.class), anyString(), anyString())).thenThrow(new BusinessException("dummy message"));
    
    //WHEN I request for environment creation
    // set environment parameters
    FormTester createEnvFormTester = myTester.newFormTester("createEnvContainer:createEnvForm:envForm");
    createEnvFormTester.setValue("label", "aLabel");
    createEnvFormTester.select("type", 0);
     // click on create environment button
    myTester.executeAjaxEvent("createEnvContainer:createEnvForm:envForm:addEnvButton", "onclick");
              
    //THEN I should get an error message containing dummy message
    myTester.assertErrorMessages("error : dummy message"); 
    
}
 
Example 17
Project: elpaaso-core   File: ReleasePagesTest.java   View Source Code Vote up 4 votes
private void createReleaseFromUI(boolean appSelected, boolean mustShowSelectApp, boolean overrideProfile) {
     // display application and its first release form panel
     myTester.clickLink("newReleaseLink");

     String releaseFormPath = "createReleaseContainer:createReleaseForm:releaseForm";

     final Component releaseCreatePanel = myTester.getComponentFromLastRenderedPage(releaseFormPath);
     assertThat(releaseCreatePanel)
             .as("release creation form should be present")
             .isNotNull();

     if (mustShowSelectApp) {
         myTester.assertContains("\"application\"");
     }
     // test release fields
     myTester.assertContains("\"releaseVersion\"");
     myTester.assertContains("\"description\"");
     // myTester.assertContains("\"versionControlUrl\"");
     myTester.assertContains("\"forkCheckbox\"");
     myTester.assertContains("\"overrideProfileCheckbox\"");
     	
     // check if button with label create application is in the page
     myTester.assertContains("create release");

     FormTester formTester = myTester.newFormTester(releaseFormPath);

     // first to be done because already input form values are RAZ'ed by wicket here
     if (overrideProfile) {
         logger.info("override profile");

// checkbox form set value
myTester.assertComponent("overrideProfileCheckbox", CheckBox.class);
formTester.setValue("releaseFieldsetPanel:overrideProfileCheckbox", true);
// ajax call overrideProfileCheckboxPath, onclick
myTester.executeAjaxEvent("overrideProfileCheckbox", "onclick");

// select profile
Component listboxComponent = myTester.getComponentFromLastRenderedPage("middlewareProfileSelect");
assertNotNull(listboxComponent);
DropDownChoice<MiddlewareProfile> listbox = (DropDownChoice<MiddlewareProfile>) listboxComponent;
int profilIndex = listbox.getChoices().indexOf(getProfile());
assertThat(profilIndex).as("Profile not found "+getProfile().getVersion()).isGreaterThanOrEqualTo(0);
formTester.select("releaseFieldsetPanel:overrideProfilePanel:middlewareProfileContainer:middlewareProfileSelect", profilIndex);
     }
     // DEBUG // myTester.debugComponentTrees("application");

     if (!appSelected) {
         formTester.select("releaseFieldsetPanel:selectApplication:application", 0);
     }

     // change release version
     myTester.assertComponent("releaseVersion", TextField.class);
     // TextField tf = (TextField)myTester.getComponentFromLastRenderedPage(releaseVersionPath);
     // tf.getModel().setObject(releaseVersion);
     formTester.setValue("releaseFieldsetPanel:releaseVersion", releaseVersion);

     // change release description
     myTester.assertComponent("releaseFieldsetPanel:description", TextArea.class);
     // TextArea ta = (TextArea)myTester.getComponentFromLastRenderedPage(releaseDescriptionPath);
     // ta.getModel().setObject(releaseDescription);
     formTester.setValue("releaseFieldsetPanel:description", releaseDescription);

     myTester.executeAjaxEvent("addReleaseButton", "onclick");

     myTester.assertNoErrorMessage();
     // test we are on designer step one page
     myTester.assertRenderedPage(DesignerPage.class);
 }
 
Example 18
Project: syncope   File: UsersITCase.java   View Source Code Vote up 4 votes
@Test
public void changePassword() {
    TESTER.cleanupFeedbackMessages();

    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");

    Component component = findComponentByProp("username", CONTAINER
            + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "vivaldi");
    assertNotNull(component);

    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink(TAB_PANEL + "outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:"
            + "actions:actions:actionRepeater:3:action:action");

    TESTER.assertLabel(TAB_PANEL + "outerObjectsRepeater:3:outer:form:content:status:resources:"
            + "firstLevelContainer:first:container:content:group:beans:0:fields:0:field", "syncope");

    FormTester formTester = TESTER.newFormTester(TAB_PANEL + "outerObjectsRepeater:3:outer:form");
    formTester.setValue("content:passwordPanel:passwordInnerForm:password:passwordField", "Password345");
    formTester.setValue("content:passwordPanel:passwordInnerForm:confirmPassword:passwordField", "Password345");
    formTester.select("content:status:resources:firstLevelContainer:first:container:content:group", 0);

    TESTER.executeAjaxEvent(
            TAB_PANEL + "outerObjectsRepeater:3:outer:dialog:footer:inputs:0:submit", Constants.ON_CLICK);

    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();

    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");

    component = findComponentByProp("username", CONTAINER
            + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "vivaldi");
    assertNotNull(component);

    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    TESTER.clickLink(TAB_PANEL + "outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:"
            + "actions:actions:actionRepeater:3:action:action");

    TESTER.assertLabel(TAB_PANEL + "outerObjectsRepeater:3:outer:form:content:status:resources:"
            + "firstLevelContainer:first:container:content:group:beans:0:fields:0:field", "syncope");

    formTester = TESTER.newFormTester(TAB_PANEL + "outerObjectsRepeater:3:outer:form");
    formTester.setValue("content:passwordPanel:passwordInnerForm:password:passwordField", "Password123");
    formTester.setValue("content:passwordPanel:passwordInnerForm:confirmPassword:passwordField", "Password123");
    formTester.select("content:status:resources:firstLevelContainer:first:container:content:group", 0);

    TESTER.executeAjaxEvent(
            TAB_PANEL + "outerObjectsRepeater:3:outer:dialog:footer:inputs:0:submit", Constants.ON_CLICK);

    TESTER.assertInfoMessages("Operation executed successfully");
    TESTER.cleanupFeedbackMessages();
}
 
Example 19
Project: syncope   File: NotificationsITCase.java   View Source Code Vote up 4 votes
private void createNotification(final String sender, final String subject) {
    TESTER.clickLink("body:content:tabbedPanel:panel:container:content:add");

    TESTER.assertComponent("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer", Modal.class);

    FormTester formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");

    formTester.select("content:form:view:template:dropDownChoiceField", 2);
    formTester.select("content:form:view:traceLevel:dropDownChoiceField", 0);
    formTester.setValue("content:form:view:sender:textField", sender);
    formTester.setValue("content:form:view:subject:textField", subject);

    TESTER.cleanupFeedbackMessages();
    formTester.submit("content:form:buttons:next");
    TESTER.assertNoErrorMessage();

    // -------------------------------
    // recipients
    // -------------------------------
    formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
    TESTER.executeAjaxEvent("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form:content:form:"
            + "view:staticRecipients:multiValueContainer:innerForm:content:panelPlus:add", Constants.ON_CLICK);
    formTester.setValue("content:form:view:staticRecipients:multiValueContainer:innerForm:content:view:0:panel:"
            + "textField", "[email protected]");
    formTester.setValue("content:form:view:selfAsRecipient:checkboxField", true);
    formTester.setValue("content:form:view:recipientAttrName:textField", "email");

    TESTER.cleanupFeedbackMessages();
    formTester.submit("content:form:buttons:next");
    TESTER.assertNoErrorMessage();

    // -------------------------------
    // generate event to populate eventsPanel
    // -------------------------------
    formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:form:view:eventSelection:categoryContainer:category:dropDownChoiceField", "0");
    TESTER.executeAjaxEvent("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form:"
            + "content:form:view:eventSelection:categoryContainer:category:dropDownChoiceField",
            Constants.ON_CHANGE);
    // -------------------------------

    // -------------------------------
    // select event template
    // -------------------------------
    formTester.setValue("content:form:view:eventSelection:eventsContainer:eventsPanel:successGroup", "check0");
    TESTER.executeAjaxEvent("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form:content:"
            + "form:view:eventSelection:eventsContainer:eventsPanel:successGroup",
            Constants.ON_CLICK);
    // -------------------------------

    formTester.setValue("content:form:view:eventSelection:categoryContainer:category:dropDownChoiceField", "0");
    formTester.setValue("content:form:view:eventSelection:eventsContainer:eventsPanel:successGroup", "check0");

    TESTER.cleanupFeedbackMessages();
    formTester.submit("content:form:buttons:next");
    TESTER.assertNoErrorMessage();

    formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
    TESTER.cleanupFeedbackMessages();

    TESTER.cleanupFeedbackMessages();
    formTester.submit("content:form:buttons:finish");
    TESTER.assertInfoMessages("Operation executed successfully");

    TESTER.cleanupFeedbackMessages();
    TESTER.clickLink("body:configurationLI:configurationUL:notificationsLI:notifications");
}
 
Example 20
Project: syncope   File: BulkActionITCase.java   View Source Code Vote up 4 votes
@Test
public void userResourceBulkAction() {
    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:1:link");

    Component component = findComponentByProp("username", CONTAINER
            + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini");
    assertNotNull(component);

    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    // manage resource
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:searchResult:outerObjectsRepeater:1"
            + ":outer:container:content:togglePanelContainer:container:actions:actions:actionRepeater:5:"
            + "action:action");

    TESTER.assertComponent(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:"
            + "checkgroup:dataTable", WebMarkupContainer.class);

    component = findComponentByProp("resource",
            TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:"
            + "checkgroup:dataTable", "resource-csv");
    assertNotNull(component);

    FormTester formTester = TESTER.newFormTester(
            TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:firstLevelContainer:"
            + "first:container:content:searchContainer:resultTable:tablePanel:groupForm");
    assertNotNull(formTester);

    formTester.select("checkgroup", 2);

    TESTER.executeAjaxEvent(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:bulkActionLink",
            Constants.ON_CLICK);

    TESTER.assertComponent(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "secondLevelContainer:second:container", WebMarkupContainer.class);

    assertNotNull(findComponentByProp("resource", TAB_PANEL + "outerObjectsRepeater:2:outer:"
            + "form:content:status:secondLevelContainer:second:container", "resource-csv"));
}
 
Example 21
Project: syncope   File: BulkActionITCase.java   View Source Code Vote up 4 votes
@Test
public void groupResourceBulkAction() {
    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:2:link");

    Component component = findComponentByProp("name", CONTAINER
            + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "director");
    assertNotNull(component);

    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    // manage resource
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:searchResult:outerObjectsRepeater:1"
            + ":outer:container:content:togglePanelContainer:container:actions:actions:actionRepeater:6:"
            + "action:action");

    TESTER.assertComponent(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:"
            + "checkgroup:dataTable", WebMarkupContainer.class);

    TESTER.clickLink(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:firstLevelContainer:first:"
            + "container:content:searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable:topToolbars:"
            + "toolbars:1:headers:2:header:orderByLink", true);

    component = findComponentByProp("resource",
            TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:"
            + "checkgroup:dataTable", "ws-target-resource-1");
    assertNotNull(component);

    FormTester formTester = TESTER.newFormTester(
            TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:firstLevelContainer:"
            + "first:container:content:searchContainer:resultTable:tablePanel:groupForm");
    assertNotNull(formTester);

    formTester.select("checkgroup", 7);

    TESTER.executeAjaxEvent(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:bulkActionLink",
            Constants.ON_CLICK);

    TESTER.assertComponent(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "secondLevelContainer:second:container", WebMarkupContainer.class);

    assertNotNull(findComponentByProp("resource", TAB_PANEL + "outerObjectsRepeater:2:outer:"
            + "form:content:status:secondLevelContainer:second:container:selectedObjects", "resource-testdb2"));
}
 
Example 22
Project: syncope   File: BulkActionITCase.java   View Source Code Vote up 4 votes
@Test
public void printerResourceBulkAction() {
    TESTER.clickLink("body:realmsLI:realms");
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");

    Component component = findComponentByProp("key", CONTAINER
            + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
            "8559d14d-58c2-46eb-a2d4-a7d35161e8f8");
    assertNotNull(component);

    TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
    // manage resource
    TESTER.clickLink("body:content:body:container:content:tabbedPanel:panel:searchResult:outerObjectsRepeater:1"
            + ":outer:container:content:togglePanelContainer:container:actions:actions:actionRepeater:2:"
            + "action:action");

    TESTER.assertComponent(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:"
            + "checkgroup:dataTable", WebMarkupContainer.class);

    TESTER.clickLink(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:firstLevelContainer:first:"
            + "container:content:searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable:topToolbars:"
            + "toolbars:1:headers:2:header:orderByLink", true);

    component = findComponentByProp("resource",
            TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:"
            + "checkgroup:dataTable", "ws-target-resource-1");
    assertNotNull(component);

    FormTester formTester = TESTER.newFormTester(
            TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:firstLevelContainer:"
            + "first:container:content:searchContainer:resultTable:tablePanel:groupForm");
    assertNotNull(formTester);

    formTester.select("checkgroup", 7);

    TESTER.executeAjaxEvent(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:bulkActionLink",
            Constants.ON_CLICK);

    TESTER.assertComponent(TAB_PANEL + "outerObjectsRepeater:2:outer:form:content:status:"
            + "secondLevelContainer:second:container", WebMarkupContainer.class);

    assertNotNull(findComponentByProp("resource", TAB_PANEL + "outerObjectsRepeater:2:outer:"
            + "form:content:status:secondLevelContainer:second:container:selectedObjects", "resource-testdb2"));
}
 
Example 23
Project: elpaaso-core   File: CreateObjectsWithGUI.java   View Source Code Vote up 3 votes
private static void selectItem(PaasWicketTester myTester, FormTester form, Object item, String id) {

        List choices = ((DropDownChoice)myTester.getComponentFromLastRenderedPage(paramsFormPath + ":" + id)).getChoices();
        int index = choices.indexOf(item);
        form.select(id, index);

    }
 
Example 24
Project: elpaaso-core   File: CreateObjectsWithGUI.java   View Source Code Vote up 2 votes
private static void simpleSelect(PaasWicketTester myTester, FormTester form, String id, int index) {

        form.select(id, index);
        myTester.executeAjaxEvent(paramsFormPath + ":" + id, "onchange");

    }