brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [2/3] git commit: Update refs to mvn id org.apache.brooklyn
Date Tue, 14 Oct 2014 11:14:20 GMT
Update refs to mvn id org.apache.brooklyn

- also changes snapshotUrlGenerator to inspect maven id: if it’s
  org.apache then return repository.apache.org; otherwise return
  oss.sonatype.org


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/8e4878d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/8e4878d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/8e4878d9

Branch: refs/heads/master
Commit: 8e4878d9330c07839fd8d211c91d698b3037ce43
Parents: ad435aa
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Oct 14 11:37:05 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Oct 14 11:39:32 2014 +0100

----------------------------------------------------------------------
 docs/dev/tips/release.md                        |  8 +++--
 .../entity/brooklynnode/BrooklynNode.java       |  8 +++--
 .../BrooklynNodeIntegrationTest.java            |  2 +-
 .../entity/brooklynnode/BrooklynNodeTest.java   | 10 +++---
 usage/dist/src/main/dist/conf/catalog.xml       |  4 +--
 .../brooklyn/util/maven/MavenRetriever.java     | 36 +++++++++++++++-----
 .../brooklyn/util/maven/MavenArtifactTest.java  | 14 +++++---
 7 files changed, 56 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8e4878d9/docs/dev/tips/release.md
----------------------------------------------------------------------
diff --git a/docs/dev/tips/release.md b/docs/dev/tips/release.md
index fef73fe..1360f46 100644
--- a/docs/dev/tips/release.md
+++ b/docs/dev/tips/release.md
@@ -33,9 +33,11 @@ Brooklyn is published to two locations:
 
 Brooklyn artifacts are generally downloaded from:
 
-1. [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.brooklyn%22),
-2. [Sonatype](https://oss.sonatype.org/index.html#nexus-search;quick~io.brooklyn),
-3. [GitHub](https://github.com/brooklyncentral/brooklyn).
+1. [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.brooklyn%22), 
+   and (http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.brooklyn%22) for pre
0.7.0 versions
+2. [Apache](https://repository.apache.org/index.html#nexus-search;quick~org.apache.brooklyn),
+2. [Sonatype](https://oss.sonatype.org/index.html#nexus-search;quick~io.brooklyn) for pre
0.7.0 versions
+3. [GitHub](https://github.com/apache/incubator-brooklyn).
 
 
 To publish:

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8e4878d9/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNode.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNode.java b/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNode.java
index fa49be0..dd5b115 100644
--- a/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNode.java
+++ b/software/base/src/main/java/brooklyn/entity/brooklynnode/BrooklynNode.java
@@ -68,14 +68,16 @@ public interface BrooklynNode extends SoftwareProcess, UsesJava {
     @SetFromFlag("distroUploadUrl")
     public static final ConfigKey<String> DISTRO_UPLOAD_URL = ConfigKeys.newStringConfigKey(
             "brooklynnode.distro.uploadurl", "URL for uploading the brooklyn distro (retrieved
locally and pushed to remote install location)", null);
-    
+
+    // Note that download URL only supports versions in org.apache.brooklyn, so not 0.6.0
and earlier 
+    // (which used maven group io.brooklyn). Aled thinks we can live with that.
     @SetFromFlag("downloadUrl")
     BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new StringAttributeSensorAndConfigKey(
             SoftwareProcess.DOWNLOAD_URL,
             "<#if version?contains(\"SNAPSHOT\")>"+
-                "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn&v=${version}&a=brooklyn-dist&c=dist&e=tar.gz"
+
+                "https://repository.apache.org/service/local/artifact/maven/redirect?r=snapshots&g=org.apache.brooklyn&v=${version}&a=brooklyn-dist&c=dist&e=tar.gz"
+
             "<#else>"+
-                "http://search.maven.org/remotecontent?filepath=io/brooklyn/brooklyn-dist/${version}/brooklyn-dist-${version}-dist.tar.gz"+
+                "http://search.maven.org/remotecontent?filepath=org/apache/brooklyn/brooklyn-dist/${version}/brooklyn-dist-${version}-dist.tar.gz"+
             "</#if>");
 
     @SetFromFlag("subpathInArchive")

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8e4878d9/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
b/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
index 6ebe3b2..4e0f52d 100644
--- a/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
+++ b/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeIntegrationTest.java
@@ -93,7 +93,7 @@ import com.google.common.io.Files;
  * The following commands may be useful:
  * <p>
  * <code>
- * cp ~/.m2/repository/io/brooklyn/brooklyn-dist/0.7.0-SNAPSHOT/brooklyn-dist-0.7.0-SNAPSHOT-dist.tar.gz
~/.brooklyn/repository/BrooklynNode/0.7.0-SNAPSHOT/BrooklynNode-0.7.0-SNAPSHOT.tar.gz
+ * cp ~/.m2/repository/org/apache/brooklyn/brooklyn-dist/0.7.0-SNAPSHOT/brooklyn-dist-0.7.0-SNAPSHOT-dist.tar.gz
~/.brooklyn/repository/BrooklynNode/0.7.0-SNAPSHOT/BrooklynNode-0.7.0-SNAPSHOT.tar.gz
  * rm -rf /tmp/brooklyn-`whoami`/installs/BrooklynNode*
  * </code>
  */

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8e4878d9/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java
b/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java
index c36adbc..21e3f34 100644
--- a/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java
+++ b/software/base/src/test/java/brooklyn/entity/brooklynnode/BrooklynNodeTest.java
@@ -58,19 +58,21 @@ public class BrooklynNodeTest {
     
     @Test
     public void testGeneratesCorrectSnapshotDownload() throws Exception {
-        String version = "0.6.0-SNAPSHOT";
-        String expectedUrl = "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.brooklyn&v="+version+"&a=brooklyn-dist&c=dist&e=tar.gz";
+        String version = "0.7.0-SNAPSHOT"; // BROOKLYN_VERSION
+        String expectedUrl = "https://repository.apache.org/service/local/artifact/maven/redirect?r=snapshots&g=org.apache.brooklyn&v="+version+"&a=brooklyn-dist&c=dist&e=tar.gz";
         runTestGeneratesCorrectDownloadUrl(version, expectedUrl);
     }
     
     @Test
     public void testGeneratesCorrectReleaseDownload() throws Exception {
-        String version = "0.5.0";
-        String expectedUrl = "http://search.maven.org/remotecontent?filepath=io/brooklyn/brooklyn-dist/"+version+"/brooklyn-dist-"+version+"-dist.tar.gz";
+        String version = "0.7.0";
+        String expectedUrl = "http://search.maven.org/remotecontent?filepath=org/apache/brooklyn/brooklyn-dist/"+version+"/brooklyn-dist-"+version+"-dist.tar.gz";
         runTestGeneratesCorrectDownloadUrl(version, expectedUrl);
     }
     
     private void runTestGeneratesCorrectDownloadUrl(String version, String expectedUrl) throws
Exception {
+        // TODO Using BrooklynNodeImpl directly, because want to instantiate a BroolynNodeSshDriver.
+        //      Really want to make that easier to test, without going through "wrong" code
path for creating entity.
         BrooklynNodeImpl entity = new BrooklynNodeImpl();
         entity.configure(MutableMap.of("version", version));
         entity.setParent(app);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8e4878d9/usage/dist/src/main/dist/conf/catalog.xml
----------------------------------------------------------------------
diff --git a/usage/dist/src/main/dist/conf/catalog.xml b/usage/dist/src/main/dist/conf/catalog.xml
index d016849..a433185 100644
--- a/usage/dist/src/main/dist/conf/catalog.xml
+++ b/usage/dist/src/main/dist/conf/catalog.xml
@@ -30,8 +30,8 @@
     </template>
     
     <classpath>
-      <entry>https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&amp;g=io.brooklyn.example&amp;a=brooklyn-example-simple-web-cluster&amp;v=0.7.0-SNAPSHOT&amp;e=jar</entry>
<!-- BROOKLYN_VERSION -->
-      <entry>https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&amp;g=io.brooklyn.example&amp;a=brooklyn-example-global-web-fabric&amp;v=0.7.0-SNAPSHOT&amp;e=jar</entry>
<!-- BROOKLYN_VERSION -->
+      <entry>https://repository.apache.org/service/local/artifact/maven/redirect?r=releases&amp;g=org.apache.brooklyn.example&amp;a=brooklyn-example-simple-web-cluster&amp;v=0.7.0-SNAPSHOT&amp;e=jar</entry>
<!-- BROOKLYN_VERSION -->
+      <entry>https://repository.apache.org/service/local/artifact/maven/redirect?r=releases&amp;g=org.apache.brooklyn.example&amp;a=brooklyn-example-global-web-fabric&amp;v=0.7.0-SNAPSHOT&amp;e=jar</entry>
<!-- BROOKLYN_VERSION -->
     </classpath>
 </catalog>
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8e4878d9/utils/common/src/main/java/brooklyn/util/maven/MavenRetriever.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/maven/MavenRetriever.java b/utils/common/src/main/java/brooklyn/util/maven/MavenRetriever.java
index 9753b19..7840d7b 100644
--- a/utils/common/src/main/java/brooklyn/util/maven/MavenRetriever.java
+++ b/utils/common/src/main/java/brooklyn/util/maven/MavenRetriever.java
@@ -29,18 +29,36 @@ import com.google.common.base.Function;
  * with some methods checking local file system, and allowing the generators for each to
be specified */
 public class MavenRetriever {
 
-    public static final Function<MavenArtifact,String> SONATYPE_SNAPSHOT_URL_GENERATOR
= new Function<MavenArtifact, String>() {
+    public static final Function<MavenArtifact,String> CONDITIONAL_SNAPSHOT_URL_GENERATOR
= new Function<MavenArtifact, String>() {
         public String apply(MavenArtifact artifact) {
-            return "https://oss.sonatype.org/service/local/artifact/maven/redirect?" +
-                    "r=snapshots&" +
-                    "v="+Urls.encode(artifact.version)+"&" +
-                    "g="+Urls.encode(artifact.groupId)+"&" +
-                    "a="+Urls.encode(artifact.artifactId)+"&" +
-                    (artifact.classifier!=null ? "c="+Urls.encode(artifact.classifier)+"&"
: "")+
-                    "e="+Urls.encode(artifact.packaging);
+            if (artifact.groupId.startsWith("org.apache")) {
+                return APACHE_SNAPSHOT_URL_GENERATOR.apply(artifact);
+            } else {
+                return SONATYPE_SNAPSHOT_URL_GENERATOR.apply(artifact);
+            }
         }
     };
 
+    public static final Function<MavenArtifact,String> SONATYPE_SNAPSHOT_URL_GENERATOR
= 
+            nexusSnapshotUrlGenerator("https://oss.sonatype.org");
+
+    public static final Function<MavenArtifact,String> APACHE_SNAPSHOT_URL_GENERATOR
= 
+            nexusSnapshotUrlGenerator("https://repository.apache.org");
+
+    public static Function<MavenArtifact,String> nexusSnapshotUrlGenerator(final String
baseUrl) {
+        return new Function<MavenArtifact, String>() {
+            public String apply(MavenArtifact artifact) {
+                return baseUrl+"/service/local/artifact/maven/redirect?" +
+                        "r=snapshots&" +
+                        "v="+Urls.encode(artifact.version)+"&" +
+                        "g="+Urls.encode(artifact.groupId)+"&" +
+                        "a="+Urls.encode(artifact.artifactId)+"&" +
+                        (artifact.classifier!=null ? "c="+Urls.encode(artifact.classifier)+"&"
: "")+
+                        "e="+Urls.encode(artifact.packaging);
+            }
+        };
+    }
+
     public static final Function<MavenArtifact,String> MAVEN_CENTRAL_URL_GENERATOR
= new Function<MavenArtifact, String>() {
         public String apply(MavenArtifact artifact) {
             return "http://search.maven.org/remotecontent?filepath="+
@@ -59,7 +77,7 @@ public class MavenRetriever {
         }
     };
 
-    protected Function<MavenArtifact,String> snapshotUrlGenerator = SONATYPE_SNAPSHOT_URL_GENERATOR;
+    protected Function<MavenArtifact,String> snapshotUrlGenerator = CONDITIONAL_SNAPSHOT_URL_GENERATOR;
     protected Function<MavenArtifact,String> releaseUrlGenerator = MAVEN_CENTRAL_URL_GENERATOR;
     
     public void setSnapshotUrlGenerator(Function<MavenArtifact, String> snapshotUrlGenerator)
{

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8e4878d9/utils/common/src/test/java/brooklyn/util/maven/MavenArtifactTest.java
----------------------------------------------------------------------
diff --git a/utils/common/src/test/java/brooklyn/util/maven/MavenArtifactTest.java b/utils/common/src/test/java/brooklyn/util/maven/MavenArtifactTest.java
index c847d8d..df8eef4 100644
--- a/utils/common/src/test/java/brooklyn/util/maven/MavenArtifactTest.java
+++ b/utils/common/src/test/java/brooklyn/util/maven/MavenArtifactTest.java
@@ -39,12 +39,13 @@ public class MavenArtifactTest {
     // only *integration* tests require these to be *installed*;
     // note this may vary from machine to machine so version should be aligned with that
in parent pom
     final static String MAVEN_JAR_PLUGIN_COORDINATE = "org.apache.maven.plugins:maven-jar-plugin:jar:2.3.2";
-    final static String THIS_PROJECT_COORDINATE = "io.brooklyn:brooklyn-utils-common:jar:0.7.0-SNAPSHOT";
 // BROOKLYN_VERSION
+    final static String THIS_PROJECT_COORDINATE = "org.apache.brooklyn:brooklyn-utils-common:jar:0.7.0-SNAPSHOT";
 // BROOKLYN_VERSION
 
     // Don't need to be installed, only used as examples
     final static String RELEASED_SOURCES_COORDINATE = "io.brooklyn:brooklyn-core:jar:sources:0.6.0";
     final static String EXAMPLE_BZIP_COORDINATE = "com.example:example-artifact:tar.bz2:server-windows:2.0.1";
 
+    @Test
     public void testArtifact() {
         MavenArtifact m = MavenArtifact.fromCoordinate(MAVEN_JAR_PLUGIN_COORDINATE);
         
@@ -60,6 +61,7 @@ public class MavenArtifactTest {
         Assert.assertEquals(m.isSnapshot(), false);
     }
 
+    @Test
     public void testArtifactWithClassifier() {
         MavenArtifact m = MavenArtifact.fromCoordinate(RELEASED_SOURCES_COORDINATE);
 
@@ -73,6 +75,7 @@ public class MavenArtifactTest {
 
     }
 
+    @Test
     public void testRetrieval() {
         MavenArtifact m = MavenArtifact.fromCoordinate(MAVEN_JAR_PLUGIN_COORDINATE);
 
@@ -85,6 +88,7 @@ public class MavenArtifactTest {
                 localPath);
     }
 
+    @Test
     public void testRetrievalWithClassifier() {
         MavenArtifact m = MavenArtifact.fromCoordinate(RELEASED_SOURCES_COORDINATE);
 
@@ -94,6 +98,7 @@ public class MavenArtifactTest {
                 localPath);
     }
 
+    @Test
     public void testRetrievalWithUnusualClassifier() {
         MavenArtifact m = MavenArtifact.fromCoordinate(EXAMPLE_BZIP_COORDINATE);
 
@@ -103,6 +108,7 @@ public class MavenArtifactTest {
                 localPath);
     }
 
+    @Test
     public void testSnapshotRetrieval() {
         MavenArtifact m = MavenArtifact.fromCoordinate(THIS_PROJECT_COORDINATE);
 
@@ -112,11 +118,11 @@ public class MavenArtifactTest {
         }
 
         String hostedUrl = new MavenRetriever().getHostedUrl(m);
-        Assert.assertTrue(hostedUrl.contains("sonatype"), hostedUrl);
+        Assert.assertTrue(hostedUrl.contains("repository.apache.org"), hostedUrl);
         
         String localPath = new MavenRetriever().getLocalPath(m);
         Assert.assertTrue(localPath.contains(
-                "/repository/io/brooklyn"));
+                "/repository/org/apache/brooklyn"));
     }
 
     @Test(groups="Integration")
@@ -161,7 +167,7 @@ public class MavenArtifactTest {
     @Test(groups="Integration")
     public void testRetrievalHostedSnapshotIntegration() {
         MavenArtifact m = MavenArtifact.fromCoordinate(
-                "io.brooklyn:brooklyn-utils-common:jar:0.7.0-SNAPSHOT");  // BROOKLYN_VERSION
+                "org.apache.brooklyn:brooklyn-utils-common:jar:0.7.0-SNAPSHOT");  // BROOKLYN_VERSION
         
         String localPath = new MavenRetriever().getLocalPath(m);
         File f = new File(localPath);


Mime
View raw message