コード例 #1
0
  @Before
  public void setUp() throws Exception {
    ServiceLocatorStub locatorStub = ServiceLocatorStub.registerEmptyLocator();
    locatorStub.addLookup(RegistrationService.JNDI_NAME, new RegistrationServiceStub());
    locatorStub.addLookup(GenericDataService.JNDI_NAME, new LocalGenericDataServiceStub());

    MockServletContext context = new MockServletContext();
    context.addInitParameter("ldap.install", "false");
    ServletActionContext.setServletContext(context);
  }
コード例 #2
0
  @Test
  public void testValidate() throws Exception {
    RegistrationRequest request = new RegistrationRequest();
    request.setLoginName("login");
    request.setEmail("*****@*****.**");
    registrationAction.setRegistrationRequest(request);
    registrationAction.prepare();
    registrationAction.validate();

    MockServletContext context = new MockServletContext();
    context.addInitParameter("ldap.install", "true");
    ServletActionContext.setServletContext(context);
    registrationAction.prepare();
    registrationAction.validate();

    registrationAction.setLdapAuthenticate(false);
    registrationAction.validate();
  }