/*
 * 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.wire;

import alluxio.util.CommonUtils;

import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Assert;
import org.junit.Test;

import java.util.Random;

public class JobConfInfoTest {

  @Test
  public void jsonTest() throws Exception {
    JobConfInfo jobConfInfo = createRandom();
    ObjectMapper mapper = new ObjectMapper();
    JobConfInfo other =
        mapper.readValue(mapper.writeValueAsBytes(jobConfInfo), JobConfInfo.class);
    checkEquality(jobConfInfo, other);
  }

  @Test
  public void thriftTest() {
    JobConfInfo jobConfInfo = createRandom();
    JobConfInfo other = ThriftUtils.fromThrift(ThriftUtils.toThrift(jobConfInfo));
    checkEquality(jobConfInfo, other);
  }

  public void checkEquality(JobConfInfo a, JobConfInfo b) {
    Assert.assertEquals(a.getOutputFile(), b.getOutputFile());
    Assert.assertEquals(a, b);
  }

  public static JobConfInfo createRandom() {
    JobConfInfo result = new JobConfInfo();
    Random random = new Random();

    String outputFile = CommonUtils.randomString(random.nextInt(10));

    result.setOutputFile(outputFile);

    return result;
  }
}

@@ -717,16 +717,193 @@
 Test %7B%0A%0A
+%0A  /**%0A   * Test to convert between a JobConfInfo type and a json type.%0A   *%0A   * @throws Exception if an error occurs during convert between BlockInfo type and json type%0A   */%0A
   @Test%0A
@@ -1190,16 +1190,88 @@
 );%0A  %7D%0A%0A
+  /**%0A   * Test to convert between a thrift type and a wire type.%0A   */%0A
   @Test%0A
@@ -1464,32 +1464,216 @@
 o, other);%0A  %7D%0A%0A
+  /**%0A   * Check if the two JobConfInfo object are equal.%0A   *%0A   * @param a the first JobConfInfo object to be checked%0A   * @param b the second JobConfInfo object to be checked%0A   */%0A
   public void ch
@@ -1815,16 +1815,120 @@
 );%0A  %7D%0A%0A
+  /**%0A   * Randomly create a JobConfInfo object.%0A   *%0A   * @return the created JobConfInfo object%0A   */%0A
   public

add javadoc