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


Java FormTester类代码示例

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


FormTester类属于org.apache.wicket.util.tester包,在下文中一共展示了FormTester类的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: 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());
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:23,代码来源:DependenciesPanelTest.java

示例3: 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);
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:19,代码来源:DependenciesPanelTest.java

示例4: 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

示例5: 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

示例6: createJEEProcessing

import org.apache.wicket.util.tester.FormTester; //导入依赖的package包/类
/**
     * Creates a JEE Processing (execution node)
     * @param myTester WicketTester of the current test
     * @param label label of the JEE Processing
     * @param groupId group id of the maven reference of the EAR
     * @param artifactId artifact id of the maven reference of the EAR
     * @param version version of the maven reference of the EAR
     * @param classifier classifier ef the maven reference of the EAR
     * @param optional TODO
     */
    public static void createJEEProcessing(PaasWicketTester myTester, String label, String groupId, String artifactId, String version, String classifier, boolean optional, int minMemoryMbHint) {

        // When adding jee processing we need mvnDao to chack maven reference
//        MvnRepoDao mvnDao = (MvnRepoDao) myTester.getPaasApplication().getContext().getBean("mvnDao");
//        MvnRepoDaoTestUtils.mockResolveUrl(mvnDao);

//        myTester.assertContains("jee processing");

        // Select JEE Processing
        selectService(myTester, JeeProcessing.class);
        // Fill the form and submit it
        FormTester creationForm = NavigationUtils.getParamsFormTester(myTester);
        creationForm.setValue("label", label);
        creationForm.setValue("softwareReference.groupId", groupId);
        creationForm.setValue("softwareReference.artifactId", artifactId);
        creationForm.setValue("softwareReference.version", version);
        creationForm.setValue("softwareReference.classifier", classifier);
        creationForm.setValue("optionalSoftwareReference", optional);
        creationForm.setValue("minMemoryMbHint",String.valueOf(minMemoryMbHint));
        NavigationUtils.submitParamsForm(myTester);

    }
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:33,代码来源:CreateObjectsWithGUI.java

示例7: createCFJavaProcessing

import org.apache.wicket.util.tester.FormTester; //导入依赖的package包/类
/**
     * Creates a CF Java Processing (execution node)
     * @param myTester WicketTester of the current test
     * @param label label of the CF Java Processing
     * @param groupId group id of the maven reference of the JAR
     * @param artifactId artifact id of the maven reference of the JAR
     * @param version version of the maven reference of the JAR
     * @param extension extension of the maven reference of the JAR
     * @param classifier classifier ef the maven reference of the JAR
     * @param optional TODO
     */
    public static void createCFJavaProcessing(PaasWicketTester myTester, String label, String groupId, String artifactId, String version, String extension, String classifier, boolean optional, int minMemoryMbHint) {

        // When adding jee processing we need mvnDao to chack maven reference
//        MvnRepoDao mvnDao = (MvnRepoDao) myTester.getPaasApplication().getContext().getBean("mvnDao");
//        MvnRepoDaoTestUtils.mockResolveUrl(mvnDao);

//        myTester.assertContains("cf java processing");

        // Select CF Java Processing
        selectService(myTester, CFJavaProcessing.class);
        // Fill the form and submit it
        FormTester creationForm = NavigationUtils.getParamsFormTester(myTester);
        creationForm.setValue("label", label);
        creationForm.setValue("softwareReference.groupId", groupId);
        creationForm.setValue("softwareReference.artifactId", artifactId);
        creationForm.setValue("softwareReference.version", version);
        creationForm.setValue("softwareReference.extension", extension);
        creationForm.setValue("softwareReference.classifier", classifier);
        creationForm.setValue("optionalSoftwareReference", optional);
        creationForm.setValue("minMemoryMbHint",String.valueOf(minMemoryMbHint));
        NavigationUtils.submitParamsForm(myTester);

    }
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:35,代码来源:CreateObjectsWithGUI.java

示例8: 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);

}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:17,代码来源:CreateObjectsWithGUI.java

示例9: 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);

}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:20,代码来源:CreateObjectsWithGUI.java

示例10: 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);

}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:20,代码来源:CreateObjectsWithGUI.java

示例11: 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");

}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:18,代码来源:CFJavaProbeIT.java

示例12: 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"});

    }
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:17,代码来源:InternalMomTest.java

示例13: 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

示例14: 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

示例15: 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


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