Author: oberhack Date: Tue Sep 7 23:33:31 2004 New Revision: 43507 Added: avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/ avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/ avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/ avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/AllCoreTests.java avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/BlockProjectManagerBasicTest.java avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/DirectoryTemplateManagerTest.java avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/ResourceTemplateManagerTest.java Modified: avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/tests/AllTests.java Log:
Added: avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/AllCoreTests.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/AllCoreTests.java Tue Sep 7 23:33:31 2004 @@ -0,0 +1,60 @@ +/* + + 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.TestResult; +import junit.framework.TestSuite; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">Metro Development Team</a> + * 12.08.2004 + * last change: + * + */ +public class AllCoreTests implements Test +{ + + public static Test suite() + { + TestSuite suite = new TestSuite( + "Test for org.apache.metro.studio.eclipse.core.templateengine"); + //$JUnit-BEGIN$ + suite.addTestSuite(BlockProjectManagerBasicTest.class); + suite.addTestSuite(DirectoryTemplateManagerTest.class); + suite.addTestSuite(ResourceTemplateManagerTest.class); + //$JUnit-END$ + return suite; + } + + /* (non-Javadoc) + * @see junit.framework.Test#countTestCases() + */ + public int countTestCases() + { + return 3; + } + + /* (non-Javadoc) + * @see junit.framework.Test#run(junit.framework.TestResult) + */ + public void run(TestResult result) + { + suite(); + } +} Added: avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/BlockProjectManagerBasicTest.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/BlockProjectManagerBasicTest.java Tue Sep 7 23:33:31 2004 @@ -0,0 +1,62 @@ +/* + + 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 junit.framework.TestCase; + +import org.apache.metro.studio.eclipse.core.templateengine.BlockProjectManager; +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:[EMAIL PROTECTED]">Metro Development Team</a> + * 11.08.2004 + * last change: + * + */ +public class BlockProjectManagerBasicTest extends TestCase +{ + + private static IProject project; + + public static void main(String[] args) + { + } + + public final void testCreateBlockProject() + { + project = BlockProjectManager.testCreateProject("EmptyBlock"); + assertEquals("Project was not created", true, (new File(project.getLocation().toString()).exists())); + + } + + public final void testDelete() + { + BlockProjectManager.delete(project); + } + +} Added: avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/DirectoryTemplateManagerTest.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/DirectoryTemplateManagerTest.java Tue Sep 7 23:33:31 2004 @@ -0,0 +1,275 @@ + +/* + + 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.util.Vector; + +import junit.framework.TestCase; + +import org.apache.metro.studio.eclipse.core.MetroStudioCore; +import org.apache.metro.studio.eclipse.core.templateengine.BlockProjectManager; +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.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; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">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() + { + DirectoryTemplateManager.initXStream(); + DirectoryTemplateManager m = new DirectoryTemplateManager(); + + m.addDirectoryTemplate(createStandardBlock()); + m.addDirectoryTemplate(createImplApiBlock()); + + m.store(configFileLocation); + m = DirectoryTemplateManager.load(configFileLocation); + + assertNotNull("Could not reload xml file", m); + + } + + /** + * Create the directory structure in project. + * Add standard libraries + * @throws CoreException + * + */ + public final void testCreateStandardBlockProject() throws CoreException + { + + project = BlockProjectManager.testCreateProject("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 sourceFolders = template.getSourceFolderNames(); + + 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 sourcedirectories are created", sourceFolders.size(), sourceCount); + + BlockProjectManager.delete(project); + } + + /** + * Create the directory structure in project. + * Add standard libraries + * + */ + public final void testCreateImplApiBlockProject() + { + project = BlockProjectManager.create("ImplApiTest", null); + 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 sourceFolders = template.getSourceFolderNames(); + + 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 sourcedirectories are created", sourceFolders.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/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/ResourceTemplateManagerTest.java ============================================================================== --- (empty file) +++ avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/core/templateengine/test/ResourceTemplateManagerTest.java Tue Sep 7 23:33:31 2004 @@ -0,0 +1,465 @@ +/* + + 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 junit.framework.TestCase; + +import org.apache.metro.studio.eclipse.core.MetroStudioCore; +import org.apache.metro.studio.eclipse.core.templateengine.BlockProjectManager; +import org.apache.metro.studio.eclipse.core.templateengine.DirectoryTemplateManager; +import org.apache.metro.studio.eclipse.core.templateengine.Library; +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.eclipse.core.resources.IProject; + +/** + * @author <a href="mailto:[EMAIL PROTECTED]">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() + { + ResourceTemplateManager.initXStream(); + ResourceTemplateManager rm = new ResourceTemplateManager(); + + // import DirectoryTemplates, which are created in + // DirectoryTemplatemanagerTest + DirectoryTemplateManager dm = DirectoryTemplateManager + .load(directoryLocation); + rm.importDirectoryTemplates(dm); + + rm.addResourceTemplate(createHelloWorldResources()); + //rm.addResourceTemplate(createCompositionApplicationResources()); + //rm.addResourceTemplate(createConfigurationResources()); + rm.addResourceTemplate(createStandardContextResources()); + /* + rm.addResourceTemplate(createCustomContextResources()); + rm.addResourceTemplate(createCastingContextResources()); + rm.addResourceTemplate(createAliasContextResources()); + rm.addResourceTemplate(createPlusContextResources()); + rm.addResourceTemplate(createStrategyContextResources()); + */ + + rm.store(resourcesLocation); + + rm = ResourceTemplateManager.load(resourcesLocation); + + assertNotNull("Could not reload xml file", rm); + + } + + public final void testListTemplateNames() + { + String[] names = BlockProjectManager.listTemplateNames(); + + ResourceTemplateManager rtm = ResourceTemplateManager.load(null); + int number = rtm.getResourceTemplates().size(); + + assertEquals("didnt get all template names ", number, names.length); + + } + + public final void testCreateHelloWorldProject() + { + project = BlockProjectManager.create("HelloWorld Tutorial", "HelloWorld Tutorial"); + assertNotNull("project was not created", project); + + 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())); + + BlockProjectManager.delete(project); + } + + public final void testCreateStandardContextProject() + { + project = BlockProjectManager.create("Context Tutorial (Standard)", "Context Tutorial (Standard)"); + assertNotNull("project was not created", project); + + String testpath; + assertEquals("Project was not created", true, (new File(project.getLocation().toString()).exists())); + testpath = "/src/tutorial/HelloComponent.java"; + assertEquals("Standard Context Tutorial", 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())); + + BlockProjectManager.delete(project); + } + + /** + * @return + */ + private ResourceTemplate createHelloWorldResources() + { + ResourceTemplate rt = new ResourceTemplate(); + rt.setTemplateId("HelloWorld Tutorial"); + rt.setDescription("This tutorial takes you through the creation of a very simple component, the declaration of a component type descriptor, and the declaration of a block containing the component."); + rt.setDirectoryType("StandardBlock"); + Library library = new Library(); + library.setName("avalon-framework-api"); + library.setVersion("4.2.0"); + rt.addLibrary(library); + + 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); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/hello/HelloComponent.xinfo"); + r.setPackageName("tutorial"); + rt.addResource(r); + + return rt; + } + /** + * @return + */ + private ResourceTemplate createConfigurationResources() + { + ResourceTemplate rt = new ResourceTemplate(); + rt.setTemplateId("Configuration Tutorial"); + rt.setDescription("This example is the HelloComponent extended to include a configuration constructor argument and updates to log the source of the configuration based on runtime information."); + rt.setDirectoryType("StandardBlock"); + Library library = new Library(); + library.setName("avalon-framework-api"); + library.setVersion("4.2.0"); + rt.addLibrary(library); + + Resource r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/configuration/HelloComponent.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/configuration/block.xml"); + r.setPackageName(""); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/configuration/categories.xml"); + r.setPackageName(""); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/configuration/config.xml"); + r.setPackageName(""); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/configuration/HelloComponent.xconfig"); + r.setPackageName("tutorial"); + rt.addResource(r); + + return rt; + } + /** + * @return + */ + private ResourceTemplate createCustomContextResources() + { + ResourceTemplate rt = new ResourceTemplate(); + rt.setTemplateId("Context Tutorial(Custom)"); + rt.setDescription("This tutorial presents information about the management of the runtime context supplied to your component."); + rt.setDirectoryType("StandardBlock"); + Library library = new Library(); + library.setName("avalon-framework-api"); + library.setVersion("4.2.0"); + rt.addLibrary(library); + + Resource r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/custom/HelloComponent.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/custom/NumberCruncher.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/context/custom/block.xml"); + r.setPackageName(""); + rt.addResource(r); + + return rt; + } + /** + * @return + */ + private ResourceTemplate createCastingContextResources() + { + ResourceTemplate rt = new ResourceTemplate(); + rt.setTemplateId("Context Tutorial (Casting)"); + rt.setDescription("This tutorial covers the declaration of context casting criteria and the creation of a typed context."); + rt.setDirectoryType("StandardBlock"); + Library library = new Library(); + library.setName("avalon-framework-api"); + library.setVersion("4.2.0"); + rt.addLibrary(library); + + Resource r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/casting/HelloComponent.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/casting/DemoContext.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/casting/DemoContextProvider.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/context/casting/block.xml"); + r.setPackageName(""); + rt.addResource(r); + + return rt; + } + /** + * @return + */ + private ResourceTemplate createStandardContextResources() + { + ResourceTemplate rt = new ResourceTemplate(); + rt.setTemplateId("Context Tutorial (Standard)"); + rt.setDescription("This tutorial presents information about the management of the runtime context supplied to your component."); + rt.setDirectoryType("StandardBlock"); + Library library = new Library(); + library.setName("avalon-framework-api"); + library.setVersion("4.2.0"); + rt.addLibrary(library); + + Resource r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/standard/HelloComponent.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/standard/HelloComponent.xinfo"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/context/standard/block.xml"); + r.setPackageName(""); + rt.addResource(r); + + return rt; + } + /** + * @return + */ + private ResourceTemplate createCompositionApplicationResources() + { + ResourceTemplate rt = new ResourceTemplate(); + rt.setTemplateId("Composition (Application) Tutorial"); + rt.setDirectoryType("ImplApiBlock"); + + Resource r = new Resource(); + r.setRootSegment("impl"); + r.setSourceFilePathName(baseDir+"templates/composition/application/Application.java"); + r.setPackageName("tutorial.application"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("impl/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/composition/application/block.xml"); + r.setPackageName(""); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("impl/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/composition/application/debug.xml"); + r.setPackageName(""); + rt.addResource(r); + + return rt; + } + /** + * @return + */ + private ResourceTemplate createAliasContextResources() + { + ResourceTemplate rt = new ResourceTemplate(); + rt.setTemplateId("Context Tutorial (Alias)"); + rt.setDescription("This tutorial covers usage of standard context entries using a constructor supplied context (as opposed to the classic Contextualization delivery mecahanism)."); + rt.setDirectoryType("StandardBlock"); + + Resource r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/alias/HelloComponent.java"); + r.setPackageName("tutorial.application"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("impl/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/context/alias/block.xml"); + r.setPackageName(""); + rt.addResource(r); + + return rt; + } + /** + * @return + */ + private ResourceTemplate createPlusContextResources() + { + ResourceTemplate rt = new ResourceTemplate(); + rt.setTemplateId("Context Tutorial (Plus)"); + rt.setDescription("This tutorial covers usage of context entries using a constructor supplied custom context"); + rt.setDirectoryType("StandardBlock"); + Library library = new Library(); + library.setName("avalon-framework-api"); + library.setVersion("4.2.0"); + rt.addLibrary(library); + + Resource r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/plus/HelloComponent.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/plus/DemoContext.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/plus/DemoContextProvider.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/context/plus/block.xml"); + r.setPackageName(""); + rt.addResource(r); + + return rt; + } + /** + * @return + */ + private ResourceTemplate createStrategyContextResources() + { + ResourceTemplate rt = new ResourceTemplate(); + rt.setTemplateId("Context Tutorial (Strategy)"); + rt.setDescription("This tutorial covers the declaration of custom contextualization strategy."); + rt.setDirectoryType("StandardBlock"); + Library library = new Library(); + library.setName("avalon-framework-api"); + library.setVersion("4.2.0"); + rt.addLibrary(library); + + Resource r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/strategy/StandardComponent.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/strategy/StandardService.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/strategy/StandardContext.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/strategy/StandardContextImp.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/strategy/Contextualizable.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src"); + r.setSourceFilePathName(baseDir+"templates/context/strategy/DemoContextualizationHandler.java"); + r.setPackageName("tutorial"); + rt.addResource(r); + + r = new Resource(); + r.setRootSegment("src/BLOCK-INF"); + r.setSourceFilePathName(baseDir+"templates/context/strategy/block.xml"); + r.setPackageName(""); + rt.addResource(r); + + return rt; + } +} \ No newline at end of file Modified: avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/tests/AllTests.java ============================================================================== --- avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/tests/AllTests.java (original) +++ avalon/trunk/central/laboratory/studio/eclipse/test/src/org/apache/metro/studio/eclipse/tests/AllTests.java Tue Sep 7 23:33:31 2004 @@ -28,7 +28,7 @@ * last change: * */ -public class AllTests +public class AllTests { public static void main(String[] args) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]