View Javadoc
1   /*
2    * Copyright (C) 2008, Imran M Yousuf <imyousuf@smartitengineering.com>
3    * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
4    * Copyright (C) 2009, Matthias Sohn <matthias.sohn@sap.com> and others
5    *
6    * This program and the accompanying materials are made available under the
7    * terms of the Eclipse Distribution License v. 1.0 which is available at
8    * https://www.eclipse.org/org/documents/edl-v10.php.
9    *
10   * SPDX-License-Identifier: BSD-3-Clause
11   */
12  
13  package org.eclipse.jgit.internal.storage.file;
14  
15  import static org.junit.Assert.assertFalse;
16  import static org.junit.Assert.fail;
17  
18  import java.io.File;
19  
20  import org.eclipse.jgit.errors.MissingObjectException;
21  import org.eclipse.jgit.junit.JGitTestUtil;
22  import org.eclipse.jgit.lib.ObjectId;
23  import org.junit.Test;
24  
25  public class PackIndexV1Test extends PackIndexTestCase {
26  	@Override
27  	public File getFileForPack34be9032() {
28  		return JGitTestUtil.getTestResourceFile(
29                      "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx");
30  	}
31  
32  	@Override
33  	public File getFileForPackdf2982f28() {
34  		return JGitTestUtil.getTestResourceFile(
35                      "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx");
36  	}
37  
38  	@Override
39  	public File getFileForBadFanoutTable() {
40  		return JGitTestUtil.getTestResourceFile("pack-bad-fanout-table.idx");
41  	}
42  
43  	/**
44  	 * Verify CRC32 - V1 should not index anything.
45  	 *
46  	 * @throws MissingObjectException
47  	 */
48  	@Override
49  	@Test
50  	public void testCRC32() throws MissingObjectException {
51  		assertFalse(smallIdx.hasCRC32Support());
52  		try {
53  			smallIdx.findCRC32(ObjectId
54  					.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904"));
55  			fail("index V1 shouldn't support CRC");
56  		} catch (UnsupportedOperationException x) {
57  			// expected
58  		}
59  	}
60  }