Github user parthchandra commented on a diff in the pull request:

    https://github.com/apache/drill/pull/831#discussion_r118098082
  
    --- Diff: 
exec/java-exec/src/test/java/org/apache/drill/exec/store/pcap/TestPcapDecoder.java
 ---
    @@ -0,0 +1,230 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to you 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
    + * <p>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p>
    + * 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 org.apache.drill.exec.store.pcap;
    +
    +import com.google.common.io.Resources;
    +import org.apache.drill.BaseTestQuery;
    +import org.apache.drill.exec.store.pcap.decoder.Packet;
    +import org.apache.drill.exec.store.pcap.decoder.PacketDecoder;
    +import org.junit.BeforeClass;
    +import org.junit.Test;
    +
    +import java.io.BufferedInputStream;
    +import java.io.DataOutputStream;
    +import java.io.File;
    +import java.io.FileInputStream;
    +import java.io.FileOutputStream;
    +import java.io.IOException;
    +import java.io.InputStream;
    +
    +import static org.junit.Assert.assertEquals;
    +import static org.junit.Assert.assertTrue;
    +
    +public class TestPcapDecoder extends BaseTestQuery {
    +  private static File bigFile;
    +
    +  /**
    +   * Creates an ephemeral file of about a GB in size
    +   *
    +   * @throws IOException If input file can't be read or output can't be 
written.
    +   */
    +  @BeforeClass
    +  public static void buildBigTcpFile() throws IOException {
    +    bigFile = File.createTempFile("tcp", ".pcap");
    +    bigFile.deleteOnExit();
    +    boolean first = true;
    +    System.out.printf("Building large test file\n");
    +    try (DataOutputStream out = new DataOutputStream(new 
FileOutputStream(bigFile))) {
    +      for (int i = 0; i < 1000e6 / (29208 - 24) + 1; i++) {
    +        // might be faster to keep this open and rewind each time, but
    +        // that is hard to do with a resource, especially if it comes
    +        // from the class path instead of files.
    +        try (InputStream in = 
Resources.getResource("store/pcap/tcp-2.pcap").openStream()) {
    +          ConcatPcap.copy(first, in, out);
    +        }
    +        first = false;
    +      }
    +      System.out.printf("Created file is %.1f MB\n", bigFile.length() / 
1e6);
    --- End diff --
    
    Can we not use System.out in a test? We're trying to get the output from a 
full build to be smaller. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to