Package org.pau.assetmanager.entities

Examples of org.pau.assetmanager.entities.User


public class PropertyBookPremiseTest extends GenericTest {

  @Test
  public void propertyPremiseTests() throws ParseException {
    // create a user
    User user = UsersBusiness.persistUserByUsernameAndPassword("new_user",
        "fake_password");
    Assert.assertArrayEquals(new Object[] { "new_user", "fake_password" },
        new Object[] { user.getUsername(), user.getPassword() });

    // create a client
    Client client = ClientsBusiness.addClientByClientName(user,
        "new_client");
    Assert.assertEquals("new_client", client.getName());
View Full Code Here


public class BookTest extends GenericTest {

  @Test
  public void bookCRUDTests() {
    // create a user
    User user = UsersBusiness.persistUserByUsernameAndPassword("new_user",
        "fake_password");
    Assert.assertArrayEquals(new Object[] { "new_user", "fake_password" },
        new Object[] { user.getUsername(), user.getPassword() });

    // create a client
    Client client = ClientsBusiness.addClientByClientName(user,
        "new_client");
    Assert.assertEquals("new_client", client.getName());
View Full Code Here

public class PropertyBookTenmentTest extends GenericTest {
  @Test
  public void propertyTenmentTests() throws ParseException {
    // create a user
    User user = UsersBusiness.persistUserByUsernameAndPassword("new_user",
        "fake_password");
    Assert.assertArrayEquals(new Object[] { "new_user", "fake_password" },
        new Object[] { user.getUsername(), user.getPassword() });

    // create a client
    Client client = ClientsBusiness.addClientByClientName(user,
        "new_client");
    Assert.assertEquals("new_client", client.getName());
View Full Code Here

public class StocksBookTest extends GenericTest {

  @Test
  public void propertyPremiseTests() throws ParseException {
    // create a user
    User user = UsersBusiness.persistUserByUsernameAndPassword("new_user",
        "fake_password");
    Assert.assertArrayEquals(new Object[] { "new_user", "fake_password" },
        new Object[] { user.getUsername(), user.getPassword() });

    // create a client
    Client client = ClientsBusiness.addClientByClientName(user,
        "new_client");
    Assert.assertEquals("new_client", client.getName());
View Full Code Here

public class AnnotationTest extends GenericTest {

  @Test
  public void annotationCRUDTests() throws ParseException {
    // create a user
    User user = UsersBusiness.persistUserByUsernameAndPassword("new_user",
        "fake_password");
    Assert.assertArrayEquals(new Object[] { "new_user", "fake_password" },
        new Object[] { user.getUsername(), user.getPassword() });

    // create a client
    Client client = ClientsBusiness.addClientByClientName(user,
        "new_client");
    Assert.assertEquals("new_client", client.getName());
View Full Code Here

  }

  @Test
  public void annotationFindersTests() throws ParseException {
    // create a user
    User user = UsersBusiness.persistUserByUsernameAndPassword("new_user",
        "fake_password");
    Assert.assertArrayEquals(new Object[] { "new_user", "fake_password" },
        new Object[] { user.getUsername(), user.getPassword() });

    // create a client
    Client client = ClientsBusiness.addClientByClientName(user,
        "new_client");
    Assert.assertEquals("new_client", client.getName());

    // create general book
    GeneralBook generalBook = new GeneralBook();
    generalBook.setClient(client);
    generalBook.setDescription("general_book_description");
    generalBook.setName("general_book");
    generalBook = BooksBusiness.addBook(generalBook);

    // create a generic annotation
    Annotation annotation = new GeneralIncomeAnnotation();
    annotation.setBook(generalBook);
    annotation.setTwoDecimalLongCodifiedAmount(1000L * 100L); // 1000.00
    annotation.setConcept("test");
    Date date = new SimpleDateFormat("dd-MM-yyyy").parse("11-11-2013");
    annotation.setDate(date);
    annotation = AnnotationsBusiness.createAnnotation(annotation);
    Assert.assertEquals(generalBook, annotation.getBook());
    Assert.assertEquals(new Long(1000L * 100L),
        annotation.getTwoDecimalLongCodifiedAmount());
    Assert.assertEquals("test", annotation.getConcept());
    Assert.assertEquals(date, annotation.getDate());

    // find annotation for current client
    List<Annotation> annotations = AnnotationsBusiness
        .getAnnotationsWithFilter(Optional.<AnnotationType>absent(),
            BookSelection.fromBook(generalBook),
            Optional.<Integer>of(2013), ClientDomainType.CURRENT_CLIENT, SortingCriteria.ASCENDING,
            AnnotationsFilter.emptyAnnotationsFilter());
    Assert.assertEquals(new Integer(1), new Integer(annotations.size()));
    Assert.assertEquals(annotation, annotations.iterator().next());

    // find annotation all clients
    annotations = AnnotationsBusiness.getAnnotationsWithFilter(Optional.<AnnotationType>absent(),
        BookSelection.fromBook(generalBook),
        Optional.<Integer>of(2013), ClientDomainType.ALL_CLIENTS, SortingCriteria.ASCENDING,
        AnnotationsFilter.emptyAnnotationsFilter());
    Assert.assertEquals(new Integer(1), new Integer(annotations.size()));
    Assert.assertEquals(annotation, annotations.iterator().next());

    // find annotation all clients
    annotations = AnnotationsBusiness.getAnnotationsWithFilter(Optional.<AnnotationType>absent(),
        BookSelection.fromBook(generalBook),
        Optional.<Integer>of(2011), ClientDomainType.ALL_CLIENTS, SortingCriteria.ASCENDING,
        AnnotationsFilter.emptyAnnotationsFilter());
    Assert.assertEquals(new Integer(0), new Integer(annotations.size()));

    // create another user
    User secondUser = UsersBusiness.persistUserByUsernameAndPassword(
        "new_user_2", "fake_password_2");
    Assert.assertArrayEquals(
        new Object[] { "new_user_2", "fake_password_2" }, new Object[] {
            secondUser.getUsername(), secondUser.getPassword() });

    // create another client
    Client secondClient = ClientsBusiness.addClientByClientName(secondUser,
        "new_client_2");
    Assert.assertEquals("new_client_2", secondClient.getName());
View Full Code Here

public class GeneralBookTest extends GenericTest {

  @Test
  public void propertyPremiseTests() throws ParseException {
    // create a user
    User user = UsersBusiness.persistUserByUsernameAndPassword("new_user",
        "fake_password");
    Assert.assertArrayEquals(new Object[] { "new_user", "fake_password" },
        new Object[] { user.getUsername(), user.getPassword() });

    // create a client
    Client client = ClientsBusiness.addClientByClientName(user,
        "new_client");
    Assert.assertEquals("new_client", client.getName());
View Full Code Here

  public void userCRUDTests() {
    Optional<User> optionalUser = UsersBusiness
        .getUserByUsername("unexistent_user");
    // unexistent user should not exist
    Assert.assertFalse(optionalUser.isPresent());
    User user = UsersBusiness.persistUserByUsernameAndPassword("new_user",
        "fake_password");
    // check newly create user
    Assert.assertArrayEquals(new Object[] { "new_user", "fake_password" },
        new Object[] { user.getUsername(), user.getPassword() });
    Optional<User> optionalNewUser = UsersBusiness
        .getUserByUsername("new_user");
    // check user finder
    Assert.assertTrue(optionalNewUser.isPresent());
    UsersBusiness.deleteUser(optionalNewUser.get());
View Full Code Here

public class ClientTest extends GenericTest {

  @Test
  public void userCRUDTests() {
    // create a user
    User user = UsersBusiness.persistUserByUsernameAndPassword("new_user",
        "fake_password");
    Assert.assertArrayEquals(new Object[] { "new_user", "fake_password" },
        new Object[] { user.getUsername(), user.getPassword() });

    // create a client
    Client client = ClientsBusiness.addClientByClientName(user,
        "new_client");
    Assert.assertEquals("new_client", client.getName());
View Full Code Here

  @Command
  @NotifyChange({ "clients", "selectedClient" })
  public void notifyAddClientRequest(
      @ContextParam(ContextType.TRIGGER_EVENT) Event event) {
    String clientName = (String) event.getData();
    User user = UserUtil.getExecutionUser();
    ClientsBusiness.addClientByClientName(user, clientName);
    Optional<Client> optionalClient = ClientsBusiness
        .getClientByName(clientName);
    if (optionalClient.isPresent()) {
      setSelectedClient(optionalClient.get());
View Full Code Here

TOP

Related Classes of org.pau.assetmanager.entities.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.