@@ -0,0 +1,2764 @@
+/*%0A * Licensed to the University of California, Berkeley under one or more contributor license%0A * agreements. See the NOTICE file distributed with this work for additional information regarding%0A * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance with the License. You may obtain a%0A * copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software distributed under the License%0A * is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express%0A * or implied. See the License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0Apackage tachyon.client.keyvalue;%0A%0Aimport java.io.IOException;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.ClassRule;%0Aimport org.junit.Test;%0A%0Aimport tachyon.Constants;%0Aimport tachyon.LocalTachyonClusterResource;%0Aimport tachyon.TachyonURI;%0Aimport tachyon.client.file.TachyonFileSystem;%0Aimport tachyon.exception.TachyonException;%0Aimport tachyon.util.io.PathUtils;%0A%0A/**%0A * Integration tests for %7B@link KeyValueFileWriter%7D%0A */%0Apublic final class KeyValueFileIntegrationTest %7B%0A  private static final int BLOCK_SIZE = 512 * Constants.MB;%0A  private static final byte%5B%5D KEY1 = %22key1%22.getBytes();%0A  private static final byte%5B%5D KEY2 = %22key2_foo%22.getBytes();%0A  private static final byte%5B%5D VALUE1 = %22value1%22.getBytes();%0A  private static final byte%5B%5D VALUE2 = %22value2_bar%22.getBytes();%0A  private static TachyonFileSystem sTfs;%0A  private KeyValueFileWriter mKeyValueFileWriter;%0A  private KeyValueFileReader mKeyValueFileReader;%0A%0A  @ClassRule%0A  public static LocalTachyonClusterResource sLocalTachyonClusterResource =%0A      new LocalTachyonClusterResource(Constants.GB, Constants.KB, BLOCK_SIZE);%0A%0A  @BeforeClass%0A  public static void beforeClass() throws Exception %7B%0A    sTfs = sLocalTachyonClusterResource.get().getClient();%0A  %7D%0A%0A  @Test%0A  public void readerWriterTest() throws IOException, TachyonException %7B%0A    String uniqPath = PathUtils.uniqPath();%0A    TachyonURI uri = new TachyonURI(uniqPath);%0A    mKeyValueFileWriter = KeyValueFileWriter.Factory.create(uri);%0A    mKeyValueFileWriter.put(KEY1, VALUE1);%0A    mKeyValueFileWriter.put(KEY2, VALUE2);%0A    mKeyValueFileWriter.close();%0A    // Expect the key-value file exists%0A    Assert.assertNotNull(sTfs.openIfExists(uri));%0A    mKeyValueFileReader = KeyValueFileReader.Factory.create(uri);%0A    Assert.assertArrayEquals(VALUE1, mKeyValueFileReader.get(KEY1));%0A    Assert.assertArrayEquals(VALUE2, mKeyValueFileReader.get(KEY2));%0A    Assert.assertNull(mKeyValueFileReader.get(%22NoSuchKey%22.getBytes()));%0A  %7D%0A%7D%0A

Add an integration tests for KeyValueFile Reader and Writer