Documenting the way JSON-RPC Communicates over HTTP with Scooby: Test Automation
Full Ethereal Session Expanded | Full Ethereal Session Collapsed
The following are done via POST /scooby/JSON-RPC HTTP/1.1 (text/plan)
1. Login to Scooby: Images
A Post is done to /scooby/j_acegi_security_check (HTTP/1.1 (application.x-www-form-urlencoded))
Its contents are: j_username=tester&j_password=testser
- {"id": 1, "method": "system.listMethods", "params": []}
- {"id": 2, "method": "scoobyService.getCalendars", "params": []}
- {"id": 3, "method": "scoobyService.getEvents", "params": ["Scooby", 1148713200000, 1149490799000]}
1.5 If this is a first login:
- j_username=tester&j_password=testser
- {"id": 1, "method": "system.listMethods", "params": []}
- {"id": 2, "method": "scoobyService.getCalendars", "params": []}
- {"id": 3, "method": "scoobyService.createCalendar", "params": ["Scooby", "Scooby]}
- {"id": 3, "method": "scoobyService.getEvents", "params": ["Scooby", 1148713200000, 1149490799000]}
- {"id": 5, "method": "scoobyService.saveEvent", "params": ["Scooby", {"id": null, "title": "Welcome to Scooby!", "description: "Welcome to Scooby!", "start": {"year": 2006, "month": 4, "date" 28, "hours": 10, "minutes": 15, "seconds": 0, "timezone": null, "utc": false, "JavaClass": "org.osaf.scooby.model.ScoobyDate"}, "end ": {"year": 2006, "month": 4, "date": 28, "hours ": 11, "minutes" : 15, "seconds": 0, "timezone": null, "utc": false, "javaClass": "org.osaf.scooby.model.ScoobyDate"}, "allDay": false, "pointInTime": false, "anyTime": false, recurrenceRule": null, "status": null, "masterEvent": false, "instance": false, "javaClass": "org.osaf.scooby.model.Event"}]}
2. Move default welcome event: Images
- {"id": 4, "method": "scoobyService.saveEvent", "params": ["Scooby", {"id": "171d9c85-bde8-49b8-a4b0-9390279ae6a1", "title": "New Event", "description": "", "start": {"year": 2006, "month": 4, "date" 28, "hours": 10, "minutes": 15, "seconds": 0, "timezone": null, "utc": false, "JavaClass": "org.osaf.scooby.model.ScoobyDate"}, "end ": {"year": 2006, "month": 4, "date": 28, "hours ": 11, "minutes" : 15, "seconds": 0, "timezone": null, "utc": false, "javaClass": "org.osaf.scooby.model.ScoobyDate"}, "allDay": false, "pointInTime": false, "anyTime": false, recurrenceRule": null, "status": null, "masterEvent": false, "instance": false, "javaClass": "org.osaf.scooby.model.Event"}]}
3. Create New Event: Images
- {"id": 5, "method": "scoobyService.saveEvent", "params": ["Scooby", {"id": null, "title": "New Event", "description": null, "start": {"year": 2006, "month": 4, "date": 30, "hours": "15", "minutes": "00", "seconds": 0, "timezone": null, "utc": false}, "end": {"year": 2006, "month": 4, "date": 30, "hours": 16, "minutes": 0, "seconds": 0, "timezone": null, "utc": false}, "allDay": false, "pointIn Time": false, "anyTime": false, "recurrenceRule": null, "status": null, "instance": false, "javaClass": "org.osaf.scooby.model.Event"}]}
4. Update Event Properties: Images
- {"id": 7 "method": "scoobyService.saveEvent", "params": ["Scooby", {"id": "d79763b3-7668-4dab-94e8-a0a93c72afle", "title": "Test Event", description", "start": {"year": 2006, "month": 4, "date": 30, "hours": 0, "minutes": 0, "timezone": null, "utc": false}, "allDay": true, "pointInTime": false, "anyTime" false, recurrenceRule": null, "status": "CONFIRMED", "masterEvent": false, "instance": false, "javaClass": "org.osaf.scooby.model.Event"}]}
5. View a different calendar month:
- {"id": 5, "method": "scoobyService.getEvents", "params": ["Scooby", 1149318000000, 1150095599000]}
6. Remove an Event: Images
- {"id": 7, "method": "scoobyService.removeEvent", "params": ["Scooby", "171d9c85-bde8-49b8-a4b0-9390279ae6a1"]}
7. Succesful Response from Server: HTTP/1.1 200 OK (text/plain)
8. Variables Options:
- status: TENTATIVE, CONFIRMED, CANCELLED, defaults to null
- recurrenceRule: this is not yet implemented, defaults to null
9. Procedure for constructing a test for scooby using the httptest object: Python Code Example?
- Create a cosmo user
- Check status to verify that the account works
- Use JSON-RPC http calls to simulate login
- Use JSON-RPC calls to design your test as a member function.
- Set the httptest paramaters
- Call the member function from init to have your test run
10. Observing communication between browser and scooby/cosmo:
- Requirements
- Ethereal
- Web Browser
- Setup Accessable Cosmo Server
- Filtering: Images
- In the interface options filter by the host ip you are trying to view
- Then filter all of those for http