o Adding my OSWorkflow work. THIS IS NOT WORKING CODE just yet.
git-svn-id: https://svn.apache.org/repos/asf/maven/continuum/branches/osworkflow-integration@369252 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/continuum-core/pom.xml b/continuum-core/pom.xml
index 4c9f6b2..9b4daf4 100644
--- a/continuum-core/pom.xml
+++ b/continuum-core/pom.xml
@@ -31,6 +31,11 @@
<artifactId>jpox</artifactId>
</dependency>
<dependency>
+ <groupId>bsh</groupId>
+ <artifactId>bsh</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ <dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>7.4</version>
@@ -46,6 +51,10 @@
<artifactId>plexus-security-osuser</artifactId>
</dependency>
<dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-osworkflow</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.maven.continuum</groupId>
<artifactId>continuum-test</artifactId>
<scope>test</scope>
diff --git a/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java b/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
index b084e85..5f25e97 100644
--- a/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
+++ b/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
@@ -19,14 +19,15 @@
import org.apache.maven.continuum.build.settings.SchedulesActivationException;
import org.apache.maven.continuum.build.settings.SchedulesActivator;
import org.apache.maven.continuum.buildqueue.BuildProjectTask;
+import org.apache.maven.continuum.configuration.ConfigurationException;
import org.apache.maven.continuum.configuration.ConfigurationLoadingException;
import org.apache.maven.continuum.configuration.ConfigurationService;
-import org.apache.maven.continuum.configuration.ConfigurationException;
import org.apache.maven.continuum.configuration.ConfigurationStoringException;
import org.apache.maven.continuum.core.action.AbstractContinuumAction;
import org.apache.maven.continuum.core.action.AddProjectToCheckOutQueueAction;
import org.apache.maven.continuum.core.action.CreateProjectsFromMetadata;
import org.apache.maven.continuum.core.action.StoreProjectAction;
+import org.apache.maven.continuum.core.workflow.ContinuumWorkflowEngine;
import org.apache.maven.continuum.initialization.ContinuumInitializationException;
import org.apache.maven.continuum.initialization.ContinuumInitializer;
import org.apache.maven.continuum.initialization.DefaultContinuumInitializer;
@@ -115,9 +116,10 @@
*/
private ContinuumSecurity security;
- // ----------------------------------------------------------------------
- // Moved from core
- // ----------------------------------------------------------------------
+ /**
+ * @plexus.requirement
+ */
+ private ContinuumWorkflowEngine workflowEngine;
/**
* @plexus.requirement
@@ -579,7 +581,23 @@
public ContinuumProjectBuildingResult addMavenTwoProject( String metadataUrl )
throws ContinuumException
{
- return executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID );
+ // old way
+// return executeAddProjectsFromMetadataActivity( metadataUrl, MavenTwoContinuumProjectBuilder.ID );
+
+ // new way - this should replace executeAddProjectsFromMetadataActivity()
+ // once it's fully working.
+
+ String username = null;
+
+ long workflowId = workflowEngine.addProjectsFromMetadata( username, MavenTwoContinuumProjectBuilder.ID,
+ metadataUrl, getWorkingDirectory(), false );
+
+ workflowEngine.waitForWorkflow( workflowId );
+
+ Map context = workflowEngine.getContext( workflowId );
+
+ return (ContinuumProjectBuildingResult)
+ context.get( CreateProjectsFromMetadata.KEY_PROJECT_BUILDING_RESULT );
}
// ----------------------------------------------------------------------
@@ -609,7 +627,7 @@
bd.setSchedule( schedule );
- project.addBuildDefinition( bd );
+ project.addBuildDefinition( bd );
}
catch ( ContinuumStoreException e )
{
@@ -673,17 +691,11 @@
executeAction( "create-projects-from-metadata", context );
- ContinuumProjectBuildingResult result = (ContinuumProjectBuildingResult) context.get(
- CreateProjectsFromMetadata.KEY_PROJECT_BUILDING_RESULT );
+ ContinuumProjectBuildingResult result = (ContinuumProjectBuildingResult)
+ context.get( CreateProjectsFromMetadata.KEY_PROJECT_BUILDING_RESULT );
- if ( result.getProjects() != null )
- {
- getLogger().info( "Created " + result.getProjects().size() + " projects." );
- }
- if ( result.getProjectGroups() != null )
- {
- getLogger().info( "Created " + result.getProjectGroups().size() + " project groups." );
- }
+ getLogger().info( "Created " + result.getProjects().size() + " projects." );
+ getLogger().info( "Created " + result.getProjectGroups().size() + " project groups." );
getLogger().info( result.getWarnings().size() + " warnings." );
// ----------------------------------------------------------------------
@@ -1018,7 +1030,7 @@
if ( buildDefinition.isDefaultForProject() && !bd.isDefaultForProject() )
{
bd.setDefaultForProject( true );
-
+
BuildDefinition defaultBd = getDefaultBuildDefinition( projectId );
if ( defaultBd != null )
@@ -1778,7 +1790,7 @@
throw new InitializationException( "Database is corrupted.", e );
}
}
-
+
getLogger().info( " " + project.getId() + ":" + project.getName() + ":" + project.getExecutorId() );
}
}
@@ -2035,14 +2047,9 @@
private boolean convertBoolean( String value )
{
- if ( "true".equalsIgnoreCase( value ) || "on".equalsIgnoreCase( value ) || "yes".equalsIgnoreCase( value ) )
- {
- return true;
- }
- else
- {
- return false;
- }
+ return "true".equalsIgnoreCase( value ) ||
+ "on".equalsIgnoreCase( value ) ||
+ "yes".equalsIgnoreCase( value );
}
private void startMessage()
diff --git a/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java b/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
index 29ac6da..dea295f 100644
--- a/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
+++ b/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
@@ -34,6 +34,8 @@
public void execute( Map context )
throws ContinuumException, ContinuumProjectBuilderManagerException, ContinuumProjectBuilderException
{
+ System.err.println( context.keySet().toString().replace( ',', '\n' ) );
+
String projectBuilderId = getString( context, KEY_PROJECT_BUILDER_ID );
String u = getString( context, KEY_URL );
@@ -76,5 +78,7 @@
}
context.put( KEY_PROJECT_BUILDING_RESULT, result );
+
+ System.err.println( "DONE BUILDING PROJECTS!" );
}
}
diff --git a/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java b/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java
new file mode 100644
index 0000000..f8bf259
--- /dev/null
+++ b/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java
@@ -0,0 +1,50 @@
+package org.apache.maven.continuum.core.workflow;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import org.apache.maven.continuum.ContinuumException;
+
+import java.util.Map;
+import java.util.List;
+
+import com.opensymphony.workflow.WorkflowException;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public interface ContinuumWorkflowEngine
+{
+ String ROLE = ContinuumWorkflowEngine.class.getName();
+
+ long addProjectsFromMetadata( String username, String builderId, String metadataUrl, String workingDirectory,
+ boolean userInteractive )
+ throws ContinuumException;
+
+ Map getContext( long workflowId )
+ throws ContinuumException;
+
+ void waitForWorkflow( long workflowId )
+ throws ContinuumException;
+
+ List getCurrentSteps( long workflowId )
+ throws ContinuumException;
+
+ void executeAction( long workflowId, int actionId, Map context )
+ throws ContinuumException;
+}
diff --git a/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java b/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java
new file mode 100644
index 0000000..79c9b77
--- /dev/null
+++ b/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java
@@ -0,0 +1,36 @@
+package org.apache.maven.continuum.core.workflow;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class ContinuumWorkflowEngineException
+ extends Exception
+{
+ public ContinuumWorkflowEngineException( String message )
+ {
+ super( message );
+ }
+
+ public ContinuumWorkflowEngineException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+}
diff --git a/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java b/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java
new file mode 100644
index 0000000..9fefc71
--- /dev/null
+++ b/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java
@@ -0,0 +1,139 @@
+package org.apache.maven.continuum.core.workflow;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import com.opensymphony.workflow.WorkflowException;
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.core.action.CreateProjectsFromMetadata;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.osworkflow.PlexusOSWorkflow;
+import org.codehaus.plexus.osworkflow.PropertySetMap;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class DefaultContinuumWorkflowEngine
+ extends AbstractLogEnabled
+ implements Initializable, ContinuumWorkflowEngine
+{
+ /**
+ * @plexus.requirement
+ */
+ private PlexusOSWorkflow workflow;
+
+ // ----------------------------------------------------------------------
+ // Component Lifecycle
+ // ----------------------------------------------------------------------
+
+ public void initialize()
+ throws InitializationException
+ {
+ }
+
+ // ----------------------------------------------------------------------
+ // ContinuumWorkflowEngine Implementation
+ // ----------------------------------------------------------------------
+
+ public long addProjectsFromMetadata( String username, String builderId, String metadataUrl, String workingDirectory,
+ boolean userInteractive )
+ throws ContinuumException
+ {
+ try
+ {
+ Map context = new HashMap();
+ context.put( CreateProjectsFromMetadata.KEY_PROJECT_BUILDER_ID, builderId );
+ context.put( CreateProjectsFromMetadata.KEY_URL, metadataUrl );
+ context.put( CreateProjectsFromMetadata.KEY_WORKING_DIRECTORY, workingDirectory );
+
+ return workflow.startWorkflow( "add-projects-from-metadata", username, context );
+ }
+ catch ( WorkflowException e )
+ {
+ throw new ContinuumException( "Error while starting workflow.", e );
+ }
+ }
+
+ public Map getContext( long workflowId )
+ throws ContinuumException
+ {
+ try
+ {
+ return new PropertySetMap( workflow.getContext( workflowId ) );
+ }
+ catch ( WorkflowException e )
+ {
+ throw new ContinuumException( "Error while getting the workflow context.", e );
+ }
+ }
+
+ public void waitForWorkflow( long workflowId )
+ throws ContinuumException
+ {
+ try
+ {
+ while( !workflow.isWorkflowDone( workflowId ) )
+ {
+ try
+ {
+ Thread.sleep( 100 );
+ }
+ catch ( InterruptedException e )
+ {
+ // continue
+ }
+ }
+ }
+ catch ( WorkflowException e )
+ {
+ throw new ContinuumException( "Error while waiting for workflow to complete", e );
+ }
+ }
+
+ public List getCurrentSteps( long workflowId )
+ throws ContinuumException
+ {
+ try
+ {
+ return workflow.getCurrentSteps( workflowId );
+ }
+ catch ( WorkflowException e )
+ {
+ throw new ContinuumException( "Error while getting the current steps for the workflow.", e );
+ }
+ }
+
+ public void executeAction( long workflowId, int actionId, Map context )
+ throws ContinuumException
+ {
+ try
+ {
+ workflow.doAction( workflowId, actionId, context );
+ }
+ catch ( WorkflowException e )
+ {
+ throw new ContinuumException( "Error while calling action.", e );
+ }
+ }
+}
diff --git a/continuum-core/src/main/resources/META-INF/plexus/components.xml b/continuum-core/src/main/resources/META-INF/plexus/components.xml
index a4d794d..cb748b7 100644
--- a/continuum-core/src/main/resources/META-INF/plexus/components.xml
+++ b/continuum-core/src/main/resources/META-INF/plexus/components.xml
@@ -17,6 +17,9 @@
<role>org.apache.maven.continuum.security.ContinuumSecurity</role>
</requirement>
<requirement>
+ <role>org.apache.maven.continuum.core.workflow.ContinuumWorkflowEngine</role>
+ </requirement>
+ <requirement>
<role>org.apache.maven.continuum.initialization.ContinuumInitializer</role>
</requirement>
<requirement>
@@ -66,6 +69,16 @@
</component>
<component>
+ <role>org.apache.maven.continuum.core.workflow.ContinuumWorkflowEngine</role>
+ <implementation>org.apache.maven.continuum.core.workflow.DefaultContinuumWorkflowEngine</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.osworkflow.PlexusOSWorkflow</role>
+ </requirement>
+ </requirements>
+ </component>
+
+ <component>
<role>org.apache.maven.continuum.initialization.ContinuumInitializer</role>
<implementation>org.apache.maven.continuum.initialization.DefaultContinuumInitializer</implementation>
<requirements>
diff --git a/continuum-core/src/main/resources/osworkflow.xml b/continuum-core/src/main/resources/osworkflow.xml
new file mode 100644
index 0000000..58510c4
--- /dev/null
+++ b/continuum-core/src/main/resources/osworkflow.xml
@@ -0,0 +1,22 @@
+<!--
+ ~ Copyright 2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<osworkflow>
+ <persistence class="com.opensymphony.workflow.spi.memory.MemoryWorkflowStore"/>
+ <factory class="com.opensymphony.workflow.loader.XMLWorkflowFactory">
+ <property key="resource" value="workflows.xml"/>
+ </factory>
+</osworkflow>
diff --git a/continuum-core/src/main/resources/workflows.xml b/continuum-core/src/main/resources/workflows.xml
new file mode 100644
index 0000000..a9ef95e
--- /dev/null
+++ b/continuum-core/src/main/resources/workflows.xml
@@ -0,0 +1,20 @@
+<!--
+ ~ Copyright 2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<workflows>
+ <workflow name="add-projects-from-metadata" type="resource" location="workflows/add-projects-from-metadata.xml"/>
+</workflows>
diff --git a/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml b/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml
new file mode 100644
index 0000000..016fbe6
--- /dev/null
+++ b/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE workflow PUBLIC "-//OpenSymphony Group//DTD OSWorkflow 2.8//EN" "http://www.opensymphony.com/osworkflow/workflow_2_8.dtd">
+<workflow>
+ <meta name="lastModified">Sun Jan 08 00:39:25 CET 2006</meta>
+ <meta name="generator">OSWOrkflow Designer</meta>
+ <registers>
+ <register type="class" variable-name="log">
+ <arg name="class.name">com.opensymphony.workflow.util.LogRegister</arg>
+ <arg name="addInstanceId">true</arg>
+ </register>
+ </registers>
+ <initial-actions>
+ <action id="1" name="Start Workflow">
+ <pre-functions>
+ <function type="beanshell">
+ <arg name="script"><![CDATA[
+ System.out.println( "Transient vars:" );
+ System.out.println( transientVars );
+ System.out.println( "Property set:" );
+ System.out.println( propertySet );
+ ]]></arg>
+ </function>
+ </pre-functions>
+ <results>
+ <unconditional-result id="4" old-status="Finished" status="Started" step="1"/>
+ </results>
+ </action>
+ </initial-actions>
+ <steps>
+ <step id="1" name="Create Projects From Metadata">
+ <actions>
+ <action id="1" name="Start" auto="true">
+ <pre-functions>
+ <function type="class">
+ <arg name="class.name">org.codehaus.plexus.osworkflow.PlexusActionFunctionProvider</arg>
+ <arg name="action.name">create-projects-from-metadata</arg>
+ </function>
+ </pre-functions>
+ <results>
+ <result id="3" old-status="Creating Projects" status="Got warnings while downloading, waiting for user input" step="2">
+ <conditions>
+ <condition type="beanshell">
+ <arg name="script"><![CDATA[
+ userInteractive = propertySet.getBoolean( "userInteractive" );
+ projectBuildingResult = propertySet.getObject( "projectBuildingResult" );
+ return userInteractive && projectBuildingResult.getWarnings().size() > 0;
+ ]]></arg>
+ </condition>
+ </conditions>
+ </result>
+ <unconditional-result id="1" old-status="Created" status="Finished" step="1000"/>
+ </results>
+ <post-functions>
+ <function type="beanshell">
+ <arg name="script"><![CDATA[
+ projectBuildingResult = propertySet.getObject( "projectBuildingResult" );
+ System.err.println( "Created " + projectBuildingResult.getProjects().size() + " projects." );
+ System.err.println( "Created " + projectBuildingResult.getProjectGroups().size() + " project groups." );
+ System.err.println( "Got " + projectBuildingResult.getWarnings().size() + " warnings." );
+ ]]></arg>
+ </function>
+ </post-functions>
+ </action>
+ </actions>
+ </step>
+ <step id="2" name="Wait For Project Verification">
+ <actions>
+ <action id="2" name="Start">
+ <pre-functions>
+ <function type="beanshell">
+ <arg name="script"><![CDATA[
+ System.out.println( "Step Wait For Project Verification" );
+ ]]></arg>
+ </function>
+ </pre-functions>
+ <results>
+ <unconditional-result id="2" old-status="Created" status="Finished" step="1000"/>
+ </results>
+ </action>
+ </actions>
+ </step>
+<!--
+ <step id="1001" name="Validate Project">
+ <actions>
+ <action id="1005" name="Validate Projects">
+ <results>
+ <unconditional-result id="1012" old-status="Finished" status="Queued" step="1002"/>
+ </results>
+ </action>
+ </actions>
+ </step>
+ <step id="1002" name="Store Project">
+ <actions>
+ <action id="1009" name="Store Project">
+ <results>
+ <unconditional-result id="1004" old-status="Finished" status="Queued" step="1000"/>
+ </results>
+ </action>
+ </actions>
+ </step>
+-->
+ <step id="1000" name="Finished">
+ <pre-functions>
+ <function type="beanshell">
+ <arg name="script"><![CDATA[
+ System.out.println( "Workflow done." );
+ ]]></arg>
+ </function>
+ </pre-functions>
+ </step>
+ </steps>
+</workflow>
diff --git a/continuum-core/src/test-projects/project2/pom.xml b/continuum-core/src/test-projects/project2/pom.xml
index a1d1689..569dc6d 100644
--- a/continuum-core/src/test-projects/project2/pom.xml
+++ b/continuum-core/src/test-projects/project2/pom.xml
@@ -9,4 +9,4 @@
<connection>scm:cvs:local:ignores:/cvs/root:project2</connection>
<url>http://cvs.plexus.codehaus.org/plexus-components/native/continuum/src/test-projects/project2</url>
</scm>
-</model>
\ No newline at end of file
+</model>
diff --git a/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java b/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
index 118b04c..8adaf3a 100644
--- a/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
+++ b/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
@@ -127,6 +127,6 @@
continuum.updateProject( project );
- project = continuum.getProject( project.getId() );
+ continuum.getProject( project.getId() );
}
}
diff --git a/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java b/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java
new file mode 100644
index 0000000..0ff5a1e
--- /dev/null
+++ b/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java
@@ -0,0 +1,49 @@
+package org.apache.maven.continuum.core.workflow;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import org.apache.maven.continuum.project.builder.maven.MavenTwoContinuumProjectBuilder;
+import org.codehaus.plexus.PlexusTestCase;
+
+import java.io.File;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class ContinuumWorkflowEngineTest
+ extends PlexusTestCase
+{
+ public void testAddMavenTwoProjectWithWarnings()
+ throws Exception
+ {
+ ContinuumWorkflowEngine workflowEngine = (ContinuumWorkflowEngine) lookup( ContinuumWorkflowEngine.ROLE );
+
+ File pom = getTestFile( "src/test/resources/projects/pom-with-warnings.xml" );
+
+ long workflowId = workflowEngine.addProjectsFromMetadata( null, MavenTwoContinuumProjectBuilder.ID,
+ pom.toURL().toExternalForm(),
+ getTestPath( "target/workingdirectory" ), true );
+
+ System.out.println( "workflowId = " + workflowId );
+ // TODO: Assert projects, projectGroups and warnings lists from the context
+
+ workflowEngine.executeAction( workflowId, 2, new HashMap() );
+ }
+}
diff --git a/continuum-core/src/test/resources/log4j.properties b/continuum-core/src/test/resources/log4j.properties
index 1b85689..2a24609 100644
--- a/continuum-core/src/test/resources/log4j.properties
+++ b/continuum-core/src/test/resources/log4j.properties
@@ -4,6 +4,7 @@
log4j.appender.root.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n
# JPOX Categories
+log4j.category=INFO, root
#log4j.category.JPOX=WARN, root
log4j.category.JPOX.RDBMS=ERROR, root
#log4j.category.JPOX.RDBMS.Schema=WARN, root
diff --git a/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml b/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
index 4176c2e..339a976 100644
--- a/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
+++ b/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
@@ -1,27 +1,4 @@
<plexus>
<components>
- <component>
- <role>org.codehaus.plexus.notification.RecipientSource</role>
- <implementation>org.apache.maven.continuum.notification.ContinuumRecipientSource</implementation>
- <configuration>
- <toOverride>nobody@localhost</toOverride>
- </configuration>
- </component>
- <!--
- |
- | These point to the flows that we use as part of the runtime.
- |
- | TODO: these should probably be packaged in the core package but the plexus-osworkflow package would
- | need to be modified in order to find them all packaged in the JAR.
- |
- -->
- <component>
- <role>org.codehaus.plexus.osworkflow.WorkflowEngine</role>
- <implementation>org.codehaus.plexus.osworkflow.DefaultWorkflowEngine</implementation>
- <configuration>
- <workflowDirectory>${basedir}/../continuum-plexus-application/src/conf/workflows</workflowDirectory>
- </configuration>
- </component>
-
</components>
</plexus>
diff --git a/continuum-core/src/test/resources/projects/pom-with-warnings.xml b/continuum-core/src/test/resources/projects/pom-with-warnings.xml
new file mode 100644
index 0000000..146d42b
--- /dev/null
+++ b/continuum-core/src/test/resources/projects/pom-with-warnings.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ Copyright 2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <!-- <groupId></groupId> groupId is missing :) -->
+ <artifactId>my-artifact</artifactId>
+ <version>1.0</version>
+</project>
diff --git a/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java b/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
index b54507f..5bf22b8 100644
--- a/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
+++ b/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
@@ -171,12 +171,11 @@
if ( result != null && !result.isEmpty() )
{
- getLogger().info( "nb result : " + result.size() );
for ( Iterator i = result.iterator(); i.hasNext(); )
{
Object[] obj = (Object[]) i.next();
- projects.put( (Integer) obj[0], (Integer) obj[1] );
+ projects.put( obj[0], obj[1] );
}
return projects;
@@ -439,7 +438,7 @@
{
Object[] obj = (Object[]) i.next();
- builds.put( (Integer) obj[0], (Integer) obj[1] );
+ builds.put( obj[0], obj[1] );
}
return builds;
@@ -1032,11 +1031,6 @@
return getAllObjectsDetached( clazz, null );
}
- private List getAllObjectsDetached( Class clazz, String fetchGroup )
- {
- return getAllObjectsDetached( clazz, null, fetchGroup );
- }
-
private List getAllObjectsDetached( Class clazz, String ordering, String fetchGroup )
{
PersistenceManager pm = pmf.getPersistenceManager();
diff --git a/continuum-test/src/main/resources/META-INF/plexus/components.xml b/continuum-test/src/main/resources/META-INF/plexus/components.xml
index 0e38d67..5e2e6b0 100644
--- a/continuum-test/src/main/resources/META-INF/plexus/components.xml
+++ b/continuum-test/src/main/resources/META-INF/plexus/components.xml
@@ -1,8 +1,68 @@
<component-set>
<components>
<component>
+ <role>org.codehaus.plexus.notification.RecipientSource</role>
+ <implementation>org.apache.maven.continuum.notification.ContinuumRecipientSource</implementation>
+ <configuration>
+ <toOverride>nobody@localhost</toOverride>
+ </configuration>
+ </component>
+ <component>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
- <implementation>org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory</implementation>
+ <implementation>org.codehaus.plexus.jdo.DefaultJdoFactory</implementation>
+ <configuration>
+ <properties>
+ <!-- JPOX and JDO configuration -->
+ <property>
+ <name>javax.jdo.PersistenceManagerFactoryClass</name>
+ <value>org.jpox.PersistenceManagerFactoryImpl</value>
+ </property>
+ <property>
+ <name>org.jpox.autoCreateSchema</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>org.jpox.autoStartMechanism</name>
+ <value>SchemaTable</value>
+ </property>
+ <property>
+ <name>org.jpox.autoStartMechanismMode</name>
+ <value>Ignored</value>
+ </property>
+ <property>
+ <name>javax.jdo.option.ConnectionDriverName</name>
+ <value>org.hsqldb.jdbcDriver</value>
+ </property>
+ <property>
+ <name>javax.jdo.option.ConnectionURL</name>
+ <value>jdbc:hsqldb:${plexus.home}/database</value>
+ </property>
+ <property>
+ <name>javax.jdo.option.ConnectionUserName</name>
+ <value>sa</value>
+ </property>
+ <property>
+ <name>javax.jdo.option.ConnectionPassword</name>
+ <value></value>
+ </property>
+ <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>org.jpox.transactionIsolation</name>
+ <value>READ_UNCOMMITTED</value>
+ </property>
+ <property>
+ <name>org.jpox.poid.transactionIsolation</name>
+ <value>READ_UNCOMMITTED</value>
+ </property>
+ </properties>
+ </configuration>
</component>
</components>
</component-set>
diff --git a/pom.xml b/pom.xml
index 49fd47b..68893a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -383,6 +383,16 @@
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-security</artifactId>
+ <version>1.0-alpha-2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-osworkflow</artifactId>
+ <version>1.0-alpha-1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-security-api</artifactId>
<version>1.0-alpha-3-SNAPSHOT</version>
</dependency>
@@ -420,4 +430,4 @@
<url>scp://repo1.maven.org/home/projects/maven/repository-staging/snapshots/maven2</url>
</snapshotRepository>
</distributionManagement>
-</project>
\ No newline at end of file
+</project>