fix:not use code

master
tanyawen01770 2023-01-29 09:45:14 +08:00
parent 4de15ae592
commit 2b4693643a
2 changed files with 33 additions and 32 deletions

View File

@ -100,8 +100,10 @@ public class TrackerClient {
return connection; return connection;
} }
//do fail over //do fail over
if (length > 1) { int currentIndex = 0;
int currentIndex = trackerServer.getIndex(); if (trackerServer != null) {
currentIndex = trackerServer.getIndex();
}
int failOverCount = 0; int failOverCount = 0;
while (failOverCount < length - 1) { while (failOverCount < length - 1) {
failOverCount++; failOverCount++;
@ -130,7 +132,6 @@ public class TrackerClient {
} }
}
return null; return null;
} }

View File

@ -33,7 +33,7 @@ public class FdfsTest {
TrackerClient tracker = new TrackerClient(); TrackerClient tracker = new TrackerClient();
trackerServer = tracker.getTrackerServer(); trackerServer = tracker.getTrackerServer();
StorageServer storageServer = null; StorageServer storageServer = null;
storageClient = new StorageClient(null, storageServer); storageClient = new StorageClient(trackerServer, storageServer);
} }
@After @After
@ -87,9 +87,9 @@ public class FdfsTest {
@Test @Test
public void download() throws Exception { public void download() throws Exception {
String[] uploadresult = {"group1", "M00/00/00/wKgBZV0phl2ASV1nAACk1tFxwrM3814331"}; String[] uploadresult = {"group1", "M00/00/00/J2fL12PVypeAWiGcAAM_gDeWVyw5817085"};
byte[] result = storageClient.download_file(uploadresult[0], uploadresult[1]); byte[] result = storageClient.download_file(uploadresult[0], uploadresult[1]);
String local_filename = "build.PNG"; String local_filename = "commitment.d2f57e10.jpg";
writeByteToFile(result, local_filename); writeByteToFile(result, local_filename);
File file = new File(local_filename); File file = new File(local_filename);
Assert.assertTrue(file.isFile()); Assert.assertTrue(file.isFile());