Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r409 committed - Complete test lifecycle but still seeing errors around servier creatio...

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r409 committed - Complete test lifecycle but still seeing errors around servier creatio...


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r409 committed - Complete test lifecycle but still seeing errors around servier creatio...
  • Date: Tue, 05 Jul 2011 19:20:44 +0000

Revision: 409
Author:

Date: Tue Jul 5 12:19:32 2011
Log: Complete test lifecycle but still seeing errors around servier creation/start.
http://code.google.com/p/ndt/source/detail?r=409

Modified:
/branches/android/Android/src/net/measurementlab/ndt/NdtService.java
/branches/android/Android/src/net/measurementlab/ndt/ServerLocation.java

=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/NdtService.java Tue Jun 21 13:11:16 2011
+++ /branches/android/Android/src/net/measurementlab/ndt/NdtService.java Tue Jul 5 12:19:32 2011
@@ -7,7 +7,10 @@
import android.util.Log;

public class NdtService extends Service {
+ public static final int PREPARING = 0;
public static final int UPLOADING = 1;
+ public static final int DOWNLOADING = 2;
+ public static final int COMPLETE = 3;

private TestReporter testReporter = new TestReporter();

@@ -27,11 +30,15 @@
public void onStart(Intent intent, int startId) {
Log.i("ndt", "Starting NDT service.");
super.onStart(intent, startId);
+ if (null == intent) {
+ throw new IllegalArgumentException("Intent was
null!");
+ }
try {
new Thread(new NdtTests(

Constants.SERVER_HOST[Constants.DEFAULT_SERVER],
new CaptiveUiServices(), intent

.getStringExtra("networkType"))).start();
+ testReporter.setState(COMPLETE);
} catch (Throwable tr) {
Log.e("ndt", "Problem running tests.", tr);
}
@@ -44,7 +51,7 @@
}

private class TestReporter extends ITestReporter.Stub {
- private int state = 0;
+ private int state = PREPARING;

@Override
public int getState() throws RemoteException {
@@ -63,10 +70,15 @@
Log.d("ndt", String.format("Appended: (%1$d) %2$s.",
viewId, str
.trim()));

- if (str.contains("client-to-server") && 1 == viewId) {
+ if (str.contains("client-to-server") && UPLOADING ==
viewId) {
Log.i("ndt", "Starting upload test.");
testReporter.setState(UPLOADING);
}
+
+ if (str.contains("server-to-client") && DOWNLOADING
== viewId) {
+ Log.i("ndt", "Starting upload test.");
+ testReporter.setState(DOWNLOADING);
+ }
}

@Override
=======================================
--- /branches/android/Android/src/net/measurementlab/ndt/ServerLocation.java Fri Jun 24 10:53:15 2011
+++ /branches/android/Android/src/net/measurementlab/ndt/ServerLocation.java Tue Jul 5 12:19:32 2011
@@ -61,13 +61,14 @@

bindService(new Intent(getApplicationContext(),
NdtService.class),
this.connection, Context.BIND_AUTO_CREATE);
+ bound = true;

running = true;
new Thread() {
@Override
public void run() {
try {
- while (true == running && (null == testReporter || 0 == testReporter.getState())) {
+ while (true == running && (null == testReporter || NdtService.COMPLETE != testReporter.getState())) {

TimeUnit.MILLISECONDS.sleep(500l);
Log.i("ndt", String.format(
"Checking test
state, %1$d.",
@@ -75,6 +76,8 @@

.getState()));
// TODO need stop when
activity is paused
}
+ TextView textView = (TextView) findViewById(R.id.NdtServerLocationLabel);
+ textView.setText("Complete!");
} catch (RemoteException e) {
Log.e("ndt", "Error in busy-wait
loop.", e);
} catch (InterruptedException e) {


  • [ndt-dev] [ndt] r409 committed - Complete test lifecycle but still seeing errors around servier creatio..., ndt, 07/05/2011

Archive powered by MHonArc 2.6.16.

Top of Page