spbu-se / baobab

Electronic university shedule engine
http://mat-mex.ru/photogallery/matmex/inside_pic-354.html
3 stars 2 forks source link

SQL-based implementation of Topic events #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Continue working on Topic entity: now we need events.

Original issue reported on code.google.com by dbarashev on 8 Nov 2012 at 10:06

GoogleCodeExporter commented 9 years ago
Well, all is ok, but i should have AuditoriumImpl to Create Auditorium from 
database in Class TopicSqlImpl method getAllEvents();

Original comment by dnsj...@gmail.com on 9 Nov 2012 at 10:35

GoogleCodeExporter commented 9 years ago
auditorium is an optional field of event, so you don't really need it. From 
code compilation point, you have Auditorium interface and that must be enough

Original comment by dbarashev on 9 Nov 2012 at 11:03

GoogleCodeExporter commented 9 years ago
http://pastebin.com/sd9XJZLM 
Could you look at this please? I dont know why program thinks that database 
TimeSlot is empty, where I just created ts1 and put it into database

Original comment by dnsj...@gmail.com on 14 Nov 2012 at 10:42

GoogleCodeExporter commented 9 years ago
If your test extends SqlTestCase then it doesn't talk to DBMS at all. You 
describe what queries do you expect, and *you* provide result set using 
Expectations.withResult() method

Original comment by dbarashev on 14 Nov 2012 at 10:48

GoogleCodeExporter commented 9 years ago
oh, i understand, thanks

Original comment by dnsj...@gmail.com on 14 Nov 2012 at 3:19

GoogleCodeExporter commented 9 years ago
Well, testAddEvent works, but in testGetEvents i have problem: i cant get Date, 
i mean when in getEvents i call rs.getDate("start_date") - it is null. But in 
test method i said, that "start_date" is sqlDate. if "start_date" in test is 
string, all is ok. Or if "start_date" is int, all is ok too.

And, also could you fix table Event?

Original comment by dnsj...@gmail.com on 14 Nov 2012 at 5:38

GoogleCodeExporter commented 9 years ago
Right, getDate() doesn't work yet in a mocking SqlAPi. Wait a little bit...

Original comment by dbarashev on 14 Nov 2012 at 6:35

GoogleCodeExporter commented 9 years ago
Another question: In TimeSlotExtentSqlImpl i know, how i can get id. But in 
TimeSlotExtentImpl..i can creat ID in this class and do ID++, or create 
TimeSlotSqlImpl where will field getID, and delete getID from TimeSlotImpl.
Whats better?

Original comment by dnsj...@gmail.com on 20 Nov 2012 at 2:54

GoogleCodeExporter commented 9 years ago
Yes, just increment a counter, or get the size of time slot collection and add 
1.

Original comment by dbarashev on 20 Nov 2012 at 3:16

GoogleCodeExporter commented 9 years ago
Thanks, and could you remind me please, how easily get id from db in method 
create, where i just insert my time slot?

Original comment by dnsj...@gmail.com on 20 Nov 2012 at 4:23

GoogleCodeExporter commented 9 years ago
select id from TimeSlot WHERE day=? AND name=? AND is_odd=?

Original comment by dbarashev on 20 Nov 2012 at 4:25

GoogleCodeExporter commented 9 years ago
This issue was closed by revision dadb3f33b931.

Original comment by dbarashev on 25 Nov 2012 at 3:20