You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ob...@apache.org on 2004/08/14 13:35:31 UTC

svn commit: rev 36383 - in avalon/trunk/central/laboratory/studio/eclipse/core/test: . org org/apache org/apache/metro org/apache/metro/studio org/apache/metro/studio/eclipse org/apache/metro/studio/eclipse/core org/apache/metro/studio/eclipse/core/templateengine org/apache/metro/studio/eclipse/core/templateengine/test org/apache/metro/studio/eclipse/ui org/apache/metro/studio/eclipse/ui/wizard org/apache/metro/studio/eclipse/ui/wizard/test

Author: oberhack
Date: Sat Aug 14 04:35:30 2004
New Revision: 36383

Added:
   avalon/trunk/central/laboratory/studio/eclipse/core/test/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/AllCoreTests.java
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/DirectoryTemplateManagerTest.java
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/ProjectManagerBasicTest.java
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/ResourceTemplateManagerTest.java
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/ui/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/ui/wizard/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/ui/wizard/test/
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/ui/wizard/test/AllTests.java
   avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/ui/wizard/test/CreateNewProjectWizardMock.java
Log:
initial testsuite for MetroStudioCore

Added: avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/AllCoreTests.java
==============================================================================
--- (empty file)
+++ avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/AllCoreTests.java	Sat Aug 14 04:35:30 2004
@@ -0,0 +1,43 @@
+/*
+
+   Copyright 2004. 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. 
+
+*/
+package org.apache.metro.studio.eclipse.core.templateengine.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author <a href="mailto:dev@avalon.apache.org">Metro Development Team</a>
+ * 12.08.2004
+ * last change:
+ * 
+ */
+public class AllCoreTests
+{
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite(
+                "Test for org.apache.metro.studio.eclipse.core.templateengine");
+        //$JUnit-BEGIN$
+        suite.addTestSuite(ProjectManagerBasicTest.class);
+        suite.addTestSuite(DirectoryTemplateManagerTest.class);
+        suite.addTestSuite(ResourceTemplateManagerTest.class);
+        //$JUnit-END$
+        return suite;
+    }
+}

Added: avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/DirectoryTemplateManagerTest.java
==============================================================================
--- (empty file)
+++ avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/DirectoryTemplateManagerTest.java	Sat Aug 14 04:35:30 2004
@@ -0,0 +1,290 @@
+
+/*
+
+   Copyright 2004. 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. 
+
+*/
+package org.apache.metro.studio.eclipse.core.templateengine.test;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Vector;
+
+import junit.framework.TestCase;
+
+import org.apache.metro.studio.eclipse.core.MetroStudioCore;
+import org.apache.metro.studio.eclipse.core.templateengine.Directory;
+import org.apache.metro.studio.eclipse.core.templateengine.DirectoryTemplate;
+import org.apache.metro.studio.eclipse.core.templateengine.DirectoryTemplateManager;
+import org.apache.metro.studio.eclipse.core.templateengine.ProjectManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * @author <a href="mailto:dev@avalon.apache.org">Metro Development Team</a>
+ * 11.08.2004
+ * last change:
+ * 
+ */
+public class DirectoryTemplateManagerTest extends TestCase
+{
+
+    static IProject project;
+    final static String configFileLocation = MetroStudioCore.getDefault().getPluginLocation().toString() + "config/directories.test_cfg";
+    
+    public static void main(String[] args)
+    {
+    }
+
+    /**
+     * Create DirectoryTemplates and store/reload them to/from file.
+     *
+     */
+    public final void testCreateLoadConfigFile()
+    {
+        XStream xstream = new XStream();
+        DirectoryTemplateManager.initXStream(xstream);
+        DirectoryTemplateManager m = new DirectoryTemplateManager();
+        
+        m.addDirectoryTemplate(createStandardBlock());        
+        m.addDirectoryTemplate(createImplApiBlock()); 
+        
+        try
+        {
+            Writer out = new FileWriter(configFileLocation);
+            xstream.toXML(m, out);
+        } catch (IOException e)
+        {
+            fail("unable to write config file");
+        }
+        
+        m = DirectoryTemplateManager.load(configFileLocation);
+        
+        assertNotNull("Could not reload xml file", m);
+
+    }
+
+    /**
+     * Create the directory structure in project.
+     * Add standard libraries 
+     *
+     */
+    public final void testCreateStandardBlockProject()
+    {
+        project = ProjectManager.createBlockProject("StandardBlockTest");
+        DirectoryTemplateManager m = DirectoryTemplateManager.load(configFileLocation);
+        m.create("StandardBlock", project.getProject());
+        
+        assertEquals("Project was not created", true, (new File(project.getLocation().toString()).exists()));
+        assertEquals("Sourcefolder not created", true, (new File(project.getLocation().toString()+"/src").exists()));
+        assertEquals("Subfolder was not created", true, (new File(project.getLocation().toString()+"/src/BLOCK-INF").exists()));
+        assertEquals("Test folder was not created", true, (new File(project.getLocation().toString()+"/test").exists()));
+        assertEquals("Docs folder was not created", true, (new File(project.getLocation().toString()+"/docs").exists()));
+    }
+
+    /**
+     * Test, whether libraries are added
+     *
+     */
+    public final void testStandardBlockClasspath()
+    {
+        int libCount=0;
+        int rootCount=0;
+        int sourceCount=0;
+        
+        DirectoryTemplateManager m = DirectoryTemplateManager.load(configFileLocation);
+        DirectoryTemplate template = m.getTemplate("StandardBlock");
+        Vector libNames = m.collectLibraries(template, m.getRepositoryPath());
+        Vector sourceNames = m.collectSourceFolders(template, project);
+        
+        try
+        {
+            IJavaProject javaProject = JavaCore.create(project);
+            IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots();
+
+            for(int i=0; i<roots.length; i++)
+            {
+                rootCount++;
+                if(roots[i].isArchive())
+                {
+                    libCount++;
+                } else {
+                    sourceCount++;
+                }
+            }
+        } catch (JavaModelException e)
+        {
+            fail("can't retrieve project libraries");
+        }
+        
+        assertEquals("not all required libs are created", libNames.size(), libCount);
+        assertEquals("not all required sourcedirectories are created", sourceNames.size(), sourceCount);
+        
+        ProjectManager.delete(project);
+    }
+
+    /**
+     * Create the directory structure in project.
+     * Add standard libraries 
+     *
+     */
+    public final void testCreateImplApiBlockProject()
+    {
+        project = ProjectManager.createBlockProject("ImplApiTest");
+        DirectoryTemplateManager m = DirectoryTemplateManager.load(configFileLocation);
+        m.create("ImplApiBlock", project.getProject());
+        
+        assertEquals("Project was not created", true, (new File(project.getLocation().toString()).exists()));
+        assertEquals("Implfolder not created", true, (new File(project.getLocation().toString()+"/impl").exists()));
+        assertEquals("Apifolder not created", true, (new File(project.getLocation().toString()+"/api").exists()));
+        assertEquals("Subfolder was not created", true, (new File(project.getLocation().toString()+"/impl/BLOCK-INF").exists()));
+        assertEquals("Test folder was not created", true, (new File(project.getLocation().toString()+"/test").exists()));
+        assertEquals("Docs folder was not created", true, (new File(project.getLocation().toString()+"/docs").exists()));
+    }
+
+    /**
+     * Test, whether libraries are added
+     *
+     */
+    public final void testImplApiBlockClasspath()
+    {
+        int libCount=0;
+        int rootCount=0;
+        int sourceCount=0;
+        
+        DirectoryTemplateManager m = DirectoryTemplateManager.load(configFileLocation);
+        DirectoryTemplate template = m.getTemplate("ImplApiBlock");
+        Vector libNames = m.collectLibraries(template, m.getRepositoryPath());
+        Vector sourceNames = m.collectSourceFolders(template, project);
+        
+        try
+        {
+            IJavaProject javaProject = JavaCore.create(project);
+            IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots();
+
+            for(int i=0; i<roots.length; i++)
+            {
+                rootCount++;
+                if(roots[i].isArchive())
+                {
+                    libCount++;
+                } else {
+                    sourceCount++;
+                }
+            }
+        } catch (JavaModelException e)
+        {
+            fail("can't retrieve project libraries");
+        }
+        
+        assertEquals("not all required libs are created", libNames.size(), libCount);
+        assertEquals("not all required sourcedirectories are created", sourceNames.size(), sourceCount);
+    }
+
+    /**
+     * Delete the project
+     *
+     */
+    public final void testDeleteProject()
+    {
+        String path = project.getLocation().toString();
+        try
+        {
+            
+            project.delete(true, true, null);
+        } catch (CoreException e)
+        {
+            fail("can't delete project");
+        }
+        assertEquals("project not deleted", false, new File(path).exists());
+    }
+    
+    /**
+     * 
+     */
+    private DirectoryTemplate createStandardBlock()
+    {
+        DirectoryTemplate dt = new DirectoryTemplate();
+        dt.setId("StandardBlock");
+
+        
+        Directory d = new Directory();
+        d.setName("src");
+        d.setSource(true);
+        dt.addDirectory(d);
+        
+        d = new Directory();
+        d.setName("src/BLOCK-INF");
+        d.setSource(false);
+        dt.addDirectory(d);
+        
+        d = new Directory();
+        d.setName("test");
+        d.setSource(true);
+        dt.addDirectory(d);
+        
+        d = new Directory();
+        d.setName("docs");
+        d.setSource(false);
+        dt.addDirectory(d);
+        
+        return dt;
+    }
+    
+    /**
+     * 
+     */
+    private DirectoryTemplate createImplApiBlock()
+    {
+        DirectoryTemplate dt = new DirectoryTemplate();
+        dt.setId("ImplApiBlock");
+
+        Directory d = new Directory();
+        d.setName("impl");
+        d.setSource(true);
+        dt.addDirectory(d);
+
+        d = new Directory();
+        d.setName("api");
+        d.setSource(true);
+        dt.addDirectory(d);
+        
+        d = new Directory();
+        d.setName("impl/BLOCK-INF");
+        d.setSource(false);
+        dt.addDirectory(d);
+        
+        d = new Directory();
+        d.setName("test");
+        d.setSource(true);
+        dt.addDirectory(d);
+        
+        d = new Directory();
+        d.setName("docs");
+        d.setSource(false);
+        dt.addDirectory(d);
+        
+        return dt;
+    }
+
+}

Added: avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/ProjectManagerBasicTest.java
==============================================================================
--- (empty file)
+++ avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/ProjectManagerBasicTest.java	Sat Aug 14 04:35:30 2004
@@ -0,0 +1,61 @@
+/*
+
+   Copyright 2004. 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. 
+
+*/
+package org.apache.metro.studio.eclipse.core.templateengine.test;
+
+import junit.framework.TestCase;
+
+import org.apache.metro.studio.eclipse.core.templateengine.ProjectManager;
+import org.apache.metro.studio.eclipse.core.templateengine.ResourceTemplate;
+import org.eclipse.core.resources.IProject;
+
+/**
+ * This test class only tests to create Metro projects with different
+ * natures.
+ * Those methods are than needed by other testcases:
+ *   - DirectoryTemplateMangerTest
+ *   - ResourceTemplateManagerTest
+ *   - ProjectManagerTest
+ * The ProjectMangerTest class is testing higher level methods than.
+ * 
+ * @author <a href="mailto:dev@avalon.apache.org">Metro Development Team</a>
+ * 11.08.2004
+ * last change: 
+ * 
+ */
+public class ProjectManagerBasicTest extends TestCase
+{
+
+    private static IProject project;
+    
+    public static void main(String[] args)
+    {
+    }
+
+    public final void testCreateBlockProject()
+    {
+        ResourceTemplate template;
+        
+        project = ProjectManager.createBlockProject("EmptyBlock");
+    }
+
+    public final void testDelete()
+    {
+        ProjectManager.delete(project);
+    }
+
+}

Added: avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/ResourceTemplateManagerTest.java
==============================================================================
--- (empty file)
+++ avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/core/templateengine/test/ResourceTemplateManagerTest.java	Sat Aug 14 04:35:30 2004
@@ -0,0 +1,131 @@
+/*
+
+ Copyright 2004. 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. 
+
+ */
+package org.apache.metro.studio.eclipse.core.templateengine.test;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+
+import junit.framework.TestCase;
+
+import org.apache.metro.studio.eclipse.core.MetroStudioCore;
+import org.apache.metro.studio.eclipse.core.templateengine.DirectoryTemplateManager;
+import org.apache.metro.studio.eclipse.core.templateengine.ProjectManager;
+import org.apache.metro.studio.eclipse.core.templateengine.Resource;
+import org.apache.metro.studio.eclipse.core.templateengine.ResourceTemplate;
+import org.apache.metro.studio.eclipse.core.templateengine.ResourceTemplateManager;
+import org.apache.metro.studio.eclipse.core.tools.DynProjectParam;
+import org.eclipse.core.resources.IProject;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+
+/**
+ * @author <a href="mailto:dev@avalon.apache.org">Metro Development Team </a>
+ *         12.08.2004 last change:
+ *  
+ */
+public class ResourceTemplateManagerTest extends TestCase
+{
+    final static String directoryLocation = DirectoryTemplateManagerTest.configFileLocation;
+
+    final static String baseDir = MetroStudioCore.getDefault()
+            .getPluginLocation().toString();
+
+    final static String resourcesLocation = baseDir
+            + "config/resources.test_cfg";
+
+    static IProject project;
+
+    public static void main(String[] args)
+    {
+    }
+
+    public final void testCreateResourceTemplate()
+    {
+        XStream xstream = new XStream(new DomDriver());
+        ResourceTemplateManager.initXStream(xstream);
+        ResourceTemplateManager rm = new ResourceTemplateManager();
+
+        // import DirectoryTemplates, which are created in
+        // DirectoryTemplatemanagerTest
+        DirectoryTemplateManager dm = DirectoryTemplateManager
+                .load(directoryLocation);
+        dm.addXStreamAliases(xstream);
+        rm.importDirectoryTemplates(dm);
+
+        rm.addResourceTemplate(createHelloWorldResources());
+
+        try
+        {
+            Writer out = new FileWriter(resourcesLocation);
+            xstream.toXML(rm, out);
+        } catch (IOException e)
+        {
+            fail("unable to write config file");
+        }
+
+        rm = ResourceTemplateManager.load(resourcesLocation);
+
+        assertNotNull("Could not reload xml file", rm);
+
+    }
+
+    public final void testCreateHelloWorldProject()
+    {
+        project = ProjectManager.createBlockProject("HelloWorld Tutorial");
+        ResourceTemplateManager rm = ResourceTemplateManager
+                .load(resourcesLocation);
+        rm.create(project, "HelloWorld Tutorial", new DynProjectParam());
+        
+        String testpath;
+        assertEquals("Project was not created", true, (new File(project.getLocation().toString()).exists()));
+        testpath = "/src/tutorial/HelloComponent.java";
+        assertEquals("HelloComponent not created", true, (new File(project.getLocation().toString()+testpath).exists()));
+        testpath = "/src/BLOCK-INF/block.xml";
+        assertEquals("block.xml not created", true, (new File(project.getLocation().toString()+testpath).exists()));
+
+        ProjectManager.delete(project);
+    }
+
+    /**
+     * @return
+     */
+    private ResourceTemplate createHelloWorldResources()
+    {
+        ResourceTemplate rt = new ResourceTemplate();
+        rt.setTemplateId("HelloWorld Tutorial");
+        rt.setDirectoryType("StandardBlock");
+
+        Resource r = new Resource();
+        r.setRootSegment("src");
+        r.setSourceFilePathName(baseDir+"templates/hello/HelloComponent.java");
+        r.setPackageName("tutorial");
+        rt.addResource(r);
+
+        r = new Resource();
+        r.setRootSegment("src/BLOCK-INF");
+        r.setSourceFilePathName(baseDir+"templates/hello/block.xml");
+        r.setPackageName("");
+        rt.addResource(r);
+
+        return rt;
+    }
+
+}
\ No newline at end of file

Added: avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/ui/wizard/test/AllTests.java
==============================================================================
--- (empty file)
+++ avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/ui/wizard/test/AllTests.java	Sat Aug 14 04:35:30 2004
@@ -0,0 +1,41 @@
+/*
+
+   Copyright 2004. 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. 
+
+*/
+package org.apache.metro.studio.eclipse.ui.wizard.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author <a href="mailto:dev@avalon.apache.org">Metro Development Team</a>
+ * 14.08.2004
+ * last change:
+ * 
+ */
+public class AllTests
+{
+
+    public static Test suite()
+    {
+        TestSuite suite = new TestSuite(
+                "Test for org.apache.metro.studio.eclipse.ui.wizard.test");
+        //$JUnit-BEGIN$
+        suite.addTestSuite(CreateNewProjectWizardMock.class);
+        //$JUnit-END$
+        return suite;
+    }
+}

Added: avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/ui/wizard/test/CreateNewProjectWizardMock.java
==============================================================================
--- (empty file)
+++ avalon/trunk/central/laboratory/studio/eclipse/core/test/org/apache/metro/studio/eclipse/ui/wizard/test/CreateNewProjectWizardMock.java	Sat Aug 14 04:35:30 2004
@@ -0,0 +1,80 @@
+/*
+
+   Copyright 2004. 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. 
+
+*/
+package org.apache.metro.studio.eclipse.ui.wizard.test;
+
+import java.util.Hashtable;
+
+import junit.framework.TestCase;
+
+import org.apache.metro.facility.presentationservice.api.ViewEventService;
+import org.apache.metro.facility.presentationservice.impl.PresentationEvent;
+import org.apache.metro.facility.presentationservice.impl.PresentationServiceFactory;
+import org.apache.metro.studio.eclipse.core.templateengine.ResourceTemplate;
+import org.apache.metro.studio.eclipse.ui.controller.CreateNewProjectWizardController;
+import org.eclipse.core.resources.IProject;
+
+/**
+ * @author <a href="mailto:dev@avalon.apache.org">Metro Development Team</a>
+ * 11.08.2004
+ * last change:
+ * 
+ */
+public class CreateNewProjectWizardMock extends TestCase
+{
+
+    private static IProject project;
+    private ViewEventService service;
+    public final String TOPIC = "CreateNewProjectWizard"; 
+    
+    public static void main(String[] args)
+    {
+    }
+
+    /**
+     * This test is done here to test the functionality of the presentation service
+     * All tests of template creation is done in MetroStudioCore in detail.
+     */
+    public final void testCreateHelloWorldProject()
+    {
+        ResourceTemplate template;
+        new CreateNewProjectWizardController().initializeListeners();
+
+		try
+        {
+            service = PresentationServiceFactory.getViewEventService();
+            Hashtable value = new Hashtable();
+            
+            // mock the "wizard page created event" to get all ResourceTemplate names
+            
+            // mock the "template selected event" in TemplateSelectionWizardPage
+            value.put("selectedTemplate", "HelloWorld Tutorial");
+            PresentationEvent event = new PresentationEvent(this, TOPIC + ".exampleProjectList", value);
+            event = service.clicked(event);
+            
+            // mock the "template apply event" in NewProjectWizard
+            value.put("projectName", "HelloWorld Tutorial");
+            event = new PresentationEvent(this, TOPIC + ".applyButton", value);
+            event = service.clicked(event);
+
+        } catch (Exception e)
+        {
+            fail("could not create HelloWorld Project");
+        }
+	}
+
+}

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