Testing Daytime Client

The first step in testing the Daytime Client is to ensure that the Daytime Server application is running, as described in section 13.3.4. Once you know the Daytime Server is running, you can run the Daytime Client.

NOTE If you are unclear on how to build and run the Daytime Client, refer to chapter 2 for information on properly setting up the Android development environment in Eclipse.

Figure 13.11 demonstrates the Daytime Client running, alongside a view of the Daytime Server. Note how the TextView of the Android application is updated to reflect the date and time sent by the Daytime Server.

Daytime Client

Wed Jul 30 0935:05 2008

Get DateiTime

Daytime Client

Wed Jul 30 0935:05 2008

Get DateiTime

Figure 13.11 Testing the Daytime Client

C5\toola >adb shell H cd /data/chlS cd /data/chl3 tt ./'daytine .»'daytime Daytime Server Waiting for connection Timeout.

Incoming connection! Calling accept: Connecting sending [Wed Jul 30 09:35:05 20081

Recordfiit: insert into bits values <»ATEnME<'N0W' >. 'Wed Jul 30 69:3£:05 2008' >; Waiting for connection T imeout.

"C

G:\tooIs>adb shell tt cd /'data/chl 3 cd /data/chi3 tt sqlite3 daytime_db.db sqlite3 daytine_db.db EQLitc ucrsion 3.5.0 Enter ".help" for instructions sqlite> select * from hits; select * iron hits;

2008 87-29 07:31:35!Tue Jul 29 07:31:35 2008 2B08-07-29 07:56: 27! Tub Jul 29 07:56:27 2008 2008 »7-29 07:56 i 28 Hue Jul 29 07:56:28 200« 2008-07-29 07:56:29!Tub Jul 29 07:56:28 2008 2008-07-29 07:56:29 !Ttie Jul 29 07:56:29 2008 2 008 -07-29 07:56:29 Hue Jul 29 07:56:29 2008 2008-07-29 07:56:29!Tue Jul 29 07:56:29 2008 Z008-07-29 07:56:29¡Tue Jul 29 07:56:29 2008 2008-07-29 07:56:30¡Tug Jul 29 07:56:30 2008 2008-07-30 0V:06:57¡Wed Jul 30 09:06:57 2008 2008-07-30 09:08:45!Wed Jul 30 09:08:44 2008 2008-07-30 09:12:34!Wed Jul 30 »9:12:34 2008 2008-07-30 09:33:45'Wed Jul 30 09:33:44 2008 2008-07-30 09:35:05!Wed Jul 30 09:35:05 2008 st|lite> .exit

»"exit exit

Figure 13.11 Testing the Daytime Client

The Daytime Server is exercising both TCP socket functionality and SQLite database record insertions, all running in the Android Emulator. A production-ready Android/ Linux application would need to be converted to run as a daemon, which is beyond our aim for this chapter.

0 0

Post a comment