Search in sources :

Example 11 with Given

use of org.jbehave.core.annotations.Given in project jbehave-core by jbehave.

the class UserSteps method setUserDisabled.

@Given("user for $orgName $username is disabled")
public void setUserDisabled(String orgName, String username) {
    Organization org = organizationDao.findByName(orgName);
    User user = userDao.findUserByOrganizationAndUsername(org.getId(), username);
    user.setEnabled(false);
    userDao.persist(user);
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) User(org.jbehave.example.spring.security.domain.User) Given(org.jbehave.core.annotations.Given)

Example 12 with Given

use of org.jbehave.core.annotations.Given in project jbehave-core by jbehave.

the class UserSteps method createUserWithUsernameAndPassword.

@Given("a user for $orgName with username $username and password $password")
public void createUserWithUsernameAndPassword(String orgName, String username, String password) {
    Organization org = organizationDao.findByName(orgName);
    User user = new User();
    user.setOrganization(org);
    user.setUsername(username);
    user.setPasswordCleartext(password);
    userDao.persist(user);
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) User(org.jbehave.example.spring.security.domain.User) Given(org.jbehave.core.annotations.Given)

Aggregations

Given (org.jbehave.core.annotations.Given)12 Organization (org.jbehave.example.spring.security.domain.Organization)8 User (org.jbehave.example.spring.security.domain.User)4 AuthenticationPolicy (org.jbehave.example.spring.security.domain.AuthenticationPolicy)2 Game (com.lunivore.gameoflife.domain.Game)1 StringRenderer (com.lunivore.gameoflife.view.string.StringRenderer)1 File (java.io.File)1 FileReader (java.io.FileReader)1 Method (java.lang.reflect.Method)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Alias (org.jbehave.core.annotations.Alias)1 Aliases (org.jbehave.core.annotations.Aliases)1 Then (org.jbehave.core.annotations.Then)1 When (org.jbehave.core.annotations.When)1 LoadOdtFromGoogle (org.jbehave.core.io.google.LoadOdtFromGoogle)1 Parameters (org.jbehave.core.steps.Parameters)1 AuthenticationPolicyBuilder (org.jbehave.example.spring.security.domain.AuthenticationPolicyBuilder)1 UserBuilder (org.jbehave.example.spring.security.domain.UserBuilder)1