This commit is contained in:
Chris Lu 2018-12-27 23:40:23 -08:00
parent 319ab6d98f
commit 9123d799b8
9 changed files with 36 additions and 39 deletions

View file

@ -50,6 +50,17 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>

View file

@ -1,4 +1,4 @@
package seaweed.hdfs;
package seaweedfs.client;
import java.io.IOException;
import java.io.OutputStream;

View file

@ -1,4 +1,4 @@
package seaweed.hdfs;
package seaweedfs.client;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
@ -6,8 +6,6 @@ import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import seaweedfs.client.FilerGrpcClient;
import seaweedfs.client.FilerProto;
import java.io.IOException;
import java.io.OutputStream;

View file

@ -1,4 +1,4 @@
package seaweed.hdfs;
package seaweedfs.client;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
@ -6,8 +6,6 @@ import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import seaweedfs.client.FilerGrpcClient;
import seaweedfs.client.FilerProto;
import java.io.ByteArrayInputStream;
import java.io.IOException;

View file

@ -1,13 +1,11 @@
package seaweed.hdfs;
package seaweedfs.client;
import org.junit.Assert;
import org.junit.Test;
import seaweedfs.client.FilerProto;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
public class SeaweedReadTest {
@Test
@ -31,33 +29,33 @@ public class SeaweedReadTest {
System.out.println("visible:" + visibleInterval);
}
assertEquals(visibleIntervals.size(), 2);
Assert.assertEquals(visibleIntervals.size(), 2);
SeaweedRead.VisibleInterval visibleInterval = visibleIntervals.get(0);
assertEquals(visibleInterval.start, 0);
assertEquals(visibleInterval.stop, 100);
assertEquals(visibleInterval.modifiedTime, 1000);
assertEquals(visibleInterval.fileId, "aaa");
Assert.assertEquals(visibleInterval.start, 0);
Assert.assertEquals(visibleInterval.stop, 100);
Assert.assertEquals(visibleInterval.modifiedTime, 1000);
Assert.assertEquals(visibleInterval.fileId, "aaa");
visibleInterval = visibleIntervals.get(1);
assertEquals(visibleInterval.start, 100);
assertEquals(visibleInterval.stop, 233);
assertEquals(visibleInterval.modifiedTime, 2000);
assertEquals(visibleInterval.fileId, "bbb");
Assert.assertEquals(visibleInterval.start, 100);
Assert.assertEquals(visibleInterval.stop, 233);
Assert.assertEquals(visibleInterval.modifiedTime, 2000);
Assert.assertEquals(visibleInterval.fileId, "bbb");
List<SeaweedRead.ChunkView> chunkViews = SeaweedRead.viewFromVisibles(visibleIntervals, 0, 233);
SeaweedRead.ChunkView chunkView = chunkViews.get(0);
assertEquals(chunkView.offset, 0);
assertEquals(chunkView.size, 100);
assertEquals(chunkView.logicOffset, 0);
assertEquals(chunkView.fileId, "aaa");
Assert.assertEquals(chunkView.offset, 0);
Assert.assertEquals(chunkView.size, 100);
Assert.assertEquals(chunkView.logicOffset, 0);
Assert.assertEquals(chunkView.fileId, "aaa");
chunkView = chunkViews.get(1);
assertEquals(chunkView.offset, 0);
assertEquals(chunkView.size, 133);
assertEquals(chunkView.logicOffset, 100);
assertEquals(chunkView.fileId, "bbb");
Assert.assertEquals(chunkView.offset, 0);
Assert.assertEquals(chunkView.size, 133);
Assert.assertEquals(chunkView.logicOffset, 100);
Assert.assertEquals(chunkView.fileId, "bbb");
}

View file

@ -154,17 +154,6 @@
<artifactId>hadoop-common</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory;
import seaweedfs.client.FilerClient;
import seaweedfs.client.FilerGrpcClient;
import seaweedfs.client.FilerProto;
import seaweedfs.client.SeaweedRead;
import java.io.FileNotFoundException;
import java.io.IOException;

View file

@ -10,6 +10,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import seaweedfs.client.FilerGrpcClient;
import seaweedfs.client.FilerProto;
import seaweedfs.client.SeaweedRead;
import java.io.EOFException;
import java.io.IOException;

View file

@ -11,6 +11,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import seaweedfs.client.FilerGrpcClient;
import seaweedfs.client.FilerProto;
import seaweedfs.client.SeaweedWrite;
import java.io.IOException;
import java.io.InterruptedIOException;