You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by tr...@apache.org on 2005/06/12 12:47:46 UTC
svn commit: r190240 [2/2] -
/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum
/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/store
/maven/continuum/trunk/continuum-core
/maven/continuum/trunk/continuum-core-it
/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum
/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core
/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action
/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/store
/maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus
/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum
/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildqueue
/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/core
/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/execution/maven/m1
/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/notification/mail
/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store
/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildqueue
/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/core
/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification
/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification/mail
/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/store
/maven/continuum/trunk/continuum-model
/maven/continuum/trunk/continuum-model/src/main/resources
/maven/continuum/trunk/continuum-plexus-application/src/conf
/maven/continuum/trunk/continuum-web
/maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc
/maven/continuum/trunk/continuum-xmlrpc/src/main/resources/META-INF/plexus
Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java (original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.java Sun Jun 12 03:47:43 2005
@@ -31,6 +31,7 @@
import org.apache.maven.continuum.project.ContinuumJPoxStore;
import org.apache.maven.continuum.project.ContinuumProject;
import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.project.MavenTwoProject;
import org.apache.maven.continuum.scm.CheckOutScmResult;
import org.apache.maven.continuum.scm.ScmFile;
import org.apache.maven.continuum.scm.UpdateScmResult;
@@ -164,40 +165,33 @@
assertEquals( ModelloJPoxContinuumStore.class, store.getClass() );
- String name = "Test Project";
- String scmUrl = "scm:local:src/test/repo";
- String nagEmailAddress = "foo@bar.com";
- String version = "1.0";
- String commandLineArguments = "a b";
- String builderId = "maven2";
- String workingDirectory = "/tmp";
Properties configuration = new Properties();
configuration.setProperty( "foo", "bar" );
- String projectId = store.addProject( name,
- scmUrl,
- nagEmailAddress,
- version,
- commandLineArguments,
- builderId,
- workingDirectory,
- configuration );
+ ContinuumProject expected = makeProject( "Test Project",
+ "scm:local:src/test/repo",
+ "foo@bar.com",
+ "1.0",
+ "a b",
+ "maven2",
+ "/tmp",
+ configuration );
+
+ String projectId = store.addProject( makeProject( "Test Project",
+ "scm:local:src/test/repo",
+ "foo@bar.com",
+ "1.0",
+ "a b",
+ "maven2",
+ "/tmp",
+ configuration ) );
assertNotNull( "The project id is null.", projectId );
- ContinuumProject project = store.getProject( projectId );
+ ContinuumProject actual = store.getProject( projectId );
- assertProjectEquals( projectId,
- name,
- scmUrl,
- nagEmailAddress,
- version,
- commandLineArguments,
- builderId,
- workingDirectory,
- configuration,
- project );
+ assertProjectEquals( projectId, expected, actual );
}
public void testGetNonExistingProject()
@@ -231,14 +225,14 @@
String workingDirectory = "/tmp";
Properties properties = new Properties();
- String projectId = store.addProject( name,
- scmUrl,
- nagEmailAddress,
- version,
- commandLineArguments,
- builderId,
- workingDirectory,
- properties );
+ String projectId = store.addProject( makeProject( name,
+ scmUrl,
+ nagEmailAddress,
+ version,
+ commandLineArguments,
+ builderId,
+ workingDirectory,
+ properties ) );
// ----------------------------------------------------------------------
//
@@ -333,14 +327,15 @@
String workingDirectory1 = "/tmp";
Properties configuration1 = new Properties();
- String id1 = store.addProject( name1,
- scmUrl1,
- nagEmailAddress1,
- version1,
- commandLineArguments1,
- builderId1,
- workingDirectory1,
- configuration1 );
+ String id1 = addProject( store,
+ name1,
+ scmUrl1,
+ nagEmailAddress1,
+ version1,
+ commandLineArguments1,
+ builderId1,
+ workingDirectory1,
+ configuration1 );
String name2 = "Test Project 2";
String scmUrl2 = "scm:local:src/test/repo/bar";
@@ -351,14 +346,15 @@
String workingDirectory2 = "/tmp";
Properties configuration2 = new Properties();
- String id2 = store.addProject( name2,
- scmUrl2,
- nagEmailAddress2,
- version2,
- commandLineArguments2,
- builderId2,
- workingDirectory2,
- configuration2 );
+ String id2 = addProject( store,
+ name2,
+ scmUrl2,
+ nagEmailAddress2,
+ version2,
+ commandLineArguments2,
+ builderId2,
+ workingDirectory2,
+ configuration2 );
Map projects = new HashMap();
@@ -469,9 +465,7 @@
{
ContinuumStore store = (ContinuumStore) lookup( ContinuumStore.ROLE );
- JdoFactory jdoFactory = (JdoFactory) lookup( JdoFactory.ROLE );
-
- jdoFactory.getPersistenceManagerFactory().close();
+ lookup( JdoFactory.ROLE );
String projectId = addProject( "Build Test Project", "scm:build" );
@@ -499,9 +493,7 @@
{
ContinuumStore store = (ContinuumStore) lookup( ContinuumStore.ROLE );
- JdoFactory jdoFactory = (JdoFactory) lookup( JdoFactory.ROLE );
-
- jdoFactory.getPersistenceManagerFactory().close();
+ lookup( JdoFactory.ROLE );
// ----------------------------------------------------------------------
// Set up projects
@@ -546,11 +538,18 @@
//
// ----------------------------------------------------------------------
+ ContinuumBuild build = store.getLatestBuildForProject( projectId );
+
+ assertNotNull( build );
+
+ assertEquals( build.getId(), (String) expectedBuilds.get( 9 ) );
+
Collection actualBuilds = store.getBuildsForProject( projectId, 0, 0 );
assertEquals( "builds.size", expectedBuilds.size(), actualBuilds.size() );
Iterator expectedIt = expectedBuilds.iterator();
+
Iterator actualIt = actualBuilds.iterator();
for ( int i = 0; expectedIt.hasNext(); i++ )
@@ -563,14 +562,41 @@
}
}
+ public void testGetLatestBuild()
+ throws Exception
+ {
+ String projectId = addProject( "Association Test Project", "scm:association" );
+
+ store.setIsUpdating( projectId );
+
+ store.setUpdateDone( projectId );
+
+ List expectedBuilds = new ArrayList();
+
+ for ( int i = 0; i < 10; i++ )
+ {
+ expectedBuilds.add( 0, store.createBuild( projectId, false ) );
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ ContinuumBuild build = store.getLatestBuildForProject( projectId );
+
+ assertNotNull( build );
+
+ assertEquals( build.getId(), (String) expectedBuilds.get( 9 ) );
+
+ Collection actualBuilds = store.getBuildsForProject( projectId, 0, 0 );
+ }
+
public void testBuildResult()
throws Exception
{
ContinuumStore store = (ContinuumStore) lookup( ContinuumStore.ROLE );
- JdoFactory jdoFactory = (JdoFactory) lookup( JdoFactory.ROLE );
-
- jdoFactory.getPersistenceManagerFactory().close();
+ lookup( JdoFactory.ROLE );
// ----------------------------------------------------------------------
//
@@ -674,12 +700,6 @@
makeStubProject( name, scmUrl ) );
}
- private String addProject( ContinuumProject project )
- throws Exception
- {
- return addProject( (ContinuumStore) lookup( ContinuumStore.ROLE ), project );
- }
-
// ----------------------------------------------------------------------
// Public utility methods
// ----------------------------------------------------------------------
@@ -696,6 +716,7 @@
scmUrl,
"foo@bar.com",
"1.0",
+ "",
ContinuumBuildExecutor.MAVEN_TWO_EXECUTOR_ID,
"/tmp",
new Properties() );
@@ -705,16 +726,18 @@
String scmUrl,
String nagEmailAddress,
String version,
+ String commandLineArguments,
String executorId,
String workingDirectory,
Properties configuration )
{
- ContinuumProject project = new ContinuumProject();
+ ContinuumProject project = new MavenTwoProject();
project.setName( name );
project.setScmUrl( scmUrl );
project.setNagEmailAddress( nagEmailAddress );
project.setVersion( version );
+ project.setCommandLineArguments( commandLineArguments );
project.setExecutorId( executorId );
project.setWorkingDirectory( workingDirectory );
project.setConfiguration( configuration );
@@ -725,15 +748,21 @@
public static String addProject( ContinuumStore store, ContinuumProject project )
throws Exception
{
- return addProject( store,
- project.getName(),
- project.getScmUrl(),
- project.getNagEmailAddress(),
- project.getVersion(),
- project.getCommandLineArguments(),
- project.getExecutorId(),
- project.getWorkingDirectory(),
- project.getConfiguration() );
+ String projectId = store.addProject( project );
+
+ CheckOutScmResult checkOutScmResult = new CheckOutScmResult();
+
+ checkOutScmResult.setSuccess( true );
+
+ store.setCheckoutDone( projectId, checkOutScmResult, null, null );
+
+ project = store.getProject( projectId );
+
+ assertNotNull( project );
+
+ assertEquals( ContinuumProjectState.NEW, project.getState() );
+
+ return projectId;
}
// public static String addProject( ContinuumStore store, String name )
@@ -759,14 +788,22 @@
Properties configuration )
throws Exception
{
- String projectId = store.addProject( name,
- scmUrl,
- nagEmailAddress,
- version,
- commandLineArguments,
- executorId,
- workingDirectory,
- configuration );
+// String projectId = store.addProject( name,
+// scmUrl,
+// nagEmailAddress,
+// version,
+// commandLineArguments,
+// executorId,
+// workingDirectory,
+// configuration );
+ String projectId = store.addProject( makeProject( name,
+ scmUrl,
+ nagEmailAddress,
+ version,
+ commandLineArguments,
+ executorId,
+ workingDirectory,
+ configuration ) );
CheckOutScmResult checkOutScmResult = new CheckOutScmResult();
@@ -803,6 +840,22 @@
}
private void assertProjectEquals( String projectId,
+ ContinuumProject expected,
+ ContinuumProject actual )
+ {
+ assertProjectEquals( projectId,
+ expected.getName(),
+ expected.getScmUrl(),
+ expected.getNagEmailAddress(),
+ expected.getVersion(),
+ expected.getCommandLineArguments(),
+ expected.getExecutorId(),
+ expected.getWorkingDirectory(),
+ expected.getConfiguration(),
+ actual );
+ }
+
+ private void assertProjectEquals( String projectId,
String name,
String scmUrl,
String nagEmailAddress,
@@ -811,29 +864,29 @@
String builderId,
String workingDirectory,
Properties configuration,
- ContinuumProject project )
+ ContinuumProject actual )
{
- assertEquals( "project.id", projectId, project.getId() );
+ assertEquals( "project.id", projectId, actual.getId() );
- assertEquals( "porject.name", name, project.getName() );
+ assertEquals( "project.name", name, actual.getName() );
- assertEquals( "porject.scmUrl", scmUrl, project.getScmUrl() );
+ assertEquals( "project.scmUrl", scmUrl, actual.getScmUrl() );
- assertEquals( "project.nagEmailAddress", nagEmailAddress, project.getNagEmailAddress() );
+ assertEquals( "project.nagEmailAddress", nagEmailAddress, actual.getNagEmailAddress() );
- assertEquals( "project.version", version, project.getVersion() );
+ assertEquals( "project.version", version, actual.getVersion() );
- assertEquals( "project.commandLineArguments", commandLineArguments, project.getCommandLineArguments() );
+ assertEquals( "project.commandLineArguments", commandLineArguments, actual.getCommandLineArguments() );
- assertEquals( "project.executorId", builderId, project.getExecutorId() );
+ assertEquals( "project.executorId", builderId, actual.getExecutorId() );
- assertEquals( "project.workingDirectory", workingDirectory, project.getWorkingDirectory() );
+ assertEquals( "project.workingDirectory", workingDirectory, actual.getWorkingDirectory() );
for ( Iterator it = configuration.keySet().iterator(); it.hasNext(); )
{
String key = (String) it.next();
- String value = project.getConfiguration().getProperty( key );
+ String value = actual.getConfiguration().getProperty( key );
assertNotNull( "Value for key '" + key + "' was null.", value );
Modified: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildqueue/BuildQueueTest.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildqueue/BuildQueueTest.xml?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildqueue/BuildQueueTest.xml (original)
+++ maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/buildqueue/BuildQueueTest.xml Sun Jun 12 03:47:43 2005
@@ -1,5 +1,6 @@
<plexus>
<components>
+<!--
<component>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
<implementation>org.codehaus.plexus.jdo.DefaultJdoFactory</implementation>
@@ -40,5 +41,6 @@
</properties>
</configuration>
</component>
+-->
</components>
</plexus>
Modified: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/core/ContinuumCoreTest.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/core/ContinuumCoreTest.xml?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/core/ContinuumCoreTest.xml (original)
+++ maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/core/ContinuumCoreTest.xml Sun Jun 12 03:47:43 2005
@@ -1,5 +1,6 @@
<plexus>
<components>
+<!--
<component>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
<implementation>org.codehaus.plexus.jdo.DefaultJdoFactory</implementation>
@@ -40,5 +41,6 @@
</properties>
</configuration>
</component>
+-->
</components>
</plexus>
Modified: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification/ContinuumNotificationDispatcherTest.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification/ContinuumNotificationDispatcherTest.xml?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification/ContinuumNotificationDispatcherTest.xml (original)
+++ maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification/ContinuumNotificationDispatcherTest.xml Sun Jun 12 03:47:43 2005
@@ -7,6 +7,7 @@
<toOverride>nobody@localhost</toOverride>
</configuration>
</component>
+<!--
<component>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
<implementation>org.codehaus.plexus.jdo.DefaultJdoFactory</implementation>
@@ -47,5 +48,6 @@
</properties>
</configuration>
</component>
+-->
</components>
</plexus>
Modified: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.xml?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.xml (original)
+++ maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/notification/mail/MailContinuumNotifierTest.xml Sun Jun 12 03:47:43 2005
@@ -35,7 +35,7 @@
<timestampFormat>EEE, d MMM yyyy HH:mm:ss Z</timestampFormat>
</configuration>
</component>
-
+<!--
<component>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
<implementation>org.codehaus.plexus.jdo.DefaultJdoFactory</implementation>
@@ -76,5 +76,6 @@
</properties>
</configuration>
</component>
+-->
</components>
</plexus>
Modified: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.xml?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.xml (original)
+++ maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/store/ModelloJPoxContinuumStoreTest.xml Sun Jun 12 03:47:43 2005
@@ -1,5 +1,6 @@
<plexus>
<components>
+<!--
<component>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
<implementation>org.codehaus.plexus.jdo.DefaultJdoFactory</implementation>
@@ -30,6 +31,10 @@
<value>true</value>
</property>
<property>
+ <name>org.jpox.autoCreateColumns</name>
+ <value>true</value>
+ </property>
+ <property>
<name>org.jpox.autoStartMechanism</name>
<value>SchemaTable</value>
</property>
@@ -40,5 +45,6 @@
</properties>
</configuration>
</component>
+-->
</components>
</plexus>
Modified: maven/continuum/trunk/continuum-model/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/pom.xml?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/pom.xml (original)
+++ maven/continuum/trunk/continuum-model/pom.xml Sun Jun 12 03:47:43 2005
@@ -9,15 +9,20 @@
<name>Continuum Model</name>
<version>1.0-alpha-3-SNAPSHOT</version>
<dependencies>
+ <!--
<dependency>
<groupId>jdo</groupId>
<artifactId>jdo</artifactId>
<version>1.0.1</version>
</dependency>
+ -->
<dependency>
<groupId>jpox</groupId>
<artifactId>jpox-enhancer</artifactId>
+ <!--
<version>1.0.4</version>
+ -->
+ <version>1.1.0-beta-3</version>
</dependency>
</dependencies>
<build>
@@ -29,7 +34,7 @@
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
- <version>1.0-alpha-2</version>
+ <version>1.0-alpha-3-SNAPSHOT</version>
<configuration>
<version>1.0.0</version>
<packageWithVersion>false</packageWithVersion>
Modified: maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo (original)
+++ maven/continuum/trunk/continuum-model/src/main/resources/continuum.mdo Sun Jun 12 03:47:43 2005
@@ -15,7 +15,7 @@
|
|-->
<classes>
- <class rootElement="true" stash.storable="true"><!-- java.abstract="true" -->
+ <class rootElement="true" stash.storable="true"><!-- java.abstract="true" -->
<name>ContinuumProject</name>
<version>1.0.0</version>
<fields>
@@ -69,7 +69,7 @@
<name>configuration</name>
<version>1.0.0</version>
<type>Properties</type>
- <association xml.mapStyle="inline">
+ <association xml.mapStyle="inline" stash.part="true">
<type>String</type>
<multiplicity>*</multiplicity>
</association>
@@ -238,6 +238,7 @@
<field>
<name>project</name>
<version>1.0.0</version>
+ <required>true</required>
<association>
<type>ContinuumProject</type>
</association>
@@ -292,7 +293,7 @@
<field>
<name>buildResult</name>
<version>1.0.0</version>
- <association>
+ <association stash.part="true">
<type>ContinuumBuildResult</type>
</association>
<description>
@@ -303,7 +304,7 @@
<field>
<name>updateScmResult</name>
<version>1.0.0</version>
- <association>
+ <association stash.part="true">
<type>UpdateScmResult</type>
</association>
</field>
@@ -333,7 +334,14 @@
</field>
</fields>
</class>
-
+<!--
+ <class>
+ <name>ErrorBuildResult</name>
+ <packageName>org.apache.maven.continuum.execution</packageName>
+ <superClass>ContinuumBuildResult</superClass>
+ <version>1.0.0</version>
+ </class>
+-->
<class>
<name>ShellBuildResult</name>
<packageName>org.apache.maven.continuum.execution.shell</packageName>
@@ -487,7 +495,7 @@
<field>
<name>checkedOutFiles</name>
<version>1.0.0</version>
- <association>
+ <association stash.part="true">
<type>ScmFile</type>
<multiplicity>*</multiplicity>
</association>
@@ -504,7 +512,7 @@
<field>
<name>updatedFiles</name>
<version>1.0.0</version>
- <association>
+ <association stash.part="true">
<type>ScmFile</type>
<multiplicity>*</multiplicity>
</association>
Modified: maven/continuum/trunk/continuum-plexus-application/src/conf/application.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-plexus-application/src/conf/application.xml?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-plexus-application/src/conf/application.xml (original)
+++ maven/continuum/trunk/continuum-plexus-application/src/conf/application.xml Sun Jun 12 03:47:43 2005
@@ -221,6 +221,20 @@
<value>trygvis</value>
</property>
-->
+ <!--
+ | NOTE: This is the only value HSQLDB supports so we're hardcoding this value
+ | here to prevent JPOX from complaining about the lack of support when running the
+ | unit tests. When running with Continuum in a production enviroment
+ | READ_COMMITTED should be used.
+ |-->
+ <property>
+ <name>org.jpox.transactionIsolation</name>
+ <value>READ_UNCOMMITTED</value>
+ </property>
+ <property>
+ <name>org.jpox.poid.transactionIsolation</name>
+ <value>READ_UNCOMMITTED</value>
+ </property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value></value>
Modified: maven/continuum/trunk/continuum-web/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-web/pom.xml?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-web/pom.xml (original)
+++ maven/continuum/trunk/continuum-web/pom.xml Sun Jun 12 03:47:43 2005
@@ -59,11 +59,13 @@
<artifactId>commons-fileupload</artifactId>
<version>1.0</version>
</dependency>
+ <!--
<dependency>
<groupId>jdo</groupId>
<artifactId>jdo</artifactId>
<version>1.0.1</version>
</dependency>
+ -->
<dependency>
<groupId>servletapi</groupId>
<artifactId>servletapi</artifactId>
Modified: maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpc.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpc.java?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpc.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/ContinuumXmlRpc.java Sun Jun 12 03:47:43 2005
@@ -27,39 +27,54 @@
String ROLE = ContinuumXmlRpc.class.getName();
// ----------------------------------------------------------------------
- // Project handling
+ // Keep these methods organized in the same order as the Continuum
+ // interface
// ----------------------------------------------------------------------
- Hashtable getProject( String projectId );
+ // ----------------------------------------------------------------------
+ // Projects
+ // ----------------------------------------------------------------------
+
+ Hashtable removeProject( String projectId );
- Hashtable updateProject( String projectId,
- String name,
- String scmUrl,
- String nagEmailAddress,
- String version,
- String commandLineArguments );
+// Hashtable updateProject( String projectId,
+// String name,
+// String scmUrl,
+// String nagEmailAddress,
+// String version,
+// String commandLineArguments );
Hashtable updateProjectConfiguration( String projectId,
Hashtable configuration );
- Hashtable getAllProjects();
+ Hashtable getProject( String projectId );
- Hashtable removeProject( String projectId );
+ Hashtable getProjects();
+
+ Hashtable getCheckOutScmResultForProject( String projectId );
+
+ Hashtable getLatestBuildForProject( String projectId );
// ----------------------------------------------------------------------
- // Build handling
+ // Building
// ----------------------------------------------------------------------
Hashtable buildProject( String projectId,
boolean force );
+ // ----------------------------------------------------------------------
+ // Builds
+ // ----------------------------------------------------------------------
+
+ Hashtable getBuild( String buildId );
+
Hashtable getBuildsForProject( String projectId,
int start,
int end );
- Hashtable getBuild( String buildId );
+ Hashtable getBuildResultForBuild( String buildId );
- Hashtable getBuildResult( String buildId );
+ Hashtable getChangedFilesForBuild( String buildId );
// ----------------------------------------------------------------------
// Maven 2.x projects
@@ -67,32 +82,41 @@
Hashtable addMavenTwoProject( String url );
+ Hashtable addMavenTwoProject( Hashtable mavenTwoProject );
+
+ Hashtable updateMavenTwoProject( Hashtable mavenTwoProject );
+
// ----------------------------------------------------------------------
// Maven 1.x projects
// ----------------------------------------------------------------------
Hashtable addMavenOneProject( String url );
+ Hashtable addMavenOneProject( Hashtable mavenOneProject );
// ----------------------------------------------------------------------
// Ant projects
// ----------------------------------------------------------------------
- Hashtable addAntProject( String scmUrl,
- String projectName,
- String nagEmailAddress,
- String version,
- String commandLineArguments,
- Hashtable configuration );
+// Hashtable addAntProject( String scmUrl,
+// String projectName,
+// String nagEmailAddress,
+// String version,
+// String commandLineArguments,
+// Hashtable configuration );
+
+ Hashtable addAntProject( Hashtable antProject );
// ----------------------------------------------------------------------
// Shell projects
// ----------------------------------------------------------------------
- Hashtable addShellProject( String scmUrl,
- String projectName,
- String nagEmailAddress,
- String version,
- String commandLineArguments,
- Hashtable configuration );
+// Hashtable addShellProject( String scmUrl,
+// String projectName,
+// String nagEmailAddress,
+// String version,
+// String commandLineArguments,
+// Hashtable configuration );
+
+ Hashtable addShellProject( Hashtable shellProject );
}
Modified: maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultContinuumXmlRpc.java Sun Jun 12 03:47:43 2005
@@ -18,6 +18,8 @@
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Hashtable;
@@ -28,22 +30,15 @@
import java.util.Vector;
import org.apache.maven.continuum.Continuum;
-import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.core.ContinuumCore;
-import org.apache.maven.continuum.execution.ant.AntBuildExecutor;
-import org.apache.maven.continuum.execution.shell.ShellBuildExecutor;
-import org.apache.maven.continuum.execution.maven.m2.MavenTwoBuildExecutor;
-import org.apache.maven.continuum.execution.maven.m1.MavenOneBuildExecutor;
import org.apache.maven.continuum.project.ContinuumBuild;
import org.apache.maven.continuum.project.ContinuumBuildResult;
import org.apache.maven.continuum.project.ContinuumProject;
import org.apache.maven.continuum.project.MavenOneProject;
-import org.apache.maven.continuum.project.ShellProject;
-import org.apache.maven.continuum.project.AntProject;
import org.apache.maven.continuum.project.MavenTwoProject;
-import org.apache.maven.continuum.project.builder.maven.MavenOneContinuumProjectBuilder;
+import org.apache.maven.continuum.project.AntProject;
+import org.apache.maven.continuum.project.ShellProject;
+import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
import org.apache.maven.continuum.scm.CheckOutScmResult;
-import org.apache.maven.continuum.scm.UpdateScmResult;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.StringUtils;
@@ -67,106 +62,103 @@
/**
* @plexus.requirement
*/
- private ContinuumCore core;
-
- /**
- * @plexus.requirement
- */
private XmlRpcHelper xmlRpcHelper;
// ----------------------------------------------------------------------
- // Maven 1.x projects
+ // ContinuumXmlRpc Implementation
// ----------------------------------------------------------------------
- public Hashtable addMavenOneProject( String url )
- {
- try
- {
- Collection projectIds = core.addProjectsFromUrl( url, MavenOneContinuumProjectBuilder.ID );
-
- return makeHashtable( "projectIds", xmlRpcHelper.collectionToVector( projectIds, false ) );
- }
- catch ( Throwable e )
- {
- return handleException( "ContinuumXmlRpc.addMavenOneProject()",
- "URL: '" + url + "'.", e );
- }
- }
-
- // ----------------------------------------------------------------------
- // Maven 2.x projects
- // ----------------------------------------------------------------------
-
- public Hashtable addMavenTwoProject( String url )
+ public Hashtable removeProject( String projectId )
{
try
{
- // TODO: Get the added projects and return the IDs
- continuum.addMavenTwoProject( url );
-
-// Collection projectIds = core.addProjectsFromUrl( url, MavenTwoContinuumProjectBuilder.ID );
+ continuum.removeProject( projectId );
-// return makeHashtable( "projectIds", xmlRpcHelper.collectionToVector( projectIds, false ) );
- return makeHashtable( "projectIds", xmlRpcHelper.collectionToVector( new Vector(), false ) );
+ return makeHashtable();
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.addMavenTwoProject()",
- "URL: '" + url + "'.", e );
+ return handleException( "ContinuumXmlRpc.removeProject()",
+ "Project id: '" + projectId + "'.", e );
}
}
- // ----------------------------------------------------------------------
- // Ant projects
- // ----------------------------------------------------------------------
-
- public Hashtable addAntProject( String scmUrl,
- String projectName,
- String nagEmailAddress,
- String version,
- String commandLineArguments,
- Hashtable configuration )
- {
- return addProjectFromScm( scmUrl,
- AntBuildExecutor.ID,
- projectName,
- nagEmailAddress,
- version,
- commandLineArguments,
- configuration );
- }
-
- // ----------------------------------------------------------------------
- // Shell projects
- // ----------------------------------------------------------------------
-
- public Hashtable addShellProject( String scmUrl,
- String projectName,
- String nagEmailAddress,
- String version,
- String commandLineArguments,
- Hashtable configuration )
- {
- return addProjectFromScm( scmUrl,
- ShellBuildExecutor.ID,
- projectName,
- nagEmailAddress,
- version,
- commandLineArguments,
- configuration );
- }
-
- // ----------------------------------------------------------------------
- // Projects
- // ----------------------------------------------------------------------
+// public Hashtable updateProject( String projectId,
+// String name,
+// String scmUrl,
+// String nagEmailAddress,
+// String version,
+// String commandLineArguments )
+// {
+// try
+// {
+// ContinuumProject project = continuum.getProject( projectId );
+//
+// if ( project.getExecutorId().equals( MavenOneBuildExecutor.ID ) )
+// {
+// project = continuum.getMavenOneProject( projectId );
+// }
+// else if ( project.getExecutorId().equals( MavenTwoBuildExecutor.ID ) )
+// {
+// project = continuum.getMavenTwoProject( projectId );
+// }
+// else if ( project.getExecutorId().equals( AntBuildExecutor.ID ) )
+// {
+// project = continuum.getAntProject( projectId );
+// }
+// else if ( project.getExecutorId().equals( ShellBuildExecutor.ID ) )
+// {
+// project = continuum.getShellProject( projectId );
+// }
+//
+// project.setName( name );
+//
+// project.setScmUrl( scmUrl );
+//
+// project.setNagEmailAddress( nagEmailAddress );
+//
+// project.setVersion( version );
+//
+// project.setCommandLineArguments( commandLineArguments );
+//
+// // ----------------------------------------------------------------------
+// //
+// // ----------------------------------------------------------------------
+//
+// if ( project instanceof MavenOneProject )
+// {
+// continuum.updateMavenOneProject( (MavenOneProject) project );
+// }
+// else if ( project instanceof MavenTwoProject )
+// {
+// continuum.updateMavenTwoProject( (MavenTwoProject) project );
+// }
+// else if ( project instanceof AntProject )
+// {
+// continuum.updateAntProject( (AntProject) project );
+// }
+// else if ( project instanceof ShellProject )
+// {
+// continuum.updateShellProject( (ShellProject) project );
+// }
+// else
+// {
+// return handleException( "ContinuumXmlRpc.updateProject()",
+// "Project id: '" + projectId + "'.",
+// new ContinuumException( "Unknown project type: " + project.getClass().getName() ) );
+// }
+//
+// return makeHashtable();
+// }
+// catch ( Throwable e )
+// {
+// return handleException( "ContinuumXmlRpc.updateProject()",
+// "Project id: '" + projectId + "'.", e );
+// }
+// }
- private Hashtable addProjectFromScm( String scmUrl,
- String executorId,
- String projectName,
- String nagEmailAddress,
- String version,
- String commandLineArguments,
- Hashtable configuration )
+ public Hashtable updateProjectConfiguration( String projectId,
+ Hashtable configuration )
{
try
{
@@ -179,19 +171,14 @@
configurationProperties.put( entry.getKey().toString(), entry.getValue().toString() );
}
- String projectId = core.addProjectFromScm( scmUrl,
- executorId,
- projectName,
- nagEmailAddress,
- version,
- commandLineArguments,
- configurationProperties );
+ continuum.updateProjectConfiguration( projectId, configurationProperties );
- return makeHashtable( "projectId", projectId );
+ return makeHashtable();
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.addProjectFromScm()", null, e );
+ return handleException( "ContinuumXmlRpc.updateProjectConfiguration()",
+ "Project id: '" + projectId + "'.", e );
}
}
@@ -199,295 +186,484 @@
{
try
{
- Set excludedProperties = new HashSet();
-
- excludedProperties.add( "configuration" );
-
- ContinuumProject project = continuum.getProject( projectId );
-
- Hashtable hashtable = xmlRpcHelper.objectToHashtable( project, excludedProperties );
+ return makeHashtable( "project", convertContinuumProject( continuum.getProject( projectId ) ) );
+ }
+ catch ( Throwable e )
+ {
+ return handleException( "ContinuumXmlRpc.getProject()",
+ "Project id: '" + projectId + "'.", e );
+ }
+ }
- Properties configuration = project.getConfiguration();
+ public Hashtable getProjects()
+ {
+ try
+ {
+ Collection projects = continuum.getAllProjects( 0, 0 );
- Hashtable configurationHashtable = new Hashtable();
+ Vector results = new Vector( projects.size() );
- for ( Iterator it = configuration.entrySet().iterator(); it.hasNext(); )
+ for ( Iterator it = projects.iterator(); it.hasNext(); )
{
- Map.Entry entry = (Map.Entry) it.next();
-
- configurationHashtable.put( entry.getKey().toString(), entry.getValue().toString() );
+ results.add( convertContinuumProject( it.next() ) );
}
- hashtable.put( "configuration", configurationHashtable );
+ return makeHashtable( "projects", results );
+ }
+ catch ( Throwable e )
+ {
+ return handleException( "ContinuumXmlRpc.getProjects()", null, e );
+ }
+ }
+ public Hashtable getCheckOutScmResultForProject( String projectId )
+ {
+ try
+ {
CheckOutScmResult result = continuum.getCheckOutScmResultForProject( projectId );
- if ( result != null )
- {
- hashtable.put( "checkOutScmResult", xmlRpcHelper.objectToHashtable( result ) );
- }
-
- return makeHashtable( "project", hashtable );
+ return makeHashtable( "checkOutScmResult", convertCheckOutScmResult( result ) );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.getProject()",
+ return handleException( "ContinuumXmlRpc.getCheckOutScmResultForProject()",
"Project id: '" + projectId + "'.", e );
}
}
- public Hashtable updateProject( String projectId,
- String name,
- String scmUrl,
- String nagEmailAddress,
- String version,
- String commandLineArguments )
+ public Hashtable getLatestBuildForProject( String projectId )
{
try
{
- ContinuumProject project = continuum.getProject( projectId );
+ ContinuumBuild build = continuum.getLatestBuildForProject( projectId );
- if ( project.getExecutorId().equals( MavenOneBuildExecutor.ID ) )
- {
- project = continuum.getMavenOneProject( projectId );
- }
- else if ( project.getExecutorId().equals( MavenTwoBuildExecutor.ID ) )
- {
- project = continuum.getMavenTwoProject( projectId );
- }
- else if ( project.getExecutorId().equals( AntBuildExecutor.ID ) )
- {
- project = continuum.getAntProject( projectId );
- }
- else if ( project.getExecutorId().equals( ShellBuildExecutor.ID ) )
- {
- project = continuum.getShellProject( projectId );
- }
+ return makeHashtable( "latestBuild", convertContinuumBuild( build ) );
+ }
+ catch ( Throwable e )
+ {
+ return handleException( "ContinuumXmlRpc.getCheckOutScmResultForProject()",
+ "Project id: '" + projectId + "'.", e );
+ }
- project.setName( name );
+ }
- project.setScmUrl( scmUrl );
+ // ----------------------------------------------------------------------
+ // Build handling
+ // ----------------------------------------------------------------------
- project.setNagEmailAddress( nagEmailAddress );
+ public Hashtable buildProject( String projectId,
+ boolean force )
+ {
+ try
+ {
+ continuum.buildProject( projectId, force );
- project.setVersion( version );
+ return makeHashtable();
+ }
+ catch ( Throwable e )
+ {
+ return handleException( "ContinuumXmlRpc.buildProject()",
+ "Project id: '" + projectId + "'.", e );
+ }
+ }
- project.setCommandLineArguments( commandLineArguments );
+ public Hashtable getBuild( String buildId )
+ {
+ try
+ {
+ ContinuumBuild build = continuum.getBuild( buildId );
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
+ return makeHashtable( "build", convertContinuumBuild( build ) );
+ }
+ catch ( Throwable e )
+ {
+ return handleException( "ContinuumXmlRpc.getBuild()",
+ "Build id: '" + buildId + "'.", e );
+ }
+ }
- if ( project instanceof MavenOneProject )
- {
- continuum.updateMavenOneProject( (MavenOneProject) project );
- }
- else if ( project instanceof MavenTwoProject )
- {
- continuum.updateMavenTwoProject( (MavenTwoProject) project );
- }
- else if ( project instanceof AntProject )
- {
- continuum.updateAntProject( (AntProject) project );
- }
- else if ( project instanceof ShellProject )
+ public Hashtable getBuildsForProject( String projectId,
+ int start,
+ int end )
+ {
+ try
+ {
+ if ( start != 0 || end != 0 )
{
- continuum.updateShellProject( (ShellProject) project );
+ getLogger().warn( "ContinuumXmlRpc.getBuildsForProject() " +
+ "doesn't support usage of the start and end parameters yet." );
}
- else
+
+ // TODO: use start and end
+ Collection builds = continuum.getBuildsForProject( projectId );
+
+ Vector result = new Vector( builds.size() );
+
+ for ( Iterator it = builds.iterator(); it.hasNext(); )
{
- return handleException( "ContinuumXmlRpc.updateProject()",
- "Project id: '" + projectId + "'.", new ContinuumException( "Unknown project type: " + project.getClass().getName() ) );
+ result.add( convertContinuumBuild( it.next() ) );
}
- return makeHashtable();
+ return makeHashtable( "builds", result );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.updateProject()",
+ return handleException( "ContinuumXmlRpc.getBuildsForProject()",
"Project id: '" + projectId + "'.", e );
}
}
- public Hashtable updateProjectFromScm( String projectId )
+ public Hashtable getBuildResultForBuild( String buildId )
{
try
{
- continuum.updateProjectFromScm( projectId );
+ ContinuumBuildResult result = continuum.getBuildResultForBuild( buildId );
- return makeHashtable();
+ return makeHashtable( "buildResult", convertContinuumBuildResult( result ) );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.updateProjectFromScm()",
- "Project id: '" + projectId + "'.", e );
+ return handleException( "ContinuumXmlRpc.getBuildResultForProject()",
+ "Build id: '" + buildId + "'.", e );
}
}
- public Hashtable updateProjectConfiguration( String projectId,
- Hashtable configuration )
+ public Hashtable getChangedFilesForBuild( String buildId )
{
try
{
- Properties configurationProperties = new Properties();
+ Collection changedFiles = continuum.getChangedFilesForBuild( buildId );
- for ( Iterator it = configuration.entrySet().iterator(); it.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) it.next();
+ Vector result = new Vector( changedFiles.size() );
- configurationProperties.put( entry.getKey().toString(), entry.getValue().toString() );
+ for ( Iterator it = changedFiles.iterator(); it.hasNext(); )
+ {
+ result.add( convertScmFile( it.next() ) );
}
- continuum.updateProjectConfiguration( projectId, configurationProperties );
-
- return makeHashtable();
+ return makeHashtable( "changedFiles", result );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.updateProjectConfiguration()",
- "Project id: '" + projectId + "'.", e );
+ return handleException( "ContinuumXmlRpc.getBuildResultForProject()",
+ "Build id: '" + buildId + "'.", e );
}
}
- public Hashtable getAllProjects()
+ // ----------------------------------------------------------------------
+ // Maven 1.x projects
+ // ----------------------------------------------------------------------
+
+ public Hashtable addMavenOneProject( String url )
{
try
{
- Vector projects = new Vector();
+ ContinuumProjectBuildingResult result = continuum.addMavenOneProject( url );
- for ( Iterator it = continuum.getAllProjects( 0, 0 ).iterator(); it.hasNext(); )
+ Collection projects = result.getProjects();
+
+ Collection projectIds = new Vector( projects.size() );
+
+ for ( Iterator it = projects.iterator(); it.hasNext(); )
{
ContinuumProject project = (ContinuumProject) it.next();
- projects.add( xmlRpcHelper.objectToHashtable( project ) );
+ projectIds.add( project.getId() );
+
+ getLogger().info( "project id: " + project.getId() );
}
- return makeHashtable( "projects", projects );
+ return makeHashtable( "projectIds", xmlRpcHelper.collectionToVector( projectIds, false ) );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.getAllProjects()", null, e );
+ return handleException( "ContinuumXmlRpc.addMavenOneProject()",
+ "URL: '" + url + "'.", e );
}
}
- public Hashtable removeProject( String projectId )
+ public Hashtable addMavenOneProject( Hashtable mavenOneProject )
{
try
{
- continuum.removeProject( projectId );
+ MavenOneProject project = new MavenOneProject();
- return makeHashtable();
+ xmlRpcHelper.hashtableToObject( mavenOneProject, project );
+
+ String projectId = continuum.addMavenOneProject( project );
+
+ Collection projectIds = new ArrayList();
+
+ projectIds.add( projectId );
+
+ return makeHashtable( "projectIds", xmlRpcHelper.collectionToVector( projectIds, false ) );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.removeProject()",
- "Project id: '" + projectId + "'.", e );
+ return handleException( "ContinuumXmlRpc.addMavenOneProject()",
+ null, e );
}
}
- // ----------------------------------------------------------------------
- // Builds
- // ----------------------------------------------------------------------
-
- public Hashtable buildProject( String projectId, boolean force )
+ public Hashtable addAntProject( Hashtable antProject )
{
try
{
- continuum.buildProject( projectId, force );
+ AntProject project = new AntProject();
- return makeHashtable();
+ xmlRpcHelper.hashtableToObject( antProject, project );
+
+ String projectId = continuum.addAntProject( project );
+
+ Collection projectIds = new ArrayList();
+
+ projectIds.add( projectId );
+
+ return makeHashtable( "projectIds", xmlRpcHelper.collectionToVector( projectIds, false ) );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.buildProject()",
- "Project id: '" + projectId + "'.", e );
+ return handleException( "ContinuumXmlRpc.addAntProject()",
+ null, e );
}
}
- public Hashtable getBuildsForProject( String projectId, int start, int end )
+ public Hashtable addShellProject( Hashtable shellProject )
{
try
{
- // TODO: use start and end
- Iterator it = continuum.getBuildsForProject( projectId ).iterator();
+ ShellProject project = new ShellProject();
- Vector builds = new Vector();
+ xmlRpcHelper.hashtableToObject( shellProject, project );
- Set excludedProperties = new HashSet();
+ String projectId = continuum.addShellProject( project );
- excludedProperties.add( "project" );
+ Collection projectIds = new ArrayList();
- while ( it.hasNext() )
- {
- ContinuumBuild continuumBuild = (ContinuumBuild) it.next();
-
- Hashtable build = xmlRpcHelper.objectToHashtable( continuumBuild, excludedProperties );
-
- UpdateScmResult result = continuumBuild.getUpdateScmResult();
+ projectIds.add( projectId );
- if ( result != null )
- {
- build.put( "updateScmResult", xmlRpcHelper.objectToHashtable( result ) );
- }
-
- builds.add( build );
- }
-
- return makeHashtable( "builds", builds );
+ return makeHashtable( "projectIds", xmlRpcHelper.collectionToVector( projectIds, false ) );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.getBuildsForProject()",
- "Project id: '" + projectId + "'.", e );
+ return handleException( "ContinuumXmlRpc.ShellProject()",
+ null, e );
}
}
- public Hashtable getBuild( String buildId )
+ // ----------------------------------------------------------------------
+ // Maven 2.x projects
+ // ----------------------------------------------------------------------
+
+ public Hashtable addMavenTwoProject( String url )
{
+ getLogger().info( "addMavenTwoProject( String url )" );
try
{
- ContinuumBuild continuumBuild = continuum.getBuild( buildId );
+ // TODO: Get the added projects and return the IDs
+ ContinuumProjectBuildingResult result = continuum.addMavenTwoProject( url );
- Set excludedProperties = new HashSet();
+ Collection projects = result.getProjects();
- excludedProperties.add( "project" );
+ Collection projectIds = new Vector( projects.size() );
- Hashtable build = makeHashtable( "build",
- xmlRpcHelper.objectToHashtable( continuumBuild, excludedProperties ) );
+ for ( Iterator it = projects.iterator(); it.hasNext(); )
+ {
+ ContinuumProject project = (ContinuumProject) it.next();
- UpdateScmResult result = continuumBuild.getUpdateScmResult();
+ projectIds.add( project.getId() );
- if ( result != null )
- {
- build.put( "updateScmResult", xmlRpcHelper.objectToHashtable( result ) );
+ getLogger().info( "project id: " + project.getId() );
}
- return build;
+ return makeHashtable( "projectIds", xmlRpcHelper.collectionToVector( projectIds, false ) );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.getBuild()",
- "Build id: '" + buildId + "'.", e );
+ return handleException( "ContinuumXmlRpc.addMavenTwoProject()",
+ "URL: '" + url + "'.", e );
}
}
- public Hashtable getBuildResult( String buildId )
+ public Hashtable addMavenTwoProject( Hashtable mavenTwoProject )
{
+ getLogger().info( "addMavenTwoProject( Hashtable mavenTwoProject )" );
try
{
- ContinuumBuildResult result = continuum.getBuildResultForBuild( buildId );
+ MavenTwoProject project = new MavenTwoProject();
+
+ xmlRpcHelper.hashtableToObject( mavenTwoProject, project );
- Set excludedProperties = new HashSet();
+ String projectId = continuum.addMavenTwoProject( project );
- excludedProperties.add( "build" );
+ // TODO: Get the added projects and return the IDs
+ Collection projectIds = new Vector();
+
+ projectIds.add( projectId );
+
+ getLogger().info( "project id: " + projectId );
- return makeHashtable( "buildResult", xmlRpcHelper.objectToHashtable( result, excludedProperties ) );
+ return makeHashtable( "projectIds", xmlRpcHelper.collectionToVector( projectIds, false ) );
}
catch ( Throwable e )
{
- return handleException( "ContinuumXmlRpc.getBuildResult()",
- "Build id: '" + buildId + "'.", e );
+ return handleException( "ContinuumXmlRpc.addMavenTwoProject()", null, e );
+ }
+ }
+
+ public Hashtable updateMavenTwoProject( Hashtable mavenTwoProject )
+ {
+ throw new RuntimeException( "NOT IMPLEMENTED" );
+ }
+
+ // ----------------------------------------------------------------------
+ // Ant projects
+ // ----------------------------------------------------------------------
+
+// public Hashtable addAntProject( String scmUrl,
+// String projectName,
+// String nagEmailAddress,
+// String version,
+// String commandLineArguments,
+// Hashtable configuration )
+// {
+// return addProjectFromScm( scmUrl,
+// AntBuildExecutor.ID,
+// projectName,
+// nagEmailAddress,
+// version,
+// commandLineArguments,
+// configuration );
+// }
+
+ // ----------------------------------------------------------------------
+ // Shell projects
+ // ----------------------------------------------------------------------
+
+// public Hashtable addShellProject( String scmUrl,
+// String projectName,
+// String nagEmailAddress,
+// String version,
+// String commandLineArguments,
+// Hashtable configuration )
+// {
+// return addProjectFromScm( scmUrl,
+// ShellBuildExecutor.ID,
+// projectName,
+// nagEmailAddress,
+// version,
+// commandLineArguments,
+// configuration );
+// }
+
+ // ----------------------------------------------------------------------
+ // Projects
+ // ----------------------------------------------------------------------
+
+// private Hashtable addProjectFromScm( String scmUrl,
+// String executorId,
+// String projectName,
+// String nagEmailAddress,
+// String version,
+// String commandLineArguments,
+// Hashtable configuration )
+// {
+// try
+// {
+// Properties configurationProperties = new Properties();
+//
+// for ( Iterator it = configuration.entrySet().iterator(); it.hasNext(); )
+// {
+// Map.Entry entry = (Map.Entry) it.next();
+//
+// configurationProperties.put( entry.getKey().toString(), entry.getValue().toString() );
+// }
+//
+// String projectId = core.addProjectFromScm( scmUrl,
+// executorId,
+// projectName,
+// nagEmailAddress,
+// version,
+// commandLineArguments,
+// configurationProperties );
+//
+// return makeHashtable( "projectId", projectId );
+// }
+// catch ( Throwable e )
+// {
+// return handleException( "ContinuumXmlRpc.addProjectFromScm()", null, e );
+// }
+// }
+
+ // ----------------------------------------------------------------------
+ // Object to Hashtable converters
+ // ----------------------------------------------------------------------
+
+ private Hashtable convertContinuumProject( Object object )
+ throws IllegalAccessException, InvocationTargetException
+ {
+ Set excludedProperties = new HashSet();
+
+ excludedProperties.add( "configuration" );
+
+ excludedProperties.add( "builds" );
+
+ excludedProperties.add( "developers" );
+
+ ContinuumProject project = (ContinuumProject) object;
+
+ Hashtable hashtable = xmlRpcHelper.objectToHashtable( project, excludedProperties );
+
+ Properties configuration = project.getConfiguration();
+
+ Hashtable configurationHashtable = new Hashtable();
+
+ for ( Iterator it = configuration.entrySet().iterator(); it.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) it.next();
+
+ configurationHashtable.put( entry.getKey().toString(), entry.getValue().toString() );
}
+
+ hashtable.put( "configuration", configurationHashtable );
+
+ return hashtable;
+ }
+
+ private Hashtable convertContinuumBuild( Object object )
+ throws IllegalAccessException, InvocationTargetException
+ {
+ Set excludedProperties = new HashSet();
+
+ excludedProperties.add( "project" );
+
+ return xmlRpcHelper.objectToHashtable( object, excludedProperties );
+ }
+
+ private Hashtable convertContinuumBuildResult( Object object )
+ throws IllegalAccessException, InvocationTargetException
+ {
+ Set excludedProperties = new HashSet();
+
+ excludedProperties.add( "build" );
+
+ return xmlRpcHelper.objectToHashtable( object, excludedProperties );
+ }
+
+ private Hashtable convertScmFile( Object object )
+ throws IllegalAccessException, InvocationTargetException
+ {
+ Set excludedProperties = new HashSet();
+
+ return xmlRpcHelper.objectToHashtable( object, excludedProperties );
+ }
+
+ private Hashtable convertCheckOutScmResult( Object object )
+ throws IllegalAccessException, InvocationTargetException
+ {
+ Set excludedProperties = new HashSet();
+
+ return xmlRpcHelper.objectToHashtable( object, excludedProperties );
}
// ----------------------------------------------------------------------
@@ -553,4 +729,4 @@
return string.getBuffer().toString();
}
- }
+}
Modified: maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultXmlRpcHelper.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultXmlRpcHelper.java?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultXmlRpcHelper.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/DefaultXmlRpcHelper.java Sun Jun 12 03:47:43 2005
@@ -63,6 +63,83 @@
public Hashtable objectToHashtable( Object object, Set excludedProperties )
throws IllegalAccessException, InvocationTargetException
{
+ return objectToHashtable( object, excludedProperties, new HashSet() );
+ }
+
+ public Vector collectionToVector( Collection value, boolean convertElements )
+ throws IllegalAccessException, InvocationTargetException
+ {
+ return collectionToVector( value, convertElements, Collections.EMPTY_SET );
+ }
+
+ public Vector collectionToVector( Collection value, boolean convertElements, Set excludedProperties )
+ throws IllegalAccessException, InvocationTargetException
+ {
+ return collectionToVector( value, convertElements, excludedProperties, new HashSet() );
+ }
+
+ public void hashtableToObject( Hashtable hashtable, Object target )
+ throws IntrospectionException, IllegalAccessException, InvocationTargetException
+ {
+ for ( Iterator it = hashtable.entrySet().iterator(); it.hasNext(); )
+ {
+ Map.Entry entry = (Map.Entry) it.next();
+
+ String key = (String) entry.getKey();
+
+ Object value = entry.getValue();
+
+ if ( key == null || value == null )
+ {
+ continue;
+ }
+
+ // ----------------------------------------------------------------------
+ // Convert the key to a setter
+ // ----------------------------------------------------------------------
+
+ String setterName = "set" +
+ Character.toUpperCase( key.charAt( 0 ) ) +
+ key.substring( 1 );
+
+ Class clazz = target.getClass();
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ Method setter = getSetter( clazz, setterName, key );
+
+ if ( setter == null )
+ {
+ continue;
+ }
+
+ // TODO: Implement to give better feedback
+// Class parameter = setter.getParameterTypes()[ 0 ];
+//
+// if ( value.getClass().isAssignableFrom( parameter ) )
+// {
+// }
+
+ setter.invoke( target, new Object[]{value} );
+ }
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ private Hashtable objectToHashtable( Object object,
+ Set excludedProperties,
+ Set visitedObjects )
+ throws IllegalAccessException, InvocationTargetException
+ {
+ if ( !visitedObjects.add( object ) )
+ {
+ return null;
+ }
+
Hashtable hashtable = new Hashtable();
if ( object == null )
@@ -114,7 +191,8 @@
propertyName = StringUtils.uncapitalise( propertyName );
- if ( excludedProperties.contains( propertyName ) || alwaysExcludedProperties.contains( propertyName ) )
+ if ( excludedProperties.contains( propertyName ) ||
+ alwaysExcludedProperties.contains( propertyName ) )
{
continue;
}
@@ -135,6 +213,7 @@
}
else if ( value instanceof String )
{
+ // nothing to do after all, the object is already a string!
}
else if ( value instanceof Number )
{
@@ -146,24 +225,35 @@
}
else if ( value instanceof Collection )
{
- value = collectionToVector( (Collection) value, true );
+ value = collectionToVector( (Collection) value,
+ true,
+ excludedProperties,
+ visitedObjects );
}
else
{
- value = objectToHashtable( value );
+ value = objectToHashtable( value,
+ excludedProperties,
+ visitedObjects );
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
- hashtable.put( propertyName, value );
+ if ( value != null )
+ {
+ hashtable.put( propertyName, value );
+ }
}
return hashtable;
}
- public Vector collectionToVector( Collection value, boolean convertElements )
+ private Vector collectionToVector( Collection value,
+ boolean convertElements,
+ Set excludedProperties,
+ Set visitedObjects )
throws IllegalAccessException, InvocationTargetException
{
if ( value instanceof Vector )
@@ -179,63 +269,16 @@
if ( convertElements )
{
- vector.add( objectToHashtable( object ) );
+ object = objectToHashtable( object, excludedProperties, visitedObjects );
}
- else
+
+ if ( object != null )
{
vector.add( object );
}
}
return vector;
- }
-
- public void hashtableToObject( Hashtable hashtable, Object target )
- throws IntrospectionException, IllegalAccessException, InvocationTargetException
- {
- for ( Iterator it = hashtable.entrySet().iterator(); it.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) it.next();
-
- String key = (String) entry.getKey();
-
- Object value = entry.getValue();
-
- if ( key == null || value == null )
- {
- continue;
- }
-
- // ----------------------------------------------------------------------
- // Convert the key to a setter
- // ----------------------------------------------------------------------
-
- String setterName = "set" +
- Character.toUpperCase( key.charAt( 0 ) ) +
- key.substring( 1 );
-
- Class clazz = target.getClass();
-
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
-
- Method setter = getSetter( clazz, setterName, key );
-
- if ( setter == null )
- {
- continue;
- }
-
- // TODO: Implement to give better feedback
-// Class parameter = setter.getParameterTypes()[ 0 ];
-//
-// if ( value.getClass().isAssignableFrom( parameter ) )
-// {
-// }
-
- setter.invoke( target, new Object[] { value } );
- }
}
// ----------------------------------------------------------------------
Modified: maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/XmlRpcHelper.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/XmlRpcHelper.java?rev=190240&r1=190239&r2=190240&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/XmlRpcHelper.java (original)
+++ maven/continuum/trunk/continuum-xmlrpc/src/main/java/org/apache/maven/continuum/xmlrpc/XmlRpcHelper.java Sun Jun 12 03:47:43 2005
@@ -40,6 +40,9 @@
Vector collectionToVector( Collection value, boolean convertElements )
throws IllegalAccessException, InvocationTargetException;
+ Vector collectionToVector( Collection value, boolean convertElements, Set excludedProperties )
+ throws IllegalAccessException, InvocationTargetException;
+
void hashtableToObject( Hashtable hashtable, Object object )
throws IntrospectionException, IllegalAccessException, InvocationTargetException;
}
Added: maven/continuum/trunk/continuum-xmlrpc/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-xmlrpc/src/main/resources/META-INF/plexus/components.xml?rev=190240&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-xmlrpc/src/main/resources/META-INF/plexus/components.xml (added)
+++ maven/continuum/trunk/continuum-xmlrpc/src/main/resources/META-INF/plexus/components.xml Sun Jun 12 03:47:43 2005
@@ -0,0 +1,20 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.continuum.xmlrpc.ContinuumXmlRpc</role>
+ <implementation>org.apache.maven.continuum.xmlrpc.DefaultContinuumXmlRpc</implementation>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.continuum.Continuum</role>
+ </requirement>
+ <requirement>
+ <role>org.apache.maven.continuum.xmlrpc.XmlRpcHelper</role>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.maven.continuum.xmlrpc.XmlRpcHelper</role>
+ <implementation>org.apache.maven.continuum.xmlrpc.DefaultXmlRpcHelper</implementation>
+ </component>
+ </components>
+</component-set>
Propchange: maven/continuum/trunk/continuum-xmlrpc/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/continuum/trunk/continuum-xmlrpc/src/main/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:keywords = Id