You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by br...@apache.org on 2011/12/22 06:54:53 UTC
svn commit: r1222072 [6/13] - in /incubator/npanday/trunk: ./
components/dotnet-executable/src/main/java/npanday/executable/
components/dotnet-executable/src/main/java/npanday/executable/compiler/
components/dotnet-executable/src/main/java/npanday/exec...
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/csharp/SettingsUtilTest.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/csharp/SettingsUtilTest.cs?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/csharp/SettingsUtilTest.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/csharp/SettingsUtilTest.cs Thu Dec 22 06:54:49 2011
@@ -1,246 +1,246 @@
-#region licence
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-#endregion
-
-using System;
-using System.Xml;
-using NPanday.Utils;
-using NUnit.Framework;
-using NPanday.Model.Settings;
-using System.IO;
-
-namespace NPanday.Utils_Test
-{
- [TestFixture]
- public class SettingsUtilTest
- {
- private string _repoUrl1 = "http://repo1.maven.org/maven2";
- private string _repoUrl2 = "http://repo.exist.com/maven2";
- private Settings _settings;
-
- private NameTable _nameTable;
- private XmlNamespaceManager _namespaceManager;
-
- public SettingsUtilTest()
- {
- _nameTable = new NameTable();
- _namespaceManager = new XmlNamespaceManager(_nameTable);
-
- }
-
- [Test]
- public void AddRepository_NoProfileTag__AddsRepoToModel()
- {
- _settings = ReadTestSettings("test-settings.xml");
-
- Profile profile = SettingsUtil.GetDefaultProfile(_settings, true);
- Assert.IsNotNull(profile);
- SettingsUtil.AddRepositoryToProfile(profile, _repoUrl1, true, false);
-
- Assert.AreEqual(1, _settings.profiles.Length, "Settings does not contain a profile");
-
- Repository repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl1);
-
- Assert.IsNotNull(repository, "Repository '" + _repoUrl1 + "' was not added to profile");
-
- Assert.AreEqual("npanday.repo.0", repository.id);
- Assert.AreEqual(_repoUrl1, repository.url);
- }
-
- [Test]
- public void AddRepository_WithProfileTag_AddsRepoToModel()
- {
- _settings = ReadTestSettings("test-settings-with-profile.xml");
-
- Profile profile = SettingsUtil.GetDefaultProfile(_settings, false);
- Assert.IsNotNull(profile);
-
- SettingsUtil.AddRepositoryToProfile(profile, _repoUrl2, true, false);
-
- Assert.AreEqual(1, _settings.profiles.Length, "Settings does not contain a profile");
- Assert.AreEqual(2, _settings.profiles[0].repositories.Length);
-
- Repository repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl1);
- Assert.IsNotNull(repository, "Repository '" + _repoUrl1 + "' was not in the profile");
- Assert.AreEqual("npanday.repo.0", repository.id);
- Assert.AreEqual(_repoUrl1, repository.url);
-
- repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl2);
- Assert.IsNotNull(repository, "Repository '" + _repoUrl2 + "' was not added to profile");
- Assert.AreEqual("npanday.repo.1", repository.id);
- Assert.AreEqual(_repoUrl2, repository.url);
- }
-
- [Test]
- public void AddRepository_WithProfileAndWithoutNs__AddsRepoToModel()
- {
- _settings = ReadTestSettings("test-settings-with-profile.xml");
-
- Profile profile = SettingsUtil.GetDefaultProfile(_settings, false);
- Assert.IsNotNull(profile);
- }
-
- [Test]
- public void AddRepository_WithProfileAndNs__AddsRepoToModel()
- {
- string fullPath;
- _settings = ReadTestSettings("test-settings-with-profile-and-namespace.xml", out fullPath);
-
- Profile profile = SettingsUtil.GetDefaultProfile(_settings, false);
- Assert.IsNotNull(profile);
- }
-
- [Test]
- public void ReadWrite_WithoutNSAndProfileTag_DoesNotChangeContent()
- {
- ReadWrite_LeavesContentUnchanged("test-settings.xml");
- }
-
- [Test]
- public void ReadWrite_WithNsWithoutProfileTag_DoesNotChangeContent()
- {
- ReadWrite_LeavesContentUnchanged("test-settings-with-namespace.xml");
- }
-
- [Test]
- public void ReadWrite_WithoutNsWithProfileTag_DoesNotChangeContent()
- {
- ReadWrite_LeavesContentUnchanged("test-settings-with-profile.xml");
- }
-
- [Test]
- public void ReadWrite_WithNsAndProfileTag_DoesNotChangeContent()
- {
- ReadWrite_LeavesContentUnchanged("test-settings-with-profile-and-namespace.xml");
- }
-
- private void ReadWrite_LeavesContentUnchanged(string testSettingsXml)
- {
- string fullPath;
- _settings = ReadTestSettings(testSettingsXml, out fullPath);
-
- Console.WriteLine("file:///" + new Uri(fullPath).AbsolutePath);
-
- Assert.IsNotNull(_settings);
-
- XmlDocument beforeXd = new XmlDocument();
- beforeXd.Load(fullPath);
- string before = beforeXd.OuterXml;
-
- SettingsUtil.MergeSettings(_settings, fullPath);
-
- XmlDocument afterXd = new XmlDocument();
- afterXd.Load(fullPath);
- string after = afterXd.OuterXml;
-
- Assert.AreEqual(before, after);
- }
-
- [Test]
- public void CreateDefaultProfile_WithoutNsAndProfileTag_AddsProfileTagsWithoutNamespace()
- {
- string fullPath;
- _settings = ReadTestSettings("test-settings.xml", out fullPath);
-
- Assert.IsNotNull(_settings);
-
- SettingsUtil.GetDefaultProfile(_settings, true);
-
- SettingsUtil.MergeSettings(_settings, fullPath);
-
- XmlDocument afterXd = new XmlDocument();
- afterXd.Load(fullPath);
-
- assertNodeExists(afterXd, "/settings/profiles");
- assertNodeExists(afterXd, "/settings/profiles/profile[id='" + SettingsUtil.defaultProfileID + "']");
- assertNodeExists(afterXd, "/settings/activeProfiles");
- assertNodeExists(afterXd, "/settings/activeProfiles/activeProfile[text()='" + SettingsUtil.defaultProfileID + "']");
- }
-
- [Test]
- public void CreateDefaultProfile_WithNsWithoutProfileTag_AddsProfileTagsWithNamespace()
- {
- string fullPath;
- _settings = ReadTestSettings("test-settings-with-namespace.xml", out fullPath);
-
- Assert.IsNotNull(_settings);
-
- SettingsUtil.GetDefaultProfile(_settings, true);
-
- SettingsUtil.MergeSettings(_settings, fullPath);
-
-
- _namespaceManager.AddNamespace("settings", SettingsUtil.MavenSettingsNamespace);
-
- XmlDocument afterXd = new XmlDocument(_nameTable);
- afterXd.Load(fullPath);
-
- assertNodeExists(afterXd, "/settings:settings");
- assertNodeExists(afterXd, "/settings:settings/settings:profiles");
- assertNodeExists(afterXd, "/settings:settings/settings:profiles/settings:profile[settings:id='" + SettingsUtil.defaultProfileID + "']");
- assertNodeExists(afterXd, "/settings:settings/settings:activeProfiles");
- assertNodeExists(afterXd, "/settings:settings/settings:activeProfiles/settings:activeProfile[text()='" + SettingsUtil.defaultProfileID + "']");
- }
-
- private void assertNodeExists(XmlDocument xml, string xpath)
- {
- assertNodesExists(xml, xpath, 1);
- }
-
- private void assertNodesExists(XmlDocument xml, string xpath, int count)
- {
- XmlNodeList nodes = xml.SelectNodes(xpath, _namespaceManager);
- if (nodes.Count == 0)
- Assert.Fail("Could not find a node matching " + xpath + " in " + xml.BaseURI);
- if (nodes.Count < count)
- Assert.Fail("Found less than " + count + " nodes matching " + xpath + " in " + xml.BaseURI);
- if (nodes.Count > count)
- Assert.Fail("Found more than " + count + " node(s) matching " + xpath + " in " + xml.BaseURI);
- }
-
- private Settings ReadTestSettings(string settingsXml)
- {
- string fullPath;
- return ReadTestSettings(settingsXml, out fullPath);
- }
-
- private Settings ReadTestSettings(string settingsXml, out string fullPath)
- {
- DirectoryInfo projectRoot = PathUtility.FindProjectRoot(new DirectoryInfo(Directory.GetCurrentDirectory()));
-
- FileInfo originalPath = getSettingsPath(projectRoot, settingsXml);
- string dir = Path.Combine(PathUtility.GetBuildDirectory(projectRoot).FullName, "test-workbench");
- Directory.CreateDirectory(dir);
- fullPath = Path.Combine(dir, settingsXml);
-
- originalPath.CopyTo(fullPath, true);
- return SettingsUtil.ReadSettings(originalPath);
- }
-
- private FileInfo getSettingsPath(DirectoryInfo projectRoot, string settingsXml)
- {
- string path = Path.Combine(projectRoot.FullName, "src");
- path = Path.Combine(path, "test");
- path = Path.Combine(path, "resource");
- path = Path.Combine(path, "m2");
- return new FileInfo(Path.Combine(path, settingsXml));
- }
- }
-}
+#region licence
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+#endregion
+
+using System;
+using System.Xml;
+using NPanday.Utils;
+using NUnit.Framework;
+using NPanday.Model.Settings;
+using System.IO;
+
+namespace NPanday.Utils_Test
+{
+ [TestFixture]
+ public class SettingsUtilTest
+ {
+ private string _repoUrl1 = "http://repo1.maven.org/maven2";
+ private string _repoUrl2 = "http://repo.exist.com/maven2";
+ private Settings _settings;
+
+ private NameTable _nameTable;
+ private XmlNamespaceManager _namespaceManager;
+
+ public SettingsUtilTest()
+ {
+ _nameTable = new NameTable();
+ _namespaceManager = new XmlNamespaceManager(_nameTable);
+
+ }
+
+ [Test]
+ public void AddRepository_NoProfileTag__AddsRepoToModel()
+ {
+ _settings = ReadTestSettings("test-settings.xml");
+
+ Profile profile = SettingsUtil.GetDefaultProfile(_settings, true);
+ Assert.IsNotNull(profile);
+ SettingsUtil.AddRepositoryToProfile(profile, _repoUrl1, true, false);
+
+ Assert.AreEqual(1, _settings.profiles.Length, "Settings does not contain a profile");
+
+ Repository repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl1);
+
+ Assert.IsNotNull(repository, "Repository '" + _repoUrl1 + "' was not added to profile");
+
+ Assert.AreEqual("npanday.repo.0", repository.id);
+ Assert.AreEqual(_repoUrl1, repository.url);
+ }
+
+ [Test]
+ public void AddRepository_WithProfileTag_AddsRepoToModel()
+ {
+ _settings = ReadTestSettings("test-settings-with-profile.xml");
+
+ Profile profile = SettingsUtil.GetDefaultProfile(_settings, false);
+ Assert.IsNotNull(profile);
+
+ SettingsUtil.AddRepositoryToProfile(profile, _repoUrl2, true, false);
+
+ Assert.AreEqual(1, _settings.profiles.Length, "Settings does not contain a profile");
+ Assert.AreEqual(2, _settings.profiles[0].repositories.Length);
+
+ Repository repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl1);
+ Assert.IsNotNull(repository, "Repository '" + _repoUrl1 + "' was not in the profile");
+ Assert.AreEqual("npanday.repo.0", repository.id);
+ Assert.AreEqual(_repoUrl1, repository.url);
+
+ repository = SettingsUtil.GetRepositoryFromProfile(profile, _repoUrl2);
+ Assert.IsNotNull(repository, "Repository '" + _repoUrl2 + "' was not added to profile");
+ Assert.AreEqual("npanday.repo.1", repository.id);
+ Assert.AreEqual(_repoUrl2, repository.url);
+ }
+
+ [Test]
+ public void AddRepository_WithProfileAndWithoutNs__AddsRepoToModel()
+ {
+ _settings = ReadTestSettings("test-settings-with-profile.xml");
+
+ Profile profile = SettingsUtil.GetDefaultProfile(_settings, false);
+ Assert.IsNotNull(profile);
+ }
+
+ [Test]
+ public void AddRepository_WithProfileAndNs__AddsRepoToModel()
+ {
+ string fullPath;
+ _settings = ReadTestSettings("test-settings-with-profile-and-namespace.xml", out fullPath);
+
+ Profile profile = SettingsUtil.GetDefaultProfile(_settings, false);
+ Assert.IsNotNull(profile);
+ }
+
+ [Test]
+ public void ReadWrite_WithoutNSAndProfileTag_DoesNotChangeContent()
+ {
+ ReadWrite_LeavesContentUnchanged("test-settings.xml");
+ }
+
+ [Test]
+ public void ReadWrite_WithNsWithoutProfileTag_DoesNotChangeContent()
+ {
+ ReadWrite_LeavesContentUnchanged("test-settings-with-namespace.xml");
+ }
+
+ [Test]
+ public void ReadWrite_WithoutNsWithProfileTag_DoesNotChangeContent()
+ {
+ ReadWrite_LeavesContentUnchanged("test-settings-with-profile.xml");
+ }
+
+ [Test]
+ public void ReadWrite_WithNsAndProfileTag_DoesNotChangeContent()
+ {
+ ReadWrite_LeavesContentUnchanged("test-settings-with-profile-and-namespace.xml");
+ }
+
+ private void ReadWrite_LeavesContentUnchanged(string testSettingsXml)
+ {
+ string fullPath;
+ _settings = ReadTestSettings(testSettingsXml, out fullPath);
+
+ Console.WriteLine("file:///" + new Uri(fullPath).AbsolutePath);
+
+ Assert.IsNotNull(_settings);
+
+ XmlDocument beforeXd = new XmlDocument();
+ beforeXd.Load(fullPath);
+ string before = beforeXd.OuterXml;
+
+ SettingsUtil.MergeSettings(_settings, fullPath);
+
+ XmlDocument afterXd = new XmlDocument();
+ afterXd.Load(fullPath);
+ string after = afterXd.OuterXml;
+
+ Assert.AreEqual(before, after);
+ }
+
+ [Test]
+ public void CreateDefaultProfile_WithoutNsAndProfileTag_AddsProfileTagsWithoutNamespace()
+ {
+ string fullPath;
+ _settings = ReadTestSettings("test-settings.xml", out fullPath);
+
+ Assert.IsNotNull(_settings);
+
+ SettingsUtil.GetDefaultProfile(_settings, true);
+
+ SettingsUtil.MergeSettings(_settings, fullPath);
+
+ XmlDocument afterXd = new XmlDocument();
+ afterXd.Load(fullPath);
+
+ assertNodeExists(afterXd, "/settings/profiles");
+ assertNodeExists(afterXd, "/settings/profiles/profile[id='" + SettingsUtil.defaultProfileID + "']");
+ assertNodeExists(afterXd, "/settings/activeProfiles");
+ assertNodeExists(afterXd, "/settings/activeProfiles/activeProfile[text()='" + SettingsUtil.defaultProfileID + "']");
+ }
+
+ [Test]
+ public void CreateDefaultProfile_WithNsWithoutProfileTag_AddsProfileTagsWithNamespace()
+ {
+ string fullPath;
+ _settings = ReadTestSettings("test-settings-with-namespace.xml", out fullPath);
+
+ Assert.IsNotNull(_settings);
+
+ SettingsUtil.GetDefaultProfile(_settings, true);
+
+ SettingsUtil.MergeSettings(_settings, fullPath);
+
+
+ _namespaceManager.AddNamespace("settings", SettingsUtil.MavenSettingsNamespace);
+
+ XmlDocument afterXd = new XmlDocument(_nameTable);
+ afterXd.Load(fullPath);
+
+ assertNodeExists(afterXd, "/settings:settings");
+ assertNodeExists(afterXd, "/settings:settings/settings:profiles");
+ assertNodeExists(afterXd, "/settings:settings/settings:profiles/settings:profile[settings:id='" + SettingsUtil.defaultProfileID + "']");
+ assertNodeExists(afterXd, "/settings:settings/settings:activeProfiles");
+ assertNodeExists(afterXd, "/settings:settings/settings:activeProfiles/settings:activeProfile[text()='" + SettingsUtil.defaultProfileID + "']");
+ }
+
+ private void assertNodeExists(XmlDocument xml, string xpath)
+ {
+ assertNodesExists(xml, xpath, 1);
+ }
+
+ private void assertNodesExists(XmlDocument xml, string xpath, int count)
+ {
+ XmlNodeList nodes = xml.SelectNodes(xpath, _namespaceManager);
+ if (nodes.Count == 0)
+ Assert.Fail("Could not find a node matching " + xpath + " in " + xml.BaseURI);
+ if (nodes.Count < count)
+ Assert.Fail("Found less than " + count + " nodes matching " + xpath + " in " + xml.BaseURI);
+ if (nodes.Count > count)
+ Assert.Fail("Found more than " + count + " node(s) matching " + xpath + " in " + xml.BaseURI);
+ }
+
+ private Settings ReadTestSettings(string settingsXml)
+ {
+ string fullPath;
+ return ReadTestSettings(settingsXml, out fullPath);
+ }
+
+ private Settings ReadTestSettings(string settingsXml, out string fullPath)
+ {
+ DirectoryInfo projectRoot = PathUtility.FindProjectRoot(new DirectoryInfo(Directory.GetCurrentDirectory()));
+
+ FileInfo originalPath = getSettingsPath(projectRoot, settingsXml);
+ string dir = Path.Combine(PathUtility.GetBuildDirectory(projectRoot).FullName, "test-workbench");
+ Directory.CreateDirectory(dir);
+ fullPath = Path.Combine(dir, settingsXml);
+
+ originalPath.CopyTo(fullPath, true);
+ return SettingsUtil.ReadSettings(originalPath);
+ }
+
+ private FileInfo getSettingsPath(DirectoryInfo projectRoot, string settingsXml)
+ {
+ string path = Path.Combine(projectRoot.FullName, "src");
+ path = Path.Combine(path, "test");
+ path = Path.Combine(path, "resource");
+ path = Path.Combine(path, "m2");
+ return new FileInfo(Path.Combine(path, settingsXml));
+ }
+ }
+}
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/csharp/SettingsUtilTest.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-namespace.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-namespace.xml?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-namespace.xml (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-namespace.xml Thu Dec 22 06:54:49 2011
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <localRepository>C:/Documents and Settings/user/.m2/repository</localRepository>
- <mirrors>
- <mirror>
- <mirrorOf>*</mirrorOf>
- <url>http://repo.npanday.org/archiva/repository/npanday-releases/</url>
- <id>npanday-repo</id>
- </mirror>
- </mirrors>
-</settings>
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <localRepository>C:/Documents and Settings/user/.m2/repository</localRepository>
+ <mirrors>
+ <mirror>
+ <mirrorOf>*</mirrorOf>
+ <url>http://repo.npanday.org/archiva/repository/npanday-releases/</url>
+ <id>npanday-repo</id>
+ </mirror>
+ </mirrors>
+</settings>
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-namespace.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile-and-namespace.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile-and-namespace.xml?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile-and-namespace.xml (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile-and-namespace.xml Thu Dec 22 06:54:49 2011
@@ -1,50 +1,50 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <localRepository>C:/Documents and Settings/user/.m2/repository</localRepository>
- <mirrors>
- <mirror>
- <mirrorOf>*</mirrorOf>
- <url>http://repo.npanday.org/archiva/repository/npanday-releases/</url>
- <id>npanday-repo</id>
- </mirror>
- </mirrors>
- <profiles>
- <profile>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>npanday.repo.0</id>
- <url>http://repo1.maven.org/maven2</url>
- </repository>
- </repositories>
- <id>NPanday.id</id>
- </profile>
- </profiles>
- <activeProfiles>
- <activeProfile>NPanday.id</activeProfile>
- </activeProfiles>
-</settings>
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <localRepository>C:/Documents and Settings/user/.m2/repository</localRepository>
+ <mirrors>
+ <mirror>
+ <mirrorOf>*</mirrorOf>
+ <url>http://repo.npanday.org/archiva/repository/npanday-releases/</url>
+ <id>npanday-repo</id>
+ </mirror>
+ </mirrors>
+ <profiles>
+ <profile>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <releases />
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>npanday.repo.0</id>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+ </repositories>
+ <id>NPanday.id</id>
+ </profile>
+ </profiles>
+ <activeProfiles>
+ <activeProfile>NPanday.id</activeProfile>
+ </activeProfiles>
+</settings>
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile-and-namespace.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile.xml?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile.xml (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile.xml Thu Dec 22 06:54:49 2011
@@ -1,50 +1,50 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <localRepository>C:/Documents and Settings/user/.m2/repository</localRepository>
- <mirrors>
- <mirror>
- <mirrorOf>*</mirrorOf>
- <url>http://repo.npanday.org/archiva/repository/npanday-releases/</url>
- <id>npanday-repo</id>
- </mirror>
- </mirrors>
- <profiles>
- <profile>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>npanday.repo.0</id>
- <url>http://repo1.maven.org/maven2</url>
- </repository>
- </repositories>
- <id>NPanday.id</id>
- </profile>
- </profiles>
- <activeProfiles>
- <activeProfile>NPanday.id</activeProfile>
- </activeProfiles>
-</settings>
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <localRepository>C:/Documents and Settings/user/.m2/repository</localRepository>
+ <mirrors>
+ <mirror>
+ <mirrorOf>*</mirrorOf>
+ <url>http://repo.npanday.org/archiva/repository/npanday-releases/</url>
+ <id>npanday-repo</id>
+ </mirror>
+ </mirrors>
+ <profiles>
+ <profile>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <releases />
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>npanday.repo.0</id>
+ <url>http://repo1.maven.org/maven2</url>
+ </repository>
+ </repositories>
+ <id>NPanday.id</id>
+ </profile>
+ </profiles>
+ <activeProfiles>
+ <activeProfile>NPanday.id</activeProfile>
+ </activeProfiles>
+</settings>
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings-with-profile.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings.xml?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings.xml (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings.xml Thu Dec 22 06:54:49 2011
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you 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.
--->
-<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <localRepository>C:/Documents and Settings/user/.m2/repository</localRepository>
- <mirrors>
- <mirror>
- <mirrorOf>*</mirrorOf>
- <url>http://repo.npanday.org/archiva/repository/npanday-releases/</url>
- <id>npanday-repo</id>
- </mirror>
- </mirrors>
-</settings>
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <localRepository>C:/Documents and Settings/user/.m2/repository</localRepository>
+ <mirrors>
+ <mirror>
+ <mirrorOf>*</mirrorOf>
+ <url>http://repo.npanday.org/archiva/repository/npanday-releases/</url>
+ <id>npanday-repo</id>
+ </mirror>
+ </mirrors>
+</settings>
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.Utils/src/test/resource/m2/test-settings.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/ArtifactUtils.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/ArtifactUtils.cs?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/ArtifactUtils.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/ArtifactUtils.cs Thu Dec 22 06:54:49 2011
@@ -1,155 +1,155 @@
-#region Apache License, Version 2.0
-//
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you 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.
-//
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Xml;
-
-namespace NPanday.VisualStudio.Addin
-{
- static class ArtifactUtils
- {
- public static bool IsSnapshot(Artifact.Artifact artifact)
- {
- return artifact.Version.EndsWith("-SNAPSHOT");
- }
-
- public static bool Exists(Artifact.Artifact artifact)
- {
- return artifact.FileInfo.Exists;
- }
-
- public static bool DownloadFromRemoteRepository(Artifact.Artifact artifact, NPanday.Logging.Logger logger)
- {
- return NPanday.ProjectImporter.Digest.Model.Reference.DownloadArtifact(artifact, logger);
- }
-
- public static string GetArtifactReferenceFolder(Artifact.Artifact artifact, string referenceFolder)
- {
- //modified artifactFolder to match the .dll searched in NPanday.ProjectImporter.Digest.Model.Reference.cs
- string artifactFolder = Path.Combine(
- referenceFolder,
- string.Format("{0}\\{1}-{2}",
- artifact.GroupId,
- artifact.ArtifactId,
- artifact.Version));
- return artifactFolder;
- }
-
- public static string GetArtifactReferenceFilePath(Artifact.Artifact artifact, string referenceFolder)
- {
- string artifactReferenceFolder = GetArtifactReferenceFolder(artifact, referenceFolder);
- Directory.CreateDirectory(artifactReferenceFolder);
-
- string artifactReferenceFilePath = Path.Combine(artifactReferenceFolder,
- String.Concat(artifact.ArtifactId, artifact.FileInfo.Extension));
-
- return artifactReferenceFilePath;
- }
-
- public static DateTime GetArtifactTimestamp(Artifact.Artifact artifact)
- {
- // try maven-metadata-${repoId}.xml or maven-metadata-local.xml
- string localRepoArtifactFolder = artifact.FileInfo.Directory.FullName;
- string[] metadataFilePaths = Directory.GetFiles(localRepoArtifactFolder, "maven-metadata-*.xml");
-
- DateTime metadataTimestamp;
- if (!TryGetArtifactTimestampFromMetadataFiles(metadataFilePaths, out metadataTimestamp))
- {
- // if that fails, get the file's timestamp)
- metadataTimestamp = new FileInfo(artifact.FileInfo.FullName).LastWriteTimeUtc;
- }
-
- return metadataTimestamp;
- }
-
- public static bool TryGetArtifactTimestampFromMetadataFiles(
- IEnumerable<string> metadataFilePaths,
- out DateTime timestamp)
- {
- foreach (string metadataFilePath in metadataFilePaths)
- {
- if (TryGetArtifactTimestampFromMetadataFile(metadataFilePath, out timestamp))
- {
- return true;
- }
- }
-
- timestamp = DateTime.MinValue;
- return false;
- }
-
- public static bool TryGetArtifactTimestampFromMetadataFile(
- string metadataFilePath,
- out DateTime timestamp)
- {
- // Try to get the timestamp from metadata/versioning/lastUpdated
- using (FileStream stream = new FileStream(metadataFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
- {
- XmlDocument doc = new XmlDocument();
- doc.Load(stream);
- XmlNode node = doc.SelectSingleNode("metadata/versioning/lastUpdated");
- string nodeInnerText;
- if (node != null && !String.IsNullOrEmpty(nodeInnerText = node.InnerText))
- {
- string value = nodeInnerText.Trim();
- // format is yyyyMMddHHmmss e.g. 20111028030112)
- bool parsed = DateTime.TryParseExact(value,
- "yyyyMMddHHmmss",
- CultureInfo.InvariantCulture,
- DateTimeStyles.AssumeUniversal,
- out timestamp);
- if (parsed)
- {
- timestamp = timestamp.ToUniversalTime();
- }
- return parsed;
- }
- }
-
- timestamp = DateTime.MinValue;
- return false;
- }
-
- public static bool IsEarlierArtifactTimestamp(DateTime value, DateTime comparand)
- {
- return CompareDatesWithoutMilliseconds(value, comparand) < 0;
- }
-
- public static int CompareDatesWithoutMilliseconds(DateTime left, DateTime right)
- {
- DateTime l = CreateDateTimeWithoutMilliseconds(left);
- DateTime r = CreateDateTimeWithoutMilliseconds(right);
- return l.CompareTo(r);
- }
-
- public static DateTime CreateDateTimeWithoutMilliseconds(DateTime dateTime)
- {
- DateTime result = new DateTime(
- dateTime.Year, dateTime.Month, dateTime.Day,
- dateTime.Hour, dateTime.Minute, dateTime.Second, 0,
- dateTime.Kind);
- return result;
- }
- }
-}
+#region Apache License, Version 2.0
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you 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.
+//
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Xml;
+
+namespace NPanday.VisualStudio.Addin
+{
+ static class ArtifactUtils
+ {
+ public static bool IsSnapshot(Artifact.Artifact artifact)
+ {
+ return artifact.Version.EndsWith("-SNAPSHOT");
+ }
+
+ public static bool Exists(Artifact.Artifact artifact)
+ {
+ return artifact.FileInfo.Exists;
+ }
+
+ public static bool DownloadFromRemoteRepository(Artifact.Artifact artifact, NPanday.Logging.Logger logger)
+ {
+ return NPanday.ProjectImporter.Digest.Model.Reference.DownloadArtifact(artifact, logger);
+ }
+
+ public static string GetArtifactReferenceFolder(Artifact.Artifact artifact, string referenceFolder)
+ {
+ //modified artifactFolder to match the .dll searched in NPanday.ProjectImporter.Digest.Model.Reference.cs
+ string artifactFolder = Path.Combine(
+ referenceFolder,
+ string.Format("{0}\\{1}-{2}",
+ artifact.GroupId,
+ artifact.ArtifactId,
+ artifact.Version));
+ return artifactFolder;
+ }
+
+ public static string GetArtifactReferenceFilePath(Artifact.Artifact artifact, string referenceFolder)
+ {
+ string artifactReferenceFolder = GetArtifactReferenceFolder(artifact, referenceFolder);
+ Directory.CreateDirectory(artifactReferenceFolder);
+
+ string artifactReferenceFilePath = Path.Combine(artifactReferenceFolder,
+ String.Concat(artifact.ArtifactId, artifact.FileInfo.Extension));
+
+ return artifactReferenceFilePath;
+ }
+
+ public static DateTime GetArtifactTimestamp(Artifact.Artifact artifact)
+ {
+ // try maven-metadata-${repoId}.xml or maven-metadata-local.xml
+ string localRepoArtifactFolder = artifact.FileInfo.Directory.FullName;
+ string[] metadataFilePaths = Directory.GetFiles(localRepoArtifactFolder, "maven-metadata-*.xml");
+
+ DateTime metadataTimestamp;
+ if (!TryGetArtifactTimestampFromMetadataFiles(metadataFilePaths, out metadataTimestamp))
+ {
+ // if that fails, get the file's timestamp)
+ metadataTimestamp = new FileInfo(artifact.FileInfo.FullName).LastWriteTimeUtc;
+ }
+
+ return metadataTimestamp;
+ }
+
+ public static bool TryGetArtifactTimestampFromMetadataFiles(
+ IEnumerable<string> metadataFilePaths,
+ out DateTime timestamp)
+ {
+ foreach (string metadataFilePath in metadataFilePaths)
+ {
+ if (TryGetArtifactTimestampFromMetadataFile(metadataFilePath, out timestamp))
+ {
+ return true;
+ }
+ }
+
+ timestamp = DateTime.MinValue;
+ return false;
+ }
+
+ public static bool TryGetArtifactTimestampFromMetadataFile(
+ string metadataFilePath,
+ out DateTime timestamp)
+ {
+ // Try to get the timestamp from metadata/versioning/lastUpdated
+ using (FileStream stream = new FileStream(metadataFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.Load(stream);
+ XmlNode node = doc.SelectSingleNode("metadata/versioning/lastUpdated");
+ string nodeInnerText;
+ if (node != null && !String.IsNullOrEmpty(nodeInnerText = node.InnerText))
+ {
+ string value = nodeInnerText.Trim();
+ // format is yyyyMMddHHmmss e.g. 20111028030112)
+ bool parsed = DateTime.TryParseExact(value,
+ "yyyyMMddHHmmss",
+ CultureInfo.InvariantCulture,
+ DateTimeStyles.AssumeUniversal,
+ out timestamp);
+ if (parsed)
+ {
+ timestamp = timestamp.ToUniversalTime();
+ }
+ return parsed;
+ }
+ }
+
+ timestamp = DateTime.MinValue;
+ return false;
+ }
+
+ public static bool IsEarlierArtifactTimestamp(DateTime value, DateTime comparand)
+ {
+ return CompareDatesWithoutMilliseconds(value, comparand) < 0;
+ }
+
+ public static int CompareDatesWithoutMilliseconds(DateTime left, DateTime right)
+ {
+ DateTime l = CreateDateTimeWithoutMilliseconds(left);
+ DateTime r = CreateDateTimeWithoutMilliseconds(right);
+ return l.CompareTo(r);
+ }
+
+ public static DateTime CreateDateTimeWithoutMilliseconds(DateTime dateTime)
+ {
+ DateTime result = new DateTime(
+ dateTime.Year, dateTime.Month, dateTime.Day,
+ dateTime.Hour, dateTime.Minute, dateTime.Second, 0,
+ dateTime.Kind);
+ return result;
+ }
+ }
+}
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/ArtifactUtils.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/AddArtifactsCommand.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/AddArtifactsCommand.cs?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/AddArtifactsCommand.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/AddArtifactsCommand.cs Thu Dec 22 06:54:49 2011
@@ -1,52 +1,52 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using EnvDTE;
-using System.IO;
-using System.Windows.Forms;
-
-namespace NPanday.VisualStudio.Addin.Commands
-{
- public class AddArtifactsCommand : ButtonCommand
- {
- public override string Caption
- {
- get
- {
- return Messages.MSG_C_ADD_MAVEN_ARTIFACT;
- }
- }
-
- public override void Execute(IButtonCommandContext context)
- {
- //First selected project
- foreach (Project project in (Array)Application.ActiveSolutionProjects)
- {
- FileInfo currentPom = context.CurrentSelectedProjectPom;
- if (currentPom == null || Path.GetDirectoryName(currentPom.FullName) != Path.GetDirectoryName(project.FullName))
- {
- DialogResult result = MessageBox.Show("Pom file not found, do you want to import the projects first before adding Maven Artifact?", "Add Maven Artifact", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (result == DialogResult.Cancel)
- return;
-
- if (result == DialogResult.OK)
- {
- context.ExecuteCommand<ImportSelectedProjectCommand>(); ;
-
- currentPom = context.CurrentSelectedProjectPom;
-
- // if import failed
- if (currentPom == null || Path.GetDirectoryName(currentPom.FullName) != Path.GetDirectoryName(project.FullName))
- {
- return;
- }
- }
- }
-
- AddArtifactsForm form = new AddArtifactsForm(project, context.ArtifactContext, context.Logger, currentPom);
- form.Show();
- break;
- }
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using EnvDTE;
+using System.IO;
+using System.Windows.Forms;
+
+namespace NPanday.VisualStudio.Addin.Commands
+{
+ public class AddArtifactsCommand : ButtonCommand
+ {
+ public override string Caption
+ {
+ get
+ {
+ return Messages.MSG_C_ADD_MAVEN_ARTIFACT;
+ }
+ }
+
+ public override void Execute(IButtonCommandContext context)
+ {
+ //First selected project
+ foreach (Project project in (Array)Application.ActiveSolutionProjects)
+ {
+ FileInfo currentPom = context.CurrentSelectedProjectPom;
+ if (currentPom == null || Path.GetDirectoryName(currentPom.FullName) != Path.GetDirectoryName(project.FullName))
+ {
+ DialogResult result = MessageBox.Show("Pom file not found, do you want to import the projects first before adding Maven Artifact?", "Add Maven Artifact", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
+ if (result == DialogResult.Cancel)
+ return;
+
+ if (result == DialogResult.OK)
+ {
+ context.ExecuteCommand<ImportSelectedProjectCommand>(); ;
+
+ currentPom = context.CurrentSelectedProjectPom;
+
+ // if import failed
+ if (currentPom == null || Path.GetDirectoryName(currentPom.FullName) != Path.GetDirectoryName(project.FullName))
+ {
+ return;
+ }
+ }
+ }
+
+ AddArtifactsForm form = new AddArtifactsForm(project, context.ArtifactContext, context.Logger, currentPom);
+ form.Show();
+ break;
+ }
+ }
+ }
+}
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/AddArtifactsCommand.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/BuildCommandContext.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/BuildCommandContext.cs?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/BuildCommandContext.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/BuildCommandContext.cs Thu Dec 22 06:54:49 2011
@@ -1,4 +1,4 @@
-namespace NPanday.VisualStudio.Addin.Commands
-{
- public delegate IButtonCommandContext BuildCommandContext();
+namespace NPanday.VisualStudio.Addin.Commands
+{
+ public delegate IButtonCommandContext BuildCommandContext();
}
\ No newline at end of file
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/BuildCommandContext.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommand.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommand.cs?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommand.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommand.cs Thu Dec 22 06:54:49 2011
@@ -1,32 +1,32 @@
-using Microsoft.VisualStudio.CommandBars;
-using EnvDTE80;
-
-namespace NPanday.VisualStudio.Addin.Commands
-{
- /// <summary>
- /// TODO: For now we only have buttons and when migrating to VSIX this
- /// has to be changed dramatically anyway.
- /// </summary>
- public abstract class ButtonCommand
- {
- private DTE2 _application;
- public DTE2 Application
- {
- get
- {
- return _application;
- }
- internal set
- {
- _application = value;
- }
- }
-
- public abstract string Caption
- {
- get;
- }
-
- public abstract void Execute(IButtonCommandContext context);
- }
-}
+using Microsoft.VisualStudio.CommandBars;
+using EnvDTE80;
+
+namespace NPanday.VisualStudio.Addin.Commands
+{
+ /// <summary>
+ /// TODO: For now we only have buttons and when migrating to VSIX this
+ /// has to be changed dramatically anyway.
+ /// </summary>
+ public abstract class ButtonCommand
+ {
+ private DTE2 _application;
+ public DTE2 Application
+ {
+ get
+ {
+ return _application;
+ }
+ internal set
+ {
+ _application = value;
+ }
+ }
+
+ public abstract string Caption
+ {
+ get;
+ }
+
+ public abstract void Execute(IButtonCommandContext context);
+ }
+}
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommand.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommandRegistry.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommandRegistry.cs?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommandRegistry.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommandRegistry.cs Thu Dec 22 06:54:49 2011
@@ -1,94 +1,94 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Microsoft.VisualStudio.CommandBars;
-using EnvDTE80;
-using NPanday.Logging;
-
-namespace NPanday.VisualStudio.Addin.Commands
-{
- /// <summary>
- /// Manages and registers NPanday commands.
- /// </summary>
- public class ButtonCommandRegistry
- {
- readonly List<CommandBarControl> _keepReferences = new List<CommandBarControl>();
-
- readonly Dictionary<Type, ButtonCommand> _commands = new Dictionary<Type, ButtonCommand>();
-
- private readonly DTE2 _application;
- private readonly BuildCommandContext _buildContext;
- private readonly Logger _logger;
-
- public ButtonCommandRegistry(DTE2 application, BuildCommandContext buildContext, Logger logger)
- {
- _application = application;
- _buildContext = buildContext;
- _logger = logger;
- }
-
- public void Excecute<TCommand>(IButtonCommandContext context)
- where TCommand : ButtonCommand, new()
- {
- getOrCreate<TCommand>().Execute(context);
- }
-
- public TCommand AddBefore<TCommand>(CommandBarControl barControl)
- where TCommand : ButtonCommand, new()
- {
- return Add<TCommand>(barControl.Parent, barControl.Index);
- }
-
- public TCommand AddAfter<TCommand>(CommandBarControl barControl)
- where TCommand : ButtonCommand, new()
- {
- return Add<TCommand>(barControl.Parent, barControl.Index + 1);
- }
-
- public TCommand Add<TCommand>(CommandBar bar, int atIndex)
- where TCommand : ButtonCommand, new()
- {
- _logger.Log(Level.DEBUG, "Adding command " + typeof(TCommand).Name + " on " + bar.Name + " at index " + atIndex);
-
- TCommand command = getOrCreate<TCommand>();
-
- CommandBarButton ctl = (CommandBarButton)
- bar.Controls.Add(MsoControlType.msoControlButton,
- System.Type.Missing, System.Type.Missing, atIndex, true);
- ctl.Click += delegate(CommandBarButton btn, ref bool Cancel)
- {
- command.Execute(_buildContext());
- };
- ctl.Caption = command.Caption;
- ctl.Visible = true;
-
- _keepReferences.Add(ctl);
-
- return command;
- }
-
- private TCommand getOrCreate<TCommand>()
- where TCommand : ButtonCommand, new()
- {
- ButtonCommand command;
- if (_commands.TryGetValue(typeof(TCommand), out command))
- {
- return (TCommand)command;
- }
-
- command = new TCommand();
- command.Application = _application;
- _commands[typeof(TCommand)] = command;
- return (TCommand)command;
- }
-
- public void UnregisterAll()
- {
- foreach (CommandBarControl commandBarControl in _keepReferences.ToArray())
- {
- // TODO: find (or previouvsly cache the commandbar)
- _logger.Log(Level.DEBUG, "TODO!! Remove " + commandBarControl.Caption + " on ?? at index " + commandBarControl.Index);
- }
- }
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.VisualStudio.CommandBars;
+using EnvDTE80;
+using NPanday.Logging;
+
+namespace NPanday.VisualStudio.Addin.Commands
+{
+ /// <summary>
+ /// Manages and registers NPanday commands.
+ /// </summary>
+ public class ButtonCommandRegistry
+ {
+ readonly List<CommandBarControl> _keepReferences = new List<CommandBarControl>();
+
+ readonly Dictionary<Type, ButtonCommand> _commands = new Dictionary<Type, ButtonCommand>();
+
+ private readonly DTE2 _application;
+ private readonly BuildCommandContext _buildContext;
+ private readonly Logger _logger;
+
+ public ButtonCommandRegistry(DTE2 application, BuildCommandContext buildContext, Logger logger)
+ {
+ _application = application;
+ _buildContext = buildContext;
+ _logger = logger;
+ }
+
+ public void Excecute<TCommand>(IButtonCommandContext context)
+ where TCommand : ButtonCommand, new()
+ {
+ getOrCreate<TCommand>().Execute(context);
+ }
+
+ public TCommand AddBefore<TCommand>(CommandBarControl barControl)
+ where TCommand : ButtonCommand, new()
+ {
+ return Add<TCommand>(barControl.Parent, barControl.Index);
+ }
+
+ public TCommand AddAfter<TCommand>(CommandBarControl barControl)
+ where TCommand : ButtonCommand, new()
+ {
+ return Add<TCommand>(barControl.Parent, barControl.Index + 1);
+ }
+
+ public TCommand Add<TCommand>(CommandBar bar, int atIndex)
+ where TCommand : ButtonCommand, new()
+ {
+ _logger.Log(Level.DEBUG, "Adding command " + typeof(TCommand).Name + " on " + bar.Name + " at index " + atIndex);
+
+ TCommand command = getOrCreate<TCommand>();
+
+ CommandBarButton ctl = (CommandBarButton)
+ bar.Controls.Add(MsoControlType.msoControlButton,
+ System.Type.Missing, System.Type.Missing, atIndex, true);
+ ctl.Click += delegate(CommandBarButton btn, ref bool Cancel)
+ {
+ command.Execute(_buildContext());
+ };
+ ctl.Caption = command.Caption;
+ ctl.Visible = true;
+
+ _keepReferences.Add(ctl);
+
+ return command;
+ }
+
+ private TCommand getOrCreate<TCommand>()
+ where TCommand : ButtonCommand, new()
+ {
+ ButtonCommand command;
+ if (_commands.TryGetValue(typeof(TCommand), out command))
+ {
+ return (TCommand)command;
+ }
+
+ command = new TCommand();
+ command.Application = _application;
+ _commands[typeof(TCommand)] = command;
+ return (TCommand)command;
+ }
+
+ public void UnregisterAll()
+ {
+ foreach (CommandBarControl commandBarControl in _keepReferences.ToArray())
+ {
+ // TODO: find (or previouvsly cache the commandbar)
+ _logger.Log(Level.DEBUG, "TODO!! Remove " + commandBarControl.Caption + " on ?? at index " + commandBarControl.Index);
+ }
+ }
+ }
+}
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ButtonCommandRegistry.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/IButtonCommandContext.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/IButtonCommandContext.cs?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/IButtonCommandContext.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/IButtonCommandContext.cs Thu Dec 22 06:54:49 2011
@@ -1,17 +1,17 @@
-using System.IO;
-using EnvDTE;
-using NPanday.Artifact;
-using NPanday.Logging;
-
-namespace NPanday.VisualStudio.Addin.Commands
-{
- public interface IButtonCommandContext
- {
- Logger Logger { get; }
- ArtifactContext ArtifactContext { get; }
- FileInfo CurrentSelectedProjectPom { get; }
-
- void ExecuteCommand(string visualStudioCommandName);
- void ExecuteCommand<TCommand>() where TCommand : ButtonCommand, new();
- }
-}
+using System.IO;
+using EnvDTE;
+using NPanday.Artifact;
+using NPanday.Logging;
+
+namespace NPanday.VisualStudio.Addin.Commands
+{
+ public interface IButtonCommandContext
+ {
+ Logger Logger { get; }
+ ArtifactContext ArtifactContext { get; }
+ FileInfo CurrentSelectedProjectPom { get; }
+
+ void ExecuteCommand(string visualStudioCommandName);
+ void ExecuteCommand<TCommand>() where TCommand : ButtonCommand, new();
+ }
+}
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/IButtonCommandContext.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ImportSelectedProjectCommand.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ImportSelectedProjectCommand.cs?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ImportSelectedProjectCommand.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ImportSelectedProjectCommand.cs Thu Dec 22 06:54:49 2011
@@ -1,18 +1,18 @@
-namespace NPanday.VisualStudio.Addin.Commands
-{
- public class ImportSelectedProjectCommand : ButtonCommand
- {
- public override string Caption
- {
- get { return Messages.MSG_C_IMPORT_PROJECT; }
- }
-
- public override void Execute(IButtonCommandContext context)
- {
- context.ExecuteCommand("File.SaveAll");
-
- NPandayImportProjectForm frm = new NPandayImportProjectForm(Application, context.Logger);
- frm.ShowDialog();
- }
- }
+namespace NPanday.VisualStudio.Addin.Commands
+{
+ public class ImportSelectedProjectCommand : ButtonCommand
+ {
+ public override string Caption
+ {
+ get { return Messages.MSG_C_IMPORT_PROJECT; }
+ }
+
+ public override void Execute(IButtonCommandContext context)
+ {
+ context.ExecuteCommand("File.SaveAll");
+
+ NPandayImportProjectForm frm = new NPandayImportProjectForm(Application, context.Logger);
+ frm.ShowDialog();
+ }
+ }
}
\ No newline at end of file
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/ImportSelectedProjectCommand.cs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/VSCommandCaptions.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/VSCommandCaptions.cs?rev=1222072&r1=1222071&r2=1222072&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/VSCommandCaptions.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/VSCommandCaptions.cs Thu Dec 22 06:54:49 2011
@@ -1,13 +1,13 @@
-namespace NPanday.VisualStudio.Addin.Commands
-{
- public class VSCommandCaptions
- {
- public const string AddReference = "Add &Reference...";
- public const string Clean = "Clea&n";
- public const string ConfigurationManager = "C&onfiguration Manager...";
- public const string PublishSelection = "Publis&h Selection";
- public const string PublishWebSite = "Publis&h Web Site";
- public const string Standard_SaveAll = "Standard->Save All";
- public const string Tools = "Tools";
- }
+namespace NPanday.VisualStudio.Addin.Commands
+{
+ public class VSCommandCaptions
+ {
+ public const string AddReference = "Add &Reference...";
+ public const string Clean = "Clea&n";
+ public const string ConfigurationManager = "C&onfiguration Manager...";
+ public const string PublishSelection = "Publis&h Selection";
+ public const string PublishWebSite = "Publis&h Web Site";
+ public const string Standard_SaveAll = "Standard->Save All";
+ public const string Tools = "Tools";
+ }
}
\ No newline at end of file
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/Commands/VSCommandCaptions.cs
------------------------------------------------------------------------------
svn:eol-style = native