You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PackIndexV1Test.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. package org.eclipse.jgit.internal.storage.file;
  13. import static org.junit.Assert.assertFalse;
  14. import static org.junit.Assert.fail;
  15. import java.io.File;
  16. import org.eclipse.jgit.errors.MissingObjectException;
  17. import org.eclipse.jgit.junit.JGitTestUtil;
  18. import org.eclipse.jgit.lib.ObjectId;
  19. import org.junit.Test;
  20. public class PackIndexV1Test extends PackIndexTestCase {
  21. @Override
  22. public File getFileForPack34be9032() {
  23. return JGitTestUtil.getTestResourceFile(
  24. "pack-34be9032ac282b11fa9babdc2b2a93ca996c9c2f.idx");
  25. }
  26. @Override
  27. public File getFileForPackdf2982f28() {
  28. return JGitTestUtil.getTestResourceFile(
  29. "pack-df2982f284bbabb6bdb59ee3fcc6eb0983e20371.idx");
  30. }
  31. @Override
  32. public File getFileForBadFanoutTable() {
  33. return JGitTestUtil.getTestResourceFile("pack-bad-fanout-table.idx");
  34. }
  35. /**
  36. * Verify CRC32 - V1 should not index anything.
  37. *
  38. * @throws MissingObjectException
  39. */
  40. @Override
  41. @Test
  42. public void testCRC32() throws MissingObjectException {
  43. assertFalse(smallIdx.hasCRC32Support());
  44. try {
  45. smallIdx.findCRC32(ObjectId
  46. .fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904"));
  47. fail("index V1 shouldn't support CRC");
  48. } catch (UnsupportedOperationException x) {
  49. // expected
  50. }
  51. }
  52. }