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.

AllFactoriesHttpTestCase.java 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C) 2019, Thomas Wolf <thomas.wolf@paranor.ch> and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.http.test;
  11. import java.util.Arrays;
  12. import java.util.Collection;
  13. import org.eclipse.jgit.junit.http.HttpTestCase;
  14. import org.eclipse.jgit.transport.HttpTransport;
  15. import org.eclipse.jgit.transport.http.HttpConnectionFactory;
  16. import org.eclipse.jgit.transport.http.JDKHttpConnectionFactory;
  17. import org.eclipse.jgit.transport.http.apache.HttpClientConnectionFactory;
  18. import org.junit.AfterClass;
  19. import org.junit.BeforeClass;
  20. import org.junit.Ignore;
  21. import org.junit.runner.RunWith;
  22. import org.junit.runners.Parameterized;
  23. import org.junit.runners.Parameterized.Parameters;
  24. /**
  25. * Abstract test base class for running HTTP-related tests with all connection
  26. * factories provided in JGit: the JDK {@link JDKHttpConnectionFactory} and the
  27. * Apache HTTP {@link HttpClientConnectionFactory}.
  28. */
  29. @Ignore
  30. @RunWith(Parameterized.class)
  31. public abstract class AllFactoriesHttpTestCase extends HttpTestCase {
  32. @Parameters(name = "{0}")
  33. public static Collection<Object[]> data() {
  34. // run all tests with both connection factories we have
  35. return Arrays.asList(new Object[][] { { new JDKHttpConnectionFactory() {
  36. @Override
  37. public String toString() {
  38. return this.getClass().getSuperclass().getName();
  39. }
  40. } }, { new HttpClientConnectionFactory() {
  41. @Override
  42. public String toString() {
  43. return this.getClass().getSuperclass().getName();
  44. }
  45. } } });
  46. }
  47. protected AllFactoriesHttpTestCase(HttpConnectionFactory cf) {
  48. HttpTransport.setConnectionFactory(cf);
  49. }
  50. private static HttpConnectionFactory originalFactory;
  51. @BeforeClass
  52. public static void saveConnectionFactory() {
  53. originalFactory = HttpTransport.getConnectionFactory();
  54. }
  55. @AfterClass
  56. public static void restoreConnectionFactory() {
  57. HttpTransport.setConnectionFactory(originalFactory);
  58. }
  59. }