You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/10/10 17:33:53 UTC

svn commit: r703498 - in /geronimo/gshell/trunk/gshell-support/gshell-ivy: ./ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/geronimo/ src/main/java/org/apache/geronimo/gshell/ src/main/java/org/apache/geronimo/gshell/ivy/ src/ma...

Author: jdillon
Date: Fri Oct 10 08:33:52 2008
New Revision: 703498

URL: http://svn.apache.org/viewvc?rev=703498&view=rev
Log:
Some testing of Ivy, looks like its a wee bit faster than maven-artifact

Added:
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/resources/org/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/resources/org/apache/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/resources/org/apache/geronimo/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/resources/org/apache/geronimo/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/resources/org/apache/geronimo/gshell/ivy/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/ivy/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/ivy/IvyTest.java   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/META-INF/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/META-INF/spring/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/log4j.xml   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/IvyTest-context.xml   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/ivysettings.xml   (with props)
Modified:
    geronimo/gshell/trunk/gshell-support/gshell-ivy/pom.xml

Modified: geronimo/gshell/trunk/gshell-support/gshell-ivy/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-ivy/pom.xml?rev=703498&r1=703497&r2=703498&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-ivy/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-ivy/pom.xml Fri Oct 10 08:33:52 2008
@@ -48,6 +48,19 @@
             <artifactId>ivy</artifactId>
             <version>2.0.0-rc1</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-spring</artifactId>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>
\ No newline at end of file

Added: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/ivy/IvyTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/ivy/IvyTest.java?rev=703498&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/ivy/IvyTest.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/ivy/IvyTest.java Fri Oct 10 08:33:52 2008
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF 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 org.apache.geronimo.gshell.ivy;
+
+import org.apache.geronimo.gshell.spring.SpringTestSupport;
+import org.apache.geronimo.gshell.chronos.StopWatch;
+import org.apache.ivy.Ivy;
+import org.apache.ivy.util.Message;
+import org.apache.ivy.util.DefaultMessageLogger;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
+import org.apache.ivy.core.module.descriptor.Configuration;
+import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.core.cache.ResolutionCacheManager;
+
+import java.io.File;
+import java.util.List;
+import java.net.URL;
+
+/**
+ * General Ivy tests.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class IvyTest
+    extends SpringTestSupport
+{
+    public void testIvy() throws Exception {
+        Message.setDefaultLogger(new DefaultMessageLogger(-1)); // Message.MSG_INFO));
+
+        IvySettings settings = new IvySettings();
+        log.debug("Settings: {}", settings);
+
+        URL url = getClass().getResource("ivysettings.xml");
+        log.debug("Settings URL: {}", url);
+        settings.load(url);
+
+        Ivy ivy = Ivy.newInstance(settings);
+        log.debug("Ivy: {}", ivy);
+
+        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache.geronimo.gshell.wisdom", "gshell-wisdom-bootstrap", "1.0-alpha-2-SNAPSHOT");
+        log.debug("MRID: {}", mrid);
+
+        DefaultModuleDescriptor md = new DefaultModuleDescriptor(ModuleRevisionId.newInstance("caller", "all-caller", "working"), "integration", null, true);
+        md.addConfiguration(new Configuration("default"));
+        md.setLastModified(System.currentTimeMillis());
+        log.debug("MD: {}", md);
+
+        DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, mrid, false, false, true);
+        dd.addDependencyConfiguration("default", "default");
+        log.debug("DD: {}", dd);
+
+        md.addDependency(dd);
+
+        ResolveOptions options = new ResolveOptions();
+        options.setOutputReport(false);
+        log.debug("Options: {}", options);
+
+        StopWatch watch = new StopWatch(true);
+
+        ResolveReport report = ivy.resolve(md, options);
+        
+        log.debug("Resolve completed in: {}", watch);
+
+        log.debug("Report: {}", report);
+
+        if (report.hasError()) {
+            log.error("Report has errors");
+        }
+
+        ResolutionCacheManager cacheManager = ivy.getResolutionCacheManager();
+
+        File ivyFile = cacheManager.getResolvedIvyFileInCache(md.getModuleRevisionId());
+        log.debug("Ivy file: {}", ivyFile);
+
+        File ivyProps = cacheManager.getResolvedIvyPropertiesInCache(md.getModuleRevisionId());
+        log.debug("Ivy props: {}", ivyProps);
+
+        log.debug("Artifact download reports");
+        for (ArtifactDownloadReport adl : report.getAllArtifactsReports()) {
+            Artifact artifact = adl.getArtifact();
+            log.debug("    {} -> {}", artifact, adl.getLocalFile());
+        }
+    }
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/ivy/IvyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/ivy/IvyTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/java/org/apache/geronimo/gshell/ivy/IvyTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/log4j.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/log4j.xml?rev=703498&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/log4j.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/log4j.xml Fri Oct 10 08:33:52 2008
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF 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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+        
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+        <param name="Target" value="System.out"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%-5p %-25.30c{1} [%t] %m%n"/>
+        </layout>
+    </appender>
+
+    <logger name="org.apache.geronimo.gshell.spring">
+        <level value="INFO"/>
+    </logger>
+
+    <logger name="org.springframework">
+        <level value="WARN"/>
+    </logger>
+
+    <root>
+        <level value="DEBUG"/>
+        <appender-ref ref="CONSOLE"/>
+    </root>
+
+</log4j:configuration>
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/log4j.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/log4j.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/log4j.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/IvyTest-context.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/IvyTest-context.xml?rev=703498&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/IvyTest-context.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/IvyTest-context.xml Fri Oct 10 08:33:52 2008
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF 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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+</beans>
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/IvyTest-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/IvyTest-context.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/IvyTest-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/ivysettings.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/ivysettings.xml?rev=703498&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/ivysettings.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/ivysettings.xml Fri Oct 10 08:33:52 2008
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF 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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<ivysettings>
+    <settings defaultResolver="default"/>
+
+    <property name="ivy.m2local.default.root"             value="${user.home}/.m2/repository" override="false"/>
+	<property name="ivy.m2local.default.ivy.pattern"      value="[organisation]/[module]/[revision]/[module]-[revision].pom" override="false"/>
+	<property name="ivy.m2local.default.artifact.pattern" value="[organisation]/[module]/[revision]/[module]-[revision].[ext]" override="false"/>
+
+    <resolvers>
+        <chain name="default"> <!-- returnFirst="true" checkmodified="true"> -->
+            <filesystem name="m2local" m2compatible="true">
+                <ivy pattern="${ivy.m2local.default.root}/${ivy.m2local.default.ivy.pattern}"/>
+                <artifact pattern="${ivy.m2local.default.root}/${ivy.m2local.default.artifact.pattern}"/>
+            </filesystem>
+
+            <!--
+            <ibiblio name="ibiblio" m2compatible="true"/>
+            -->
+        </chain>
+    </resolvers>
+</ivysettings>
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/ivysettings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/ivysettings.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/test/resources/org/apache/geronimo/gshell/ivy/ivysettings.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml