<commit_before>/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.cli.fs.command;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

import alluxio.AlluxioURI;
import alluxio.client.WriteType;
import alluxio.client.file.FileSystemTestUtils;
import alluxio.client.file.URIStatus;
import alluxio.exception.AlluxioException;
import alluxio.cli.fs.AbstractAlluxioShellTest;

import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

/**
 * Tests for load command.
 */
public final class LoadCommandIntegrationTest extends AbstractAlluxioShellTest {
  @Test
  public void loadDir() throws IOException, AlluxioException {
    FileSystemTestUtils.createByteFile(mFileSystem, "/testRoot/testFileA", WriteType.THROUGH, 10);
    FileSystemTestUtils
        .createByteFile(mFileSystem, "/testRoot/testFileB", WriteType.MUST_CACHE, 10);
    AlluxioURI uriA = new AlluxioURI("/testRoot/testFileA");
    AlluxioURI uriB = new AlluxioURI("/testRoot/testFileB");

    URIStatus statusA = mFileSystem.getStatus(uriA);
    URIStatus statusB = mFileSystem.getStatus(uriB);
    assertFalse(statusA.getInAlluxioPercentage() == 100);
    assertTrue(statusB.getInAlluxioPercentage() == 100);
    // Testing loading of a directory
    mFsShell.run("load", "/testRoot");
    statusA = mFileSystem.getStatus(uriA);
    statusB = mFileSystem.getStatus(uriB);
    assertTrue(statusA.getInAlluxioPercentage() == 100);
    assertTrue(statusB.getInAlluxioPercentage() == 100);
  }

  @Test
  public void loadFile() throws IOException, AlluxioException {
    FileSystemTestUtils.createByteFile(mFileSystem, "/testFile", WriteType.THROUGH, 10);
    AlluxioURI uri = new AlluxioURI("/testFile");
    URIStatus status = mFileSystem.getStatus(uri);
    assertFalse(status.getInAlluxioPercentage() == 100);
    // Testing loading of a single file
    mFsShell.run("load", "/testFile");
    status = mFileSystem.getStatus(uri);
    assertTrue(status.getInAlluxioPercentage() == 100);
    // Testing loading a file has been loaded fully
    mFsShell.run("load", "--local", "/testFile");
    Assert.assertEquals("/testFile" + " loaded" + "\n" + "/testFile" + " loaded" + "\n",
        mOutput.toString());
    // Testing "load --local" works when the file isn't already loaded
    FileSystemTestUtils.createByteFile(mFileSystem, "/testFile2", WriteType.THROUGH, 10);
    uri = new AlluxioURI("/testFile2");
    status = mFileSystem.getStatus(uri);
    assertFalse(status.getInAlluxioPercentage() == 100);
    mFsShell.run("load", "--local", "/testFile2");
    status = mFileSystem.getStatus(uri);
    assertTrue(status.getInAlluxioPercentage() == 100);
  }
}
<commit_msg>Address comment, add a new test of local option test.<commit_after>/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.cli.fs.command;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

import alluxio.AlluxioURI;
import alluxio.client.WriteType;
import alluxio.client.file.FileSystemTestUtils;
import alluxio.client.file.URIStatus;
import alluxio.exception.AlluxioException;
import alluxio.cli.fs.AbstractAlluxioShellTest;

import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;

/**
 * Tests for load command.
 */
public final class LoadCommandIntegrationTest extends AbstractAlluxioShellTest {
  @Test
  public void loadDir() throws IOException, AlluxioException {
    FileSystemTestUtils.createByteFile(mFileSystem, "/testRoot/testFileA", WriteType.THROUGH, 10);
    FileSystemTestUtils
        .createByteFile(mFileSystem, "/testRoot/testFileB", WriteType.MUST_CACHE, 10);
    AlluxioURI uriA = new AlluxioURI("/testRoot/testFileA");
    AlluxioURI uriB = new AlluxioURI("/testRoot/testFileB");

    URIStatus statusA = mFileSystem.getStatus(uriA);
    URIStatus statusB = mFileSystem.getStatus(uriB);
    assertFalse(statusA.getInAlluxioPercentage() == 100);
    assertTrue(statusB.getInAlluxioPercentage() == 100);
    // Testing loading of a directory
    mFsShell.run("load", "/testRoot");
    statusA = mFileSystem.getStatus(uriA);
    statusB = mFileSystem.getStatus(uriB);
    assertTrue(statusA.getInAlluxioPercentage() == 100);
    assertTrue(statusB.getInAlluxioPercentage() == 100);
  }

  @Test
  public void loadFile() throws IOException, AlluxioException {
    FileSystemTestUtils.createByteFile(mFileSystem, "/testFile", WriteType.THROUGH, 10);
    AlluxioURI uri = new AlluxioURI("/testFile");
    URIStatus status = mFileSystem.getStatus(uri);
    assertFalse(status.getInAlluxioPercentage() == 100);
    // Testing loading of a single file
    mFsShell.run("load", "/testFile");
    status = mFileSystem.getStatus(uri);
    assertTrue(status.getInAlluxioPercentage() == 100);
  }

  @Test
  public void loadFileWithLocalOption() throws IOException, AlluxioException {
    FileSystemTestUtils.createByteFile(mFileSystem, "/testFile", WriteType.CACHE_THROUGH, 10);
    AlluxioURI uri = new AlluxioURI("/testFile");
    URIStatus status = mFileSystem.getStatus(uri);
    assertTrue(status.getInAlluxioPercentage() == 100);
    // Testing loading a file has been loaded fully
    mFsShell.run("load", "--local", "/testFile");
    Assert.assertEquals("/testFile" + " loaded" + "\n", mOutput.toString());
    // Testing "load --local" works when the file isn't already loaded
    FileSystemTestUtils.createByteFile(mFileSystem, "/testFile2", WriteType.THROUGH, 10);
    uri = new AlluxioURI("/testFile2");
    status = mFileSystem.getStatus(uri);
    assertFalse(status.getInAlluxioPercentage() == 100);
    mFsShell.run("load", "--local", "/testFile2");
    status = mFileSystem.getStatus(uri);
    assertTrue(status.getInAlluxioPercentage() == 100);
  }
}

{'fraction_non_alphanumeric': 0.11495285136955545, 'fraction_numerical': 0.012423289926657685, 'mean_word_length': 4.596314907872697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3837522', 'n_tokens_mistral': 2107, 'n_tokens_neox': 2018, 'n_words': 500}