[java-opensaml] 08/24: Port new RepositorySupport test class down from java-support.

Brent Putman putmanb at georgetown.edu
Wed Sep 27 16:46:02 EDT 2017


This is an automated email from the git hooks/post-receive script.

putmanb pushed a commit to branch maint-3.3
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=4229e8e4429659fcab727ecdecaf1ba20ed49720

commit 4229e8e4429659fcab727ecdecaf1ba20ed49720
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Fri Sep 22 18:15:33 2017 -0400

    Port new RepositorySupport test class down from java-support.
    
    This avoids having to do a patch release of java-support.
---
 .../java/support/repository/RepositorySupport.java | 68 ++++++++++++++++++++++
 opensaml-saml-impl/pom.xml                         |  6 --
 opensaml-xmlsec-impl/pom.xml                       |  7 ---
 3 files changed, 68 insertions(+), 13 deletions(-)

diff --git a/opensaml-core/src/test/java/net/shibboleth/utilities/java/support/repository/RepositorySupport.java b/opensaml-core/src/test/java/net/shibboleth/utilities/java/support/repository/RepositorySupport.java
new file mode 100644
index 0000000..da05fc1
--- /dev/null
+++ b/opensaml-core/src/test/java/net/shibboleth/utilities/java/support/repository/RepositorySupport.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.utilities.java.support.repository;
+
+import javax.annotation.Nonnull;
+
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
+/**
+ * Support class for working with the project version control repository.
+ */
+public final class RepositorySupport {
+    
+    /** Constructor. */
+    private RepositorySupport() { } 
+    
+    /**
+     * Build an HTTPS resource URL for the selected repository name and path.
+     * 
+     * @param repoName the repository name.  If Git, do not include the ".git" suffix.
+     * @param resourcePath The relative resource path within the repository, e.g. "foo/bar/baz/file.txt"
+     * @return the HTTPS resource URL
+     */
+    public static String buildHTTPSResourceURL(@Nonnull final String repoName, @Nonnull final String resourcePath) {
+        return buildHTTPResourceURL(repoName, resourcePath, true);
+    }
+    
+    /**
+     * Build an HTTP/HTTPS resource URL for the selected repository name and path.
+     * 
+     * @param repoName the repository name.  If Git, do not include a trailing ".git" suffix for bare repos.
+     * @param resourcePath The relative resource path within the repository, e.g. "foo/bar/baz/file.txt"
+     * @param https if true, use https if possible, otherwise use http
+     * @return the HTTP(S) resource URL
+     */
+    public static String buildHTTPResourceURL(@Nonnull final String repoName, @Nonnull final String resourcePath, 
+            final boolean https) {
+        
+        final String repo = Constraint.isNotNull(StringSupport.trimOrNull(repoName), 
+                "Repository name was null or empty");
+        String path = Constraint.isNotNull(StringSupport.trimOrNull(resourcePath), 
+                "Resource path was null or empty");
+        
+        if (path.startsWith("/")) {
+            path = path.substring(1);
+        }
+        
+        return String.format("%s://git.shibboleth.net/view/?p=%s.git&a=blob_plain&f=%s&hb=master", 
+                https ? "https" : "http", repo, path);
+    }
+
+}
diff --git a/opensaml-saml-impl/pom.xml b/opensaml-saml-impl/pom.xml
index cdcf76a..bd5eeee 100644
--- a/opensaml-saml-impl/pom.xml
+++ b/opensaml-saml-impl/pom.xml
@@ -141,12 +141,6 @@
             <artifactId>spring-extensions</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>net.shibboleth.utilities</groupId>
-            <artifactId>java-support</artifactId>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
         
     </dependencies>
 
diff --git a/opensaml-xmlsec-impl/pom.xml b/opensaml-xmlsec-impl/pom.xml
index 845f108..34f0cf1 100644
--- a/opensaml-xmlsec-impl/pom.xml
+++ b/opensaml-xmlsec-impl/pom.xml
@@ -50,13 +50,6 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
-        
-        <dependency>
-            <groupId>net.shibboleth.utilities</groupId>
-            <artifactId>java-support</artifactId>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
 
     </dependencies>
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list