Search in sources :

Example 26 with StudentDomain

use of org.springframework.integration.jpa.test.entity.StudentDomain in project spring-integration by spring-projects.

the class JpaOutboundGatewayTests method getStudent.

@Test
public void getStudent() {
    final StudentDomain student = studentService.getStudent(1001L);
    Assert.assertNotNull(student);
}
Also used : StudentDomain(org.springframework.integration.jpa.test.entity.StudentDomain) Test(org.junit.Test)

Example 27 with StudentDomain

use of org.springframework.integration.jpa.test.entity.StudentDomain in project spring-integration by spring-projects.

the class JpaOutboundGatewayTests method getStudentStudentWithPositionalParameters.

@Test
public void getStudentStudentWithPositionalParameters() {
    StudentDomain student = studentService.getStudentWithParameters("First Two");
    Assert.assertEquals("First Two", student.getFirstName());
    Assert.assertEquals("Last Two", student.getLastName());
}
Also used : StudentDomain(org.springframework.integration.jpa.test.entity.StudentDomain) Test(org.junit.Test)

Example 28 with StudentDomain

use of org.springframework.integration.jpa.test.entity.StudentDomain in project spring-integration by spring-projects.

the class JpaOutboundGatewayTests method deleteNonExistingStudent.

@Test
public void deleteNonExistingStudent() {
    StudentDomain student = JpaTestUtils.getTestStudent();
    student.setRollNumber(3424234234L);
    try {
        studentService.deleteStudent(student);
    } catch (IllegalArgumentException e) {
        return;
    }
    Assert.fail("Was expecting a MessageHandlingException to be thrown.");
}
Also used : StudentDomain(org.springframework.integration.jpa.test.entity.StudentDomain) Test(org.junit.Test)

Example 29 with StudentDomain

use of org.springframework.integration.jpa.test.entity.StudentDomain in project spring-integration by spring-projects.

the class JpaOutboundGatewayTests method testRetrievingGatewayInsideChain.

@Test
public void testRetrievingGatewayInsideChain() {
    final StudentDomain student = studentService.getStudent2(1001L);
    Assert.assertNotNull(student);
}
Also used : StudentDomain(org.springframework.integration.jpa.test.entity.StudentDomain) Test(org.junit.Test)

Example 30 with StudentDomain

use of org.springframework.integration.jpa.test.entity.StudentDomain in project spring-integration by spring-projects.

the class JpaOutboundGatewayTests method testUpdatingGatewayInsideChain.

@Test
@Transactional
public void testUpdatingGatewayInsideChain() {
    final StudentDomain studentToPersist = JpaTestUtils.getTestStudent();
    Assert.assertNull(studentToPersist.getRollNumber());
    final StudentDomain persistedStudent = studentService.persistStudent2(studentToPersist);
    Assert.assertNotNull(persistedStudent);
    Assert.assertNotNull(persistedStudent.getRollNumber());
}
Also used : StudentDomain(org.springframework.integration.jpa.test.entity.StudentDomain) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

StudentDomain (org.springframework.integration.jpa.test.entity.StudentDomain)35 Test (org.junit.Test)21 BeanFactory (org.springframework.beans.factory.BeanFactory)7 ArrayList (java.util.ArrayList)5 TransactionStatus (org.springframework.transaction.TransactionStatus)5 Transactional (org.springframework.transaction.annotation.Transactional)5 JpaExecutor (org.springframework.integration.jpa.core.JpaExecutor)4 ExpressionEvaluatingParameterSourceFactory (org.springframework.integration.jpa.support.parametersource.ExpressionEvaluatingParameterSourceFactory)4 ParameterSource (org.springframework.integration.jpa.support.parametersource.ParameterSource)4 Calendar (java.util.Calendar)3 Date (java.util.Date)3 ParameterSourceFactory (org.springframework.integration.jpa.support.parametersource.ParameterSourceFactory)3 TransactionCallbackWithoutResult (org.springframework.transaction.support.TransactionCallbackWithoutResult)3 TransactionTemplate (org.springframework.transaction.support.TransactionTemplate)3 List (java.util.List)2 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)2 DefaultTransactionDefinition (org.springframework.transaction.support.DefaultTransactionDefinition)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Collection (java.util.Collection)1 Map (java.util.Map)1