本文整理汇总了Java中org.apache.wicket.util.tester.FormTester.select方法的典型用法代码示例。如果您正苦于以下问题:Java FormTester.select方法的具体用法?Java FormTester.select怎么用?Java FormTester.select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.util.tester.FormTester
的用法示例。
在下文中一共展示了FormTester.select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDropDowns
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
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());
}
示例2: createRelationalDatabaseService
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
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);
}
示例3: testSubmitWithError3
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@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();
}
示例4: testSubmit
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@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();
}
示例5: usersBulkAction
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@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"));
}
示例6: executePropagationTask
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@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);
}
示例7: performForget
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
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"));
}
示例8: createSoapService
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
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);
}
示例9: createQueueSendService
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
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);
}
示例10: selectService
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
/**
* 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");
}
示例11: read
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@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);
}
示例12: createSchedTask
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@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();
}
示例13: submit_setsModelObjectSelectionCorrectly
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@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());
}
示例14: testInstall
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@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);
}
示例15: update_application_should_update_application_details
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@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");
}