diff options
Diffstat (limited to 'lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/file/PcapFileOpenTest.java')
-rw-r--r-- | lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/file/PcapFileOpenTest.java | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/file/PcapFileOpenTest.java b/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/file/PcapFileOpenTest.java deleted file mode 100644 index df22a7b902..0000000000 --- a/lttng/org.eclipse.linuxtools.pcap.core.tests/src/org/eclipse/linuxtools/pcap/core/tests/file/PcapFileOpenTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Perot - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.pcap.core.tests.file; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assume.assumeTrue; - -import java.io.IOException; -import java.nio.ByteOrder; - -import org.eclipse.linuxtools.internal.pcap.core.trace.BadPcapFileException; -import org.eclipse.linuxtools.internal.pcap.core.trace.PcapFile; -import org.eclipse.linuxtools.pcap.core.tests.shared.PcapTestTrace; -import org.junit.Test; - -/** - * JUnit Class that tests the opening of valid pcap files. - * - * @author Vincent Perot - */ -public class PcapFileOpenTest { - - /** - * Test that verify that an empty pcap file is properly opened and that the - * file properties are correct. - * - * @throws BadPcapFileException - * Thrown when the file is erroneous. Fails the test. - * @throws IOException - * Thrown when an IO error occurs. Fails the test. - */ - @Test - public void FileOpenEmptyTest() throws IOException, BadPcapFileException { - - PcapTestTrace trace = PcapTestTrace.EMPTY_PCAP; - assumeTrue(trace.exists()); - - try (PcapFile file = new PcapFile(trace.getPath());) { - assertEquals(PcapTestTrace.EMPTY_PCAP.getPath(), file.getPath()); - assertEquals(2, file.getMajorVersion()); - assertEquals(4, file.getMinorVersion()); - assertEquals(1, file.getDataLinkType()); - assertEquals(65535, file.getSnapLength()); - assertEquals(0, file.getTimeAccuracy()); - assertEquals(0, file.getTimeZoneCorrection()); - assertEquals(ByteOrder.LITTLE_ENDIAN, file.getByteOrder()); - - assertEquals(0, file.getTotalNbPackets()); - - } - } - - /** - * Test that verify that an non-empty pcap file is properly opened and that - * the file properties are correct. - * - * @throws BadPcapFileException - * Thrown when the file is erroneous. Fails the test. - * @throws IOException - * Thrown when an IO error occurs. Fails the test. - */ - - @Test - public void FileOpenTest() throws IOException, BadPcapFileException { - - PcapTestTrace trace = PcapTestTrace.MOSTLY_TCP; - assumeTrue(trace.exists()); - - try (PcapFile file = new PcapFile(trace.getPath());) { - assertEquals(PcapTestTrace.MOSTLY_TCP.getPath(), file.getPath()); - assertEquals(2, file.getMajorVersion()); - assertEquals(4, file.getMinorVersion()); - assertEquals(1, file.getDataLinkType()); - assertEquals(65535, file.getSnapLength()); - assertEquals(0, file.getTimeAccuracy()); - assertEquals(0, file.getTimeZoneCorrection()); - assertEquals(ByteOrder.LITTLE_ENDIAN, file.getByteOrder()); - - assertEquals(43, file.getTotalNbPackets()); - - } - } - -} |