Revision: 99 http://mvn-infix.svn.sourceforge.net/mvn-infix/?rev=99&view=rev Author: bindul Date: 2010-12-21 02:57:17 +0000 (Tue, 21 Dec 2010)
Log Message: ----------- Added unit tests for merging maps Modified Paths: -------------- plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/SfNetMvnMojoInfoTCImpl.java plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/mapper/sfnetsftp/SFTPParseTest.java shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/MojoInfoTCImpl.java shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/PlexusTestCase.java shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/ssh/JunitDummyAuthenticationProvider.java shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/ssh/SSHServerResource.java shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/xml/XmlTestUtil.java Added Paths: ----------- plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/AbstractRepoMapTest.java plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/ plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.java plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/ plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.xml plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM01-in.xml plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM02-in.xml plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-out.xml plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-DT01-in.xml plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-EM01-in.xml plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-out.xml Added: plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/AbstractRepoMapTest.java =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/AbstractRepoMapTest.java (rev 0) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/AbstractRepoMapTest.java 2010-12-21 02:57:17 UTC (rev 99) @@ -0,0 +1,140 @@ +/* + * $HeadURL$ + * + * Copyright (c) 2010 MindTree Ltd. + * + * This file is part of Infix Maven Plugins + * + * Infix Maven Plugins is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * Infix Maven Plugins is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * Infix Maven Plugins. If not, see <http://www.gnu.org/licenses/>. + */ +package com.mindtree.techworks.infix.plugins.sfnetmvnrepo; + +import static org.custommonkey.xmlunit.XMLAssert.*; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; +import java.net.URL; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.stream.XMLStreamException; + +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.IOUtil; +import org.xml.sax.SAXException; + +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repomap.RepositoryMap; +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repomap.io.stax.RepositoryMapStaxWriter; +import com.mindtree.techworks.infix.pluginscommon.mojo.MojoInfo; +import com.mindtree.techworks.infix.pluginscommon.test.PlexusTestCase; +import com.mindtree.techworks.infix.pluginscommon.test.xml.XmlTestUtil; + +/** + * @author Bindul Bhowmik + * @version $Revision$ $Date$ + * + */ +public abstract class AbstractRepoMapTest extends PlexusTestCase { + + protected void checkXmlEqual (String controlLoc, RepositoryMap repoMap) throws IOException, + XMLStreamException, SAXException, ParserConfigurationException { + + Reader controlReader = new InputStreamReader(getClass().getResourceAsStream( + getPackageLocalLocation(controlLoc))); + + // Dump the repo map + StringWriter writer = new StringWriter(); + RepositoryMapStaxWriter repoMapWriter = new RepositoryMapStaxWriter(); + repoMapWriter.write(writer, repoMap); + String repoMapContent = writer.toString(); + + // Log if enabled + if (getLog().isDebugEnabled()) { + getLog().debug(repoMapContent); + } + + // Assert Equals + assertXMLEqual(XmlTestUtil.getNormalizedDocument(controlReader), + XmlTestUtil.getNormalizedDocument(new StringReader(repoMapContent))); + } + + protected void checkXmlEqual (String controlLoc, String repoMapLoc) throws IOException, + XMLStreamException, SAXException, ParserConfigurationException { + Reader controlReader = new InputStreamReader(getClass().getResourceAsStream( + getPackageLocalLocation(controlLoc))); + + // Assert Equals + assertXMLEqual(XmlTestUtil.getNormalizedDocument(controlReader), + XmlTestUtil.getNormalizedDocument(repoMapLoc)); + } + + protected String getPackageLocalLocation (String resource) { + String packageName = getClass().getPackage().getName().replace('.', '/'); + String resourceLoc = packageName + "/" + resource; + if (!resourceLoc.startsWith("/")) { + resourceLoc = "/" + resourceLoc; + } + return resourceLoc; + } + + protected String copyPackageLocalLocation (File destinationDir, String resource) throws IOException { + URL resourceUrl = getClass().getResource(getPackageLocalLocation(resource)); + File destination = new File (destinationDir, resource); + OutputStream os = null; + InputStream is = null; + try { + is = resourceUrl.openStream(); + os = new FileOutputStream(destination); + IOUtil.copy(is, os); + } catch (IOException e) { + getLog().warn("Error copying resource [" + resource + "] to directory [" + destinationDir.getAbsolutePath() + "]" , e); + throw e; + } finally { + if (null != os) { + try { + os.close(); + } catch (IOException e) { + // Ignore + } + } + if (null != is) { + try { + is.close(); + } catch (IOException e) { + // Ignore + } + } + } + + return destination.getAbsolutePath(); + } + + protected void setProjectBasedir(MojoInfo mojoInfo) { + MavenProject mvnProj = mojoInfo.getProject(); + String baseDirPath = System.getProperty( "basedir" ); + if (null == baseDirPath) { + baseDirPath = new File ("").getAbsolutePath(); + } + + File projFilePath = new File (baseDirPath, "pom.xml"); + + mvnProj.setFile(projFilePath); + } +} Property changes on: plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/AbstractRepoMapTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/SfNetMvnMojoInfoTCImpl.java =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/SfNetMvnMojoInfoTCImpl.java 2010-12-21 02:55:29 UTC (rev 98) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/SfNetMvnMojoInfoTCImpl.java 2010-12-21 02:57:17 UTC (rev 99) @@ -20,6 +20,7 @@ */ package com.mindtree.techworks.infix.plugins.sfnetmvnrepo; +import java.util.ArrayList; import java.util.List; import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repoconfig.RepositoryConfig; @@ -47,4 +48,10 @@ this.repositoryConfigs = repositoryConfigs; } + public void addRepositoryConfig (RepositoryConfig repositoryConfig) { + if (null == this.repositoryConfigs) { + this.repositoryConfigs = new ArrayList<RepositoryConfig>(); + } + this.repositoryConfigs.add(repositoryConfig); + } } Added: plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.java =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.java (rev 0) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.java 2010-12-21 02:57:17 UTC (rev 99) @@ -0,0 +1,190 @@ +/* + * $HeadURL$ + * + * Copyright (c) 2010 MindTree Ltd. + * + * This file is part of Infix Maven Plugins + * + * Infix Maven Plugins is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * Infix Maven Plugins is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * Infix Maven Plugins. If not, see <http://www.gnu.org/licenses/>. + */ +package com.mindtree.techworks.infix.plugins.sfnetmvnrepo.actions; + +import static org.junit.Assert.*; + +import java.io.File; +import java.io.IOException; +import java.net.URL; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.stream.XMLStreamException; + +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.xml.sax.SAXException; + +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.AbstractRepoMapTest; +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.SfNetMvnMojoInfoTCImpl; +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.mapper.MapGenerationException; +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repoconfig.ExistingRepositoryMap; +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repoconfig.InsertedGroupId; +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repoconfig.RepositoryConfig; +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repoconfig.SourceForgeFRSMapper; +import com.mindtree.techworks.infix.pluginscommon.test.dummydirtree.DirectoryTreeUtil; +import com.mindtree.techworks.infix.pluginscommon.test.ssh.SSHServerResource; + + +/** + * @author Bindul Bhowmik + * @version $Revision$ $Date$ + * + */ +public class RepoMapGenActionTest extends AbstractRepoMapTest { + + @Rule + public TemporaryFolder sourceDir = new TemporaryFolder(); + + @Rule + public TemporaryFolder workDir = new TemporaryFolder(); + + @Rule + public SSHServerResource sshServer = new SSHServerResource("test", 22, "127.0.0.1"); + + @Test + public void testSimpleExecute () { + try { + // Simple test + SfNetMvnRepoAction action = lookup(SfNetMvnRepoAction.class, "repo-map"); + SfNetMvnMojoInfoTCImpl mojoInfo = new SfNetMvnMojoInfoTCImpl(); + setProjectBasedir(mojoInfo); + + // Setup two simple repo maps to merge + RepositoryConfig repoConfig = new RepositoryConfig(); + repoConfig.setBaseUrl("http://example.com/mvnrepo/"); + repoConfig.setId("eg1"); + repoConfig.setName("Example Merge 1"); + ExistingRepositoryMap repoMap = new ExistingRepositoryMap(); + repoMap.setSource(copyPackageLocalLocation(sourceDir.getRoot(), "T01-EM01-in.xml")); + repoConfig.addRepositoryMap(repoMap); + repoMap = new ExistingRepositoryMap(); + repoMap.setSource(copyPackageLocalLocation(sourceDir.getRoot(), "T01-EM02-in.xml")); + repoConfig.addRepositoryMap(repoMap); + mojoInfo.addRepositoryConfig(repoConfig); + + mojoInfo.setWorkDirectory(workDir.getRoot()); + + action.execute(mojoInfo); + + // Assertions + File destinFile = new File(workDir.getRoot(), "eg1-repomap.xml"); + assertTrue("Merged File should exist!", destinFile.exists()); + + checkXmlEqual("T01-out.xml", destinFile.getAbsolutePath()); + + } catch (ComponentLookupException e) { + getLog().warn("Missing component : repo-map", e); + fail("Missing component : repo-map"); + } catch (IOException e) { + getLog().warn("Error processing test! ", e); + fail("Error processing test! " + e.getMessage()); + } catch (MapGenerationException e) { + getLog().warn("Error merging maps ", e); + fail("Error merging maps " + e.getMessage()); + } catch (XMLStreamException e) { + getLog().warn("Error testing merge ", e); + fail("Error testing merge " + e.getMessage()); + } catch (SAXException e) { + getLog().warn("Error testing merge ", e); + fail("Error testing merge " + e.getMessage()); + } catch (ParserConfigurationException e) { + getLog().warn("Error testing merge ", e); + fail("Error testing merge " + e.getMessage()); + } + } + + @Test + public void testMixedExecute () { + try { + SfNetMvnRepoAction action = lookup(SfNetMvnRepoAction.class, "repo-map"); + SfNetMvnMojoInfoTCImpl mojoInfo = new SfNetMvnMojoInfoTCImpl(); + setProjectBasedir(mojoInfo); + + // Setup one simple mapper and one SSH mapper + RepositoryConfig repoConfig = new RepositoryConfig(); + repoConfig.setBaseUrl("http://sourceforge.net/projects/mvn-infix/files/"); + repoConfig.setId("mvnrepo"); + repoConfig.setName("Infix Maven Repository"); + mojoInfo.addRepositoryConfig(repoConfig); + + ExistingRepositoryMap repoMap = new ExistingRepositoryMap(); + repoMap.setSource(copyPackageLocalLocation(sourceDir.getRoot(), "T02-EM01-in.xml")); + repoConfig.addRepositoryMap(repoMap); + + SourceForgeFRSMapper sfMapper = new SourceForgeFRSMapper(); + sfMapper.setAddDownloadSuffix(true); + sfMapper.setBaseDir("/home/test/act-one"); + sfMapper.addExclude("**/ignore-file"); + sfMapper.setBaseGroupId("com.mindtree.techworks.infix"); + InsertedGroupId insertedGroupId = new InsertedGroupId(); + insertedGroupId.setGroupId("plugins"); + insertedGroupId.setPath("/sfnet-mvnrepo-plugin"); + sfMapper.addInsertedGroupId(insertedGroupId); + insertedGroupId = new InsertedGroupId(); + insertedGroupId.setGroupId("plugins"); + insertedGroupId.setPath("/maven-nsis-plugin"); + sfMapper.addInsertedGroupId(insertedGroupId); + sfMapper.setBaseUrl("http://sourceforge.net/projects/mvn-infix/files/"); + sfMapper.setFrsHost("localhost"); + sfMapper.setPassword("test"); + sfMapper.setUserId("test"); + sfMapper.setProjectId("mvn-infix"); + repoConfig.addSourceForgeFRSMapper(sfMapper); + + mojoInfo.setWorkDirectory(workDir.getRoot()); + + // Create the directory structure for the test + File userHome = sshServer.getUserHome(); + URL dirTreeDesc = getClass().getResource(getPackageLocalLocation("T02-DT01-in.xml")); + DirectoryTreeUtil.generateDirectoryTree(userHome, dirTreeDesc); + + action.execute(mojoInfo); + + // Assertions + File destinFile = new File(workDir.getRoot(), "mvnrepo-repomap.xml"); + assertTrue("Merged File should exist!", destinFile.exists()); + + checkXmlEqual("T02-out.xml", destinFile.getAbsolutePath()); + } catch (ComponentLookupException e) { + getLog().warn("Missing component : repo-map", e); + fail("Missing component : repo-map"); + } catch (IOException e) { + getLog().warn("Error processing test! ", e); + fail("Error processing test! " + e.getMessage()); + } catch (MapGenerationException e) { + getLog().warn("Error merging maps ", e); + fail("Error merging maps " + e.getMessage()); + } catch (XMLStreamException e) { + getLog().warn("Error testing merge ", e); + fail("Error testing merge " + e.getMessage()); + } catch (SAXException e) { + getLog().warn("Error testing merge ", e); + fail("Error testing merge " + e.getMessage()); + } catch (ParserConfigurationException e) { + getLog().warn("Error testing merge ", e); + fail("Error testing merge " + e.getMessage()); + } + } + +} Property changes on: plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/mapper/sfnetsftp/SFTPParseTest.java =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/mapper/sfnetsftp/SFTPParseTest.java 2010-12-21 02:55:29 UTC (rev 98) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/java/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/mapper/sfnetsftp/SFTPParseTest.java 2010-12-21 02:57:17 UTC (rev 99) @@ -23,32 +23,20 @@ import static org.junit.Assert.*; import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; import java.net.URL; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.stream.XMLStreamException; - import org.junit.Rule; import org.junit.Test; -import org.xml.sax.SAXException; -import org.custommonkey.xmlunit.XMLAssert; +import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.AbstractRepoMapTest; import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.SfNetMvnMojoInfo; import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.SfNetMvnMojoInfoTCImpl; import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.mapper.MapGenerator; import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repoconfig.InsertedGroupId; import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repoconfig.SourceForgeFRSMapper; import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repomap.RepositoryMap; -import com.mindtree.techworks.infix.plugins.sfnetmvnrepo.model.repomap.io.stax.RepositoryMapStaxWriter; import com.mindtree.techworks.infix.pluginscommon.mojo.MojoInfo; -import com.mindtree.techworks.infix.pluginscommon.test.PlexusTestCase; import com.mindtree.techworks.infix.pluginscommon.test.dummydirtree.DirectoryTreeUtil; import com.mindtree.techworks.infix.pluginscommon.test.ssh.SSHServerResource; -import com.mindtree.techworks.infix.pluginscommon.test.xml.XmlTestUtil; /** @@ -56,7 +44,7 @@ * @version $Revision$ $Date$ * */ -public class SFTPParseTest extends PlexusTestCase { +public class SFTPParseTest extends AbstractRepoMapTest { @Rule public SSHServerResource sshServer = new SSHServerResource("test", 22, "127.0.0.1"); @@ -66,28 +54,36 @@ * @throws Exception */ @Test - public void testGenerateRepositoryMap () { + public void testBasicGenerateRepositoryMap () { // 1 - Generate basic mapper SourceForgeFRSMapper mapper = generateBasicMapper(); mapper.setBaseDir("/home/test/one"); execute(mapper, "T1DirTree.xml", "T1Expected.xml"); - + } + + public void testExclude () { // 2 - Test exclude - mapper = generateBasicMapper(); + SourceForgeFRSMapper mapper = generateBasicMapper(); mapper.setBaseDir("/home/test/two"); mapper.addExclude("**/ignore-file"); execute(mapper, "T2DirTree.xml", "T2Expected.xml"); - + } + + @Test + public void testBaseGroupId () { // 3 - Test base group id - mapper = generateBasicMapper(); + SourceForgeFRSMapper mapper = generateBasicMapper(); mapper.setBaseDir("/home/test/three"); mapper.setBaseGroupId("net.sf.infix"); execute(mapper, "T3DirTree.xml", "T3Expected.xml"); - + } + + @Test + public void testInsertedGroupId () { // 4 - Test inserted group id - mapper = generateBasicMapper(); + SourceForgeFRSMapper mapper = generateBasicMapper(); mapper.setBaseDir("/home/test/four"); mapper.addExclude("**/ignore-file"); mapper.setBaseGroupId("net.sf.infix"); @@ -97,14 +93,17 @@ mapper.addInsertedGroupId(insertedGroupId); execute(mapper, "T4DirTree.xml", "T4Expected.xml"); - + } + + @Test + public void testMultipleInsertedGroupId () { // 5 - Multiple inserted group id - mapper = generateBasicMapper(); + SourceForgeFRSMapper mapper = generateBasicMapper(); mapper.setAddDownloadSuffix(true); mapper.setBaseDir("/home/test/five"); mapper.addExclude("**/ignore-file"); mapper.setBaseGroupId("net.sf.infix"); - insertedGroupId = new InsertedGroupId(); + InsertedGroupId insertedGroupId = new InsertedGroupId(); insertedGroupId.setGroupId("plugins"); insertedGroupId.setPath("/sfnet-mvnrepo-plugin"); mapper.addInsertedGroupId(insertedGroupId); @@ -153,32 +152,6 @@ return mapper; } - private void checkXmlEqual (String controlLoc, RepositoryMap repoMap) throws IOException, XMLStreamException, SAXException, ParserConfigurationException { - - Reader controlReader = new InputStreamReader(getClass().getResourceAsStream(getPackageLocalLocation(controlLoc))); - - // Dump the repo map - StringWriter writer = new StringWriter(); - RepositoryMapStaxWriter repoMapWriter = new RepositoryMapStaxWriter(); - repoMapWriter.write(writer, repoMap); - String repoMapContent = writer.toString(); - - // Log if enabled - getLog().info(repoMapContent); - - // Assert Equals - XMLAssert.assertXMLEqual(XmlTestUtil.getNormalizedDocument(controlReader), XmlTestUtil.getNormalizedDocument(new StringReader(repoMapContent))); - } - - private String getPackageLocalLocation (String resource) { - String packageName = getClass().getPackage().getName().replace('.', '/'); - String resourceLoc = packageName + "/" + resource; - if (!resourceLoc.startsWith("/")) { - resourceLoc = "/" + resourceLoc; - } - return resourceLoc; - } - /* (non-Javadoc) * @see com.mindtree.techworks.infix.pluginscommon.test.PlexusTestCase#createMojoInfo() */ Added: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.xml =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.xml (rev 0) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.xml 2010-12-21 02:57:17 UTC (rev 99) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component-set> + <components> + <component> + <role>com.mindtree.techworks.infix.plugins.sfnetmvnrepo.mapper.jschutil.SfNetFRSUserInfo + </role> + <role-hint>default</role-hint> + <implementation>com.mindtree.techworks.infix.plugins.sfnetmvnrepo.mapper.jschutil.UserInfoImpl + </implementation> + <instantiation-strategy>per-lookup</instantiation-strategy> + <description /> + <isolated-realm>false</isolated-realm> + <requirements> + <requirement> + <role>org.codehaus.plexus.components.interactivity.Prompter</role> + <role-hint /> + <field-name>prompter</field-name> + </requirement> + </requirements> + <configuration> + <auto-prompt-yes>true</auto-prompt-yes> + </configuration> + </component> + </components> +</component-set> \ No newline at end of file Property changes on: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/RepoMapGenActionTest.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM01-in.xml =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM01-in.xml (rev 0) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM01-in.xml 2010-12-21 02:57:17 UTC (rev 99) @@ -0,0 +1,24 @@ +<Repository + xmlns="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0 http://mvn-infix.sourceforge.net/sfnet-mvnrepo-plugin/xsds/repo-map-0.1.0.xsd" + redirectBase="http://example.com/mvnrepo/"> + <directories> + <directory nodeId="infix-parent" name="infix-parent"> + <directories> + <directory nodeId="1.0" name="1.0"> + <files> + <file nodeId="infix-parent-1.0-M1.pom" name="infix-parent-1.0-M1.pom" /> + <file nodeId="infix-parent-1.0-M1.pom.md5" name="infix-parent-1.0-M1.pom.md5" /> + <file nodeId="infix-parent-1.0-M1.pom.sha1" name="infix-parent-1.0-M1.pom.sha1" /> + </files> + </directory> + </directories> + <files> + <file nodeId="maven-metadata.xml" name="maven-metadata.xml" /> + <file nodeId="maven-metadata.xml.md5" name="maven-metadata.xml.md5" /> + <file nodeId="maven-metadata.xml.sha1" name="maven-metadata.xml.sha1" /> + </files> + </directory> + </directories> +</Repository> Property changes on: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM01-in.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM02-in.xml =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM02-in.xml (rev 0) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM02-in.xml 2010-12-21 02:57:17 UTC (rev 99) @@ -0,0 +1,35 @@ +<Repository + xmlns="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0 http://mvn-infix.sourceforge.net/sfnet-mvnrepo-plugin/xsds/repo-map-0.1.0.xsd" + redirectBase="http://example.com/mvnrepo/"> + <directories> + <directory nodeId="plugins" name="plugins"> + <directories> + <directory nodeId="maven-nsis-plugin" name="maven-nsis-plugin" + redirectBase="http://example.com/mvnrepo/maven-nsis-plugin/"> + <directories> + <directory nodeId="1.0" name="1.0"> + <files> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom" name="sfnet-mvnrepo-plugin-0.1.0-M1.pom" + urlSuffix="/download" /> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5" name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5" + urlSuffix="/download" /> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1" name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1" + urlSuffix="/download" /> + </files> + </directory> + </directories> + <files> + <file nodeId="maven-metadata.xml" name="maven-metadata.xml" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.md5" name="maven-metadata.xml.md5" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.sha1" name="maven-metadata.xml.sha1" + urlSuffix="/download" /> + </files> + </directory> + </directories> + </directory> + </directories> +</Repository> Property changes on: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-EM02-in.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-out.xml =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-out.xml (rev 0) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-out.xml 2010-12-21 02:57:17 UTC (rev 99) @@ -0,0 +1,51 @@ +<Repository + xmlns="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0 http://mvn-infix.sourceforge.net/sfnet-mvnrepo-plugin/xsds/repo-map-0.1.0.xsd" + redirectBase="http://example.com/mvnrepo/" nodeId="eg1" name="Example Merge 1"> + <directories> + <directory nodeId="infix-parent" name="infix-parent"> + <directories> + <directory nodeId="1.0" name="1.0"> + <files> + <file nodeId="infix-parent-1.0-M1.pom" name="infix-parent-1.0-M1.pom" /> + <file nodeId="infix-parent-1.0-M1.pom.md5" name="infix-parent-1.0-M1.pom.md5" /> + <file nodeId="infix-parent-1.0-M1.pom.sha1" name="infix-parent-1.0-M1.pom.sha1" /> + </files> + </directory> + </directories> + <files> + <file nodeId="maven-metadata.xml" name="maven-metadata.xml" /> + <file nodeId="maven-metadata.xml.md5" name="maven-metadata.xml.md5" /> + <file nodeId="maven-metadata.xml.sha1" name="maven-metadata.xml.sha1" /> + </files> + </directory> + <directory nodeId="plugins" name="plugins"> + <directories> + <directory nodeId="maven-nsis-plugin" name="maven-nsis-plugin" + redirectBase="http://example.com/mvnrepo/maven-nsis-plugin/"> + <directories> + <directory nodeId="1.0" name="1.0"> + <files> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom" name="sfnet-mvnrepo-plugin-0.1.0-M1.pom" + urlSuffix="/download" /> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5" name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5" + urlSuffix="/download" /> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1" name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1" + urlSuffix="/download" /> + </files> + </directory> + </directories> + <files> + <file nodeId="maven-metadata.xml" name="maven-metadata.xml" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.md5" name="maven-metadata.xml.md5" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.sha1" name="maven-metadata.xml.sha1" + urlSuffix="/download" /> + </files> + </directory> + </directories> + </directory> + </directories> +</Repository> Property changes on: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T01-out.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-DT01-in.xml =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-DT01-in.xml (rev 0) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-DT01-in.xml 2010-12-21 02:57:17 UTC (rev 99) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<DirectoryTree + xmlns="http://mvn-infix.sourceforge.net/pluginscommon/test/dummydirtree" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Directory name="act-one"> + <Directory name="infix-parent"> + <Directory name="1.0"> + <File name="infix-parent-1.0-M1.pom"/> + <File name="infix-parent-1.0-M1.pom.md5"/> + <File name="infix-parent-1.0-M1.pom.sha1"/> + </Directory> + <File name="maven-metadata.xml"/> + <File name="maven-metadata.xml.md5"/> + <File name="maven-metadata.xml.sha1"/> + </Directory> + <Directory name="ignore-file"> + <File name="maven-metadata.xml"/> + <File name="maven-metadata.xml.md5"/> + <File name="maven-metadata.xml.sha1"/> + </Directory> + <Directory name="sfnet-mvnrepo-plugin"> + <Directory name=".svn"> + <Directory name="prop-base"> + <File name="pom.xml.svn-base"/> + </Directory> + <File name="all-wcprops"/> + <File name="dir-prop-base"/> + <File name="entries"/> + </Directory> + <Directory name="1.0"> + <File name="sfnet-mvnrepo-plugin-0.1.0-M1.pom"/> + <File name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5"/> + <File name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1"/> + </Directory> + <File name="maven-metadata.xml"/> + <File name="maven-metadata.xml.md5"/> + <File name="maven-metadata.xml.sha1"/> + </Directory> + <Directory name="maven-nsis-plugin"> + <Directory name=".svn"> + <Directory name="prop-base"> + <File name="pom.xml.svn-base"/> + </Directory> + <File name="all-wcprops"/> + <File name="dir-prop-base"/> + <File name="entries"/> + </Directory> + <Directory name="1.0"> + <File name="sfnet-mvnrepo-plugin-0.1.0-M1.pom"/> + <File name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5"/> + <File name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1"/> + </Directory> + <File name="maven-metadata.xml"/> + <File name="maven-metadata.xml.md5"/> + <File name="maven-metadata.xml.sha1"/> + </Directory> + </Directory> +</DirectoryTree> Property changes on: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-DT01-in.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-EM01-in.xml =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-EM01-in.xml (rev 0) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-EM01-in.xml 2010-12-21 02:57:17 UTC (rev 99) @@ -0,0 +1,38 @@ +<Repository + xmlns="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0 http://mvn-infix.sourceforge.net/sfnet-mvnrepo-plugin/xsds/repo-map-0.1.0.xsd" + redirectBase="http://mindtreeinsight.svn.sourceforge.net/svnroot/mindtreeinsight/maven-repo/trunk/dependency/"> + <directories> + <directory nodeId="net" name="net"> + <directories> + <directory name="charabia" nodeId="charabia"> + <directories> + <directory name="jsmoothgen" nodeId="jsmoothgen"> + <directories> + <directory name="0.9.9-7" nodeId="0.9.9-7"> + <files> + <file name="jsmoothgen-0.9.9-7.pom" nodeId="jsmoothgen-0.9.9-7.pom"/> + <file name="jsmoothgen-0.9.9-7.pom" nodeId="jsmoothgen-0.9.9-7.pom.md5"/> + <file name="jsmoothgen-0.9.9-7.pom" nodeId="jsmoothgen-0.9.9-7.pom"/> + <file name="jsmoothgen-0.9.9-7.jar" nodeId="jsmoothgen-0.9.9-7.jar"/> + <file name="jsmoothgen-0.9.9-7.jar" nodeId="jsmoothgen-0.9.9-7.jar.md5"/> + <file name="jsmoothgen-0.9.9-7.jar" nodeId="jsmoothgen-0.9.9-7.jar.sha1"/> + <file name="jsmoothgen-0.9.9-7-sources.jar" nodeId="jsmoothgen-0.9.9-7-sources.jar"/> + <file name="jsmoothgen-0.9.9-7-sources.jar" nodeId="jsmoothgen-0.9.9-7-sources.jar.md5"/> + <file name="jsmoothgen-0.9.9-7-sources.jar" nodeId="jsmoothgen-0.9.9-7-sources.jar.sha1"/> + </files> + </directory> + </directories> + <files> + <file nodeId="maven-metadata.xml" name="maven-metadata.xml" /> + <file nodeId="maven-metadata.xml.md5" name="maven-metadata.xml.md5" /> + <file nodeId="maven-metadata.xml.sha1" name="maven-metadata.xml.sha1" /> + </files> + </directory> + </directories> + </directory> + </directories> + </directory> + </directories> +</Repository> Property changes on: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-EM01-in.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-out.xml =================================================================== --- plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-out.xml (rev 0) +++ plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-out.xml 2010-12-21 02:57:17 UTC (rev 99) @@ -0,0 +1,130 @@ +<Repository + xmlns="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://mvn-infix.sourceforge.net/plugins/sfnet-mvnrepo-plugin/repo-map/0.1.0 http://mvn-infix.sourceforge.net/sfnet-mvnrepo-plugin/xsds/repo-map-0.1.0.xsd" + redirectBase="http://sourceforge.net/projects/mvn-infix/files/" nodeId="mvnrepo" + name="Infix Maven Repository"> + <directories> + <directory nodeId="net" name="net" + redirectBase="http://mindtreeinsight.svn.sourceforge.net/svnroot/mindtreeinsight/maven-repo/trunk/dependency/net/"> + <directories> + <directory name="charabia" nodeId="charabia"> + <directories> + <directory name="jsmoothgen" nodeId="jsmoothgen"> + <directories> + <directory name="0.9.9-7" nodeId="0.9.9-7"> + <files> + <file name="jsmoothgen-0.9.9-7.pom" nodeId="jsmoothgen-0.9.9-7.pom" /> + <file name="jsmoothgen-0.9.9-7.pom" nodeId="jsmoothgen-0.9.9-7.pom.md5" /> + <file name="jsmoothgen-0.9.9-7.pom" nodeId="jsmoothgen-0.9.9-7.pom" /> + <file name="jsmoothgen-0.9.9-7.jar" nodeId="jsmoothgen-0.9.9-7.jar" /> + <file name="jsmoothgen-0.9.9-7.jar" nodeId="jsmoothgen-0.9.9-7.jar.md5" /> + <file name="jsmoothgen-0.9.9-7.jar" nodeId="jsmoothgen-0.9.9-7.jar.sha1" /> + <file name="jsmoothgen-0.9.9-7-sources.jar" nodeId="jsmoothgen-0.9.9-7-sources.jar" /> + <file name="jsmoothgen-0.9.9-7-sources.jar" nodeId="jsmoothgen-0.9.9-7-sources.jar.md5" /> + <file name="jsmoothgen-0.9.9-7-sources.jar" nodeId="jsmoothgen-0.9.9-7-sources.jar.sha1" /> + </files> + </directory> + </directories> + <files> + <file nodeId="maven-metadata.xml" name="maven-metadata.xml" /> + <file nodeId="maven-metadata.xml.md5" name="maven-metadata.xml.md5" /> + <file nodeId="maven-metadata.xml.sha1" name="maven-metadata.xml.sha1" /> + </files> + </directory> + </directories> + </directory> + </directories> + </directory> + <directory nodeId="com" name="com"> + <directories> + <directory nodeId="mindtree" name="mindtree"> + <directories> + <directory nodeId="techworks" name="techworks"> + <directories> + <directory redirectBase="http://sourceforge.net/projects/mvn-infix/files/" nodeId="infix" name="infix"> + <directories> + <directory nodeId="infix-parent" name="infix-parent"> + <directories> + <directory nodeId="1.0" name="1.0"> + <files> + <file nodeId="infix-parent-1.0-M1.pom" name="infix-parent-1.0-M1.pom" + urlSuffix="/download" /> + <file nodeId="infix-parent-1.0-M1.pom.md5" name="infix-parent-1.0-M1.pom.md5" + urlSuffix="/download" /> + <file nodeId="infix-parent-1.0-M1.pom.sha1" name="infix-parent-1.0-M1.pom.sha1" + urlSuffix="/download" /> + </files> + </directory> + </directories> + <files> + <file nodeId="maven-metadata.xml" name="maven-metadata.xml" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.md5" name="maven-metadata.xml.md5" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.sha1" name="maven-metadata.xml.sha1" + urlSuffix="/download" /> + </files> + </directory> + <directory nodeId="plugins" name="plugins"> + <directories> + <directory nodeId="maven-nsis-plugin" name="maven-nsis-plugin" + redirectBase="http://sourceforge.net/projects/mvn-infix/files/maven-nsis-plugin/"> + <directories> + <directory nodeId="1.0" name="1.0"> + <files> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom" + name="sfnet-mvnrepo-plugin-0.1.0-M1.pom" urlSuffix="/download" /> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5" + name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5" urlSuffix="/download" /> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1" + name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1" + urlSuffix="/download" /> + </files> + </directory> + </directories> + <files> + <file nodeId="maven-metadata.xml" name="maven-metadata.xml" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.md5" name="maven-metadata.xml.md5" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.sha1" name="maven-metadata.xml.sha1" + urlSuffix="/download" /> + </files> + </directory> + <directory nodeId="sfnet-mvnrepo-plugin" name="sfnet-mvnrepo-plugin" + redirectBase="http://sourceforge.net/projects/mvn-infix/files/sfnet-mvnrepo-plugin/"> + <directories> + <directory nodeId="1.0" name="1.0"> + <files> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom" + name="sfnet-mvnrepo-plugin-0.1.0-M1.pom" urlSuffix="/download" /> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5" + name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.md5" urlSuffix="/download" /> + <file nodeId="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1" + name="sfnet-mvnrepo-plugin-0.1.0-M1.pom.sha1" + urlSuffix="/download" /> + </files> + </directory> + </directories> + <files> + <file nodeId="maven-metadata.xml" name="maven-metadata.xml" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.md5" name="maven-metadata.xml.md5" + urlSuffix="/download" /> + <file nodeId="maven-metadata.xml.sha1" name="maven-metadata.xml.sha1" + urlSuffix="/download" /> + </files> + </directory> + </directories> + </directory> + </directories> + </directory> + </directories> + </directory> + </directories> + </directory> + </directories> + </directory> + </directories> +</Repository> Property changes on: plugins/sfnet-mvnrepo-plugin/trunk/src/test/resources/com/mindtree/techworks/infix/plugins/sfnetmvnrepo/actions/T02-out.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/MojoInfoTCImpl.java =================================================================== --- shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/MojoInfoTCImpl.java 2010-12-21 02:55:29 UTC (rev 98) +++ shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/MojoInfoTCImpl.java 2010-12-21 02:57:17 UTC (rev 99) @@ -39,6 +39,10 @@ public class MojoInfoTCImpl implements MojoInfo { private Log log = new SystemStreamLog (); + + private File workDirectory; + + private MavenProject project = new MavenProject(); /* (non-Javadoc) * @see com.mindtree.techworks.infix.pluginscommon.mojo.MojoInfo#getLog() @@ -53,8 +57,7 @@ */ @Override public MavenProject getProject () { - // TODO Auto-generated method stub - return null; + return project; } /* (non-Javadoc) @@ -62,8 +65,7 @@ */ @Override public File getWorkDirectory () { - // TODO Auto-generated method stub - return null; + return workDirectory; } /* (non-Javadoc) @@ -84,4 +86,14 @@ return null; } + + public void setLog (Log log) { + this.log = log; + } + + + public void setWorkDirectory (File workDirectory) { + this.workDirectory = workDirectory; + } + } Modified: shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/PlexusTestCase.java =================================================================== --- shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/PlexusTestCase.java 2010-12-21 02:55:29 UTC (rev 98) +++ shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/PlexusTestCase.java 2010-12-21 02:57:17 UTC (rev 99) @@ -31,6 +31,8 @@ import org.codehaus.plexus.DefaultPlexusContainer; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.PlexusContainerException; +import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.context.Context; import org.codehaus.plexus.context.DefaultContext; import org.codehaus.plexus.logging.Logger; @@ -132,7 +134,11 @@ * configuration name if required. */ protected String getConfigurationName () { - return getClass().getName().replace( '.', '/' ) + ".xml"; + String customConfigName = getClass().getName().replace( '.', '/' ) + ".xml"; + if (null != getClass().getResource("/" + customConfigName)) { + return customConfigName; + } + return null; } protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration ) { @@ -158,15 +164,15 @@ /** * Looks up the default component for the role */ - protected <T> T lookup ( Class<T> role ) throws Exception { + protected <T> T lookup ( Class<T> role ) throws ComponentLookupException { return getContainer().lookup( role ); } - protected <T> T lookup ( Class<T> role, String roleHint ) throws Exception { + protected <T> T lookup ( Class<T> role, String roleHint ) throws ComponentLookupException { return getContainer().lookup( role, roleHint ); } - protected <T> void release ( T component ) throws Exception { + protected <T> void release ( T component ) throws ComponentLifecycleException { getContainer().release( component ); } Modified: shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/ssh/JunitDummyAuthenticationProvider.java =================================================================== --- shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/ssh/JunitDummyAuthenticationProvider.java 2010-12-21 02:55:29 UTC (rev 98) +++ shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/ssh/JunitDummyAuthenticationProvider.java 2010-12-21 02:57:17 UTC (rev 99) @@ -26,7 +26,6 @@ import com.sshtools.daemon.configuration.PlatformConfiguration; import com.sshtools.daemon.platform.DummyAuthenticationProvider; import com.sshtools.daemon.vfs.VFSMount; -import com.sshtools.j2ssh.configuration.ConfigurationException; import com.sshtools.j2ssh.configuration.ConfigurationLoader; @@ -37,18 +36,9 @@ */ public class JunitDummyAuthenticationProvider extends DummyAuthenticationProvider { - private VFSMount vfsroot; - - /** - * @throws ConfigurationException - */ - public JunitDummyAuthenticationProvider () throws ConfigurationException { - vfsroot = ((PlatformConfiguration) ConfigurationLoader.getConfiguration(PlatformConfiguration.class)).getVFSRoot(); - } - @Override public String getHomeDirectory (String username) throws IOException { - + VFSMount vfsroot = ((PlatformConfiguration) ConfigurationLoader.getConfiguration(PlatformConfiguration.class)).getVFSRoot(); String base = vfsroot.getPath(); File homeDir = new File (base + "/home/" + username); return homeDir.getAbsolutePath().replace('\\', '/'); Modified: shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/ssh/SSHServerResource.java =================================================================== --- shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/ssh/SSHServerResource.java 2010-12-21 02:55:29 UTC (rev 98) +++ shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/ssh/SSHServerResource.java 2010-12-21 02:57:17 UTC (rev 99) @@ -55,6 +55,8 @@ */ public class SSHServerResource extends ExternalResource { + private static XmlServerConfigurationContext serverPlatformConfiguration; + private final String userId; private final int port; private final String bindAddress; @@ -191,23 +193,35 @@ } private void configureServer () throws ConfigurationException { - + String configBase = configDir.getRoot().getAbsolutePath().replace('\\', '/') + '/'; - - XmlServerConfigurationContext context = new XmlServerConfigurationContext(); - context.setServerConfigurationResource(ConfigurationLoader.checkAndGetProperty( - "sshtools.server", configBase + "server.xml")); - context.setPlatformConfigurationResource(System.getProperty( - "sshtools.platform", configBase + "platform.xml")); - ConfigurationLoader.initialize(false, context); - XmlConfigurationContext context2 = new XmlConfigurationContext(); - context2.setFailOnError(false); - context2.setAPIConfigurationResource(ConfigurationLoader.checkAndGetProperty( - "sshtools.config", configBase + "sshtools.xml")); - context2.setAutomationConfigurationResource(ConfigurationLoader.checkAndGetProperty( - "sshtools.automate", configBase + "automation.xml")); - ConfigurationLoader.initialize(false, context2); + // We store serverPlatformConfiguration as a static variable so we can + // reinitialize it. This is required if the server is started and stopped + // from multiple test executions - the design of J2SSH daemon does not + // allow re-configuration (configs stored in static variables). + if (null == serverPlatformConfiguration) { + serverPlatformConfiguration = new XmlServerConfigurationContext(); + serverPlatformConfiguration.setServerConfigurationResource(ConfigurationLoader + .checkAndGetProperty("sshtools.server", configBase + "server.xml")); + serverPlatformConfiguration.setPlatformConfigurationResource(System.getProperty( + "sshtools.platform", configBase + "platform.xml")); + ConfigurationLoader.initialize(false, serverPlatformConfiguration); + } else { + serverPlatformConfiguration.setServerConfigurationResource(ConfigurationLoader + .checkAndGetProperty("sshtools.server", configBase + "server.xml")); + serverPlatformConfiguration.setPlatformConfigurationResource(System.getProperty( + "sshtools.platform", configBase + "platform.xml")); + serverPlatformConfiguration.initialize(); + } + + XmlConfigurationContext context2 = new XmlConfigurationContext(); + context2.setFailOnError(false); + context2.setAPIConfigurationResource(ConfigurationLoader.checkAndGetProperty( + "sshtools.config", configBase + "sshtools.xml")); + context2.setAutomationConfigurationResource(ConfigurationLoader.checkAndGetProperty( + "sshtools.automate", configBase + "automation.xml")); + ConfigurationLoader.initialize(false, context2); } private void setupHomeDir () { Modified: shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/xml/XmlTestUtil.java =================================================================== --- shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/xml/XmlTestUtil.java 2010-12-21 02:55:29 UTC (rev 98) +++ shared/infix-plugins-common/trunk/infix-test-utils/src/main/java/com/mindtree/techworks/infix/pluginscommon/test/xml/XmlTestUtil.java 2010-12-21 02:57:17 UTC (rev 99) @@ -20,6 +20,7 @@ */ package com.mindtree.techworks.infix.pluginscommon.test.xml; +import java.io.FileReader; import java.io.IOException; import java.io.Reader; @@ -59,4 +60,8 @@ return (Document) Nodes.normalizeWhitespace(d); } + public static Document getNormalizedDocument (String fileLocation) + throws ParserConfigurationException, SAXException, IOException { + return getNormalizedDocument(new FileReader(fileLocation)); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ mvn-Infix-commits mailing list mvn-Infix-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mvn-infix-commits