mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 11:21:29 +00:00
Fix several lint warnings
This commit is contained in:
parent
bcbec555cd
commit
df92b179c7
2 changed files with 10 additions and 16 deletions
|
@ -17,35 +17,29 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class RestApiTest extends AndroidTestCase {
|
public class RestApiTest extends AndroidTestCase {
|
||||||
|
|
||||||
private SyncthingRunnable mSyncthing;
|
|
||||||
|
|
||||||
private ConfigXml mConfig;
|
|
||||||
|
|
||||||
private RestApi mApi;
|
private RestApi mApi;
|
||||||
|
|
||||||
private String mHttpsCertPath;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
mSyncthing = new SyncthingRunnable(new MockContext(null),
|
new SyncthingRunnable(new MockContext(null),
|
||||||
getContext().getApplicationInfo().dataDir + "/" + SyncthingService.BINARY_NAME);
|
getContext().getApplicationInfo().dataDir + "/" + SyncthingService.BINARY_NAME);
|
||||||
|
|
||||||
mConfig = new ConfigXml(new MockContext(getContext()));
|
ConfigXml config = new ConfigXml(new MockContext(getContext()));
|
||||||
mConfig.changeDefaultFolder();
|
config.changeDefaultFolder();
|
||||||
|
|
||||||
mHttpsCertPath = getContext().getFilesDir() + "/" + SyncthingService.HTTPS_CERT_FILE;
|
String httpsCertPath = getContext().getFilesDir() + "/" + SyncthingService.HTTPS_CERT_FILE;
|
||||||
|
|
||||||
final CountDownLatch latch = new CountDownLatch(2);
|
final CountDownLatch latch = new CountDownLatch(2);
|
||||||
new PollWebGuiAvailableTask(mHttpsCertPath) {
|
new PollWebGuiAvailableTask(httpsCertPath) {
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void aVoid) {
|
protected void onPostExecute(Void aVoid) {
|
||||||
mApi.onWebGuiAvailable();
|
mApi.onWebGuiAvailable();
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
}.execute(mConfig.getWebGuiUrl());
|
}.execute(config.getWebGuiUrl());
|
||||||
mApi = new RestApi(getContext(), mConfig.getWebGuiUrl(), mConfig.getApiKey(),
|
mApi = new RestApi(getContext(), config.getWebGuiUrl(), config.getApiKey(),
|
||||||
new RestApi.OnApiAvailableListener() {
|
new RestApi.OnApiAvailableListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onApiAvailable() {
|
public void onApiAvailable() {
|
||||||
|
@ -58,8 +52,6 @@ public class RestApiTest extends AndroidTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
|
||||||
SyncthingRunnable.killSyncthing();
|
SyncthingRunnable.killSyncthing();
|
||||||
ConfigXml.getConfigFile(new MockContext(getContext())).delete();
|
ConfigXml.getConfigFile(new MockContext(getContext())).delete();
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,9 @@ public class GetTask extends AsyncTask<String, Void, String> {
|
||||||
try {
|
try {
|
||||||
// Don't push the API too hard
|
// Don't push the API too hard
|
||||||
Thread.sleep(500 * i);
|
Thread.sleep(500 * i);
|
||||||
} catch (InterruptedException e) { }
|
} catch (InterruptedException e) {
|
||||||
|
Log.w(TAG, e);
|
||||||
|
}
|
||||||
Log.w(TAG, "Retrying GetTask Rest API call ("+i+")");
|
Log.w(TAG, "Retrying GetTask Rest API call ("+i+")");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue