aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/SpiTransport.java
blob: b951f523fce8f2fd1b92aa030538186458154d66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * Copyright (C) 2012, GitHub Inc. and others
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * https://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
package org.eclipse.jgit.transport;

import java.util.Collections;
import java.util.Set;

import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Repository;

/**
 * Transport protocol contributed via service provider
 */
public class SpiTransport extends Transport {

	/**
	 * Transport protocol scheme
	 */
	public static final String SCHEME = "testspi";

	/**
	 * Instance
	 */
	public static final TransportProtocol PROTO = new TransportProtocol() {

		@Override
		public String getName() {
			return "Test SPI Transport Protocol";
		}

		@Override
		public Set<String> getSchemes() {
			return Collections.singleton(SCHEME);
		}

		@Override
		public Transport open(URIish uri, Repository local, String remoteName)
				throws NotSupportedException, TransportException {
			throw new NotSupportedException("not supported");
		}
	};

	private SpiTransport(Repository local, URIish uri) {
		super(local, uri);
	}

	@Override
	public FetchConnection openFetch() throws NotSupportedException,
			TransportException {
		throw new NotSupportedException("not supported");
	}

	@Override
	public PushConnection openPush() throws NotSupportedException,
			TransportException {
		throw new NotSupportedException("not supported");
	}

	@Override
	public void close() {
		// Intentionally left blank
	}
}