geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r370268 - in /geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent: ContinuumBuildAgentTest.java SVN.java
Date Wed, 18 Jan 2006 21:35:13 GMT
Author: dblevins
Date: Wed Jan 18 13:35:03 2006
New Revision: 370268

URL: http://svn.apache.org/viewcvs?rev=370268&view=rev
Log:
Added test for verifying svn capabilities -- seem to be having problems with that.

Added:
    geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SVN.java
Modified:
    geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgentTest.java

Modified: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgentTest.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgentTest.java?rev=370268&r1=370267&r2=370268&view=diff
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgentTest.java
(original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgentTest.java
Wed Jan 18 13:35:03 2006
@@ -29,16 +29,20 @@
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
+import java.net.URL;
 
 public class ContinuumBuildAgentTest extends TestCase {
 
     private CVS cvs;
     private File shellScript;
     private BrokerService broker;
+    private SVN svn;
 
     protected void setUp() throws Exception {
 
         File root = new File("target/it").getCanonicalFile();
+        deleteAndCreateDirectory(root);
+
         File cvsroot = new File(root, "cvs-root");
         File module = new File(root, "shell");
 
@@ -49,6 +53,15 @@
         cvs = new CVS(cvsroot);
         cvs.init();
         cvs._import(module, "shell");
+
+
+        File svnroot = new File(root, "svn-root");
+
+        SVN.create(svnroot);
+        File svnpath = new File(svnroot, "shell");
+        svn = new SVN("file://"+svnpath.getAbsolutePath());
+        svn._import(module);
+
         broker = new BrokerService();
         broker.addConnector("tcp://localhost:61616");
         broker.start();
@@ -58,7 +71,7 @@
         broker.stop();
     }
 
-    public void testBuild() throws Exception {
+    public void testBuildCvs() throws Exception {
 
         Project project = new Project();
         project.setId(10);
@@ -100,6 +113,48 @@
         ThreadContextContinuumStore.setStore(null);
     }
 
+    public void testBuildSvn() throws Exception {
+
+        Project project = new Project();
+        project.setId(11);
+        project.setScmUrl("scm|svn|" + svn.getSvnUrl());
+        project.setName("Shell Project");
+        project.setVersion("3.0");
+        project.setExecutorId(ShellBuildExecutor.ID);
+        project.setState(ContinuumProjectState.OK);
+
+        BuildDefinition bd = new BuildDefinition();
+        bd.setId(20);
+        bd.setBuildFile(shellScript.getAbsolutePath());
+        bd.setArguments("");
+
+        project.addBuildDefinition(bd);
+
+        MapContinuumStore store = new MapContinuumStore();
+
+        store.updateProject(project);
+        store.storeBuildDefinition(bd);
+
+        ThreadContextContinuumStore.setStore(store);
+
+        Embedder embedder = new Embedder();
+        embedder.start();
+        ContinuumBuildAgent buildAgent = (ContinuumBuildAgent) embedder.lookup(BuildAgent.ROLE);
+
+        buildAgent.init();
+        buildAgent.build(project.getId(), bd.getId(), 1);
+
+        int latestBuildId = project.getLatestBuildId();
+        BuildResult buildResult = store.getBuildResult(latestBuildId);
+
+        assertNotNull("buildResult", buildResult);
+        assertEquals("buildResult.getState", ContinuumProjectState.OK, buildResult.getState());
+        assertEquals("project.getState", ContinuumProjectState.OK, project.getState());
+
+        embedder.stop();
+        ThreadContextContinuumStore.setStore(null);
+    }
+
 
     // need to throw in a Broker
     public void testBuildQueue() throws Exception {
@@ -176,8 +231,8 @@
         }
 
 
-        buildAgent.stop();
-
+//        buildAgent.stop();
+        embedder.stop();
         session.close();
         connection.close();
     }

Added: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SVN.java
URL: http://svn.apache.org/viewcvs/geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SVN.java?rev=370268&view=auto
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SVN.java
(added)
+++ geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SVN.java
Wed Jan 18 13:35:03 2006
@@ -0,0 +1,61 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.gbuild.agent;
+
+import org.codehaus.plexus.util.cli.CommandLineException;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SVN extends SystemExecutable {
+    private final String cmd = "svn";
+    private final String svnUrl;
+
+    public SVN(String svnUrl) {
+        this.svnUrl = svnUrl;
+    }
+
+    public void _import(File dir) throws CommandLineException {
+//        svn import /tmp/myproject file:///path/to/repos/myproject -m "initial import"
+        system(dir.getParentFile(), "svn", "import " + dir.getAbsolutePath() + " " + svnUrl
+" -m yo_yo");
+    }
+
+    public String getSvnUrl() {
+        return svnUrl;
+    }
+
+//    public static SVN checkout(URL url, File dir) throws CommandLineException {
+//        system(dir.getParentFile(), "svn", "co " + url.toExternalForm() + " " + dir.getName());
+//        return new SVN(dir);
+//    }
+//
+    public static void create(File dir) throws CommandLineException {
+        //svnadmin create /home/projects/FOO/scm
+        system(dir.getParentFile(), "svnadmin", "create " + dir.getAbsolutePath());
+    }
+//
+//    public void add(String artifactId) throws CommandLineException {
+//        system(work, cmd, "add " + artifactId);
+//    }
+//
+//    public void commit(String artifactId) throws CommandLineException {
+//        system(work, cmd, "ci -m yo_yo " + artifactId);
+//    }
+}



Mime
View raw message