本文整理汇总了Java中org.apache.wicket.util.tester.FormTester.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java FormTester.setValue方法的具体用法?Java FormTester.setValue怎么用?Java FormTester.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.util.tester.FormTester
的用法示例。
在下文中一共展示了FormTester.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSelectAllCheckbox
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
public void testSelectAllCheckbox() {
addDependencyValues();
Assert.assertFalse(((AjaxCheckBox) tester.getComponentFromLastRenderedPage(listViewPath + ":0:deleteCheckbox")).getModel().getObject());
// click checkbox
FormTester formTester = tester.newFormTester(formPath, false);
formTester.setValue("dependenciesContainer:selectAllCheckbox", true);
tester.executeAjaxEvent(formPath + ":dependenciesContainer:selectAllCheckbox", "onclick");
ComponentHierarchyIterator allCheckboxes = tester.getLastRenderedPage().visitChildren(AjaxCheckBox.class);
int numberOfCheckedBoxes = 0;
for (Component box : allCheckboxes) {
numberOfCheckedBoxes++;
System.out.println("PATH: " + box.getPageRelativePath());
Assert.assertTrue(((AjaxCheckBox) box).getModel().getObject());
}
Assert.assertEquals(3, numberOfCheckedBoxes);
}
示例2: createQueueReceiveService
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
public static void createQueueReceiveService(PaasWicketTester myTester, String name, String serviceName, String serviceVersion, String jndiQueuName
, long msgMaxSizeKB, long maxNbMsgPerDay, long nbRetentionDay) {
selectService(myTester, LogicalQueueReceiveService.class);
FormTester creationForm = NavigationUtils.getParamsFormTester(myTester);
creationForm.setValue("label", name);
creationForm.setValue("serviceName", serviceName);
creationForm.setValue("serviceVersion", serviceVersion);
creationForm.setValue("jndiQueueName", jndiQueuName);
myTester.assertComponent(paramsFormPath + ":msgMaxSizeKB", DropDownChoice.class);
myTester.assertComponent(paramsFormPath + ":maxNbMsgPerDay", DropDownChoice.class);
myTester.assertComponent(paramsFormPath + ":nbRetentionDay", DropDownChoice.class);
selectItem(myTester, creationForm, msgMaxSizeKB, "msgMaxSizeKB");
selectItem(myTester, creationForm, maxNbMsgPerDay, "maxNbMsgPerDay");
selectItem(myTester, creationForm, nbRetentionDay, "nbRetentionDay");
NavigationUtils.submitParamsForm(myTester);
}
示例3: testPreviewWrongUrl
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testPreviewWrongUrl() {
goOnGoodPage();
//Create FormTester
FormTester formTester = getMyTester().newFormTester(NavigationUtils.designerParamFormPath);
//Set wrong url
formTester.setValue("iconUrl","hicons.iconarchive.com/icons/ahdesign91/media-player/32/WinAmp-icon");
//Update modelObject
getMyTester().executeAjaxEvent(NavigationUtils.designerParamFormPath + ":iconUrl", "onchange");
//Click on preview button
getMyTester().executeAjaxEvent(NavigationUtils.designerParamFormPath+":imageContainer:preview", "onclick");
//Check error
getMyTester().assertContains("Invalid icon Url format");
getMyTester().assertContains("no protocol: hicons.iconarchive.com/icons/ahdesign91/media-player/32/WinAmp-icon");
}
示例4: testNegativeValueForMaxMessageSize
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testNegativeValueForMaxMessageSize() {
//Create FormTester
FormTester formTester = myTester.newFormTester(NavigationUtils.designerParamFormPath);
//Fill form with default required values
fillForm(formTester);
// Set negative Value on msg size field
formTester.setValue("msgMaxSizeKB", "-1");
//Submit form
myTester.executeAjaxEvent(NavigationUtils.designerParamFormPath + ":addUpdateButton", "onclick");
//Check error
//TODO : Wait for zenika i18n improvments
// myTester.assertErrorMessages(new String[]{"msgMaxSizeKB doit �tre plus grand que 1"});
}
示例5: formSubmitWithCSRFToken
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
public void formSubmitWithCSRFToken() throws Exception {
getTester().startPage(LoginPage.class);
getTester().assertRenderedPage(LoginPage.class);
// We expect the CSRF token to be rendered in the HTML
getTester().assertContains("SECURE_FORM_TOKEN");
// If the user doesn't send the token, the form should fail!
getTester().getRequest().getPostParameters().addParameterValue("SECURE_FORM_TOKEN",
(String) getTester().getSession().getAttribute("SECURE_FORM_TOKEN"));
// NOTE! formTester.submit() is by-passing the onSubmit() on DefaultLoginLink so it's not a real submit!!
FormTester formTester = getTester().newFormTester("loginBorder:loginBorder_body:loginForm");
formTester.setValue("loginPanel:username", "admin");
formTester.setValue("loginPanel:password", "password");
formTester.submit();
// This doesn't work since FormTester doesn't actually call onSubmit() so we are not transferred anywhere after successful login
//getTester().assertRenderedPage(HomePage.class);
}
示例6: createWebServiceConsumerService
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
public static void createWebServiceConsumerService(PaasWicketTester myTester, String name, String jndiPrefix, LogicalSoapConsumer.SoapServiceDomainEnum domain
, String serviceProviderName, String serviceName, int serviceMajorVersion, int serviceMinorVersion) {
selectService(myTester, LogicalSoapConsumer.class);
FormTester creationForm = NavigationUtils.getParamsFormTester(myTester);
creationForm.setValue("label", name);
creationForm.setValue("jndiPrefix", jndiPrefix);
//creationForm.select("wsDomain", domain.ordinal());
//tester.executeAjaxEvent(paramsFormPath + ":wsDomain", "onchange");
creationForm.setValue("serviceProviderName", serviceProviderName);
creationForm.setValue("serviceName", serviceName);
creationForm.setValue("serviceMajorVersion", String.valueOf(serviceMajorVersion));
creationForm.setValue("serviceMinorVersion", String.valueOf(serviceMinorVersion));
NavigationUtils.submitParamsForm(myTester);
}
示例7: 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);
}
示例8: testSaveValid
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testSaveValid() {
wicketTester.startPage(RegistrationPage.class);
FormTester formTester = wicketTester.newFormTester("registration");
formTester.setValue("firstname", "Max");
formTester.setValue("lastname", "Müller");
formTester.setValue("username", "Max.M");
formTester.setValue("email", "[email protected]");
formTester.setValue("password", "password123");
formTester.setValue("repeatPassword", "password123");
formTester.setValue("city", "München");
formTester.setValue("street", "Lindwurmstr. 33");
formTester.setValue("zip", "81369");
wicketTester.hasNoInfoMessage();
}
示例9: testSaveInvalid
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testSaveInvalid() {
wicketTester.startPage(RegistrationPage.class);
FormTester formTester = wicketTester.newFormTester("registration");
formTester.setValue("firstname", "Max");
formTester.setValue("lastname", "Müller");
formTester.setValue("username", "Max.M");
formTester.setValue("email", "[email protected]");
formTester.setValue("password", "passsword123");
formTester.setValue("repeatPassword", "password123");
formTester.setValue("city", "München");
formTester.setValue("street", "Lindwurmstr. 33");
formTester.setValue("zip", "81369");
formTester.submit();
//verify(userService, times(0));
wicketTester.assertErrorMessages("The entered Passwords do not match");
}
示例10: resourceBulkAction
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void resourceBulkAction() {
Component component = findComponentByProp("key", "body:resources", "ws-target-resource-1");
assertNotNull(component);
TESTER.executeAjaxEvent(component.getPageRelativePath() + ":res", Constants.ON_CLICK);
TESTER.clickLink("body:toggle:container:content:togglePanelContainer:container:actions:status");
TESTER.assertComponent("body:toggle:outerObjectsRepeater:1:outer", Modal.class);
FormTester formTester = TESTER.newFormTester("body:toggle:outerObjectsRepeater:1:outer:form");
formTester.setValue("content:anyTypes:dropDownChoiceField", "0");
TESTER.executeAjaxEvent(
"body:toggle:outerObjectsRepeater:1:outer:form:content:anyTypes:dropDownChoiceField",
Constants.ON_CHANGE);
formTester.setValue("content:anyTypes:dropDownChoiceField", "0");
component = findComponentByProp("key", "body:toggle:outerObjectsRepeater:1:outer:form:content:status:"
+ "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:"
+ "checkgroup:dataTable", "b3cbc78d-32e6-4bd4-92e0-bbe07566a2ee");
assertNotNull(component);
TESTER.executeAjaxEvent(
"body:toggle:outerObjectsRepeater:1:outer:dialog:footer:buttons:0:button", Constants.ON_CLICK);
}
示例11: createRole
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
private void createRole(final String name) {
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.setValue("content:form:view:key:textField", name);
formTester.submit("content:form:buttons:next");
formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
formTester.setValue("content:form:view:entitlements:paletteField:recorder",
"WORKFLOW_DEF_READ,NOTIFICATION_UPDATE,RELATIONSHIPTYPE_READ,RELATIONSHIPTYPE_LIST");
formTester.submit("content:form:buttons:next");
formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
formTester.submit("content:form:buttons:next");
formTester = TESTER.newFormTester("body:content:tabbedPanel:panel:outerObjectsRepeater:0:outer:form");
formTester.submit("content:form:buttons:finish");
TESTER.assertInfoMessages("Operation executed successfully");
TESTER.cleanupFeedbackMessages();
TESTER.clickLink("body:configurationLI:configurationUL:administrationLI:administration");
}
示例12: updateParameter
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void updateParameter() {
TESTER.assertComponent("body:content:parametersPanel", WebMarkupContainer.class);
Component result = findComponentByProp(SCHEMA, "body:content:parametersPanel", "notification.maxRetries");
assertNotNull(result);
TESTER.executeAjaxEvent(result.getPageRelativePath(), Constants.ON_CLICK);
TESTER.clickLink("body:content:parametersPanel:outerObjectsRepeater:1:outer:container:content:"
+ "togglePanelContainer:container:actions:actions:actionRepeater:0:action:action");
FormTester formTester = TESTER.newFormTester(
"body:content:parametersPanel:container:content:modalDetails:form");
formTester.setValue("content:parametersDetailsPanel:container:parametersForm:panel:spinner", "70");
TESTER.clickLink("body:content:parametersPanel:"
+ "container:content:modalDetails:dialog:footer:inputs:0:submit");
TESTER.assertInfoMessages("Operation executed successfully");
TESTER.cleanupFeedbackMessages();
TESTER.assertRenderedPage(Parameters.class);
}
示例13: login
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
/**
* Logs the user in, if not already logged-in. If an user is already logged in then nothing is done. Therefore you must log-out an user
* before any new login.
* @param username
* @param password not encrypted.
*/
public void login(final String username, final String password, final boolean checkDefaultPage)
{
// start and render the test page
tester.startPage(LoginPage.class);
if (ClassUtils.isAssignable(tester.getLastRenderedPage().getClass(), WicketUtils.getDefaultPage()) == true) {
// Already logged-in.
return;
}
// assert rendered page class
tester.assertRenderedPage(LoginPage.class);
final FormTester form = tester.newFormTester("body:form");
form.setValue(findComponentByLabel(form, "username"), username);
form.setValue(findComponentByLabel(form, "password"), password);
form.submit(KEY_LOGINPAGE_BUTTON_LOGIN);
if (checkDefaultPage == true) {
tester.assertRenderedPage(WicketUtils.getDefaultPage());
}
}
示例14: testDependencyValueDeletion
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
public void testDependencyValueDeletion() {
addDependencyValues();
final Label oldLabel = (Label) tester.getComponentFromLastRenderedPage(listViewPath + ":0:baseAttributeValue");
FormTester formTester = tester.newFormTester(formPath, false);
formTester.setValue("dependenciesContainer:dependenciesListview:0:deleteCheckbox", true);
tester.executeAjaxEvent(listViewPath + ":0:deleteCheckbox", "onclick");
tester.executeAjaxEvent(formPath + ":deleteValuesButton", "onclick");
final Label newLabel = (Label) tester.getComponentFromLastRenderedPage(listViewPath + ":0:baseAttributeValue");
Assert.assertFalse(oldLabel.getDefaultModelObjectAsString().equals(newLabel.getDefaultModelObjectAsString()));
}
示例15: addDependencyValues
import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
private void addDependencyValues() {
tester.executeAjaxEvent(formPath + ":addDependencyButton", "click");
FormTester formTester = tester.newFormTester(formPath, false);
formTester.setValue("baseAttributeInput", "String1");
formTester.setValue("dependentAttributeInput", "1");
tester.executeAjaxEvent(formPath + ":addDependencyValueButton", "click");
formTester.setValue("baseAttributeInput", "String2");
formTester.setValue("dependentAttributeInput", "2");
tester.executeAjaxEvent(formPath + ":addDependencyValueButton", "click");
tester.executeAjaxEvent(formPath + ":submitButton", "click");
}