Package org.springframework.data.jpa.domain.sample

Examples of org.springframework.data.jpa.domain.sample.AuditableUser


  AuditableUser user;

  @Before
  public void setUp() {

    user = new AuditableUser();
    auditorAware.setAuditor(user);

    repository.saveAndFlush(user);
  }
View Full Code Here


  static class TestConfig {}

  @Before
  public void setup() {

    AuditableUser auditor = new AuditableUser(null);
    auditor.setFirstname("auditor");

    this.auditor = this.auditableUserRepository.save(auditor);
    doReturn(this.auditor).when(this.auditorAware).getCurrentAuditor();
  }
View Full Code Here

  }

  @Test
  public void basicAuditing() throws Exception {

    AuditableUser user = new AuditableUser(null);
    user.setFirstname("user");

    AuditableUser savedUser = auditableUserRepository.save(user);
    TimeUnit.MILLISECONDS.sleep(10);

    assertThat(savedUser.getCreatedDate(), is(notNullValue()));
    assertThat(savedUser.getCreatedDate().isBeforeNow(), is(true));

    AuditableUser createdBy = savedUser.getCreatedBy();
    assertThat(createdBy, is(notNullValue()));
    assertThat(createdBy.getFirstname(), is(this.auditor.getFirstname()));
  }
View Full Code Here

  @Test
  @Transactional("transactionManager-2")
  public void useAuditableUserRepository() throws Exception {

    auditableUserRepository.saveAndFlush(new AuditableUser());
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.jpa.domain.sample.AuditableUser

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.