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 2006/10/15 09:06:32 UTC
svn commit: r464142 [3/4] - in /geronimo/gbuild/trunk: ./ gbuild-agent/
gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/
gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/activemq/
gbuild-agent/src/main/java/org/apache/geronimo/gb...
Copied: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/producer/PropertiesBuildTaskProducer.java (from r463602, geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PropertiesBuildTaskProducer.java)
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/producer/PropertiesBuildTaskProducer.java?view=diff&rev=464142&p1=geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PropertiesBuildTaskProducer.java&r1=463602&p2=geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/producer/PropertiesBuildTaskProducer.java&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/PropertiesBuildTaskProducer.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/producer/PropertiesBuildTaskProducer.java Sun Oct 15 00:06:27 2006
@@ -17,11 +17,13 @@
* under the License.
*/
-package org.apache.geronimo.gbuild.agent;
+package org.apache.geronimo.gbuild.agent.producer;
+import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -31,102 +33,132 @@
import javax.jms.Queue;
import javax.jms.Session;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.StoppingException;
+import org.codehaus.plexus.util.FileUtils;
-import org.apache.maven.continuum.core.action.AbstractContinuumAction;
import org.apache.maven.continuum.execution.shell.ShellBuildExecutor;
import org.apache.maven.continuum.model.project.BuildDefinition;
import org.apache.maven.continuum.model.project.Project;
import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.geronimo.gbuild.agent.continuum.AbstractContinuumBuildAgent;
+import org.apache.geronimo.gbuild.agent.continuum.Context;
+import org.apache.geronimo.gbuild.agent.continuum.MapContinuumStore;
+
/**
+ * Produces build tasks by monitoring a directory for build task property files.
+ *
* @version $Rev$ $Date$
*/
-public class PropertiesBuildTaskProducer extends AbstractContinuumBuildAgent implements DirectoryMonitor.Listener {
+public class PropertiesBuildTaskProducer
+ extends AbstractContinuumBuildAgent
+ implements Initializable
+{
+ private Logger log;
- /**
- * @plexus.configuration
- */
private String buildTaskQueue;
- /**
- * @plexus.configuration
- */
private String includePrefix = "include.";
- /**
- * @plexus.configuration
- */
private String buildPrefix = "build.";
- /**
- * @plexus.configuration
- */
private String headerPrefix = "header.";
- /**
- * @plexus.configuration
- */
- private String watchDirectory;
-
- /**
- * @plexus.configuration
- */
+ private File watchDirectory;
+
private int pollInterval;
private DirectoryMonitor scanner;
+ //
+ // Initializable
+ //
+
+ public void initialize() throws InitializationException {
+ log = getLogger();
+ }
+
public synchronized void start() throws StartingException {
- getLogger().info("Task Producer Agent starting.");
- getLogger().debug("buildTaskQueue "+buildTaskQueue);
+ log.info("Task Producer Agent starting.");
+
+ log.debug("buildTaskQueue " + buildTaskQueue);
+
+ try {
+ FileUtils.forceMkdir(watchDirectory);
+ }
+ catch (IOException e) {
+ throw new StartingException("Failed to create directory: " + watchDirectory, e);
+ }
+
+ DirectoryMonitor.Listener listener = new DirectoryMonitor.Listener() {
+ public boolean fileAdded(final File file) {
+ return process(file);
+ }
- File dir = new File(watchDirectory);
- dir.mkdirs();
- scanner = new DirectoryMonitor(dir, this, pollInterval, getLogger());
+ public boolean fileRemoved(final File file) {
+ return true;
+ }
+
+ public void fileUpdated(final File file) {
+ fileAdded(file);
+ }
+ };
+
+ scanner = new DirectoryMonitor(watchDirectory, listener, pollInterval, getLogger());
+
+ log.info("Watching " + watchDirectory);
- getLogger().info("Watching "+dir.getAbsolutePath());
super.start();
}
- public synchronized void stop() throws StoppingException {
- scanner.stop();
- super.stop();
- }
+ private boolean process(final File file) {
+ assert file != null;
- public void run() {
- scanner.run();
- }
+ log.info("Processing: " + file);
- public boolean fileAdded(File file) {
Properties properties = null;
+
try {
- FileInputStream in = new FileInputStream(file);
+ InputStream in = new BufferedInputStream(new FileInputStream(file));
properties = new Properties();
properties.load(in);
- } catch (IOException e) {
- getLogger().error("Unable to load properties file: "+file.getAbsolutePath(), e);
+ in.close();
}
+ catch (IOException e) {
+ log.error("Unable to load properties file: " + file, e);
+ }
+
try {
+ //
// TODO: Improve this so you can have ${my-property} parts to property values
- getLogger().info("Processing "+file.getAbsolutePath());
+ //
+
execute(properties);
- } catch (Exception e) {
- getLogger().error("Unable to process file: "+file.getAbsolutePath(), e);
+
+ return true;
+ }
+ catch (Exception e) {
+ log.error("Unable to process file: " + file, e);
}
- return true;
- }
- public boolean fileRemoved(File file) {
- return true;
+ return false;
}
- public void fileUpdated(File file) {
- fileAdded(file);
+ public synchronized void stop() throws StoppingException {
+ scanner.stop();
+ super.stop();
}
+ public void run() {
+ scanner.run();
+ }
- public void execute(Map def) throws Exception {
+ public void execute(final Map def) throws Exception {
+ assert def != null;
Session result;
synchronized (this) {
@@ -141,18 +173,14 @@
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
int id = Integer.parseInt(getString(def, "project.id"));
-
String scmUrl = getString(def, "project.scmUrl");
-
String name = getString(def, "project.name");
-
String version = getString(def, "project.version");
+ String executor = getString(def, "project.executor", ShellBuildExecutor.ID);
String buildFile = getString(def, "project.buildFile");
- getLogger().info("Project - " + id + " - " + name + " " + version);
-
- String executor = ShellBuildExecutor.ID;
+ log.info("Project - " + id + " - " + name + " " + version);
MapContinuumStore store = new MapContinuumStore();
@@ -161,15 +189,19 @@
project.setScmUrl(scmUrl);
project.setName(name);
project.setVersion(version);
-
project.setExecutorId(executor);
-
project.setState(ContinuumProjectState.OK);
store.updateProject(project);
+ //
+ // TODO: Need to provide persistence for the buildId
+ //
+
int buildIds = 0;
- for (Iterator iterator = def.entrySet().iterator(); iterator.hasNext();) {
- Map.Entry entry = (Map.Entry) iterator.next();
+ Iterator iter = def.entrySet().iterator();
+
+ while (iter.hasNext()) {
+ Map.Entry entry = (Map.Entry) iter.next();
String key = (String) entry.getKey();
String value = (String) entry.getValue();
@@ -177,7 +209,7 @@
continue;
}
- getLogger().info("Build - " + buildIds + " - " + key + " " + value);
+ log.info("Build - " + buildIds + " - " + key + " " + value);
BuildDefinition bd = new BuildDefinition();
bd.setId(buildIds++);
@@ -190,44 +222,42 @@
HashMap map = new HashMap();
map.put(key, value);
-
- map.put("build.name", key.replaceFirst("build.",""));
-
- map.put(KEY_STORE, store);
+ map.put("build.name", key.replaceFirst("build.", ""));
+ map.put(Context.KEY_STORE, store);
Integer projectId = new Integer(project.getId());
-
- map.put(KEY_PROJECT_ID, projectId);
-
- map.put(AbstractContinuumAction.KEY_PROJECT_ID, projectId);
+ map.put(Context.KEY_PROJECT_ID, projectId);
+ map.put(Context.KEY_PROJECT_ID, projectId);
+ map.put(Context.KEY_BUILD_DEFINITION_ID, projectId);
+ map.put(Context.KEY_BUILD_ID, projectId);
Integer buildId = new Integer(bd.getId());
-
- map.put(KEY_BUILD_DEFINITION_ID, buildId);
-
- map.put(AbstractContinuumAction.KEY_BUILD_DEFINITION_ID, projectId);
-
+ map.put(Context.KEY_BUILD_DEFINITION_ID, buildId);
map.put("build.id", buildId);
- map.put(AbstractContinuumAction.KEY_BUILD_ID, projectId);
-
- map.put(KEY_TRIGGER, new Integer(ContinuumProjectState.TRIGGER_FORCED));
+ map.put(Context.KEY_TRIGGER, new Integer(ContinuumProjectState.TRIGGER_FORCED));
addProperties("project.", def, map);
-
addProperties(headerPrefix, def, map);
-
addProperties(includePrefix, def, map);
+ log.info("Creating build task; configuration: " + map);
+ //
+ // TODO: Show better sorted output of config
+ //
+
producer.send(session.createObjectMessage(map));
}
-
}
- private void addProperties(String prefix, Map def, HashMap map) {
- for (Iterator iterator = def.entrySet().iterator(); iterator.hasNext();) {
-
- Map.Entry entry = (Map.Entry) iterator.next();
+ private void addProperties(final String prefix, final Map def, final HashMap map) {
+ assert prefix != null;
+ assert def != null;
+ assert map != null;
+
+ Iterator iter = def.entrySet().iterator();
+ while (iter.hasNext()) {
+ Map.Entry entry = (Map.Entry) iter.next();
String key = (String) entry.getKey();
String value = (String) entry.getValue();
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/producer/PropertiesBuildTaskProducer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/producer/PropertiesBuildTaskProducer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/producer/PropertiesBuildTaskProducer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/util/GZipUtils.java
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/util/GZipUtils.java?view=diff&rev=464142&r1=464141&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/util/GZipUtils.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/util/GZipUtils.java Sun Oct 15 00:06:27 2006
@@ -19,22 +19,26 @@
package org.apache.geronimo.gbuild.agent.util;
+import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import org.codehaus.plexus.util.IOUtil;
/**
+ * ???
+ *
* @version $Rev$ $Date$
*/
-public class GZipUtils {
-
+public class GZipUtils
+{
/**
* Reads data from a file in to a gzip byte array.
*
@@ -77,15 +81,16 @@
GZIPInputStream in = new GZIPInputStream(bais);
- FileOutputStream out = null;
+ OutputStream out = null;
try {
- out = new FileOutputStream(file);
+ out = new BufferedOutputStream(new FileOutputStream(file));
int count;
byte[] b = new byte[512];
while ((count = in.read(b)) > 0) {
out.write(b, 0, count);
}
+ out.flush();
}
finally {
IOUtil.close(out);
Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/util/StringTemplate.java
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/util/StringTemplate.java?view=diff&rev=464142&r1=464141&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/util/StringTemplate.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/java/org/apache/geronimo/gbuild/agent/util/StringTemplate.java Sun Oct 15 00:06:27 2006
@@ -24,6 +24,10 @@
//
/**
+ * ???
+ *
+ * @deprecated Use {@link org.codehaus.swizzle.stream.StringTemplate} directly.
+ *
* @version $Rev$ $Date$
*/
public class StringTemplate extends org.codehaus.swizzle.stream.StringTemplate {
Modified: geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=464142&r1=464141&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/main/resources/META-INF/plexus/components.xml Sun Oct 15 00:06:27 2006
@@ -23,9 +23,24 @@
<component-set>
<components>
+ <!--
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.activemq.ActiveMQBrokerService</role>
+ <implementation>org.apache.geronimo.gbuild.agent.activemq.ActiveMQBrokerServiceImpl</implementation>
+ <configuration>
+ <broker-uri>http://foo.bar.baz</broker-uri>
+ </configuration>
+ </component>
+ -->
+
<component>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
<implementation>org.apache.geronimo.gbuild.agent.client.ClientManager</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gbuild.agent.activemq.ActiveMQBrokerService</role>
+ </requirement>
+ </requirements>
<configuration>
<broker-url>tcp://localhost:61616</broker-url>
<ping-interval>300000</ping-interval>
@@ -37,7 +52,7 @@
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>build-executor</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.ContinuumBuildAgent</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.ContinuumBuildAgent</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
@@ -65,7 +80,7 @@
<component>
<role>org.codehaus.plexus.action.Action</role>
<role-hint>execute-builder</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.ExecuteDistributedBuilderContinuumAction</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.ExecuteDistributedBuilderContinuumAction</implementation>
<requirements>
<requirement>
<role>org.apache.maven.continuum.configuration.ConfigurationService</role>
@@ -83,15 +98,16 @@
</component>
<component>
- <role>org.apache.maven.continuum.store.ContinuumStore</role>
- <role-hint>agent-store</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.ThreadContextContinuumStore</implementation>
+ <role>org.codehaus.plexus.component.factory.ComponentFactory</role>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.ThreadContextContinuumStoreFactory</implementation>
+ <role-hint>org.apache.geronimo.gbuild.agent.continuum.ThreadContextContinuumStoreFactory</role-hint>
</component>
<component>
- <role>org.apache.maven.continuum.notification.ContinuumNotificationDispatcher</role>
- <!--<role-hint>agent-notifier</role-hint>-->
- <implementation>org.apache.geronimo.gbuild.agent.MockContinuumNotificationDispatcher</implementation>
+ <role>org.apache.maven.continuum.store.ContinuumStore</role>
+ <role-hint>agent-store</role-hint>
+ <component-factory>org.apache.geronimo.gbuild.agent.continuum.ThreadContextContinuumStoreFactory</component-factory>
+ <instantiation-strategy>singleton</instantiation-strategy>
</component>
<component>
@@ -105,13 +121,10 @@
</requirements>
</component>
- <!--
- | Build Producer
- -->
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>build-producer</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.PropertiesBuildTaskProducer</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.producer.PropertiesBuildTaskProducer</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
@@ -126,13 +139,10 @@
</configuration>
</component>
- <!--
- | Build Producer
- -->
<component>
- <role>org.apache.geronimo.gbuild.agent.BuildQueueReloader</role>
+ <role>org.apache.geronimo.gbuild.agent.producer.BuildQueueReloader</role>
<role-hint>build-producer</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.BuildQueueReloader</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.producer.BuildQueueReloader</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
@@ -140,18 +150,15 @@
</requirements>
<configuration>
<build-task-queue>BUILD.TASKS</build-task-queue>
- <tasks-directory>tasks</tasks-directory>
+ <tasks-directory>${plexus.home}/tasks</tasks-directory>
<poll-interval>30</poll-interval>
</configuration>
</component>
- <!--
- | Build Results
- -->
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>build-results</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.BuildResultsContinuumAgent</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.BuildResultsContinuumAgent</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.extension.BuildResultsExtensionManager</role>
@@ -173,13 +180,10 @@
</requirements>
</component>
- <!--
- | Ping monitor
- -->
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>ping-monitor</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.PingMonitorAgent</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.client.PingMonitorAgent</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
@@ -187,13 +191,10 @@
</requirements>
</component>
- <!--
- | Build Activity
- -->
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>build-activity</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.BuildActivityMonitor</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.activity.BuildActivityMonitor</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
@@ -206,9 +207,9 @@
</component>
<component>
- <role>org.apache.geronimo.gbuild.agent.BuildActivityNotifier</role>
+ <role>org.apache.geronimo.gbuild.agent.activity.BuildActivityNotifier</role>
<role-hint>ping-monitor</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.BuildActivityNotifier</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.activity.BuildActivityNotifier</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
Copied: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/CVS.java (from r463602, geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/CVS.java)
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/CVS.java?view=diff&rev=464142&p1=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/CVS.java&r1=463602&p2=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/CVS.java&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/CVS.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/CVS.java Sun Oct 15 00:06:27 2006
@@ -1,33 +1,39 @@
-/**
- *
- * Copyright 2004 The Apache Software Foundation
+/*
+ * 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
*
- * 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
*
- * 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.
+ * 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 org.codehaus.plexus.util.FileUtils;
+package org.apache.geronimo.gbuild.agent.continuum;
import java.io.File;
import java.io.IOException;
import junit.framework.Assert;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+
/**
+ * ???
+ *
* @version $Rev$ $Date$
*/
-public class CVS extends SystemExecutable {
+public class CVS extends SystemExecutable
+{
private final String cmd = "cvs";
private final File cvsroot;
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/CVS.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/CVS.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/CVS.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/Chmod.java (from r463602, geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/Chmod.java)
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/Chmod.java?view=diff&rev=464142&p1=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/Chmod.java&r1=463602&p2=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/Chmod.java&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/Chmod.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/Chmod.java Sun Oct 15 00:06:27 2006
@@ -1,31 +1,36 @@
-/**
- *
- * Copyright 2004 The Apache Software Foundation
+/*
+ * 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
*
- * 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
*
- * 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.
+ * 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;
+package org.apache.geronimo.gbuild.agent.continuum;
import java.io.File;
+import org.codehaus.plexus.util.cli.CommandLineException;
+
/**
+ * ???
+ *
* @version $Rev$ $Date$
*/
-public class Chmod extends SystemExecutable {
+public class Chmod extends SystemExecutable
+{
public static void exec(File root, String opts, File script) throws CommandLineException {
system( root, "chmod", opts +" " + script.getAbsolutePath() );
-
}
}
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/Chmod.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/Chmod.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/Chmod.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/ContinuumBuildAgentTest.java (from r463602, geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgentTest.java)
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/ContinuumBuildAgentTest.java?view=diff&rev=464142&p1=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/ContinuumBuildAgentTest.java&r1=463602&p2=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/ContinuumBuildAgentTest.java&r2=464142
==============================================================================
--- 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/continuum/ContinuumBuildAgentTest.java Sun Oct 15 00:06:27 2006
@@ -1,41 +1,68 @@
-package org.apache.geronimo.gbuild.agent;
-/**
- * @version $Rev$ $Date$
+/*
+ * 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.gbuild.agent.continuum;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.Topic;
+
import junit.framework.TestCase;
+
+import org.codehaus.plexus.embed.Embedder;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.cli.CommandLineException;
+
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
+import org.apache.maven.continuum.core.action.AbstractContinuumAction;
import org.apache.maven.continuum.execution.shell.ShellBuildExecutor;
import org.apache.maven.continuum.model.project.BuildDefinition;
import org.apache.maven.continuum.model.project.BuildResult;
import org.apache.maven.continuum.model.project.Project;
import org.apache.maven.continuum.project.ContinuumProjectState;
import org.apache.maven.continuum.store.ContinuumStore;
-import org.apache.maven.continuum.core.action.AbstractContinuumAction;
-import org.codehaus.plexus.embed.Embedder;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.cli.CommandLineException;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.Topic;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.net.URL;
+import org.apache.geronimo.gbuild.agent.BuildAgent;
+/**
+ * Unit tests for the {@link ContinuumBuildAgent} class.
+ *
+ * @version $Rev$ $Date$
+ */
public class ContinuumBuildAgentTest extends TestCase {
private CVS cvs;
+
private File shellScript;
+
private BrokerService broker;
+
private SVN svn;
protected void setUp() throws Exception {
@@ -94,7 +121,7 @@
store.updateProject(project);
store.storeBuildDefinition(bd);
- ThreadContextContinuumStore.setStore(store);
+ ThreadContextContinuumStoreFactory.setStore(store);
Embedder embedder = new Embedder();
embedder.start();
@@ -111,7 +138,7 @@
assertEquals("project.getState", ContinuumProjectState.OK, project.getState());
embedder.stop();
- ThreadContextContinuumStore.setStore(null);
+ ThreadContextContinuumStoreFactory.setStore(null);
}
public void testBuildSvn() throws Exception {
@@ -136,7 +163,7 @@
store.updateProject(project);
store.storeBuildDefinition(bd);
- ThreadContextContinuumStore.setStore(store);
+ ThreadContextContinuumStoreFactory.setStore(store);
Embedder embedder = new Embedder();
embedder.start();
@@ -153,7 +180,7 @@
assertEquals("project.getState", ContinuumProjectState.OK, project.getState());
embedder.stop();
- ThreadContextContinuumStore.setStore(null);
+ ThreadContextContinuumStoreFactory.setStore(null);
}
@@ -192,11 +219,12 @@
HashMap map = new HashMap();
- map.put(AbstractContinuumAgentAction.KEY_STORE, store);
- map.put(AbstractContinuumAgentAction.KEY_PROJECT_ID, new Integer(project.getId()));
+ map.put(Context.KEY_STORE, store);
+
+ map.put(AbstractContinuumAction.KEY_PROJECT_ID, new Integer(project.getId()));
map.put(AbstractContinuumAction.KEY_PROJECT_ID, new Integer(project.getId()));
- map.put(AbstractContinuumAgentAction.KEY_BUILD_DEFINITION_ID, new Integer(bd.getId()));
- map.put(AbstractContinuumAgentAction.KEY_TRIGGER, new Integer(0));
+ map.put(AbstractContinuumAction.KEY_BUILD_DEFINITION_ID, new Integer(bd.getId()));
+ map.put(AbstractContinuumAction.KEY_TRIGGER, new Integer(0));
producer.send(session.createObjectMessage(map));
}
@@ -216,10 +244,9 @@
for (int i = 0; i < goals.length; i++) {
ObjectMessage objectMessage = (ObjectMessage) resultsConsumer.receive();
Map results = (Map) objectMessage.getObject();
- ContinuumStore store2 = ContinuumBuildAgent.getContinuumStore(results);
-
- int buildDefinitionId = ContinuumBuildAgent.getBuildDefinitionId(results);
- int projectId = ContinuumBuildAgent.getProjectId(results);
+ ContinuumStore store2 = Context.getContinuumStore(results);
+ int buildDefinitionId = Context.getBuildDefinitionId(results);
+ int projectId = Context.getProjectId(results);
Project project2 = store2.getProject(projectId);
int latestBuildId = project2.getLatestBuildId();
BuildResult buildResult = store2.getBuildResult(latestBuildId);
@@ -230,14 +257,12 @@
assertEquals("buildResult.getState", ContinuumProjectState.OK, buildResult.getState());
assertEquals("project.getState", ContinuumProjectState.OK, project.getState());
}
-
-
-// buildAgent.stop();
+
+ // buildAgent.stop();
embedder.stop();
session.close();
connection.close();
}
-
public static void deleteAndCreateDirectory(File directory)
throws IOException {
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/ContinuumBuildAgentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/ContinuumBuildAgentTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/ContinuumBuildAgentTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SVN.java (from r463602, geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SVN.java)
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SVN.java?view=diff&rev=464142&p1=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SVN.java&r1=463602&p2=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SVN.java&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SVN.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SVN.java Sun Oct 15 00:06:27 2006
@@ -1,30 +1,35 @@
-/**
- *
- * 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
+/*
+ * 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
+ * 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.
+ * 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;
+package org.apache.geronimo.gbuild.agent.continuum;
import java.io.File;
-import java.net.URL;
+
+import org.codehaus.plexus.util.cli.CommandLineException;
/**
+ * ???
+ *
* @version $Rev$ $Date$
*/
-public class SVN extends SystemExecutable {
+public class SVN extends SystemExecutable
+{
private final String cmd = "svn";
private final String svnUrl;
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SVN.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SVN.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SVN.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SystemExecutable.java (from r463602, geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SystemExecutable.java)
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SystemExecutable.java?view=diff&rev=464142&p1=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SystemExecutable.java&r1=463602&p2=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SystemExecutable.java&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/SystemExecutable.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SystemExecutable.java Sun Oct 15 00:06:27 2006
@@ -1,30 +1,35 @@
-/**
- *
- * 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
+/*
+ * 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
+ * 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.
+ * 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 org.codehaus.plexus.util.cli.Commandline;
-import org.codehaus.plexus.util.cli.CommandLineUtils;
+package org.apache.geronimo.gbuild.agent.continuum;
import java.io.File;
import junit.framework.Assert;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
/**
+ * ???
+ *
* @version $Rev$ $Date$
*/
public class SystemExecutable {
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SystemExecutable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SystemExecutable.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/SystemExecutable.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/TestLogger.java (from r463602, geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/TestLogger.java)
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/TestLogger.java?view=diff&rev=464142&p1=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/TestLogger.java&r1=463602&p2=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/TestLogger.java&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/TestLogger.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/TestLogger.java Sun Oct 15 00:06:27 2006
@@ -1,27 +1,32 @@
-/**
- *
- * 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
+/*
+ * 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
+ * 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.
+ * 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;
+
+package org.apache.geronimo.gbuild.agent.continuum;
import org.codehaus.plexus.logging.Logger;
/**
+ * ???
+ *
* @version $Rev$ $Date$
*/
-public class TestLogger implements org.codehaus.plexus.logging.Logger {
+public class TestLogger implements Logger {
private final String name;
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/TestLogger.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/TestLogger.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/continuum/TestLogger.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/producer/DirectoryMonitorTest.java (from r463602, geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/DirectoryMonitorTest.java)
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/producer/DirectoryMonitorTest.java?view=diff&rev=464142&p1=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/DirectoryMonitorTest.java&r1=463602&p2=geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/producer/DirectoryMonitorTest.java&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/DirectoryMonitorTest.java (original)
+++ geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/producer/DirectoryMonitorTest.java Sun Oct 15 00:06:27 2006
@@ -1,14 +1,37 @@
-package org.apache.geronimo.gbuild.agent;
-/**
- * @version $Rev$ $Date$
+/*
+ * 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.
*/
-import junit.framework.TestCase;
+package org.apache.geronimo.gbuild.agent.producer;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import junit.framework.TestCase;
+
+import org.apache.geronimo.gbuild.agent.continuum.TestLogger;
+
+/**
+ * Unit tests for the {@link DirectoryMonitor} class.
+ *
+ * @version $Rev$ $Date$
+ */
public class DirectoryMonitorTest extends TestCase {
public void testScanDirectory() throws Exception {
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/producer/DirectoryMonitorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/producer/DirectoryMonitorTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gbuild/trunk/gbuild-agent/src/test/java/org/apache/geronimo/gbuild/agent/producer/DirectoryMonitorTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/pom.xml?view=diff&rev=464142&r1=464141&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/pom.xml (original)
+++ geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/pom.xml Sun Oct 15 00:06:27 2006
@@ -67,6 +67,12 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-log4j-logging</artifactId>
<version>1.1-alpha-1</version>
</dependency>
@@ -92,8 +98,37 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
- <version>2.0-1</version>
+ <version>2.0.4</version>
+ </dependency>
+
+ <!-- ActiveMQ Support -->
+
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-spring</artifactId>
+ <version>2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.1.1.0</version>
+ </dependency>
+
+ <!-- Required to Load XBean xml -->
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ <version>2.2.1</version>
</dependency>
+
</dependencies>
<build>
Added: geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/activemq.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/activemq.xml?view=auto&rev=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/activemq.xml (added)
+++ geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/activemq.xml Sun Oct 15 00:06:27 2006
@@ -0,0 +1,83 @@
+<?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://activemq.org/config/1.0">
+
+ <!-- Allows us to use system properties as variables in this configuration file -->
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+ <broker useJmx="false" useShutdownHook="false">
+
+ <!-- Use the following to set the broker memory limit (in bytes)
+ <memoryManager>
+ <usageManager id="memory-manager" limit="1048576"/>
+ </memoryManager>
+ -->
+
+ <!-- Use the following to configure how ActiveMQ is exposed in JMX
+ <managementContext>
+ <managementContext connectorPort="1099" jmxDomainName="org.apache.activemq"/>
+ </managementContext>
+ -->
+
+ <!-- In ActiveMQ 4, you can setup destination policies -->
+ <!--
+ <destinationPolicy>
+ <policyMap>
+ <policyEntries>
+
+ <policyEntry topic="FOO.>">
+ <dispatchPolicy>
+ <strictOrderDispatchPolicy/>
+ </dispatchPolicy>
+ <subscriptionRecoveryPolicy>
+ <lastImageSubscriptionRecoveryPolicy/>
+ </subscriptionRecoveryPolicy>
+ </policyEntry>
+
+ </policyEntries>
+ </policyMap>
+ </destinationPolicy>
+ -->
+
+ <persistenceAdapter>
+ <journaledJDBC journalLogFiles="5" dataDirectory="${activemq.datadir}"/>
+ </persistenceAdapter>
+
+ <!--
+ <transportConnectors>
+ <transportConnector name="default" uri="tcp://localhost:61616"/>
+ </transportConnectors>
+ -->
+
+ <networkConnectors>
+ <!--
+ <networkConnector name="default" uri="multicast://default"/>
+ -->
+ <!--
+ <networkConnector name="host1 and host2" uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
+ -->
+ </networkConnectors>
+
+ </broker>
+
+</beans>
Propchange: geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/activemq.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/activemq.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/activemq.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/application.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/application.xml?view=diff&rev=464142&r1=464141&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/application.xml (original)
+++ geronimo/gbuild/trunk/gbuild-assemblies/gbuild-agent-assembly/src/main/resources/application.xml Sun Oct 15 00:06:27 2006
@@ -22,51 +22,141 @@
<application>
+ <resources>
+ <jar-repository>${plexus.home}/lib</jar-repository>
+ </resources>
+
<load-on-start>
+
+ <!-- Slave Node -->
+
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>build-executor</role-hint>
</component>
+
+ <!-- Manager Node -->
+
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
+ <role-hint>build-producer</role-hint>
+ </component>
+
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
+ <role-hint>build-results</role-hint>
+ </component>
+
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
+ <role-hint>ping-monitor</role-hint>
+ </component>
+
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
+ <role-hint>build-activity</role-hint>
+ </component>
+
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.producer.BuildQueueReloader</role>
+ <role-hint>build-producer</role-hint>
+ </component>
+
</load-on-start>
- <resources>
- <jar-repository>${plexus.home}/lib</jar-repository>
- </resources>
+ <components>
+
+ <!-- ================= -->
+ <!-- Shared Components -->
+ <!-- ================= -->
- <services>
- <service>
- <id>jetty</id>
- <configuration>
- <webapps>
- <webapp>
- <file>${plexus.home}/lib/gbuild-agent-web-1.0-SNAPSHOT.jar</file>
- <context>/gbuild</context>
- <extraction-path>${plexus.home}/webapp</extraction-path>
- <listeners>
- <http-listener>
- <port>17171</port>
- </http-listener>
-
- <!--
- <proxy-http-listener>
- <port>8090</port>
- <proxy-host>localhost</proxy-host>
- <proxy-port>80</proxy-port>
- </proxy-http-listener>
- -->
- </listeners>
- </webapp>
- </webapps>
+ <component>
+ <role>org.codehaus.plexus.logging.LoggerManager</role>
+ <implementation>org.codehaus.plexus.logging.log4j.Log4JLoggerManager</implementation>
+ <lifecycle-handler>basic</lifecycle-handler>
+
+ <configuration>
+ <threshold>DEBUG</threshold>
+ <default-appender>console,rolling</default-appender>
+ <appenders>
+ <appender>
+ <id>console</id>
+ <threshold>DEBUG</threshold>
+ <type>org.apache.log4j.ConsoleAppender</type>
+ <conversion-pattern>%d{ABSOLUTE} %-5p [%c{1}] %m%n</conversion-pattern>
+ </appender>
+
+ <appender>
+ <id>rolling</id>
+ <threshold>DEBUG</threshold>
+ <type>org.apache.log4j.RollingFileAppender</type>
+ <conversion-pattern>%-4r [%t] %-5p %c %x - %m%n</conversion-pattern>
+
+ <properties>
+ <property>
+ <name>file</name>
+ <value>${plexus.home}/logs/gbuild-agent.log</value>
+ </property>
+ <property>
+ <name>append</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>maxBackupIndex</name>
+ <value>10</value>
+ </property>
+ <property>
+ <name>maxFileSize</name>
+ <value>100KB</value>
+ </property>
+ </properties>
+ </appender>
+ </appenders>
+ <levels>
+ <level>
+ <hierarchy>org.apache.geronimo.gbuild.agent</hierarchy>
+ <level>DEBUG</level>
+ </level>
+ <level>
+ <hierarchy>org.apache.activemq</hierarchy>
+ <level>INFO</level>
+ </level>
+ </levels>
</configuration>
- </service>
- </services>
+ </component>
+
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.activemq.ActiveMQBrokerService</role>
+ <implementation>org.apache.geronimo.gbuild.agent.activemq.ActiveMQBrokerServiceImpl</implementation>
+ <configuration>
+ <!--
+ <broker-uri>xbean:file:${plexus.home}/conf/activemq.xml</broker-uri>
+ -->
+ <data-directory>${plexus.home}/activemq</data-directory>
+ <!--
+ <transport-connectors>
+ <transport-connector>tcp://localhost:61616</transport-connector>
+ </transport-connectors>
+ <network-connectors>
+ <network-connector></network-connector>
+ </network-connectors>
+ -->
+ </configuration>
+ </component>
- <components>
<component>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
<implementation>org.apache.geronimo.gbuild.agent.client.ClientManager</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gbuild.agent.activemq.ActiveMQBrokerService</role>
+ </requirement>
+ </requirements>
<configuration>
+ <!--
<broker-url>failover:(tcp://ci.gbuild.org:16161)?maxReconnectDelay=1800000</broker-url>
+ -->
+ <broker-url>vm://localhost</broker-url>
<ping-interval>300000</ping-interval>
<reconnect-attempts>48</reconnect-attempts>
<reconnect-delay>2</reconnect-delay>
@@ -74,10 +164,14 @@
</configuration>
</component>
+ <!-- ================ -->
+ <!-- Slave Components -->
+ <!-- ================ -->
+
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>build-executor</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.ContinuumBuildAgent</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.ContinuumBuildAgent</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
@@ -102,15 +196,13 @@
</configuration>
</component>
- <component>
- <role>org.apache.maven.continuum.store.ContinuumStore</role>
- <role-hint>agent-store</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.ThreadContextContinuumStore</implementation>
- </component>
-
+ <!--
+ NOTE: Override the default ContinuumNotificationDispatcher with a mock version for now.
+ This must be in the application configuration to override.
+ -->
<component>
<role>org.apache.maven.continuum.notification.ContinuumNotificationDispatcher</role>
- <implementation>org.apache.geronimo.gbuild.agent.MockContinuumNotificationDispatcher</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.LoggingContinuumNotificationDispatcher</implementation>
</component>
<component>
@@ -136,6 +228,61 @@
</configuration>
</component>
+ <!-- ================= -->
+ <!-- Master Components -->
+ <!-- ================= -->
+
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
+ <role-hint>build-producer</role-hint>
+ <implementation>org.apache.geronimo.gbuild.agent.producer.PropertiesBuildTaskProducer</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
+ </requirement>
+ </requirements>
+ <configuration>
+ <build-task-queue>BUILD.TASKS</build-task-queue>
+ <include-prefix>include.</include-prefix>
+ <header-prefix>header.</header-prefix>
+ <watch-directory>${plexus.home}/tasks</watch-directory>
+ <poll-interval>10000</poll-interval>
+ </configuration>
+ </component>
+
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.producer.BuildQueueReloader</role>
+ <role-hint>build-producer</role-hint>
+ <implementation>org.apache.geronimo.gbuild.agent.producer.BuildQueueReloader</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
+ </requirement>
+ </requirements>
+ <configuration>
+ <build-task-queue>BUILD.TASKS</build-task-queue>
+ <tasks-directory>${plexus.home}/tasks</tasks-directory>
+ <poll-interval>30</poll-interval>
+ </configuration>
+ </component>
+
+ <component>
+ <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
+ <role-hint>build-results</role-hint>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.BuildResultsContinuumAgent</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
+ </requirement>
+ <requirement>
+ <role>org.apache.geronimo.gbuild.agent.extension.BuildResultsExtensionManager</role>
+ </requirement>
+ </requirements>
+ <configuration>
+ <build-results-topic>BUILD.RESULTS</build-results-topic>
+ </configuration>
+ </component>
+
<component>
<role>org.apache.geronimo.gbuild.agent.extension.BuildResultsExtension</role>
<role-hint>write-include-file</role-hint>
@@ -149,75 +296,15 @@
</component>
<component>
- <role>org.codehaus.plexus.logging.LoggerManager</role>
- <implementation>org.codehaus.plexus.logging.log4j.Log4JLoggerManager</implementation>
- <lifecycle-handler>basic</lifecycle-handler>
-
- <configuration>
- <threshold>DEBUG</threshold>
- <default-appender>console,rolling</default-appender>
- <appenders>
- <appender>
- <id>console</id>
- <threshold>DEBUG</threshold>
- <type>org.apache.log4j.ConsoleAppender</type>
- <conversion-pattern>%d [%t] %-5p %-30c{1} - %m%n</conversion-pattern>
- </appender>
-
- <appender>
- <id>rolling</id>
- <threshold>DEBUG</threshold>
- <type>org.apache.log4j.RollingFileAppender</type>
- <conversion-pattern>%-4r [%t] %-5p %c %x - %m%n</conversion-pattern>
-
- <properties>
- <property>
- <name>file</name>
- <value>${plexus.home}/logs/gbuild-agent.log</value>
- </property>
- <property>
- <name>append</name>
- <value>true</value>
- </property>
- <property>
- <name>maxBackupIndex</name>
- <value>10</value>
- </property>
- <property>
- <name>maxFileSize</name>
- <value>100KB</value>
- </property>
- </properties>
- </appender>
- </appenders>
- <levels>
- <level>
- <hierarchy>org.apache.geronimo.gbuild.agent.BuildAgent:build-activity</hierarchy>
- <level>INFO</level>
- </level>
- <level>
- <hierarchy>org.apache.geronimo.gbuild.agent.extension.BuildAgentExtension:file-include</hierarchy>
- <level>INFO</level>
- </level>
- <level>
- <hierarchy>org.apache.geronimo.gbuild.agent.extension.BuildAgentExtension:general-headers</hierarchy>
- <level>INFO</level>
- </level>
- <level>
- <hierarchy>org.apache.geronimo.gbuild.agent.extension.BuildResultsExtension:write-include-file</hierarchy>
- <level>INFO</level>
- </level>
- <level>
- <hierarchy>org.apache.geronimo.gbuild.agent.extension.BuildAgentExtension:file-include</hierarchy>
- <level>INFO</level>
- </level>
- <level>
- <hierarchy>org.activemq</hierarchy>
- <level>WARN</level>
- </level>
- </levels>
- </configuration>
+ <role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
+ <role-hint>ping-monitor</role-hint>
+ <implementation>org.apache.geronimo.gbuild.agent.client.PingMonitorAgent</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
+ </requirement>
+ </requirements>
</component>
- </components>
+ </components>
</application>
Modified: geronimo/gbuild/trunk/gbuild-assemblies/gbuild-manager-assembly/src/main/resources/application.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-assemblies/gbuild-manager-assembly/src/main/resources/application.xml?view=diff&rev=464142&r1=464141&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-assemblies/gbuild-manager-assembly/src/main/resources/application.xml (original)
+++ geronimo/gbuild/trunk/gbuild-assemblies/gbuild-manager-assembly/src/main/resources/application.xml Sun Oct 15 00:06:27 2006
@@ -40,7 +40,7 @@
<role-hint>build-activity</role-hint>
</component>
<component>
- <role>org.apache.geronimo.gbuild.agent.BuildQueueReloader</role>
+ <role>org.apache.geronimo.gbuild.agent.producer.BuildQueueReloader</role>
<role-hint>build-producer</role-hint>
</component>
</load-on-start>
@@ -48,7 +48,8 @@
<resources>
<jar-repository>${plexus.home}/lib</jar-repository>
</resources>
-
+
+ <!--
<services>
<service>
<id>jetty</id>
@@ -62,21 +63,14 @@
<http-listener>
<port>17171</port>
</http-listener>
-
- <!--
- <proxy-http-listener>
- <port>8090</port>
- <proxy-host>localhost</proxy-host>
- <proxy-port>80</proxy-port>
- </proxy-http-listener>
- -->
</listeners>
</webapp>
</webapps>
</configuration>
</service>
</services>
-
+ -->
+
<components>
<component>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
@@ -93,12 +87,12 @@
<component>
<role>org.apache.maven.continuum.store.ContinuumStore</role>
<role-hint>agent-store</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.ThreadContextContinuumStore</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.ThreadContextContinuumStore</implementation>
</component>
<component>
<role>org.apache.maven.continuum.notification.ContinuumNotificationDispatcher</role>
- <implementation>org.apache.geronimo.gbuild.agent.MockContinuumNotificationDispatcher</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.MockContinuumNotificationDispatcher</implementation>
</component>
<component>
@@ -118,7 +112,7 @@
<component>
<role>org.apache.geronimo.gbuild.agent.extension.BuildAgentExtension</role>
<role-hint>general-headers</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.extension.standard.HeaderIncludeExtension</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.extension.standard.BuildAgentExtentionSupport</implementation>
<configuration>
<pattern>^(project|build|header).*</pattern>
</configuration>
@@ -127,7 +121,7 @@
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>build-producer</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.PropertiesBuildTaskProducer</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.producer.PropertiesBuildTaskProducer</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
@@ -145,7 +139,7 @@
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>build-results</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.BuildResultsContinuumAgent</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.continuum.BuildResultsContinuumAgent</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
@@ -174,7 +168,7 @@
<component>
<role>org.apache.geronimo.gbuild.agent.BuildAgent</role>
<role-hint>ping-monitor</role-hint>
- <implementation>org.apache.geronimo.gbuild.agent.PingMonitorAgent</implementation>
+ <implementation>org.apache.geronimo.gbuild.agent.client.PingMonitorAgent</implementation>
<requirements>
<requirement>
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
Modified: geronimo/gbuild/trunk/gbuild-extensions/requeue-failed/src/main/java/org/apache/geronimo/gbuild/extension/requeue/RequeueFailedBuilds.java
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-extensions/requeue-failed/src/main/java/org/apache/geronimo/gbuild/extension/requeue/RequeueFailedBuilds.java?view=diff&rev=464142&r1=464141&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-extensions/requeue-failed/src/main/java/org/apache/geronimo/gbuild/extension/requeue/RequeueFailedBuilds.java (original)
+++ geronimo/gbuild/trunk/gbuild-extensions/requeue-failed/src/main/java/org/apache/geronimo/gbuild/extension/requeue/RequeueFailedBuilds.java Sun Oct 15 00:06:27 2006
@@ -31,16 +31,14 @@
import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.apache.maven.continuum.core.action.AbstractContinuumAction;
import org.apache.maven.continuum.model.project.BuildResult;
import org.apache.maven.continuum.model.project.Project;
import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
-import org.apache.geronimo.gbuild.agent.AbstractContinuumAgentAction;
-import org.apache.geronimo.gbuild.agent.BuildActivityNotifier;
+import org.apache.geronimo.gbuild.agent.activity.BuildActivityNotifier;
import org.apache.geronimo.gbuild.agent.client.ClientManager;
-import org.apache.geronimo.gbuild.agent.ContinuumBuildAgent;
+import org.apache.geronimo.gbuild.agent.continuum.Context;
import org.apache.geronimo.gbuild.agent.extension.BuildAgentExtension;
import org.apache.geronimo.gbuild.agent.extension.BuildResultsExtension;
import org.apache.geronimo.gbuild.agent.util.StringTemplate;
@@ -53,35 +51,44 @@
*
* @version $Rev$ $Date$
*/
-public class RequeueFailedBuilds extends AbstractLogEnabled {
-
+public class RequeueFailedBuilds
+ extends AbstractLogEnabled
+{
public static final String PREFIX = RequeueFailedBuilds.class.getName() + "@";
+
public static final String BUILD_TASK = PREFIX + "build-task";
- public static final String HOSTS_LIST = PREFIX + "hosts-list";
- public int getExitCode(Map context) {
- try {
- ContinuumStore store = AbstractContinuumAgentAction.getContinuumStore(context);
+ public static final String HOSTS_LIST = PREFIX + "hosts-list";
- int projectId = AbstractContinuumAction.getProjectId(context);
+ public int getExitCode(final Map context) {
+ assert context != null;
+ try {
+ ContinuumStore store = Context.getContinuumStore(context);
+ int projectId = Context.getProjectId(context);
Project project = store.getProject(projectId);
BuildResult buildResult = store.getBuildResult(project.getLatestBuildId());
return buildResult.getExitCode();
- } catch (ContinuumStoreException e) {
+ }
+ catch (ContinuumStoreException e) {
getLogger().error("Unable to use continuum store.", e);
return -1;
}
}
+ //
+ // BuildAgentExtension
+ //
+
public static class AgentExtension extends RequeueFailedBuilds implements BuildAgentExtension
{
public static void main(String[] args) {
String name = AgentExtension.class.getName();
System.out.println("name = " + name);
}
+
public void preProcess(Map build) {
}
@@ -92,6 +99,10 @@
}
}
+ //
+ // BuildResultsExtension
+ //
+
public static class ResultsExtension extends RequeueFailedBuilds implements BuildResultsExtension {
/**
* @plexus.requirement
@@ -131,9 +142,7 @@
HashMap buildTask = (HashMap) results.get(BUILD_TASK);
if (buildTask == null) {
-
notifier.sendNotification(results, requeueNotPossible.apply(results));
-
return;
}
@@ -148,46 +157,38 @@
hostsList.add(failedOnHost);
if (hostsList.size() >= maxRequeue) {
-
notifier.sendNotification(results, maxRetriesExceeded.apply(results));
-
return;
}
try{
Session session = clientManager.getClient().getSession();
-
Queue buildQueue = session.createQueue(buildTaskQueue);
MessageProducer producer = session.createProducer(buildQueue);
-
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
ObjectMessage message = session.createObjectMessage(buildTask);
for (int i = 0; i < hostsList.size(); i++) {
-
String hostName = (String) hostsList.get(i);
-
message.setStringProperty(hostName, "exclude");
}
producer.send(message);
notifier.sendNotification(buildTask, requeuedMessage.apply(results));
-
- } catch (JMSException e) {
-
+ }
+ catch (JMSException e) {
getLogger().error(failedLogMessage.apply(results));
-
- } catch (Exception e) {
-
+ }
+ catch (Exception e) {
notifier.sendNotification(results, failedNotification.apply(results));
}
}
private String getHostName(Map results) {
- return (String) results.get(ContinuumBuildAgent.KEY_HOST_NAME);
+ return (String) results.get(Context.KEY_HOST_NAME);
}
}
}
Modified: geronimo/gbuild/trunk/gbuild-extensions/requeue-failed/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-extensions/requeue-failed/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=464142&r1=464141&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-extensions/requeue-failed/src/main/resources/META-INF/plexus/components.xml (original)
+++ geronimo/gbuild/trunk/gbuild-extensions/requeue-failed/src/main/resources/META-INF/plexus/components.xml Sun Oct 15 00:06:27 2006
@@ -38,7 +38,7 @@
<role>org.apache.geronimo.gbuild.agent.client.ClientManager</role>
</requirement>
<requirement>
- <role>org.apache.geronimo.gbuild.agent.BuildActivityNotifier</role>
+ <role>org.apache.geronimo.gbuild.agent.activity.BuildActivityNotifier</role>
</requirement>
</requirements>
<configuration>
Modified: geronimo/gbuild/trunk/gbuild-extensions/standard/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gbuild/trunk/gbuild-extensions/standard/pom.xml?view=diff&rev=464142&r1=464141&r2=464142
==============================================================================
--- geronimo/gbuild/trunk/gbuild-extensions/standard/pom.xml (original)
+++ geronimo/gbuild/trunk/gbuild-extensions/standard/pom.xml Sun Oct 15 00:06:27 2006
@@ -31,4 +31,11 @@
<artifactId>standard</artifactId>
<name>GBuild Extensions :: Standard</name>
+ <dependencies>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+ </dependencies>
+
</project>