mirror of
https://github.com/moparisthebest/JdbcMapper
synced 2024-12-21 23:08:52 -05:00
Test porting continues
This commit is contained in:
parent
f9af32dba2
commit
05ac1d3f84
@ -156,4 +156,11 @@ public interface QmDao extends JdbcMapper {
|
||||
|
||||
@SQL(selectThreePeople)
|
||||
ResultSetIterable<FieldPerson> getThreePeopleResultSetIterable(long personNo1, long personNo2, long personNo3) throws SQLException;
|
||||
|
||||
//IFJAVA 8_START
|
||||
|
||||
@SQL(selectThreePeople)
|
||||
java.util.stream.Stream<FieldPerson> getThreePeopleStream(long personNo1, long personNo2, long personNo3) throws SQLException;
|
||||
|
||||
//IFJAVA 8_END
|
||||
}
|
||||
|
@ -247,4 +247,14 @@ public class QueryMapperQmDao implements QmDao {
|
||||
return qm.toResultSetIterable(selectThreePeople,
|
||||
FieldPerson.class, personNo1, personNo2, personNo3);
|
||||
}
|
||||
|
||||
//IFJAVA 8_START
|
||||
|
||||
@Override
|
||||
public java.util.stream.Stream<FieldPerson> getThreePeopleStream(final long personNo1, final long personNo2, final long personNo3) throws SQLException {
|
||||
return qm.toStream(selectThreePeople,
|
||||
FieldPerson.class, personNo1, personNo2, personNo3);
|
||||
}
|
||||
|
||||
//IFJAVA 8_END
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
//IFJAVA8_START
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
//IFJAVA8_END
|
||||
|
||||
import static com.moparisthebest.jdbc.TryClose.tryClose;
|
||||
@ -451,23 +453,21 @@ public class QueryMapperTest {
|
||||
rsi.close();
|
||||
assertArrayEquals(people, fromDb.toArray());
|
||||
}
|
||||
/*
|
||||
|
||||
//IFJAVA 8_START
|
||||
|
||||
@Test
|
||||
public void testStream() throws SQLException {
|
||||
final List<FieldPerson> fromDb;
|
||||
try(Stream<FieldPerson> rsi = qm.toStream("SELECT * from person WHERE person_no IN (?,?,?) ORDER BY person_no",
|
||||
FieldPerson.class, people[0].getPersonNo(), people[1].getPersonNo(), people[2].getPersonNo())) {
|
||||
try(Stream<FieldPerson> rsi = qm.getThreePeopleStream(people[0].getPersonNo(), people[1].getPersonNo(), people[2].getPersonNo())) {
|
||||
fromDb = rsi.collect(Collectors.toList());
|
||||
}
|
||||
assertArrayEquals(people, fromDb.toArray());
|
||||
}
|
||||
|
||||
|
||||
//IFJAVA 8_END
|
||||
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testEnumPerson() throws SQLException {
|
||||
assertEquals(new EnumPerson(FirstName.First), qm.toObject("SELECT first_name, last_name FROM person WHERE person_no = ?", EnumPerson.class, fieldPerson1.getPersonNo()));
|
||||
|
Loading…
Reference in New Issue
Block a user