continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r220169 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/build/settings/ continuum-core/src/main/java/org/apache/maven/continuum/initialization/ continuum-core/src/main/java/org/apache/maven/continuum/trig...
Date Thu, 21 Jul 2005 19:07:10 GMT
Author: jvanzyl
Date: Thu Jul 21 12:07:08 2005
New Revision: 220169

URL: http://svn.apache.org/viewcvs?rev=220169&view=rev
Log:
o building up the usage test case

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/BuildSettingsConstants.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializer.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/quartz/QuartzAlarmClockTrigger.java
    maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/BuildSettingsConstants.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/BuildSettingsConstants.java?rev=220169&r1=220168&r2=220169&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/BuildSettingsConstants.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/build/settings/BuildSettingsConstants.java
Thu Jul 21 12:07:08 2005
@@ -50,4 +50,7 @@
 
     public static final int SCM_MODE_UPDATE = 1;
 
+    // ----------------------------------------------------------------------
+    // Cron scheduling
+    // ----------------------------------------------------------------------
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializer.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializer.java?rev=220169&r1=220168&r2=220169&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializer.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializer.java
Thu Jul 21 12:07:08 2005
@@ -29,4 +29,8 @@
 
     void initialize()
         throws ContinuumInitializationException;
+
+    ContinuumProjectGroup getDefaultProjectGroup();
+
+    ContinuumBuildSettings getDefaultBuildSettings();
 }

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java?rev=220169&r1=220168&r2=220169&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
Thu Jul 21 12:07:08 2005
@@ -45,6 +45,17 @@
 
     public static final String DEFAULT_BUILD_SETTINGS_NAME = "DEFAULT_BUILD_SETTINGS";
 
+    // Cron expression for execution every hour.
+    public static final String DEFAULT_BUILD_SETTINGS_CRON_EXPRESSION = "0 0 * * * ?";
+
+    // ----------------------------------------------------------------------
+    // Default project group and build settings
+    // ----------------------------------------------------------------------
+
+    private ContinuumProjectGroup defaultProjectGroup;
+
+    private ContinuumBuildSettings defaultBuildSettings;
+
     // ----------------------------------------------------------------------
     //  Requirements
     // ----------------------------------------------------------------------
@@ -59,24 +70,28 @@
     public void initialize()
         throws ContinuumInitializationException
     {
-        ContinuumBuildSettings defaultBuildSettings = createDefaultBuildSettings();
+        defaultBuildSettings = createDefaultBuildSettings();
 
         try
         {
-            store.addBuildSettings( defaultBuildSettings );
+            String id = store.addBuildSettings( defaultBuildSettings );
+
+            defaultBuildSettings = store.getBuildSettings( id );
         }
         catch ( ContinuumStoreException e )
         {
             throw new ContinuumInitializationException( "Error storing default Continuum
build settings.", e );
         }
 
-        ContinuumProjectGroup defaultProjectGroup = createDefaultProjectGroup();
+        defaultProjectGroup = createDefaultProjectGroup();
 
         defaultProjectGroup.addBuildSetting( defaultBuildSettings );
 
         try
         {
-            store.addProjectGroup( defaultProjectGroup );
+            String id = store.addProjectGroup( defaultProjectGroup );
+
+            defaultProjectGroup = store.getProjectGroup( id );
         }
         catch ( ContinuumStoreException e )
         {
@@ -84,6 +99,16 @@
         }
     }
 
+    public ContinuumProjectGroup getDefaultProjectGroup()
+    {
+        return defaultProjectGroup;
+    }
+
+    public ContinuumBuildSettings getDefaultBuildSettings()
+    {
+        return defaultBuildSettings;
+    }
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -114,6 +139,8 @@
         buildSettings.setLabelingScheme( BuildSettingsConstants.LABELLING_STRATEGY_NEVER
);
 
         buildSettings.setScmMode( BuildSettingsConstants.SCM_MODE_UPDATE );
+
+        buildSettings.setCronExpression( DEFAULT_BUILD_SETTINGS_CRON_EXPRESSION );
 
         // Setting the jdk version to null means fall back to the default JAVA_HOME.
         buildSettings.setJdkVersion( null );

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/quartz/QuartzAlarmClockTrigger.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/quartz/QuartzAlarmClockTrigger.java?rev=220169&r1=220168&r2=220169&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/quartz/QuartzAlarmClockTrigger.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/trigger/quartz/QuartzAlarmClockTrigger.java
Thu Jul 21 12:07:08 2005
@@ -96,7 +96,7 @@
 
         try
         {
-            trigger.setCronExpression( "0 * * * * ?" );
+            trigger.setCronExpression( "0 0 * * * ?" );
         }
         catch ( ParseException e )
         {

Modified: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java?rev=220169&r1=220168&r2=220169&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
(original)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
Thu Jul 21 12:07:08 2005
@@ -1,7 +1,10 @@
 package org.apache.maven.continuum.store;
 
 import org.apache.maven.continuum.AbstractContinuumTest;
+import org.apache.maven.continuum.project.ContinuumProject;
+import org.apache.maven.continuum.project.ContinuumProjectGroup;
 import org.apache.maven.continuum.initialization.ContinuumInitializer;
+import org.apache.maven.continuum.initialization.DefaultContinuumInitializer;
 
 /*
  * Copyright 2004-2005 The Apache Software Foundation.
@@ -26,9 +29,27 @@
 public class ContinuumTypicalUsageTest
     extends AbstractContinuumTest
 {
+    // !! as part of creating the build settings a build job needs to be scheduled
+    // and we need to control the activation of the build settings.
+
+    // I can specify the class of the job and have a test job
+    // I can set a job listener here
+    // figure out when the job is done and make sure the mechanism works
+    // then we can figure out how to get projects into the right groups.
+    // create a project group for all projects with X groupId
+
     // ----------------------------------------------------------------------
-    // 1. Create the default project group
-    // 2. Create the default build settings
+    // 1. Initialize Continuum
+    //    -> create default build settings
+    //    -> create default project group
+    //    -> default build settings are added to the project group
+    //
+    // 2. Create a project
+    //
+    // 3. Add the project to the default project group
+    //
+    // 4.
+
     // ----------------------------------------------------------------------
 
     public void testContinuumTypicalUsage()
@@ -42,5 +63,31 @@
         ContinuumInitializer initializer = (ContinuumInitializer) lookup( ContinuumInitializer.ROLE
);
 
         initializer.initialize();
+
+        ContinuumProjectGroup defaultProjectGroup = initializer.getDefaultProjectGroup();
+
+        // ----------------------------------------------------------------------
+        // At this point we can now accept new projects into the system
+        // ----------------------------------------------------------------------
+
+        ContinuumProject project = makeStubMavenTwoProject( "test1", "scm:url" );
+
+        String projectId = addMavenTwoProject( getStore(), project );
+
+        project = getStore().getProject( projectId );
+
+        // ----------------------------------------------------------------------
+        // Now that we have a project we want to add it to the default project group
+        // ----------------------------------------------------------------------
+
+        defaultProjectGroup.addProject( project );
+
+        getStore().updateProjectGroup( defaultProjectGroup );
+
+        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_NAME,   project.getProjectGroup().getName()
);
+
+        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_DESCRIPTION,   project.getProjectGroup().getDescription()
);
+
+        assertEquals( DefaultContinuumInitializer.DEFAULT_PROJECT_GROUP_ID,   project.getProjectGroup().getGroupId()
);
     }
 }



Mime
View raw message