continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r220106 - in /maven/continuum/trunk/continuum-core/src: main/java/org/apache/maven/continuum/initialization/ main/resources/META-INF/plexus/ test/java/org/apache/maven/continuum/store/
Date Thu, 21 Jul 2005 15:30:29 GMT
Author: jvanzyl
Date: Thu Jul 21 08:30:28 2005
New Revision: 220106

URL: http://svn.apache.org/viewcvs?rev=220106&view=rev
Log:
o adding a typical usage test case to exercise the model and make sure it
all works before working on the UI counterpart.

Added:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializationException.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/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
Modified:
    maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml

Added: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializationException.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializationException.java?rev=220106&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializationException.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializationException.java
Thu Jul 21 08:30:28 2005
@@ -0,0 +1,40 @@
+package org.apache.maven.continuum.initialization;
+
+/*
+ * Copyright 2004-2005 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:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:$
+ */
+public class ContinuumInitializationException
+    extends Exception
+{
+    public ContinuumInitializationException( String message )
+    {
+        super( message );
+    }
+
+    public ContinuumInitializationException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public ContinuumInitializationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Added: 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=220106&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializer.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/ContinuumInitializer.java
Thu Jul 21 08:30:28 2005
@@ -0,0 +1,32 @@
+package org.apache.maven.continuum.initialization;
+
+import org.apache.maven.continuum.project.ContinuumProjectGroup;
+import org.apache.maven.continuum.project.ContinuumBuildSettings;
+
+/*
+ * Copyright 2004-2005 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:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:$
+ */
+public interface ContinuumInitializer
+{
+    String ROLE = ContinuumInitializer.class.getName();
+
+    void initialize()
+        throws ContinuumInitializationException;
+}

Added: 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=220106&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
(added)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/initialization/DefaultContinuumInitializer.java
Thu Jul 21 08:30:28 2005
@@ -0,0 +1,123 @@
+package org.apache.maven.continuum.initialization;
+
+import org.apache.maven.continuum.project.ContinuumProjectGroup;
+import org.apache.maven.continuum.project.ContinuumBuildSettings;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.apache.maven.continuum.build.settings.BuildSettingsConstants;
+
+/*
+ * Copyright 2004-2005 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:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:$
+ */
+public class DefaultContinuumInitializer
+    implements ContinuumInitializer
+{
+    // ----------------------------------------------------------------------
+    // Default values for the default project group
+    // ----------------------------------------------------------------------
+
+    public static final String DEFAULT_PROJECT_GROUP_NAME = "DEFAULT_PROJECT_GROUP";
+
+    public static final String DEFAULT_PROJECT_GROUP_ID = "DEFAULT";
+
+    public static final String DEFAULT_PROJECT_GROUP_DESCRIPTION = "Default Project Group";
+
+    // ----------------------------------------------------------------------
+    // Default values for the default build settings
+    // ----------------------------------------------------------------------
+
+    public static final String DEFAULT_BUILD_SETTINGS_NAME = "DEFAULT_BUILD_SETTINGS";
+
+    // ----------------------------------------------------------------------
+    //  Requirements
+    // ----------------------------------------------------------------------
+
+    /** @plexus.requirement */
+    private ContinuumStore store;
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    public void initialize()
+        throws ContinuumInitializationException
+    {
+        ContinuumBuildSettings defaultBuildSettings = createDefaultBuildSettings();
+
+        try
+        {
+            store.addBuildSettings( defaultBuildSettings );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumInitializationException( "Error storing default Continuum
build settings.", e );
+        }
+
+        ContinuumProjectGroup defaultProjectGroup = createDefaultProjectGroup();
+
+        defaultProjectGroup.addBuildSetting( defaultBuildSettings );
+
+        try
+        {
+            store.addProjectGroup( defaultProjectGroup );
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new ContinuumInitializationException( "Error storing default Continuum
project group.", e );
+        }
+    }
+
+    // ----------------------------------------------------------------------
+    //
+    // ----------------------------------------------------------------------
+
+    public ContinuumProjectGroup createDefaultProjectGroup()
+        throws ContinuumInitializationException
+    {
+        ContinuumProjectGroup projectGroup = new ContinuumProjectGroup();
+
+        projectGroup.setName( DEFAULT_PROJECT_GROUP_NAME );
+
+        projectGroup.setGroupId( DEFAULT_PROJECT_GROUP_ID );
+
+        projectGroup.setDescription( DEFAULT_PROJECT_GROUP_DESCRIPTION );
+
+        return projectGroup;
+    }
+
+    public ContinuumBuildSettings createDefaultBuildSettings()
+        throws ContinuumInitializationException
+    {
+        ContinuumBuildSettings buildSettings = new ContinuumBuildSettings();
+
+        buildSettings.setName( DEFAULT_BUILD_SETTINGS_NAME );
+
+        buildSettings.setNotificationScheme( BuildSettingsConstants.NOTIFICATION_STRATEGY_ON_FAILURE
);
+
+        buildSettings.setLabelingScheme( BuildSettingsConstants.LABELLING_STRATEGY_NEVER
);
+
+        buildSettings.setScmMode( BuildSettingsConstants.SCM_MODE_UPDATE );
+
+        // Setting the jdk version to null means fall back to the default JAVA_HOME.
+        buildSettings.setJdkVersion( null );
+
+        return buildSettings;
+    }
+}

Modified: maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml?rev=220106&r1=220105&r2=220106&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/main/resources/META-INF/plexus/components.xml
Thu Jul 21 08:30:28 2005
@@ -43,6 +43,16 @@
     </component>
 
     <component>
+      <role>org.apache.maven.continuum.initialization.ContinuumInitializer</role>
+      <implementation>org.apache.maven.continuum.initialization.DefaultContinuumInitializer</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+      </requirements>
+    </component>
+
+    <component>
       <role>org.apache.maven.continuum.Continuum</role>
       <implementation>org.apache.maven.continuum.DefaultContinuum</implementation>
       <requirements>

Added: 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=220106&view=auto
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
(added)
+++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/store/ContinuumTypicalUsageTest.java
Thu Jul 21 08:30:28 2005
@@ -0,0 +1,46 @@
+package org.apache.maven.continuum.store;
+
+import org.apache.maven.continuum.AbstractContinuumTest;
+import org.apache.maven.continuum.initialization.ContinuumInitializer;
+
+/*
+ * Copyright 2004-2005 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:jason@maven.org">Jason van Zyl</a>
+ * @version $Id:$
+ */
+public class ContinuumTypicalUsageTest
+    extends AbstractContinuumTest
+{
+    // ----------------------------------------------------------------------
+    // 1. Create the default project group
+    // 2. Create the default build settings
+    // ----------------------------------------------------------------------
+
+    public void testContinuumTypicalUsage()
+        throws Exception
+    {
+        // ----------------------------------------------------------------------
+        // Simulate the initial running of the system which will create the
+        // default project group and the default build settings.
+        // ----------------------------------------------------------------------
+
+        ContinuumInitializer initializer = (ContinuumInitializer) lookup( ContinuumInitializer.ROLE
);
+
+        initializer.initialize();
+    }
+}



Mime
View raw message