Class CommonTestSupportUtils
java.lang.Object
org.apache.maven.scm.provider.git.CommonTestSupportUtils
TODO Add javadoc
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSuffix of compile Java class filesstatic final Stringstatic final intstatic final Stringstatic final StringPrefix used in URL(s) that reference a file resourcestatic final StringURL/URI scheme that refers to a filestatic final StringSuffix of JAR filesstatic final StringPrefix used in URL(s) that reference a resource inside a JARstatic final StringURL/URI scheme that refers to a JARprivate static final AtomicReference<org.apache.sshd.common.keyprovider.KeyPairProvider> static final charSeparator used in URL(s) that reference a resource inside a JAR to denote the sub-path inside the JAR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringadjustURLPathValue(String path) static StringadjustURLPathValue(URL url) static org.apache.sshd.common.keyprovider.KeyPairProvidercreateTestHostKeyProvider(Class<?> anchor) static org.apache.sshd.common.keyprovider.KeyPairProviderstatic org.apache.sshd.common.keyprovider.FileKeyPairProvidercreateTestKeyPairProvider(String resource) static PathdetectTargetFolder(Class<?> anchor) static PathdetectTargetFolder(Path anchorFile) static KeyPairgenerateKeyPair(String algorithm, int keySize) static StringgetClassBytesResourceName(Class<?> clazz) static Stringstatic URLgetClassBytesURL(Class<?> clazz) static PathgetClassContainerLocationPath(Class<?> clazz) static URIgetClassContainerLocationURI(Class<?> clazz) static URLgetClassContainerLocationURL(Class<?> clazz) private static Pathstatic KeyPairgetFirstKeyPair(org.apache.sshd.common.keyprovider.KeyIdentityProvider provider) static KeyPairgetFirstKeyPair(org.apache.sshd.common.keyprovider.KeyPairProviderHolder holder) static StringgetURLSource(String externalForm) static StringgetURLSource(URI uri) static StringgetURLSource(URL url) static Pathstatic Pathresolve(Path root, Collection<String> children) static StringstripJarURLPrefix(String externalForm) static PathtoPathSource(URI uri) static PathtoPathSource(URL url) static <P extends org.apache.sshd.common.keyprovider.KeyIdentityProvider>
PvalidateKeyPairProvider(P provider)
-
Field Details
-
FILE_URL_SCHEME
-
FILE_URL_PREFIX
Prefix used in URL(s) that reference a file resource- See Also:
-
RESOURCE_SUBPATH_SEPARATOR
public static final char RESOURCE_SUBPATH_SEPARATORSeparator used in URL(s) that reference a resource inside a JAR to denote the sub-path inside the JAR- See Also:
-
JAR_FILE_SUFFIX
-
JAR_URL_SCHEME
-
JAR_URL_PREFIX
Prefix used in URL(s) that reference a resource inside a JAR- See Also:
-
CLASS_FILE_SUFFIX
-
TARGET_FOLDER_NAMES
-
DEFAULT_TEST_HOST_KEY_PROVIDER_ALGORITHM
- See Also:
-
DEFAULT_TEST_HOST_KEY_SIZE
public static final int DEFAULT_TEST_HOST_KEY_SIZE- See Also:
-
DEFAULT_TEST_HOST_KEY_TYPE
-
KEYPAIR_PROVIDER_HOLDER
private static final AtomicReference<org.apache.sshd.common.keyprovider.KeyPairProvider> KEYPAIR_PROVIDER_HOLDER -
PROVIDERS_MAP
-
-
Constructor Details
-
CommonTestSupportUtils
private CommonTestSupportUtils()
-
-
Method Details
-
getClassContainerLocationURI
- Parameters:
clazz- AClassobject- Returns:
- A
URIto the location of the class bytes container - e.g., the root folder, the containing JAR, etc.. Returnsnullif location could not be resolved - Throws:
URISyntaxException- if location is not a valid URI- See Also:
-
getClassContainerLocationURL
-
getURLSource
- Parameters:
uri- TheURIvalue - ignored ifnull- Returns:
- The URI(s) source path where
JAR_URL_PREFIXand any sub-resource are stripped - See Also:
-
getURLSource
- Parameters:
url- TheURLvalue - ignored ifnull- Returns:
- The URL(s) source path where
JAR_URL_PREFIXand any sub-resource are stripped - See Also:
-
getURLSource
- Parameters:
externalForm- TheURL.toExternalForm()string - ignored ifnull/empty- Returns:
- The URL(s) source path where
JAR_URL_PREFIXand any sub-resource are stripped
-
adjustURLPathValue
-
adjustURLPathValue
-
stripJarURLPrefix
-
getClassBytesURL
-
getClassBytesResourceName
-
getClassBytesResourceName
-
resolve
-
resolve
-
detectTargetFolder
-
getClassContainerLocationPath
- Parameters:
clazz- AClassobject- Returns:
- A
Pathof the location of the class bytes container - e.g., the root folder, the containing JAR, etc.. Returnsnullif location could not be resolved - Throws:
IllegalArgumentException- If location is not a validPathlocation- See Also:
-
toPathSource
Converts aURLthat may refer to an internal resource to aPathrepresenting is "source" container (e.g., if it is a resource in a JAR, then the result is the JAR's path)- Parameters:
url- TheURL- ignored ifnull- Returns:
- The matching
Path - Throws:
MalformedURLException- If source URL does not refer to a file location- See Also:
-
toPathSource
Converts aURIthat may refer to an internal resource to aPathrepresenting is "source" container (e.g., if it is a resource in a JAR, then the result is the JAR's path)- Parameters:
uri- TheURI- ignored ifnull- Returns:
- The matching
Path - Throws:
MalformedURLException- If source URI does not refer to a file location- See Also:
-
detectTargetFolder
-
generateKeyPair
public static KeyPair generateKeyPair(String algorithm, int keySize) throws GeneralSecurityException - Throws:
GeneralSecurityException
-
createTestHostKeyProvider
public static org.apache.sshd.common.keyprovider.KeyPairProvider createTestHostKeyProvider(Class<?> anchor) -
createTestHostKeyProvider
public static org.apache.sshd.common.keyprovider.KeyPairProvider createTestHostKeyProvider(Path path) -
getFirstKeyPair
public static KeyPair getFirstKeyPair(org.apache.sshd.common.keyprovider.KeyPairProviderHolder holder) -
getFirstKeyPair
public static KeyPair getFirstKeyPair(org.apache.sshd.common.keyprovider.KeyIdentityProvider provider) -
getFile
-
createTestKeyPairProvider
public static org.apache.sshd.common.keyprovider.FileKeyPairProvider createTestKeyPairProvider(String resource) -
validateKeyPairProvider
public static <P extends org.apache.sshd.common.keyprovider.KeyIdentityProvider> P validateKeyPairProvider(P provider)
-