@@ -0,0 +1,2663 @@
+/*%0A * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0%0A * (the %22License%22). You may not use this work except in compliance with the License, which is%0A * available at www.apache.org/licenses/LICENSE-2.0%0A *%0A * This software is distributed on an %22AS IS%22 basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,%0A * either express or implied, as more fully set forth in the License.%0A *%0A * See the NOTICE file distributed with this work for information regarding copyright ownership.%0A */%0A%0Apackage alluxio.client.block.policy.options;%0A%0Aimport alluxio.CommonTestUtils;%0Aimport alluxio.Constants;%0Aimport alluxio.client.block.BlockWorkerInfo;%0A%0Aimport alluxio.wire.WorkerNetAddress;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Random;%0A%0A/**%0A * Tests for the %7B@link GetWorkerOptions%7D class.%0A */%0Apublic final class GetWorkerOptionsTest %7B%0A  private static final int PORT = 1;%0A%0A  private final List%3CBlockWorkerInfo%3E mWorkerInfos = new ArrayList%3C%3E();%0A%0A  /**%0A   * Tests for defaults %7B@link CreateOptions%7D.%0A   */%0A  @Test%0A  public void defaults() throws IOException %7B%0A    GetWorkerOptions options = GetWorkerOptions.defaults();%0A    Assert.assertEquals(null, options.getBlockWorkerInfos());%0A    Assert.assertEquals(0, options.getBlockId());%0A    Assert.assertEquals(0, options.getBlockSize());%0A  %7D%0A%0A  /**%0A   * Tests for setBlockWorkerInfo.%0A   */%0A  @Test%0A  public void setBlockWorkerInfoTest() %7B%0A    mWorkerInfos.clear();%0A    mWorkerInfos.add(new BlockWorkerInfo(%0A            new WorkerNetAddress().setHost(%22worker1%22).setRpcPort(PORT).setDataPort(PORT)%0A                    .setWebPort(PORT), Constants.GB, 0));%0A    mWorkerInfos.add(new BlockWorkerInfo(%0A            new WorkerNetAddress().setHost(%22worker2%22).setRpcPort(PORT).setDataPort(PORT)%0A                    .setWebPort(PORT), 2 * (long) Constants.GB, 0));%0A    GetWorkerOptions options = GetWorkerOptions.defaults();%0A    options.setBlockWorkerInfos(mWorkerInfos);%0A    Assert.assertEquals(mWorkerInfos, options.getBlockWorkerInfos());%0A  %7D%0A%0A  /**%0A   * Tests for setBlockId and setBlockSize.%0A   */%0A  @Test%0A  public void fields() %7B%0A    Random rand = new Random();%0A    long blockId = rand.nextLong();%0A    long blockSize = rand.nextLong();%0A    GetWorkerOptions options = GetWorkerOptions.defaults();%0A    options.setBlockId(blockId);%0A    options.setBlockSize(blockSize);%0A    Assert.assertEquals(blockId, options.getBlockId());%0A    Assert.assertEquals(blockSize, options.getBlockSize());%0A  %7D%0A%0A  @Test%0A  public void equalTest() throws Exception %7B%0A    CommonTestUtils.testEquals(GetWorkerOptions.class);%0A  %7D%0A%7D%0A

add getworkeroptions test