avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject svn commit: rev 21618 - in avalon/trunk/tools/magic: . etc/test etc/test/demo etc/test/demo/gizmo etc/test/demo/gizmo/src etc/test/demo/gizmo/src/main etc/test/demo/gizmo/src/main/org etc/test/demo/gizmo/src/main/org/apache etc/test/demo/gizmo/src/main/org/apache/playground etc/test/demo/gizmo/src/main/org/apache/playground/gizmo etc/test/demo/gizmo/src/test etc/test/demo/gizmo/src/test/org etc/test/demo/gizmo/src/test/org/apache etc/test/demo/gizmo/src/test/org/apache/playground etc/test/demo/gizmo/src/test/org/apache/playground/gizmo etc/test/demo/gizmo/src/test/org/apache/playground/gizmo/test etc/test/demo/widget etc/test/demo/widget/src etc/test/demo/widget/src/main etc/test/demo/widget/src/main/org etc/test/demo/widget/src/main/org/apache etc/test/demo/widget/src/main/org/apache/playground etc/test/demo/widget/src/main/org/apache/playground/widget etc/test/demo/widget/src/test etc/test/demo/widget/src/test/org etc/test/demo/widget/src/test/org/apache etc/test/demo/widget/src/test/org/apache/playground etc/test/demo/widget/src/test/org/apache/playground/widget etc/test/demo/widget/src/test/org/apache/playground/widget/test src/main/org/apache/avalon/tools/model
Date Thu, 24 Jun 2004 04:02:55 GMT
Author: mcconnell
Date: Wed Jun 23 21:02:54 2004
New Revision: 21618

Added:
   avalon/trunk/tools/magic/etc/test/
   avalon/trunk/tools/magic/etc/test/demo/
   avalon/trunk/tools/magic/etc/test/demo/build.xml
   avalon/trunk/tools/magic/etc/test/demo/gizmo/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/build.xml
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/main/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/main/org/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/main/org/apache/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/main/org/apache/playground/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/main/org/apache/playground/gizmo/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/main/org/apache/playground/gizmo/Gizmo.java
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/test/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/test/org/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/test/org/apache/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/test/org/apache/playground/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/test/org/apache/playground/gizmo/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/test/org/apache/playground/gizmo/test/
   avalon/trunk/tools/magic/etc/test/demo/gizmo/src/test/org/apache/playground/gizmo/test/GizmoTestCase.java
   avalon/trunk/tools/magic/etc/test/demo/index.xml
   avalon/trunk/tools/magic/etc/test/demo/widget/
   avalon/trunk/tools/magic/etc/test/demo/widget/build.xml
   avalon/trunk/tools/magic/etc/test/demo/widget/src/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/main/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/main/org/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/main/org/apache/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/main/org/apache/playground/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/main/org/apache/playground/widget/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/main/org/apache/playground/widget/Widget.java
   avalon/trunk/tools/magic/etc/test/demo/widget/src/test/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/test/org/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/test/org/apache/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/test/org/apache/playground/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/test/org/apache/playground/widget/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/test/org/apache/playground/widget/test/
   avalon/trunk/tools/magic/etc/test/demo/widget/src/test/org/apache/playground/widget/test/WidgetTestCase.java
Modified:
   avalon/trunk/tools/magic/build.xml
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java
Log:
add an example of a magic based project

Modified: avalon/trunk/tools/magic/build.xml
==============================================================================
--- avalon/trunk/tools/magic/build.xml	(original)
+++ avalon/trunk/tools/magic/build.xml	Wed Jun 23 21:02:54 2004
@@ -7,14 +7,21 @@
 
   <import file="${magic.templates}/standard.xml"/>
 
-  <target name="package" depends="standard.package">
-    <x:bar name="avalon-tools.bar"/>
-  </target>
-
   <target name="javadoc" depends="prepare">
     <x:javadoc title="Avalon Magic" id="avalon-tools-magic">
       <x:link href="http://java.sun.com/j2se/1.4/docs/api" />
     </x:javadoc>
+  </target>
+
+  <target name="test" depends="standard.test">
+    <ant dir="target/test/temp/demo" target="test"/>
+    <mkdir dir="${basedir}/target/deliverables/demos"/>
+    <zip destfile="${basedir}/target/deliverables/demos/demo.zip"
+      basedir="etc/test/demo"/>
+  </target>
+
+  <target name="package" depends="standard.package">
+    <x:bar name="avalon-tools.bar"/>
   </target>
 
   <target name="install" depends="standard.install">

Added: avalon/trunk/tools/magic/etc/test/demo/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/etc/test/demo/build.xml	Wed Jun 23 21:02:54 2004
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="demo" default="install" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <x:home index="."/>
+  <import file="${magic.templates}/reactor.xml"/>
+
+</project>

Added: avalon/trunk/tools/magic/etc/test/demo/gizmo/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/etc/test/demo/gizmo/build.xml	Wed Jun 23 21:02:54 2004
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="gizmo" default="install" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <x:home index=".."/>
+  <import file="${magic.templates}/standard.xml"/>
+
+</project>

Added: avalon/trunk/tools/magic/etc/test/demo/gizmo/src/main/org/apache/playground/gizmo/Gizmo.java
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/etc/test/demo/gizmo/src/main/org/apache/playground/gizmo/Gizmo.java
Wed Jun 23 21:02:54 2004
@@ -0,0 +1,36 @@
+/* 
+ * Copyright 2004 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.
+ */
+
+package org.apache.playground.gizmo;
+
+/**
+ * Demo class. 
+ *
+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class Gizmo
+{
+   /**
+    * Returns some information abut gizmo.
+    * @return gizmo info
+    */
+    public String getInfo()
+    {
+        return "Hello World from Gizmo";
+    }
+}

Added: avalon/trunk/tools/magic/etc/test/demo/gizmo/src/test/org/apache/playground/gizmo/test/GizmoTestCase.java
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/etc/test/demo/gizmo/src/test/org/apache/playground/gizmo/test/GizmoTestCase.java
Wed Jun 23 21:02:54 2004
@@ -0,0 +1,52 @@
+/* 
+ * Copyright 2004 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.
+ */
+
+package org.apache.playground.gizmo.test;
+
+import junit.framework.TestCase;
+
+import org.apache.playground.gizmo.Gizmo;
+
+/**
+ * Demo class. 
+ *
+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
+ * @version $Revisio:-)n: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class GizmoTestCase extends TestCase
+{
+   /**
+    * Test gizmo creation.
+    */
+    public void testGizmoCreation()
+    {
+        Gizmo gizmo = new Gizmo();
+        String info = gizmo.getInfo();
+        assertNotNull( info );
+    }
+
+   /**
+    * Test gizmo creation.
+    */
+    public void testGizmoContent()
+    {
+        Gizmo gizmo = new Gizmo();
+        String info = gizmo.getInfo();
+        assertEquals( info, "Hello World from Gizmo" );
+    }
+
+}

Added: avalon/trunk/tools/magic/etc/test/demo/index.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/etc/test/demo/index.xml	Wed Jun 23 21:02:54 2004
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<system>
+
+  <project basedir="gizmo">
+    <info>
+      <group>demo</group>
+      <name>gizmo</name>
+    </info>
+  </project>
+
+  <project basedir="widget">
+    <info>
+      <group>demo</group>
+      <name>widget</name>
+    </info>
+    <dependencies>
+      <include key="gizmo"/>
+    </dependencies>
+  </project>
+
+</system>

Added: avalon/trunk/tools/magic/etc/test/demo/widget/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/etc/test/demo/widget/build.xml	Wed Jun 23 21:02:54 2004
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="widget" default="install" basedir="." 
+    xmlns:x="antlib:org.apache.avalon.tools">
+
+  <x:home index=".."/>
+  <import file="${magic.templates}/standard.xml"/>
+
+</project>

Added: avalon/trunk/tools/magic/etc/test/demo/widget/src/main/org/apache/playground/widget/Widget.java
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/etc/test/demo/widget/src/main/org/apache/playground/widget/Widget.java
Wed Jun 23 21:02:54 2004
@@ -0,0 +1,42 @@
+/* 
+ * Copyright 2004 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.
+ */
+
+package org.apache.playground.widget;
+
+import org.apache.playground.gizmo.Gizmo;
+
+/**
+ * A demo Gixmo that extends a Widget.
+ *
+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class Widget extends Gizmo
+{
+   /**
+    * Returns some information about the widget.
+    * @return widget info
+    */
+    public String getInfo()
+    {
+        StringBuffer buffer = new StringBuffer();
+        String info = super.getInfo();
+        buffer.append( info );
+        buffer.append( "\nHello World from Widget" );
+        return buffer.toString();
+    }
+}

Added: avalon/trunk/tools/magic/etc/test/demo/widget/src/test/org/apache/playground/widget/test/WidgetTestCase.java
==============================================================================
--- (empty file)
+++ avalon/trunk/tools/magic/etc/test/demo/widget/src/test/org/apache/playground/widget/test/WidgetTestCase.java
Wed Jun 23 21:02:54 2004
@@ -0,0 +1,63 @@
+/* 
+ * Copyright 2004 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.
+ */
+
+package org.apache.playground.widget.test;
+
+import junit.framework.TestCase;
+
+import org.apache.playground.gizmo.Gizmo;
+import org.apache.playground.widget.Widget;
+
+/**
+ * Demo class. 
+ *
+ * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
+ * @version $Revisio:-)n: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class WidgetTestCase extends TestCase
+{
+   /**
+    * Test widget creation.
+    */
+    public void testWidgetCreation()
+    {
+        Widget widget = new Widget();
+        String info = widget.getInfo();
+        assertNotNull( info );
+    }
+
+   /**
+    * Test widget type.
+    */
+    public void testWidgetType()
+    {
+        Widget widget = new Widget();
+        assertTrue( widget instanceof Gizmo );
+        assertTrue( widget instanceof Widget );
+    }
+
+   /**
+    * Test widget info.
+    */
+    public void testWidgetContent()
+    {
+        Widget widget = new Widget();
+        String info = widget.getInfo();
+        assertEquals( info, "Hello World from Gizmo\nHello World from Widget" );
+    }
+
+}

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java	Wed Jun 23
21:02:54 2004
@@ -67,8 +67,9 @@
             SYSTEM = new Magic( project );
         }
 
+        File system = SYSTEM.getSystemDirectory();
         project.setProperty( 
-          KEY, SYSTEM.getSystemDirectory().toString() );
+          KEY, system.toString() );
 
         File main = SYSTEM.getRepository().getCacheDirectory();
         project.setProperty( 
@@ -79,14 +80,14 @@
           DOCS_CACHE_KEY, Context.getCanonicalPath( docs ) );
 
         project.setProperty( 
-          TEMPLATES_KEY, getTemplatePath( main ) );
+          TEMPLATES_KEY, getTemplatePath( system ) );
         project.addReference( KEY, SYSTEM );
         return SYSTEM;
     }
 
-    private static String getTemplatePath( File cache )
+    private static String getTemplatePath( File system )
     {
-        File templates = new File( cache, "avalon/tools/templates" );
+        File templates = new File( system, "templates" );
         return Context.getCanonicalPath( templates ); 
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message