continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tryg...@apache.org
Subject svn commit: r369252 - in /maven/continuum/branches/osworkflow-integration: ./ continuum-core/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ continuum-core/src/main/java/org...
Date Sun, 15 Jan 2006 19:20:18 GMT
Author: trygvis
Date: Sun Jan 15 11:19:17 2006
New Revision: 369252

URL: http://svn.apache.org/viewcvs?rev=369252&view=rev
Log:
o Adding my OSWorkflow work. THIS IS NOT WORKING CODE just yet.

Added:
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java   (with props)
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java   (with props)
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java   (with props)
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/osworkflow.xml   (with props)
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows/
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows.xml   (with props)
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml   (with props)
    maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/core/
    maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/
    maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java   (with props)
    maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/projects/pom-with-warnings.xml   (with props)
Modified:
    maven/continuum/branches/osworkflow-integration/continuum-core/pom.xml
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
    maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/branches/osworkflow-integration/continuum-core/src/test-projects/project2/pom.xml
    maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
    maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/log4j.properties
    maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
    maven/continuum/branches/osworkflow-integration/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    maven/continuum/branches/osworkflow-integration/continuum-test/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/branches/osworkflow-integration/pom.xml

Modified: maven/continuum/branches/osworkflow-integration/continuum-core/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/pom.xml?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/pom.xml (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/pom.xml Sun Jan 15 11:19:17 2006
@@ -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>
@@ -44,6 +49,10 @@
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-security-osuser</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-osworkflow</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.continuum</groupId>

Modified: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Sun Jan 15 11:19:17 2006
@@ -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()

Modified: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadata.java Sun Jan 15 11:19:17 2006
@@ -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!" );
     }
 }

Added: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java?rev=369252&view=auto
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java (added)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java Sun Jan 15 11:19:17 2006
@@ -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&oslash;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;
+}

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngine.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java?rev=369252&view=auto
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java (added)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java Sun Jan 15 11:19:17 2006
@@ -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&oslash;l</a>
+ * @version $Id$
+ */
+public class ContinuumWorkflowEngineException
+    extends Exception
+{
+    public ContinuumWorkflowEngineException( String message )
+    {
+        super( message );
+    }
+
+    public ContinuumWorkflowEngineException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineException.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java?rev=369252&view=auto
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java (added)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java Sun Jan 15 11:19:17 2006
@@ -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&oslash;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 );
+        }
+    }
+}

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/workflow/DefaultContinuumWorkflowEngine.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml Sun Jan 15 11:19:17 2006
@@ -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>
@@ -61,6 +64,16 @@
       <requirements>
         <requirement>
           <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+      </requirements>
+    </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>

Added: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/osworkflow.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/osworkflow.xml?rev=369252&view=auto
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/osworkflow.xml (added)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/osworkflow.xml Sun Jan 15 11:19:17 2006
@@ -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>

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/osworkflow.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/osworkflow.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows.xml?rev=369252&view=auto
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows.xml (added)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows.xml Sun Jan 15 11:19:17 2006
@@ -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>

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml?rev=369252&view=auto
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml (added)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml Sun Jan 15 11:19:17 2006
@@ -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>

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/main/resources/workflows/add-projects-from-metadata.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: maven/continuum/branches/osworkflow-integration/continuum-core/src/test-projects/project2/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/test-projects/project2/pom.xml?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/test-projects/project2/pom.xml (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/test-projects/project2/pom.xml Sun Jan 15 11:19:17 2006
@@ -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>

Modified: maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumTest.java Sun Jan 15 11:19:17 2006
@@ -127,6 +127,6 @@
 
         continuum.updateProject( project );
 
-        project = continuum.getProject( project.getId() );
+        continuum.getProject( project.getId() );
     }
 }

Added: maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java?rev=369252&view=auto
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java (added)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java Sun Jan 15 11:19:17 2006
@@ -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&oslash;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() );
+    }
+}

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/test/java/org/apache/maven/continuum/core/workflow/ContinuumWorkflowEngineTest.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/log4j.properties?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/log4j.properties (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/log4j.properties Sun Jan 15 11:19:17 2006
@@ -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

Modified: maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml Sun Jan 15 11:19:17 2006
@@ -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>

Added: maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/projects/pom-with-warnings.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/projects/pom-with-warnings.xml?rev=369252&view=auto
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/projects/pom-with-warnings.xml (added)
+++ maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/projects/pom-with-warnings.xml Sun Jan 15 11:19:17 2006
@@ -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>

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/projects/pom-with-warnings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/osworkflow-integration/continuum-core/src/test/resources/projects/pom-with-warnings.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: maven/continuum/branches/osworkflow-integration/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java Sun Jan 15 11:19:17 2006
@@ -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;
@@ -1030,11 +1029,6 @@
     private List getAllObjectsDetached( Class clazz )
     {
         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 )

Modified: maven/continuum/branches/osworkflow-integration/continuum-test/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/continuum-test/src/main/resources/META-INF/plexus/components.xml?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/continuum-test/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/continuum/branches/osworkflow-integration/continuum-test/src/main/resources/META-INF/plexus/components.xml Sun Jan 15 11:19:17 2006
@@ -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>

Modified: maven/continuum/branches/osworkflow-integration/pom.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/osworkflow-integration/pom.xml?rev=369252&r1=369251&r2=369252&view=diff
==============================================================================
--- maven/continuum/branches/osworkflow-integration/pom.xml (original)
+++ maven/continuum/branches/osworkflow-integration/pom.xml Sun Jan 15 11:19:17 2006
@@ -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>



Mime
View raw message