Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package com.facebook.presto.operator;
 
 
 import static com.facebook.presto.operator.TestPipelineStats.assertExpectedPipelineStats;
 import static io.airlift.units.DataSize.Unit.BYTE;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
 import static org.joda.time.DateTimeZone.UTC;
 import static org.testng.Assert.assertEquals;
 
 public class TestTaskStats
 {
     public static final TaskStats EXPECTED = new TaskStats(
             new DateTime(1),
             new DateTime(2),
             new DateTime(100),
             new DateTime(3),
             new Duration(4, ),
             new Duration(5, ),
 
             6,
             7,
             5,
             8,
             6,
             10,
 
             new DataSize(11, ),
             new Duration(12, ),
             new Duration(13, ),
             new Duration(14, ),
             new Duration(15, ),
 
             new DataSize(16, ),
             17,
 
             new DataSize(18, ),
             19,
 
             new DataSize(20, ),
             21,
 
             ImmutableList.of(.));
 
     @Test
     public void testJson()
     {
         JsonCodec<TaskStatscodec = JsonCodec.jsonCodec(TaskStats.class);
 
         String json = codec.toJson();
         TaskStats actual = codec.fromJson(json);
 
         assertExpectedTaskStats(actual);
     }
 
     public static void assertExpectedTaskStats(TaskStats actual)
     {
         assertEquals(actual.getCreateTime(), new DateTime(1, ));
         assertEquals(actual.getFirstStartTime(), new DateTime(2, ));
         assertEquals(actual.getLastStartTime(), new DateTime(100, ));
         assertEquals(actual.getEndTime(), new DateTime(3, ));
         assertEquals(actual.getElapsedTime(), new Duration(4, ));
         assertEquals(actual.getQueuedTime(), new Duration(5, ));
 
         assertEquals(actual.getTotalDrivers(), 6);
         assertEquals(actual.getQueuedDrivers(), 7);
         assertEquals(actual.getQueuedPartitionedDrivers(), 5);
         assertEquals(actual.getRunningDrivers(), 8);
         assertEquals(actual.getRunningPartitionedDrivers(), 6);
         assertEquals(actual.getCompletedDrivers(), 10);
 
         assertEquals(actual.getMemoryReservation(), new DataSize(11, ));
 
         assertEquals(actual.getTotalScheduledTime(), new Duration(12, ));
         assertEquals(actual.getTotalCpuTime(), new Duration(13, ));
         assertEquals(actual.getTotalUserTime(), new Duration(14, ));
         assertEquals(actual.getTotalBlockedTime(), new Duration(15, ));
 
         assertEquals(actual.getRawInputDataSize(), new DataSize(16, ));
         assertEquals(actual.getRawInputPositions(), 17);
 
        assertEquals(actual.getProcessedInputDataSize(), new DataSize(18, ));
        assertEquals(actual.getProcessedInputPositions(), 19);
        assertEquals(actual.getOutputDataSize(), new DataSize(20, ));
        assertEquals(actual.getOutputPositions(), 21);
        assertEquals(actual.getPipelines().size(), 1);
        assertExpectedPipelineStats(actual.getPipelines().get(0));
    }
New to GrepCode? Check out our FAQ X