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 lc...@apache.org on 2011/11/16 17:19:59 UTC
svn commit: r1202791 [3/3] - in /incubator/npanday/trunk: dotnet/assemblies/
dotnet/assemblies/NPanday.Artifact/
dotnet/assemblies/NPanday.Artifact/src/main/csharp/
dotnet/assemblies/NPanday.Artifact/src/main/csharp/NPanday/Artifact/
dotnet/assemblies/...
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs?rev=1202791&r1=1202790&r2=1202791&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/AddArtifactsForm.cs Wed Nov 16 17:19:58 2011
@@ -41,7 +41,7 @@ using VSLangProj;
using NPanday.Artifact;
using NPanday.Logging;
using NPanday.Model.Pom;
-using NPanday.Model.Setting;
+using NPanday.Model.Settings;
using NPanday.Utils;
@@ -59,10 +59,10 @@ namespace NPanday.VisualStudio.Addin
private string settingsPath;
private Settings settings;
- private NPanday.Model.Setting.Profile defaultProfile;
- private NPanday.Model.Setting.Repository selectedRepo;
+ private NPanday.Model.Settings.Profile defaultProfile;
+ private NPanday.Model.Settings.Repository selectedRepo;
private string prevSelectedRepoUrl = string.Empty;
-
+
/// <summary>
/// For Testing
/// </summary>
@@ -77,7 +77,7 @@ namespace NPanday.VisualStudio.Addin
{
get { return settingsPath; }
}
-
+
public AddArtifactsForm(Project project, ArtifactContext container, Logger logger, FileInfo pom)
{
this.project = project;
@@ -85,7 +85,7 @@ namespace NPanday.VisualStudio.Addin
InitializeForm();
InitializeComponent();
addArtifact.Visible = true;
- localListView.View = View.Details;
+ localListView.View = View.Details;
artifactContext = container;
this.pom = pom;
}
@@ -127,11 +127,6 @@ namespace NPanday.VisualStudio.Addin
return;
}
- if (settings.profiles == null || settings.profiles.Length < 1)
- {
- addProfilesTag(settingsPath);
- }
-
defaultProfile = getDefaultProfile();
selectedRepo = getDefaultRepository();
@@ -152,7 +147,7 @@ namespace NPanday.VisualStudio.Addin
{
repoCombo_Refresh(selectedRepo.url);
}
-
+
}
private void localListView_Refresh()
@@ -174,7 +169,7 @@ namespace NPanday.VisualStudio.Addin
treeView1.Nodes.Clear();
List<TreeNode> treeNodes = getNodesFor(selectedRepo.url);
- treeView1.Nodes.AddRange(treeNodes.ToArray());
+ treeView1.Nodes.AddRange(treeNodes.ToArray());
prevSelectedRepoUrl = selectedRepo.url;
}
@@ -195,7 +190,7 @@ namespace NPanday.VisualStudio.Addin
// check if URL is already in NPanday.id profile
if (defaultProfile != null)
{
- foreach (NPanday.Model.Setting.Repository repo in defaultProfile.repositories)
+ foreach (NPanday.Model.Settings.Repository repo in defaultProfile.repositories)
{
if (repo.url == RepoCombo.Text)
{
@@ -213,12 +208,12 @@ namespace NPanday.VisualStudio.Addin
{
return false;
}
-
+
if (uri.StartsWith(".."))
{
return false;
}
-
+
if (uri.Contains("."))
{
string[] tokens = name.Split(".".ToCharArray());
@@ -226,7 +221,7 @@ namespace NPanday.VisualStudio.Addin
if (extension.Equals("txt") || extension.Equals("pom") ||
extension.Equals("md5") || extension.Equals("sha1") ||
extension.Equals("xml") || extension.Equals("tar") ||
- extension.Equals("gz") || extension.Equals("rb") ||
+ extension.Equals("gz") || extension.Equals("rb") ||
extension.Equals("htm") || extension.Equals("html") ||
extension.Equals("jsp"))
{
@@ -246,7 +241,7 @@ namespace NPanday.VisualStudio.Addin
{
string[] tokens = name.Split(".".ToCharArray());
string extension = tokens[tokens.Length - 1];
-
+
if (extension.Equals("dll") || extension.Equals("jar") ||
extension.Equals("exe"))
{
@@ -441,14 +436,14 @@ namespace NPanday.VisualStudio.Addin
try
{
VsWebSite.VSWebSite website = (VsWebSite.VSWebSite)project.Object;
-
+
Assembly a = Assembly.LoadFile(artifact.FileInfo.FullName);
if (a.ToString().Split(",".ToCharArray())[0].ToLower().StartsWith("interop.", true, CultureInfo.InvariantCulture))
{
MessageBox.Show("Cannot add COM Interop reference from a Maven Artifact, just use Add Reference if you wish to add a COM reference.", "Add Maven Artifact", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
-
+
bool referenced = false;
try
{
@@ -467,7 +462,7 @@ namespace NPanday.VisualStudio.Addin
// not need to written in pom anymore
//addArtifactToPom(artifact);
-
+
website.References.AddFromFile(artifact.FileInfo.FullName);
return true;
}
@@ -519,7 +514,7 @@ namespace NPanday.VisualStudio.Addin
//paths = uri.Substring(repoUri.LocalPath.Length).Replace(@"\",@"/");
paths = uri;
}
- else
+ else
{
paths = normalizePath(uri.Substring(repoUrl.Length));
}
@@ -607,38 +602,31 @@ namespace NPanday.VisualStudio.Addin
defaultProfile = getDefaultProfile();
}
- // if NPanday profile is not found, create it
- if (defaultProfile == null)
- {
- defaultProfile = new NPanday.Model.Setting.Profile();
- defaultProfile.id = SettingsUtil.defaultProfileID; ;
- }
-
// add repository to profile
- selectedRepo = SettingsUtil.AddRepositoryToProfile(defaultProfile, selectedUrl, checkBoxRelease.Checked, checkBoxSnapshot.Checked, settings);
-
+ selectedRepo = SettingsUtil.AddRepositoryToProfile(defaultProfile, selectedUrl, checkBoxRelease.Checked, checkBoxSnapshot.Checked);
+
// make NPanday.id profile active
SettingsUtil.AddActiveProfile(settings, SettingsUtil.defaultProfileID);
// write to Settings.xml
- SettingsUtil.WriteSettings(settings, settingsPath);
-
+ SettingsUtil.MergeSettings(settings, settingsPath);
+
// do not specify SelectedUrl to suppress SelectedIndexChanged event
repoCombo_Refresh(null);
MessageBox.Show(this, "Successfully Changed Remote Repository.", "Repository Configuration");
//localListView_Refresh();
}
}
-
+
private void repoCombo_Refresh(string selectedUrl)
{
RepoCombo.Items.Clear();
if (settings.profiles != null)
{
- List<NPanday.Model.Setting.Repository> repositories = SettingsUtil.GetAllRepositories(settings);
+ List<NPanday.Model.Settings.Repository> repositories = SettingsUtil.GetAllRepositories(settings);
- foreach (NPanday.Model.Setting.Repository repo in repositories)
+ foreach (NPanday.Model.Settings.Repository repo in repositories)
{
if (!RepoCombo.Items.Contains(repo.url))
{
@@ -655,18 +643,8 @@ namespace NPanday.VisualStudio.Addin
private void repoCheckboxes_Refresh()
{
- checkBoxRelease.Checked = (selectedRepo.releases != null)? selectedRepo.releases.enabled: false;
- checkBoxSnapshot.Checked = (selectedRepo.snapshots != null)? selectedRepo.snapshots.enabled: false;
- }
-
- public void addProfilesTag(string settingsPath)
- {
- XmlDocument doc = new XmlDocument();
- doc.Load(settingsPath);
- XmlElement element = doc.CreateElement("profiles");
-
- doc.DocumentElement.AppendChild(element);
- doc.Save(settingsPath);
+ checkBoxRelease.Checked = (selectedRepo.releases != null) ? selectedRepo.releases.enabled : false;
+ checkBoxSnapshot.Checked = (selectedRepo.snapshots != null) ? selectedRepo.snapshots.enabled : false;
}
#region GUI Events
@@ -920,17 +898,17 @@ namespace NPanday.VisualStudio.Addin
}
}
- private NPanday.Model.Setting.Profile getDefaultProfile()
+ private NPanday.Model.Settings.Profile getDefaultProfile()
{
if (settings == null)
{
loadSettings();
}
- return SettingsUtil.GetProfile(settings, SettingsUtil.defaultProfileID);
+ return SettingsUtil.GetDefaultProfile(settings, true);
}
- private NPanday.Model.Setting.Repository getRepository(string url)
+ private NPanday.Model.Settings.Repository getRepository(string url)
{
if (string.IsNullOrEmpty(url))
{
@@ -943,7 +921,7 @@ namespace NPanday.VisualStudio.Addin
}
// extract from NPanday repositories first
- NPanday.Model.Setting.Repository repo;
+ NPanday.Model.Settings.Repository repo;
if (defaultProfile != null)
{
repo = SettingsUtil.GetRepositoryFromProfile(defaultProfile, url);
@@ -957,7 +935,7 @@ namespace NPanday.VisualStudio.Addin
return SettingsUtil.GetRepositoryByUrl(settings, url);
}
- private NPanday.Model.Setting.Repository getDefaultRepository()
+ private NPanday.Model.Settings.Repository getDefaultRepository()
{
if (defaultProfile == null)
{
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/ConfigureMavenRepositoryForm.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/ConfigureMavenRepositoryForm.cs?rev=1202791&r1=1202790&r2=1202791&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/ConfigureMavenRepositoryForm.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/ConfigureMavenRepositoryForm.cs Wed Nov 16 17:19:58 2011
@@ -28,10 +28,11 @@ using System.IO;
using System.Text;
using System.Windows.Forms;
-using NPanday.Model.Setting;
+using NPanday.Model.Settings;
using System.Xml;
using System.Xml.Serialization;
+using NPanday.Utils;
namespace NPanday.VisualStudio.Addin
{
@@ -58,7 +59,7 @@ namespace NPanday.VisualStudio.Addin
private void update_Click(object sender, EventArgs e)
{
- XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Setting.Settings));
+ XmlSerializer serializer = new XmlSerializer(typeof(NPanday.Model.Settings.Settings));
TextWriter writer = new StreamWriter(settingsPath);
if (settings.profiles != null)
{
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs?rev=1202791&r1=1202790&r2=1202791&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/Connect.cs Wed Nov 16 17:19:58 2011
@@ -47,7 +47,7 @@ using NPanday.Artifact;
using NPanday.Logging;
using NPanday.VisualStudio.Logging;
-using NPanday.Model.Setting;
+using NPanday.Model.Settings;
using NPanday.Model.Pom;
@@ -112,7 +112,7 @@ namespace NPanday.VisualStudio.Addin
{
if (_applicationObject != null && projectItem != null)
{
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
// added configuration when including web or service reference
@@ -179,13 +179,18 @@ namespace NPanday.VisualStudio.Addin
}
}
+ private PomHelperUtility createPomUtility()
+ {
+ return new PomHelperUtility(new FileInfo(_applicationObject.Solution.FullName), new FileInfo(CurrentSelectedProject.FullName));
+ }
+
void ProjectItemEvents_ItemRemoved(ProjectItem projectItem)
{
if (_applicationObject != null && projectItem != null)
{
if (_applicationObject != null && projectItem != null)
{
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
// remove web reference configuration in pom.xml when using "Exclude in Project"
@@ -224,7 +229,7 @@ namespace NPanday.VisualStudio.Addin
{
if (_applicationObject != null && projectItem != null)
{
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
if (projectItem.Name.Contains(".cs") || projectItem.Name.Contains(".vb"))
{
@@ -786,7 +791,7 @@ namespace NPanday.VisualStudio.Addin
}
//check if reference is already in pom
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
if (pomUtil.IsPomDependency(pReference.Name))
{
return;
@@ -904,7 +909,7 @@ namespace NPanday.VisualStudio.Addin
{
try
{
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
if (Path.GetExtension(e.Name).ToLower() == ".dll" || Path.GetExtension(e.Name).ToLower() == ".exe")
{
pomUtil.RemovePomDependency(Path.GetFileNameWithoutExtension(e.Name));
@@ -926,7 +931,7 @@ namespace NPanday.VisualStudio.Addin
wrc.WaitForClasses(e.Namespace);
e.Init(projectReferenceFolder(CurrentSelectedProject));
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
lock (typeof(PomHelperUtility))
{
pomUtil.RenameWebReference(e.ReferenceDirectory, e.OldNamespace, e.Namespace, e.WsdlFile, string.Empty);
@@ -943,7 +948,7 @@ namespace NPanday.VisualStudio.Addin
try
{
e.Init(projectReferenceFolder(CurrentSelectedProject));
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
lock (typeof(PomHelperUtility))
{
pomUtil.RemoveWebReference(e.ReferenceDirectory, e.Namespace);
@@ -967,7 +972,7 @@ namespace NPanday.VisualStudio.Addin
e.Init(projectReferenceFolder(CurrentSelectedProject));
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
lock (typeof(PomHelperUtility))
{
pomUtil.AddWebReference(e.Namespace, e.WsdlFile, string.Empty, logger);
@@ -987,7 +992,7 @@ namespace NPanday.VisualStudio.Addin
{
System.Threading.Thread.Sleep(1500);
e.Init(Path.Combine(Path.GetDirectoryName(CurrentSelectedProject.FullName), Messages.MSG_D_SERV_REF));
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
pomUtil.RenameWebReference(e.ReferenceDirectory, e.OldNamespace, e.Namespace, e.WsdlFile, string.Empty);
}
catch (Exception ex)
@@ -1001,7 +1006,7 @@ namespace NPanday.VisualStudio.Addin
try
{
e.Init(Path.Combine(Path.GetDirectoryName(CurrentSelectedProject.FullName), Messages.MSG_D_SERV_REF));
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
pomUtil.RemoveWebReference(e.ReferenceDirectory, e.Namespace);
}
catch (Exception ex)
@@ -1019,7 +1024,7 @@ namespace NPanday.VisualStudio.Addin
string path = Path.Combine(Path.GetDirectoryName(CurrentSelectedProject.FullName), Messages.MSG_D_SERV_REF);
e.Init(path);
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ PomHelperUtility pomUtil = createPomUtility();
pomUtil.AddWebReference(e.Namespace, e.WsdlFile, string.Empty, logger);
}
@@ -1505,7 +1510,7 @@ namespace NPanday.VisualStudio.Addin
if (!mavenConnected)
return;
- PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, pReference.ContainingProject);
+ PomHelperUtility pomUtil = new PomHelperUtility(new FileInfo(_applicationObject.Solution.FullName), new FileInfo(pReference.ContainingProject.FullName));
string refName = pReference.Name;
if (pReference.Type == prjReferenceType.prjReferenceTypeActiveX && refName.ToLower().StartsWith("interop.", true, CultureInfo.InvariantCulture))
refName = refName.Substring(8);
@@ -2306,7 +2311,7 @@ namespace NPanday.VisualStudio.Addin
//public bool RemovePomWebReferenceInfo(string webRefNamespace)
//{
- // PomHelperUtility pomUtil = new PomHelperUtility(_applicationObject.Solution, CurrentSelectedProject);
+ // PomHelperUtility pomUtil = createPomUtility();
// pomUtil.RemoveWebReference(webRefNamespace);
// return true;
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/MavenRunner.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/MavenRunner.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/MavenRunner.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/MavenRunner.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,497 @@
+#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.IO;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using EnvDTE;
+using EnvDTE80;
+
+namespace NPanday.VisualStudio.Addin
+{
+ public class MavenRunner
+ {
+ OutputWindowPane output;
+ System.Diagnostics.Process currentProcess;
+ DTE2 dte2;
+ bool stopCalled;
+ System.Threading.Thread outputThread;
+ System.Threading.Thread outputErrorThread;
+ bool running;
+ ManualResetEvent outputThreadEvent;
+ ManualResetEvent outputErrorThreadEvent;
+ public event EventHandler RunnerStopped;
+
+
+ protected void onRunnerStopped()
+ {
+ if (RunnerStopped != null)
+ RunnerStopped(this, new EventArgs());
+ }
+
+ public MavenRunner(DTE2 dte2)
+ {
+ this.dte2 = dte2;
+ output = MakeOutputWindow();
+ outputThreadEvent = null;
+
+ // create a worker thread for outputing the process console out puts
+ running = true;
+ System.Threading.ThreadStart outputThreadStart = new System.Threading.ThreadStart(OutputThreadDelegate);
+ outputThread = new System.Threading.Thread(outputThreadStart);
+ outputThread.Start();
+
+ // create a separate worker thread for outputing the Process.StandardError
+ System.Threading.ThreadStart outputErrorThreadStart = new System.Threading.ThreadStart(OutputErrorThreadDelegate);
+ outputErrorThread = new System.Threading.Thread(outputErrorThreadStart);
+ outputErrorThread.Start();
+
+ }
+
+ public void ClearOutputWindow()
+ {
+ output.Clear();
+ }
+
+ public void Quit()
+ {
+ running = false;
+ if (IsRunning)
+ {
+ stop();
+ }
+ }
+
+ private void DeleteBinDir()
+ {
+ Solution2 solution = (Solution2)dte2.Solution;
+
+ Projects projs = solution.Projects;
+
+ bool isFlatProject = true;
+
+ string[] directoryPartial = solution.FullName.Split("\\".ToCharArray());
+ string pathPartial = directoryPartial[directoryPartial.Length - 1];
+ string path = solution.FullName.Substring(0, solution.FullName.Length - pathPartial.Length);
+
+ path = path.Replace("\\", "//");
+ string baseDirectory = path;
+ path = path + "/bin";
+
+
+ string[] directories = Directory.GetDirectories(baseDirectory);
+
+ //searching for pom file to determine whether the project is flat or not
+ foreach (string dir in directories)
+ {
+ string[] dirFiles = Directory.GetFiles(dir);
+ foreach (string f in dirFiles)
+ {
+ if (f.Contains("pom.xml"))
+ {
+ isFlatProject = false;
+ break;
+ }
+ }
+ if (!isFlatProject)
+ {
+ break;
+ }
+ }
+
+ //searching for target folders to delete the temp directories generated
+ foreach (string dir in directories)
+ {
+ //projects
+ string[] dirFolders = Directory.GetDirectories(baseDirectory);
+ foreach (string dirFolder in dirFolders)
+ {
+ string[] projectFolders = Directory.GetDirectories(dirFolder);
+ //folders in projects
+ foreach (string projectFolder in projectFolders)
+ {
+ if (projectFolder.Contains("target"))
+ {
+ string[] targetFolders = Directory.GetDirectories(projectFolder);
+ foreach (string targetFolder in targetFolders)
+ {
+ string targetChange = targetFolder.Replace("\\", "//");
+
+ string[] targetPartial = targetChange.Split("//".ToCharArray());
+ string targetPath = targetPartial[targetPartial.Length - 1];
+
+ if (IsAllDigit(targetPath))
+ {
+ try
+ {
+ Directory.Delete(targetChange, true);
+ }
+ catch (Exception e)
+ {
+ output.OutputString("\n[delete error]" + e.Message);
+ }
+
+ }
+ }
+ }
+ }
+ }
+ if (!isFlatProject)
+ {
+ break;
+ }
+ }
+
+ //Delete the temp bin generated
+ if (Directory.Exists(path) && !isFlatProject)
+ {
+ Directory.Delete(path, true);
+ }
+
+ }
+
+ // Function To test for temp folder
+ private bool IsAllDigit(String strToCheck)
+ {
+ bool isValid = true;
+ foreach (char item in strToCheck)
+ {
+ if (!Char.IsDigit(item))
+ {
+ isValid = false;
+ break;
+ }
+ }
+ return isValid;
+ }
+
+
+ private void OutputErrorThreadDelegate()
+ {
+
+ while (running)
+ {
+ // assign to a local variable to avoid raise exception
+ System.Diagnostics.Process proc = currentProcess;
+
+
+
+ if (!IsRunning)
+ {
+ // no process, make the thread pasivate to save cpu usage;
+ outputErrorThreadEvent = new ManualResetEvent(false);
+ outputErrorThreadEvent.WaitOne();
+ continue;
+ }
+
+ StreamReader mvnErrorOutput = proc.StandardError;
+ if (mvnErrorOutput.Peek() != 0)
+ {
+ string value = mvnErrorOutput.ReadLine();
+ if (!string.IsNullOrEmpty(value) && !"".Equals(value.Trim()))
+ {
+ if (!stopCalled)
+ output.OutputString("\n" + value);
+ }
+ }
+ }
+
+ }
+
+
+ private void OutputThreadDelegate()
+ {
+
+ while (running)
+ {
+ // assign to a local variable to avoid raise exception
+ System.Diagnostics.Process proc = currentProcess;
+
+
+
+ if (!IsRunning)
+ {
+ // no process, make the thread pasivate to save cpu usage;
+ outputThreadEvent = new ManualResetEvent(false);
+ outputThreadEvent.WaitOne();
+ continue;
+ }
+
+ StreamReader mvnOutput = proc.StandardOutput;
+ if (mvnOutput.Peek() != 0)
+ {
+ string value = mvnOutput.ReadLine();
+ if (!string.IsNullOrEmpty(value) && !"".Equals(value.Trim()))
+ {
+ if (!stopCalled)
+ output.OutputString("\n" + value);
+ }
+ }
+ }
+
+ }
+
+ private OutputWindowPane MakeOutputWindow()
+ {
+ // _applicationObject is from the main class
+ try
+ {
+ Window win = dte2.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
+ OutputWindow outputWindow = (OutputWindow)win.Object;
+ OutputWindowPane outputPane = null;
+
+ OutputWindowPanes panes = outputWindow.OutputWindowPanes;
+
+ // Reuse the existing pane (if it exists)
+
+ for (int i = 1; i <= panes.Count; i++)
+ {
+ outputPane = panes.Item(i);
+ if (outputPane.Name == "NPanday Execution Output:")
+ return outputPane;
+ }
+
+ OutputWindowPane output = outputWindow.OutputWindowPanes.Add("NPanday Execution Output:");
+ return output;
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Error In Generation Output Window: " + e.Message);
+ }
+ }
+
+ [MethodImpl(MethodImplOptions.Synchronized)]
+ private void InitializeMavenRunner()
+ {
+ output.Clear();
+ output.Activate();
+ stopCalled = false;
+ }
+
+ public void execute(string pomFile, string goal)
+ {
+ execute(pomFile, goal, null);
+ }
+
+ public void execute(string pomFile, string goal, string[] parameters)
+ {
+ InitializeMavenRunner();
+
+ if (!(new FileInfo(pomFile)).Exists)
+ {
+ string errStr = string.Format("Pom File {0} not found!", pomFile);
+ output.OutputString(errStr);
+ throw new Exception(errStr);
+ }
+
+ List<string> paramList = new List<string>();
+ paramList.Add(pomFile);
+ paramList.Add(goal);
+
+ if (!"pom.xml".Equals(Path.GetFileName(pomFile), StringComparison.OrdinalIgnoreCase))
+ {
+ paramList.Add(string.Format("-f\"{0}\"", Path.GetFileName(pomFile)));
+ }
+
+ if (parameters != null)
+ {
+ paramList.AddRange(parameters);
+ }
+
+
+ ExecuteMaven(paramList.ToArray());
+ }
+
+ [MethodImpl(MethodImplOptions.Synchronized)]
+ private void ExecuteMaven(string[] param)
+ {
+ // use local variable to avoid raise exception
+ System.Diagnostics.Process process = null;
+
+ try
+ {
+ process = StartNewMavenProcess((string[])param);
+ currentProcess = process;
+ if (outputThreadEvent != null)
+ {
+ outputThreadEvent.Set();
+ }
+ if (outputErrorThreadEvent != null)
+ {
+ outputErrorThreadEvent.Set();
+ }
+
+
+ }
+ catch (Exception e)
+ {
+ output.OutputString("Error in Starting Maven Process: " + e.Message);
+ return;
+ }
+ }
+
+ [MethodImpl(MethodImplOptions.Synchronized)]
+ private System.Diagnostics.Process StartNewMavenProcess(string[] args)
+ {
+
+ if (this.IsRunning)
+ {
+ throw new Exception("A Maven: Process Is still Running!");
+ }
+
+ string pomFile = args[0];
+ string goal = args[1];
+ string arguments = null;
+
+ if (args.Length > 2)
+ {
+ arguments = string.Join(" ", args, 2, args.Length - 2);
+ }
+
+
+
+
+ if (!string.IsNullOrEmpty(arguments))
+ {
+ arguments = string.Format("{0} {1}", goal, arguments);
+ }
+ else
+ {
+ arguments = goal;
+ }
+
+
+ System.Diagnostics.Process process = new System.Diagnostics.Process();
+
+
+ string mvn_file = Path.Combine(System.Environment.GetEnvironmentVariable("M2_HOME"), @"bin\mvn.bat");
+
+ output.OutputString("\n------------------------------------------------------------------");
+ output.OutputString("\nExecuting Maven");
+ output.OutputString("\nPom File: " + pomFile);
+ output.OutputString("\nGoal: " + goal);
+ output.OutputString("\nArguments: " + arguments);
+ output.OutputString(string.Format("\nNPanday Command: {0} {1}\n\n", mvn_file, arguments));
+ output.OutputString("\n------------------------------------------------------------------\n\n");
+
+
+ System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo(mvn_file);
+ procInfo.Arguments = arguments;
+ procInfo.WorkingDirectory = Path.GetDirectoryName(pomFile);
+
+ procInfo.RedirectStandardOutput = true;
+ procInfo.RedirectStandardError = true;
+ procInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
+ procInfo.CreateNoWindow = true;
+ procInfo.UseShellExecute = false;
+
+
+ process.StartInfo = procInfo;
+
+ process.EnableRaisingEvents = true;
+ process.Exited += new EventHandler(mvn_process_exited);
+
+ process.Start();
+ return process;
+ }
+
+
+ public bool IsRunning
+ {
+ get
+ {
+ if (currentProcess == null)
+ return false;
+
+ return !currentProcess.HasExited;
+ }
+ }
+
+ [MethodImpl(MethodImplOptions.Synchronized)]
+ public void stop()
+ {
+ try
+ {
+ stopCalled = true;
+ output.OutputString("\nStopping current NPanday process.");
+ if (outputThreadEvent != null)
+ {
+ outputThreadEvent.WaitOne();
+ }
+ currentProcess.Kill();
+ currentProcess.WaitForExit();
+ }
+ catch (Exception e)
+ {
+
+ output.OutputString("Error in Stopping Maven Process: " + e.Message);
+ }
+
+
+ }
+
+ private void mvn_process_exited(object sender, System.EventArgs e)
+ {
+ System.Diagnostics.Process process = (System.Diagnostics.Process)sender;
+
+ // flush the remaining output
+ StreamReader mvnOutput = process.StandardOutput;
+
+ if (stopCalled)
+ {
+ output.OutputString("\nNPanday execution stopped successfully.");
+ onRunnerStopped();
+ return;
+ }
+
+ if (mvnOutput.Peek() != 0)
+ {
+ string value = mvnOutput.ReadToEnd();
+ if (!string.IsNullOrEmpty(value) && !"".Equals(value.Trim()))
+ {
+ output.OutputString("\n" + value);
+ }
+ }
+
+
+
+ int exitCode = process.ExitCode;
+ if (exitCode == 0)
+ {
+ output.OutputString("\nNPanday Execution is Successful!");
+ DeleteBinDir();
+ }
+ else
+ {
+ output.OutputString("\nNPanday Execution Failed!, with exit code: " + exitCode);
+ DeleteBinDir();
+ }
+ onRunnerStopped();
+ // dont display any failed execution if stop
+ //else if (exitCode == -1)
+ //{
+ // output.OutputString("\nNPanday Execution Failed!");
+ //}
+ }
+ }
+}
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandaySignAssembly.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandaySignAssembly.cs?rev=1202791&r1=1202790&r2=1202791&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandaySignAssembly.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/NPandaySignAssembly.cs Wed Nov 16 17:19:58 2011
@@ -39,7 +39,7 @@ using VSLangProj;
using NPanday.Artifact;
using NPanday.Logging;
using NPanday.Model.Pom;
-using NPanday.Model.Setting;
+using NPanday.Model.Settings;
using NPanday.Utils;
Modified: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/RemoveArtifactsForm.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/RemoveArtifactsForm.cs?rev=1202791&r1=1202790&r2=1202791&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/RemoveArtifactsForm.cs (original)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/main/csharp/NPanday/VisualStudio/Addin/RemoveArtifactsForm.cs Wed Nov 16 17:19:58 2011
@@ -40,7 +40,7 @@ using VSLangProj;
using NPanday.Artifact;
using NPanday.Logging;
using NPanday.Model.Pom;
-using NPanday.Model.Setting;
+using NPanday.Model.Settings;
namespace NPanday.VisualStudio.Addin
{
Propchange: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Nov 16 17:19:58 2011
@@ -0,0 +1,7 @@
+[Bb]in
+obj
+[Dd]ebug
+[Rr]elease
+*.user
+*.aps
+*.eto
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/AddLocalMavenArtifactTest.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/AddLocalMavenArtifactTest.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/AddLocalMavenArtifactTest.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/AddLocalMavenArtifactTest.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,101 @@
+#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.IO;
+using NUnit.Framework;
+using NPanday.VisualStudio.Addin;
+
+namespace NPanday.VisualStudio.Addin_Test
+{
+ [TestFixture]
+ public class AddLocalMavenArtifactTest
+ {
+ private DirectoryInfo testProject;
+ private DirectoryInfo testProjectCopy;
+ private DirectoryInfo repo;
+ private DirectoryInfo repoCopy;
+ private ReferenceManager refManager;
+ private Artifact.Artifact testArtifact;
+
+ public AddLocalMavenArtifactTest()
+ {
+ testProject = new DirectoryInfo(FileUtils.getBaseDirectory() + "\\src\\test\\resource\\TestProject");
+ testProjectCopy = new DirectoryInfo(FileUtils.getBaseDirectory() + "\\src\\test\\resource\\TestProjectCopy");
+
+ repo = new DirectoryInfo(FileUtils.getBaseDirectory() + "\\src\\test\\resource\\m2");
+ repoCopy = new DirectoryInfo(FileUtils.getBaseDirectory() + "\\src\\test\\resource\\m2Copy");
+ }
+
+ [TestFixtureSetUp]
+ public void TestSetUp()
+ {
+ FileUtils.CopyDirectory(testProject, testProjectCopy);
+ FileUtils.CopyDirectory(repo, repoCopy);
+
+ refManager = new ReferenceManager();
+ refManager.ReferenceFolder = testProjectCopy.FullName + "\\TestProject\\.references";
+
+ testArtifact = new Artifact.Artifact();
+ testArtifact.GroupId = "npanday.test";
+ testArtifact.ArtifactId = "NPanday.Test";
+ testArtifact.Version = "1.0";
+ testArtifact.Extension = "dll";
+ }
+
+ [Test]
+ public void addMavenArtifact()
+ {
+ testArtifact.FileInfo = new FileInfo(FileUtils.getBaseDirectory() + "\\src\\test\\resource\\m2Copy\\ClassLibrary1.dll");
+ refManager.CopyArtifact(testArtifact, null);
+ Assert.IsTrue(new FileInfo(refManager.ReferenceFolder + "\\npanday.test\\NPanday.Test-1.0\\NPanday.Test.dll").Exists);
+ }
+
+ [Test]
+ public void addExistingMavenArtifact()
+ {
+ testArtifact.FileInfo = new FileInfo(FileUtils.getBaseDirectory() + "\\src\\test\\resource\\m2Copy\\ClassLibrary1.dll");
+ refManager.CopyArtifact(testArtifact, null);
+ FileInfo copiedArtifact = new FileInfo(refManager.ReferenceFolder + "\\npanday.test\\NPanday.Test-1.0\\NPanday.Test.dll");
+
+ Assert.IsTrue(copiedArtifact.Exists);
+ Assert.AreEqual(testArtifact.FileInfo.Length, copiedArtifact.Length);
+
+ testArtifact.FileInfo = new FileInfo(FileUtils.getBaseDirectory() + "\\src\\test\\resource\\m2Copy\\ClassLibrary2.dll");
+
+ Assert.IsFalse(copiedArtifact.Length == testArtifact.FileInfo.Length);
+ //so that new artifact will have a newer timestamp
+ File.SetLastWriteTime(testArtifact.FileInfo.FullName, copiedArtifact.LastWriteTime.AddMinutes(1));
+
+ refManager.CopyArtifact(testArtifact, null);
+ FileInfo copiedArtifact2 = new FileInfo(refManager.ReferenceFolder + "\\npanday.test\\NPanday.Test-1.0\\NPanday.Test.dll");
+
+ Assert.IsTrue(copiedArtifact2.Exists);
+ Assert.AreEqual(testArtifact.FileInfo.Length, copiedArtifact2.Length);
+ }
+
+ [TestFixtureTearDown]
+ public void TestTearDown()
+ {
+ Directory.Delete(testProjectCopy.FullName, true);
+ Directory.Delete(repoCopy.FullName, true);
+ }
+ }
+}
\ No newline at end of file
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/AddWebReferenceTest.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/AddWebReferenceTest.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/AddWebReferenceTest.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/AddWebReferenceTest.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,170 @@
+#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.Text;
+using NUnit.Framework;
+using System.IO;
+using NPanday.Utils;
+
+namespace NPanday.VisualStudio.Addin_Test
+{
+ [TestFixture]
+ public class AddWebReferenceTest
+ {
+ private PomHelperUtility pomCopy;
+ private PomHelperUtility pomCopy2;
+ private String pomPath;
+ private String pomPath2;
+ private String pomCopyPath;
+ private String pomCopyPath2;
+ private String fullPath;
+ private String path;
+ private String testFullPath;
+ private String testPath;
+ private String output;
+ private StringBuilder strLine;
+
+ public AddWebReferenceTest()
+ {
+ pomPath = (new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target")) + "\\src\\test\\resource\\ClassLibrary1\\ClassLibrary1\\pom.xml").FullName);
+ pomCopyPath = pomPath.Replace("pom.xml", "pomCopy.xml");
+
+ fullPath = (new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target")) + "\\src\\test\\resource\\ClassLibrary1\\ClassLibrary1\\Web References\\WebRef").FullName);
+ path = "Web References\\WebRef\\demoService.wsdl";
+
+ testFullPath = (new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target")) + "\\src\\test\\resource\\ClassLibrary1\\ClassLibrary1\\Web References\\WebRef2").FullName);
+ testPath = "Web References\\WebRef2\\dilbert.wsdl";
+
+ pomPath2 = (new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target")) + "\\src\\test\\resource\\ClassLibrary1\\ClassLibrary1\\pom2.xml").FullName);
+ pomCopyPath2 = pomPath2.Replace("pom2.xml", "pomCopy2.xml");
+ }
+
+ [SetUp]
+ public void TestSetUp()
+ {
+ File.Copy(pomPath, pomCopyPath);
+ File.Copy(pomPath2, pomCopyPath2);
+
+ pomCopy = new PomHelperUtility(pomCopyPath);
+ pomCopy2 = new PomHelperUtility(pomCopyPath2);
+
+ }
+ [Test]
+ public void AddNewWebReferenceTest()
+ {
+ int ctr = 0;
+
+ ctr = GetWebReferenceCount(pomCopyPath);
+ Assert.AreEqual(0, ctr);
+ pomCopy.AddWebReference("WebRef", path, output, null);
+
+ ctr = GetWebReferenceCount(pomCopyPath);
+ Assert.AreEqual(1, ctr);
+ Assert.IsTrue(strLine.ToString().Contains("<path>Web References/WebRef/demoService.wsdl</path>"));
+ }
+
+ [Test]
+ public void AddDuplicateWebReferenceTest()
+ {
+ int ctr = 0;
+ ctr = GetWebReferenceCount(pomCopyPath);
+ Assert.AreEqual(0, ctr);
+
+ pomCopy.AddWebReference("WebRef", path, output, null);
+ pomCopy.AddWebReference("WebRef", path, output, null);
+
+ ctr = GetWebReferenceCount(pomCopyPath);
+ Assert.AreEqual(1, ctr);
+ }
+
+ [Test]
+ public void AddWithExistingWebReferenceTest()
+ {
+ int ctr = 0;
+
+ ctr = GetWebReferenceCount(pomCopyPath2);
+ Assert.AreEqual (1, ctr);
+
+ pomCopy2.AddWebReference("WebRef", path, output, null);
+
+ ctr = GetWebReferenceCount(pomCopyPath2);
+ Assert.AreEqual(2, ctr);
+ }
+
+ [Test]
+ public void CheckIncludeSourceWithDiscoFileTest()
+ {
+ pomCopy.AddWebReference("WebRef", testPath, output, null);
+ Assert.IsFalse(GetIncludeSource(pomCopyPath));
+ }
+
+ private bool GetIncludeSource(String pom_path)
+ {
+ bool exists = false;
+ String line;
+ StreamReader strm = new StreamReader(pom_path);
+ strLine = new StringBuilder();
+
+ while ((line = strm.ReadLine()) != null)
+ {
+ strLine.Append(line);
+
+ if (line.ToString().Contains(".disco"))
+ {
+ exists = true;
+ }
+ }
+
+ strm.Close();
+ return exists;
+ }
+
+ private int GetWebReferenceCount(String pom_path)
+ {
+ int ctr = 0;
+ String line;
+ StreamReader strm = new StreamReader(pom_path);
+ strLine = new StringBuilder();
+
+ while ((line = strm.ReadLine()) != null)
+ {
+ strLine.Append(line);
+
+ if (line.ToString().Contains("<webreference>"))
+ {
+ ctr++;
+ }
+ }
+
+ strm.Close();
+ return ctr;
+ }
+
+ [TearDown]
+ public void TestTearDown()
+ {
+ File.Delete(pomCopyPath);
+ File.Delete(pomCopyPath2);
+ }
+
+ }
+}
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/FileUtils.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/FileUtils.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/FileUtils.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/FileUtils.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,79 @@
+#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.IO;
+
+namespace NPanday.VisualStudio.Addin_Test
+{
+ public class FileUtils
+ {
+ public static string getBaseDirectory()
+ {
+ return new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target"))).FullName;
+ }
+
+ public static string getLocalRepository()
+ {
+ string homePath = string.Empty;
+ if (Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX)
+ {
+ homePath = Environment.GetEnvironmentVariable("HOME");
+ }
+ else
+ {
+ homePath = Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%");
+
+ if (homePath == null || homePath == string.Empty)
+ {
+ homePath = Environment.GetEnvironmentVariable("USERPROFILE");
+ }
+ }
+
+ return new FileInfo(homePath + "\\.m2").FullName;
+
+ }
+
+ public static void CopyDirectory(DirectoryInfo source, DirectoryInfo destination)
+ {
+ if (!destination.Exists)
+ {
+ destination.Create();
+ }
+
+ FileInfo[] files = source.GetFiles();
+ foreach (FileInfo filePath in files)
+ {
+ if (filePath.Name != null && !filePath.Name.EndsWith(".test"))
+ filePath.CopyTo(Path.Combine(destination.FullName, filePath.Name));
+ }
+
+ DirectoryInfo[] subDirectories = source.GetDirectories();
+ foreach (DirectoryInfo dirPath in subDirectories)
+ {
+ if (!dirPath.Name.Equals(".svn"))
+ {
+ CopyDirectory(new DirectoryInfo(Path.Combine(source.FullName, dirPath.Name)), new DirectoryInfo(Path.Combine(destination.FullName, dirPath.Name)));
+ }
+ }
+ }
+ }
+}
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/MavenCompilePluginConfigurationTest.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/MavenCompilePluginConfigurationTest.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/MavenCompilePluginConfigurationTest.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/MavenCompilePluginConfigurationTest.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,80 @@
+#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 NUnit.Framework;
+using NPanday.Utils;
+using System.IO;
+
+namespace NPanday.VisualStudio.Addin_Test
+{
+ [TestFixture]
+ public class MavenCompilePluginConfigurationTest
+ {
+ private PomHelperUtility pomCopy;
+ private String pomPath;
+ private String pomCopyPath;
+
+
+
+ public MavenCompilePluginConfigurationTest()
+ {
+
+ }
+
+ [SetUp]
+ public void TestSetUp()
+ {
+ pomPath = (new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target")) + "\\src\\test\\resource\\ClassLibrary1\\ClassLibrary1\\pom.xml").FullName);
+
+ pomCopyPath = pomPath.Replace("pom.xml", "pomCopy.xml");
+
+ pomCopy = new PomHelperUtility(pomCopyPath);
+
+ File.Copy(pomPath, pomCopyPath);
+ }
+
+ [Test]
+ public void AddMavenCompilePluginConfigurationTest()
+ {
+ pomCopy.AddMavenCompilePluginConfiguration("org.apache.npanday.plugins", "maven-compile-plugin", "includeSources", "includeSource", "IISHandler1.cs");
+ }
+
+ [Test]
+ public void RenameMavenCompilePluginConfigurationTest()
+ {
+ pomCopy.RenameMavenCompilePluginConfiguration("org.apache.npanday.plugins", "maven-compile-plugin", "includeSources", "includeSource", "IISHandler1.cs","IISHandlerRenamed.cs");
+ }
+
+ [Test]
+ public void RemoveMavenCompilePluginConfigurationTest()
+ {
+ pomCopy.RemoveMavenCompilePluginConfiguration("org.apache.npanday.plugins", "maven-compile-plugin", "includeSources", "includeSource", "IISHandler1.cs");
+ }
+
+ [TearDown]
+ public void TestCleanUp()
+ {
+ File.Delete(pomCopyPath);
+ }
+
+ }
+}
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/MavenResxPluginConfigurationTest.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/MavenResxPluginConfigurationTest.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/MavenResxPluginConfigurationTest.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/MavenResxPluginConfigurationTest.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,81 @@
+#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 NUnit.Framework;
+using NPanday.Utils;
+using System.IO;
+
+namespace NPanday.VisualStudio.Addin_Test
+{
+ [TestFixture]
+ public class MavenResxPluginConfigurationTest
+ {
+ private PomHelperUtility pomCopy;
+ private String pomPath;
+ private String pomCopyPath;
+
+
+
+ public MavenResxPluginConfigurationTest()
+ {
+
+ }
+
+ [SetUp]
+ public void TestSetUp()
+ {
+ pomPath = (new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target")) + "\\src\\test\\resource\\ClassLibrary1\\ClassLibrary1\\pom.xml").FullName);
+
+ pomCopyPath = pomPath.Replace("pom.xml", "pomCopy.xml");
+
+ pomCopy = new PomHelperUtility(pomCopyPath);
+
+ File.Copy(pomPath, pomCopyPath);
+ }
+
+ [Test]
+ public void AddMavenResxPluginConfigurationTest()
+ {
+ pomCopy.AddMavenResxPluginConfiguration("org.apache.npanday.plugins", "maven-resgen-plugin", "embeddedResources", "embeddedResource", "Copy of Resource1.resx", "ClassLibrary1.Copy of Resource1");
+ }
+
+ [Test]
+ public void RenameMavenResxPluginConfigurationTest()
+ {
+ pomCopy.RenameMavenResxPluginConfiguration("org.apache.npanday.plugins", "maven-resgen-plugin", "embeddedResources", "embeddedResource", "Copy of Resource1.resx", "ClassLibrary1.Copy of Resource1", "ToBeDeleted.resx", "ClassLibrary1.ToBeDeleted");
+ }
+
+ [Test]
+ public void RemoveMavenResxPluginConfigurationTest()
+ {
+ pomCopy.RemoveMavenResxPluginConfiguration("org.apache.npanday.plugins", "maven-resgen-plugin", "embeddedResources", "embeddedResource", "ToBeDeleted.resx", "ClassLibrary1.ToBeDeleted");
+ //File.Delete(pomCopyPath);
+ }
+
+ [TearDown]
+ public void TestCleanUp()
+ {
+ File.Delete(pomCopyPath);
+ }
+
+ }
+}
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/NPanday.VisualStudio.Addin-Test.csproj
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/NPanday.VisualStudio.Addin-Test.csproj?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/NPanday.VisualStudio.Addin-Test.csproj (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/NPanday.VisualStudio.Addin-Test.csproj Wed Nov 16 17:19:58 2011
@@ -0,0 +1,104 @@
+<?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.
+-->
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{CD2E70EA-44C3-4AA0-9701-F99181332E8F}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NPanday.VisualStudio.Addin_Test</RootNamespace>
+ <AssemblyName>NPanday.VisualStudio.Addin-Test</AssemblyName>
+ <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+ <OutputPath>../../../target</OutputPath>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>../../../target</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <EmbedInteropTypes>True</EmbedInteropTypes>
+ </Reference>
+ <Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <EmbedInteropTypes>True</EmbedInteropTypes>
+ </Reference>
+ <Reference Include="Extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <EmbedInteropTypes>True</EmbedInteropTypes>
+ </Reference>
+ <Reference Include="NPanday.Model.Pom, Version=1.4.1.0, Culture=neutral, PublicKeyToken=4b435f4d76e2f0e6, processorArchitecture=MSIL">
+ <HintPath>..\..\..\..\NPanday.Model.Pom\target\NPanday.Model.Pom.dll</HintPath>
+ </Reference>
+ <Reference Include="NPanday.Model.Settings, Version=1.4.1.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\..\..\..\NPanday.Model.Settings\target\NPanday.Model.Settings.dll</HintPath>
+ </Reference>
+ <Reference Include="NUnit.Framework, Version=2.2.8.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\.references\NUnit.Framework.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AddLocalMavenArtifactTest.cs" />
+ <Compile Include="AddWebReferenceTest.cs" />
+ <Compile Include="FileUtils.cs" />
+ <Compile Include="MavenCompilePluginConfigurationTest.cs" />
+ <Compile Include="MavenResxPluginConfigurationTest.cs" />
+ <Compile Include="RenameWebReferenceTest.cs" />
+ <Compile Include="ResyncArtifactSnapshot.cs" />
+ <Compile Include="SuccessfulDisconnectTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\..\NPanday.Artifact\src\main\csharp\NPanday.Artifact.csproj">
+ <Project>{701803D4-90F5-44D7-919D-4844FEB7F936}</Project>
+ <Name>NPanday.Artifact</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\NPanday.Logging\src\main\csharp\NPanday.Logging.csproj">
+ <Project>{C511B03B-8AB7-4E61-9F6E-5E6F9F65E8CE}</Project>
+ <Name>NPanday.Logging</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\..\NPanday.Utils\src\main\csharp\NPanday.Utils.csproj">
+ <Project>{CAA4864F-F4C8-4024-8535-8B8C112307CE}</Project>
+ <Name>NPanday.Utils</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\main\csharp\NPanday.VisualStudio.Addin.csproj">
+ <Project>{5BE35FDF-E620-4EB0-B9A8-2359C506D85D}</Project>
+ <Name>NPanday.VisualStudio.Addin</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/ProjectImporterValidationTest.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/ProjectImporterValidationTest.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/ProjectImporterValidationTest.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/ProjectImporterValidationTest.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,106 @@
+#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.Text;
+using NUnit.Framework;
+using NPanday.Utils;
+using NPanday.VisualStudio.Addin;
+using System.IO;
+
+namespace ConnectTest.UtilsTest
+{
+ [TestFixture]
+ public class ProjectImporterValidationTest
+ {
+
+
+ private class NPandayImportProjectFormTest : NPandayImportProjectForm
+ {
+ public void GeneratePomTest(String solutionFile, String groupId, String version, String scmTag)
+ {
+ this.GeneratePom(solutionFile, groupId, version, scmTag);
+ }
+ }
+
+ private NPandayImportProjectFormTest importerTest;
+ private String solutionSample;
+
+ [SetUp]
+ public void ProjectImporterValidationTestSetup()
+ {
+ importerTest = new NPandayImportProjectFormTest();
+ solutionSample = new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target")) + "\\src\\test\\resource\\ClassLibrary1\\ClassLibrary1.sln").FullName;
+ }
+
+ [Test]
+ public void ImporterInvalidGroupIdTest()
+ {
+ try
+ {
+ importerTest.GeneratePomTest(solutionSample, "", "1.0-SNAPSHOT", "");
+ }
+ catch (Exception e)
+ {
+ Assert.AreEqual("Group Id is empty.", e.Message);
+ }
+ }
+
+ [Test]
+ public void ImporterEmptyVersionTest()
+ {
+ try
+ {
+ importerTest.GeneratePomTest(solutionSample, "npanday", "", "");
+ }
+ catch (Exception e)
+ {
+ Assert.AreEqual("\r\nVersion is empty.", e.Message);
+ }
+ }
+
+ [Test]
+ public void ImporterInvalidVersionTest()
+ {
+ try
+ {
+ importerTest.GeneratePomTest(solutionSample, "npanday", "123--.", "");
+ }
+ catch (Exception e)
+ {
+ Assert.AreEqual("\r\nVersion should be in the form major.minor.build.revision-SNAPSHOT", e.Message);
+ }
+ }
+
+ [Test]
+ public void ImporterInvalidSolutionFileTest()
+ {
+ try
+ {
+ importerTest.GeneratePomTest("", "npanday", "1.0-SNAPSHOT", "");
+ }
+ catch (Exception e)
+ {
+ Assert.AreEqual("Solution File Not Found: \r\n", e.Message);
+ }
+ }
+ }
+}
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/RenameWebReferenceTest.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/RenameWebReferenceTest.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/RenameWebReferenceTest.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/RenameWebReferenceTest.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,90 @@
+#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.Text;
+using NUnit.Framework;
+using System.IO;
+using NPanday.Utils;
+
+namespace NPanday.VisualStudio.Addin_Test
+{
+ [TestFixture]
+ public class RenameWebReferenceTest
+ {
+ private PomHelperUtility pomCopy;
+ private String pomPath;
+ private String pomCopyPath;
+ private String fullPath;
+ private String fullPathCopy;
+ private String path;
+ private String output;
+ private String oldName = "WebRef";
+ private String newName = "WebRef2";
+
+ private StringBuilder strLine;
+ private String line;
+ private StreamReader strm;
+
+ public RenameWebReferenceTest()
+ {
+ pomPath = (new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target")) + "\\src\\test\\resource\\ClassLibrary1\\ClassLibrary1\\pom.xml").FullName);
+
+ pomCopyPath = pomPath.Replace("pom.xml", "pomCopy.xml");
+
+ pomCopy = new PomHelperUtility(pomCopyPath);
+
+ File.Copy(pomPath, pomCopyPath);
+
+ fullPath = (new FileInfo(Directory.GetCurrentDirectory().Substring(0, Directory.GetCurrentDirectory().LastIndexOf("target")) + "\\src\\test\\resource\\ClassLibrary1\\ClassLibrary1\\Web References\\WebRef").FullName);
+ fullPathCopy = fullPath.Replace(oldName, newName);
+ path = "Web References\\" + oldName + "\\demoService.wsdl";
+ }
+
+ [Test]
+ public void RenameExistingWebReferenceTest()
+ {
+ int ctr = 0;
+
+ pomCopy.RenameWebReference(fullPath, oldName, newName, path, output);
+
+ strm = new StreamReader(pomCopyPath);
+ strLine = new StringBuilder();
+
+ while ((line = strm.ReadLine()) != null)
+ {
+ strLine.Append(line);
+
+ if (line.ToString().Contains("<webreference>"))
+ {
+ ctr++;
+ }
+ }
+
+ strm.Close();
+ File.Delete(pomCopyPath);
+
+ Assert.AreEqual(1, ctr);
+ Assert.IsFalse(strLine.ToString().Contains("<namespace>WebRef</namespace>"));
+ }
+
+ }
+}
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/ResyncArtifactSnapshot.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/ResyncArtifactSnapshot.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/ResyncArtifactSnapshot.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/ResyncArtifactSnapshot.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,52 @@
+#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 NUnit.Framework;
+using NPanday.VisualStudio.Addin;
+using System.IO;
+
+namespace NPanday.VisualStudio.Addin_Test
+{
+ [TestFixture]
+ public class ResyncArtifactSnapshot
+ {
+ public void artifactSetUp()
+ {
+ ReferenceManager refMngr = new ReferenceManager();
+ Artifact.Artifact artifact = new Artifact.Artifact();
+
+ artifact.GroupId = "npanday.artifact";
+ artifact.Version = "1.1-SNAPSHOT";
+ artifact.ArtifactId = "NPanday.Artifact";
+ artifact.Extension = "dll";
+
+ refMngr.CopyArtifact(artifact,null);
+ }
+
+ [Test]
+ public void downloadArtifact()
+ {
+ string user = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
+ Assert.IsNotNull(new FileInfo(string.Format("C:\\Documents and Settings\\{0}\\.m2\\uac\\gac_msil\\npanday.artifact\\1.1-SNAPSHOT__npanday.artifact\\NPanday.Artifact.dll", user)));
+ }
+
+ }
+}
Added: incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/SuccessfulDisconnectTest.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/SuccessfulDisconnectTest.cs?rev=1202791&view=auto
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/SuccessfulDisconnectTest.cs (added)
+++ incubator/npanday/trunk/dotnet/assemblies/NPanday.VisualStudio.Addin/src/test/csharp/SuccessfulDisconnectTest.cs Wed Nov 16 17:19:58 2011
@@ -0,0 +1,54 @@
+#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 NUnit.Framework;
+using NPanday.VisualStudio.Addin;
+using Extensibility;
+
+namespace NPanday.VisualStudio.Addin_Test
+{
+ [TestFixture]
+ public class SuccessfulDisconnectTest
+ {
+ public class ConnectTest : Connect
+ {
+ public bool IsNpandayDisconnected()
+ {
+ return this.IsApplicationObjectNull();
+ }
+ }
+
+ [Test]
+ public void CheckCleanDisconnectTest()
+ {
+ ConnectTest npandayConnect = new ConnectTest();
+
+ ext_DisconnectMode disconnectMode = ext_DisconnectMode.ext_dm_HostShutdown;
+ Object[] holder = { "" };
+ Array custom = (Array)holder;
+
+ npandayConnect.OnDisconnection(disconnectMode, ref custom);
+
+ Assert.AreEqual(true, npandayConnect.IsNpandayDisconnected());
+ }
+ }
+}
Modified: incubator/npanday/trunk/dotnet/assemblies/pom.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/dotnet/assemblies/pom.xml?rev=1202791&r1=1202790&r2=1202791&view=diff
==============================================================================
--- incubator/npanday/trunk/dotnet/assemblies/pom.xml (original)
+++ incubator/npanday/trunk/dotnet/assemblies/pom.xml Wed Nov 16 17:19:58 2011
@@ -33,6 +33,7 @@ under the License.
<module>NPanday.Model.Pom</module>
<module>NPanday.Model.Settings</module>
<module>NPanday.Model.AutomationExtensibility</module>
+ <module>NPanday.Utils</module>
<module>NPanday.Logging</module>
<module>NPanday.Artifact</module>
<module>NPanday.Plugin</module>
@@ -50,8 +51,7 @@ under the License.
</os>
</activation>
<modules>
- <!-- TODO: should build without EnvDTE80, etc. but currently has dependencies on windows libs -->
- <module>NPanday.Utils</module>
+ <!-- TODO: uses MSBuild from gac / could rely on Xbuild from Mono on non-windows... -->
<module>NPanday.ProjectImporter</module>
<!-- TODO: should be optional -->
Modified: incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/src/main/csharp/NPanday/Plugin/Msbuild/MsbuildMojo.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/src/main/csharp/NPanday/Plugin/Msbuild/MsbuildMojo.cs?rev=1202791&r1=1202790&r2=1202791&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/src/main/csharp/NPanday/Plugin/Msbuild/MsbuildMojo.cs (original)
+++ incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/src/main/csharp/NPanday/Plugin/Msbuild/MsbuildMojo.cs Wed Nov 16 17:19:58 2011
@@ -27,7 +27,6 @@ using Microsoft.Win32;
using NPanday.Plugin;
using NPanday.Model.Pom;
-using NPanday.Model;
using NPanday.Artifact;
using System.Reflection;
Modified: incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.SysRef/src/main/csharp/NPanday/Plugin/SysRef/SysRefMojo.cs
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.SysRef/src/main/csharp/NPanday/Plugin/SysRef/SysRefMojo.cs?rev=1202791&r1=1202790&r2=1202791&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.SysRef/src/main/csharp/NPanday/Plugin/SysRef/SysRefMojo.cs (original)
+++ incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.SysRef/src/main/csharp/NPanday/Plugin/SysRef/SysRefMojo.cs Wed Nov 16 17:19:58 2011
@@ -27,7 +27,6 @@ using Microsoft.Win32;
using NPanday.Plugin;
using NPanday.Model.Pom;
-using NPanday.Model;
using NPanday.Artifact;
using System.Reflection;