当前位置: 首页>>代码示例>>Java>>正文


Java FormTester.submit方法代码示例

本文整理汇总了Java中org.apache.wicket.util.tester.FormTester.submit方法的典型用法代码示例。如果您正苦于以下问题:Java FormTester.submit方法的具体用法?Java FormTester.submit怎么用?Java FormTester.submit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.wicket.util.tester.FormTester的用法示例。


在下文中一共展示了FormTester.submit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performRegister

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
private void performRegister(String uid, String lbl) throws ReflectiveOperationException, SecurityException {
	ButtonAjaxBehavior b1 = getButtonBehavior("signin", "register");
	tester.executeBehavior(b1);
	FormTester formTester = tester.newFormTester(PATH_REGISTER);
	formTester.setValue("login", getLogin(uid));
	formTester.setValue("email", getEmail(uid));
	formTester.setValue("firstName", String.format("first%s", uid));
	formTester.setValue("lastName", String.format("last%s", uid));
	formTester.setValue("password", userpass);
	formTester.setValue("confirmPassword", userpass);
	formTester.setValue("captcha:captchaText", getCaptcha("register:form:captcha:captcha"));
	formTester.submit("submit");
	checkErrors(0);
	tester.assertLabel("register:confirmRegistration:container:message", getEscapedString(lbl));
	ButtonAjaxBehavior b2 = getButtonBehavior("register:confirmRegistration", "OK");
	tester.executeBehavior(b2);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:18,代码来源:TestLoginUI.java

示例2: assert_customer_not_saved_if_user_already_exist

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void assert_customer_not_saved_if_user_already_exist() {
	getTester().startPage(CustomerCreatePage.class);
	getTester().assertRenderedPage(CustomerCreatePage.class);

	String newUsername = "newUsername";

	when(repository.usernameExists(newUsername)).thenReturn(true);
	
	FormTester formTester = getTester().newFormTester("form");
	formTester.setValue(borderPath("username"), newUsername);
	formTester.setValue(borderPath("firstname"), "myFirstname");
	formTester.setValue(borderPath("lastname"), "myLastname");
	formTester.setValue(borderPath("password"), "myPassword");
	formTester.submit("submit");
	
	getTester().assertErrorMessages("Username already exists!");
	getTester().assertRenderedPage(CustomerCreatePage.class);
	
	//it should be checked, that the username does already exists
	verify(repository, times(1)).usernameExists(newUsername);
	verify(repository, times(0)).save(Mockito.any());

	verifyNoMoreInteractions(repository);
}
 
开发者ID:MarcGiffing,项目名称:wicket-spring-boot,代码行数:26,代码来源:CustomerCreatePageTest.java

示例3: testMismatchingPassword

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testMismatchingPassword() throws PolicyValidationException {
    userService.validatePassword("user", "password");
    replay(userService);

    tester.getSession().setSsoLoginData(new SSOLoginData("test-subsystem", "/target"));
    tester.startPage(new SSOChangePasswordPage("user"));
    tester.assertRenderedPage(SSOChangePasswordPage.class);
    FormTester form;

    // check password comparison logic
    form = tester.newFormTester("change-password-panel:form");
    form.setValue("password", "password");
    form.setValue("password2", "another-password");
    form.submit();
    // still on the same page
    tester.assertRenderedPage(SSOChangePasswordPage.class);
    tester.assertLabel("change-password-panel:feedback:feedbackul:messages:0:message", "password and password2 must be equal.");
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:20,代码来源:SSOChangePasswordPageTest.java

示例4: assert_error_when_create_existing_customer

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void assert_error_when_create_existing_customer(){
	getTester().startPage(CustomerCreatePage.class);
	getTester().assertRenderedPage(CustomerCreatePage.class);
	getTester().debugComponentTrees();
	FormTester formTester = getTester().newFormTester("form");
	
	//user is created via liquibase as initial data
	String usernameOfExistingUser = "frodo";
	formTester.setValue(borderPath("username"), usernameOfExistingUser);
	formTester.setValue(borderPath("firstname"), "newFirstname");
	formTester.setValue(borderPath("lastname"), "newLastname");
	formTester.setValue(borderPath("password"), "newPassword");
	formTester.submit("submit");
	
	getTester().assertErrorMessages("Username already exists!");
	
}
 
开发者ID:MarcGiffing,项目名称:wicket-spring-boot,代码行数:19,代码来源:CustomerCreatePageIntTest.java

示例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);
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:21,代码来源:LoginPageTest.java

示例6: testSuccessNoHOTP

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testSuccessNoHOTP() {
    expect(userService.checkUserCanLoginWithThisPassword("known-user", "password", "test-subsystem"))
            .andReturn(UserLoginStatus.SUCCESS);
    expect(sessionService.createSSOSession("known-user"))
            .andReturn(new SSOSession(1L, "super-session-id"));
    expect(subsystemService.issueSubsystemTokenIfCanLogin(1L, "test-subsystem"))
            .andReturn(new SubsystemTokenData("abcdef", "http://some.host.test/landing-url"));
    expect(settingsService.getPolicy()).andReturn(Policy.NONE);
    expect(settingsService.isHotpDisabled()).andReturn(true).anyTimes();
    replay(userService, sessionService, subsystemService, settingsService);

    tester.getSession().setSsoLoginData(new SSOLoginData("test-subsystem", "/target"));
    tester.startPage(SSOLoginPasswordPage.class);
    tester.assertRenderedPage(SSOLoginPasswordPage.class);
    FormTester form = tester.newFormTester("form");
    form.setValue("username", "known-user");
    form.setValue("password", "password");
    form.submit();
    tester.assertRedirectUrl("http://some.host.test/landing-url?subsystemToken=abcdef&targetUrl=%2Ftarget");
    tester.assertHasCookie(SSOUtils.SSO_SESSION_ID_COOKIE_NAME, "super-session-id");

    verify(userService, sessionService, subsystemService, settingsService);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:25,代码来源:SSOLoginPasswordPageTest.java

示例7: testSuccessAndHOTP

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testSuccessAndHOTP() {
    expect(userService.checkUserCanLoginWithThisPassword("known-user", "password", "test-subsystem"))
            .andReturn(UserLoginStatus.SUCCESS);
    expect(settingsService.getPolicy()).andReturn(Policy.PCIDSS);
    expect(settingsService.isHotpDisabled()).andReturn(false);
    replay(userService, settingsService, subsystemService);

    tester.getSession().setSsoLoginData(new SSOLoginData("test-subsystem", "/target"));
    tester.startPage(SSOLoginPasswordPage.class);
    tester.assertRenderedPage(SSOLoginPasswordPage.class);
    FormTester form = tester.newFormTester("form");
    form.setValue("username", "known-user");
    form.setValue("password", "password");
    form.submit();
    tester.assertRenderedPage(SSOLoginHOTPPage.class);
    assertEquals("known-user", tester.getSession().getSsoLoginData().getUsername());

    verify(userService, settingsService, subsystemService);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:21,代码来源:SSOLoginPasswordPageTest.java

示例8: testInvalidPassword

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testInvalidPassword() throws PolicyValidationException {
    // password validation logic
    userService.validatePassword("user", "invalid-password");
    expectLastCall().andThrow(new PolicyValidationException("P003"));
    replay(userService);

    tester.getSession().setSsoLoginData(new SSOLoginData("test-subsystem", "/target"));
    tester.startPage(new SSOChangePasswordPage("user"));
    tester.assertRenderedPage(SSOChangePasswordPage.class);
    FormTester form = tester.newFormTester("change-password-panel:form");
    form.setValue("password", "invalid-password");
    form.setValue("password2", "invalid-password");
    form.submit();
    // still on the same page
    tester.assertRenderedPage(SSOChangePasswordPage.class);
    tester.assertLabel("change-password-panel:feedback:feedbackul:messages:0:message", "Password was already used");

    verify(userService);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:21,代码来源:SSOChangePasswordPageTest.java

示例9: testTempPassword

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testTempPassword() {
    expect(userService.checkUserCanLoginWithThisPassword("known-user", "expired-password", "test-subsystem"))
            .andReturn(UserLoginStatus.TEMP_PASSWORD);
    replay(userService);

    tester.getSession().setSsoLoginData(new SSOLoginData("test-subsystem", "/target"));
    tester.startPage(SSOLoginPasswordPage.class);
    tester.assertRenderedPage(SSOLoginPasswordPage.class);
    FormTester form = tester.newFormTester("form");
    form.setValue("username", "known-user");
    form.setValue("password", "expired-password");
    form.submit();
    tester.assertRenderedPage(SSOChangePasswordPage.class);

    verify(userService);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:18,代码来源:SSOLoginPasswordPageTest.java

示例10: testSuccess

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testSuccess() throws PolicyValidationException {
    userService.validatePassword("user", "password");
    expectLastCall();
    userService.changeTempPassword("user", "password");
    expectLastCall();
    expect(sessionService.createSSOSession("user"))
            .andReturn(new SSOSession(1L, "super-session-id"));
    expect(subsystemService.issueSubsystemTokenIfCanLogin(1L, "test-subsystem"))
            .andReturn(new SubsystemTokenData("abcdef", "http://some.host.test/landing-url"));
    replay(userService, sessionService, subsystemService);

    tester.getSession().setSsoLoginData(new SSOLoginData("test-subsystem", "/target"));
    tester.startPage(new SSOChangePasswordPage("user"));
    tester.assertRenderedPage(SSOChangePasswordPage.class);
    FormTester form = tester.newFormTester("change-password-panel:form");
    form.setValue("password", "password");
    form.setValue("password2", "password");
    form.submit();
    tester.assertRedirectUrl("http://some.host.test/landing-url?subsystemToken=abcdef&targetUrl=%2Ftarget");
    tester.assertHasCookie(SSOUtils.SSO_SESSION_ID_COOKIE_NAME, "super-session-id");

    verify(userService, sessionService, subsystemService);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:25,代码来源:SSOChangePasswordPageTest.java

示例11: testFailure

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testFailure() {
    expect(internalSSOService.authenticateHOTP("test-subsystem", "known-user", "222222"))
                    .andReturn(false);
    replay(internalSSOService);

    tester.getSession().setSsoLoginData(createLoginData());
    tester.startPage(SSOLoginHOTPPage.class);
    tester.assertRenderedPage(SSOLoginHOTPPage.class);
    FormTester form = tester.newFormTester("form");
    form.setValue("hotp", "222222");
    form.submit();
    tester.assertRenderedPage(SSOLoginHOTPPage.class);
    tester.assertLabel("form:message", "One-time password value did not match.");

    verify(internalSSOService);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:18,代码来源:SSOLoginHOTPPageTest.java

示例12: 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");
}
 
开发者ID:zutherb,项目名称:AppStash,代码行数:20,代码来源:RegistrationPageTest.java

示例13: testRenderLoginPageSubmit

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void testRenderLoginPageSubmit() throws UserNotFoundException {
	UserApplication userLoggedIn = new UserApplication();
	userLoggedIn.setProfile(new UserProfile());
	userLoggedIn.getProfile().setPermissions(new HashSet<String>());
	userLoggedIn.getProfile().getPermissions().add(Permissions.ACCESS_HOMEPAGE);
	
	expect(usersService.verifyLogin("[email protected]", "123")).andReturn(userLoggedIn);
	replayAll();
	getTester().startPage(HomePage.class);
	getTester().assertRenderedPage(LoginPage.class);
	FormTester form = getTester().newFormTester("form");
	form.setValue("email", "[email protected]");
	form.setValue("password", "123");
	form.submit();
	getTester().startPage(HomePage.class);
	getTester().assertRenderedPage(HomePage.class);
	verifyAll();
}
 
开发者ID:premium-minds,项目名称:pm-wicket-archetype,代码行数:20,代码来源:LoginPageTest.java

示例14: createReport

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
private void createReport(final String name) {
    TESTER.clickLink("body:content:tabbedPanel:panel:firstLevelContainer:first:container:content:add");

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

    FormTester formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:form:view:name:textField", name);
    formTester.setValue("content:form:view:template:dropDownChoiceField", "0");
    formTester.submit("content:form:buttons:next");

    TESTER.assertComponent("body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater"
            + ":0:outer:form:content:form:view:schedule:seconds:textField", TextField.class);

    formTester = TESTER.newFormTester(
            "body:content:tabbedPanel:panel:firstLevelContainer:first:outerObjectsRepeater:0:outer:form");
    formTester.submit("content:form:buttons:finish");

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

    TESTER.clickLink("body:reportsLI:reports");
}
 
开发者ID:apache,项目名称:syncope,代码行数:25,代码来源:ReportsITCase.java

示例15: createParameter

import org.apache.wicket.util.tester.FormTester; //导入方法依赖的package包/类
@Test
public void createParameter() {
    TESTER.assertComponent("body:content:parametersPanel", WebMarkupContainer.class);

    TESTER.clickLink("body:content:parametersPanel:container:content:add");
    TESTER.assertComponent("body:content:parametersPanel:outerObjectsRepeater:0:outer", Modal.class);

    FormTester formTester =
            TESTER.newFormTester("body:content:parametersPanel:outerObjectsRepeater:0:outer:form");
    formTester.submit("content:parametersCreateWizardPanel:form:buttons:next");

    formTester = TESTER.newFormTester("body:content:parametersPanel:outerObjectsRepeater:0:outer:form");
    formTester.setValue("content:parametersCreateWizardPanel:form:view:content:schema:textField", "testParam");
    formTester.setValue("content:parametersCreateWizardPanel:form:view:content:attrs:0:panel:textField", "test");

    formTester.submit("content:parametersCreateWizardPanel:form:buttons:finish");

    TESTER.assertInfoMessages("Operation executed successfully");

    TESTER.cleanupFeedbackMessages();
    TESTER.assertRenderedPage(Parameters.class);
}
 
开发者ID:apache,项目名称:syncope,代码行数:23,代码来源:ParametersITCase.java


注:本文中的org.apache.wicket.util.tester.FormTester.submit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。