It's been a while since this post but I will reply anyway. I've been
scratching my head over this for the entire weekend. It's now come to
my realisation that android release version 1 has been cut down to
only include what will be the API. That is to say the jar file
includes the API and not the implementation of the API as such. This
means that many objects will not contain an implementation - hence
the rather unhelpful "Stub!" exception to indicate an access to a
stub implementation. Within the emulator is a full implementation of
the API. I'm still figuring out how to include this implementation in
a project so that J. unit tests can run.
On Sep 30, 1:41 am, elephantbug <[EMAIL PROTECTED]> wrote:
> Hi,
>
> After I migrate my code to 1.0, all my JUnit test cases throw
> following exception, anyone can give me some clue:
>
> java.lang.RuntimeException: Stub!
> at
> org.apache.http.params.AbstractHttpParams.<init>(AbstractHttpParams.java:
> 5)
> at org.apache.http.params.BasicHttpParams.<init>(BasicHttpParams.java:
> 6)
> at
> com.loopt.network.HttpClientNetworkProvider.<init>(HttpClientNetworkProvider.java:
> 39)
> at com.loopt.network.NetworkProvider.getInstance(NetworkProvider.java:
> 65)
> at com.loopt.tests.network.BaseTestCase.setUp(BaseTestCase.java:43)
> at junit.framework.TestCase.runBare(TestCase.java:132)
> at junit.framework.TestResult$1.protect(TestResult.java:110)
> at junit.framework.TestResult.runProtected(TestResult.java:128)
> at junit.framework.TestResult.run(TestResult.java:113)
> at junit.framework.TestCase.run(TestCase.java:124)
> at junit.framework.TestSuite.runTest(TestSuite.java:232)
> at junit.framework.TestSuite.run(TestSuite.java:227)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:
> 130)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:
> 38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
> 460)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
> 673)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
> 386)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
> 196)
>
> Here is the code snippet for the HttpClientNetworkProvider:
>
> HttpParams params = new
> BasicHttpParams(); //line 39:
> ConnManagerParams.setMaxTotalConnections(params, 100);
> HttpConnectionParams.setConnectionTimeout(params, 20 * 1000);
> HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
>
> // Create and initialize scheme registry
> SchemeRegistry schemeRegistry = new SchemeRegistry();
> schemeRegistry.register(new Scheme("http",
> PlainSocketFactory.getSocketFactory(), 80));
> schemeRegistry.register(new Scheme("https",
> SSLSocketFactory.getSocketFactory(), 443));
>
> // Create an HttpClient with the ThreadSafeClientConnManager.
> // This connection manager must be used if more than one
> thread will
> // be using the HttpClient.
> ClientConnectionManager cm = new
> ThreadSafeClientConnManager(params,
> schemeRegistry);
>
> httpClient = new DefaultHttpClient(cm, params);
>
> Thanks.
>
> --elephantbug
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---