mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
branded all to xcp-ng, removed old xcp-ng splash, removed tests, removed xe project files
This commit is contained in:
parent
980788a0ab
commit
21cfe7a57a
@ -35,9 +35,9 @@ using System.Runtime.InteropServices;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CommandLib")]
|
||||
[assembly: AssemblyDescription("[XenCenter] library")]
|
||||
[assembly: AssemblyDescription("XCP-ng Center library")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("[XenCenter]")]
|
||||
[assembly: AssemblyProduct("XCP-ng Center")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
@ -30,12 +30,12 @@
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyCompany("[XenServerProduct]")]
|
||||
[assembly: AssemblyCopyright("Copyright © [Vendor Legal]")]
|
||||
[assembly: AssemblyCompany("XCP-ng")]
|
||||
[assembly: AssemblyCopyright("Copyright © XCP-ng")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0000")]
|
||||
[assembly: AssemblyVersion("99.99.99.9999")]
|
||||
[assembly: AssemblyFileVersion("99.99.99.9999")]
|
||||
|
||||
/*
|
||||
* .NET Framework 4.8 docs: All components of the version must be integers greater
|
||||
|
@ -35,10 +35,10 @@ using System.Runtime.InteropServices;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("[XenCenter]")]
|
||||
[assembly: AssemblyDescription("[XenCenter]")]
|
||||
[assembly: AssemblyTitle("XCP-ng Center")]
|
||||
[assembly: AssemblyDescription("XCP-ng Center")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("[XenCenter]")]
|
||||
[assembly: AssemblyProduct("XCP-ng Center")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
8
XenAdmin/SplashScreen.Designer.cs
generated
8
XenAdmin/SplashScreen.Designer.cs
generated
@ -32,6 +32,7 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SplashScreen));
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -46,11 +47,17 @@
|
||||
this.timer1.Interval = 2000;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
resources.ApplyResources(this.label1, "label1");
|
||||
this.label1.Name = "label1";
|
||||
//
|
||||
// SplashScreen
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Name = "SplashScreen";
|
||||
@ -66,6 +73,7 @@
|
||||
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ namespace XenAdmin
|
||||
{
|
||||
InitializeComponent();
|
||||
pictureBox1.Image = Images.StaticImages.splash;
|
||||
label1.Text = "Version " + Program.VersionText;
|
||||
//labelCopyright.Text = BrandManager.Copyright;
|
||||
//labelCopyright.ForeColor = Color.FromArgb(39, 52, 64);
|
||||
|
||||
|
@ -126,7 +126,7 @@
|
||||
<value>0, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="pictureBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>830, 434</value>
|
||||
<value>415, 217</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="pictureBox1.TabIndex" type="System.Int32, mscorlib">
|
||||
@ -142,16 +142,49 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>pictureBox1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</data>
|
||||
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="label1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Left, Right</value>
|
||||
</data>
|
||||
<data name="label1.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Microsoft Sans Serif, 8.25pt, style=Bold</value>
|
||||
</data>
|
||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>12, 217</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>391, 29</value>
|
||||
</data>
|
||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="label1.Text" xml:space="preserve">
|
||||
<value>label1</value>
|
||||
</data>
|
||||
<data name="label1.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleCenter</value>
|
||||
</data>
|
||||
<data name=">>label1.Name" xml:space="preserve">
|
||||
<value>label1</value>
|
||||
</data>
|
||||
<data name=">>label1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>192, 192</value>
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
<data name="$this.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
@ -160,10 +193,7 @@
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>830, 434</value>
|
||||
</data>
|
||||
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>6, 6, 6, 6</value>
|
||||
<value>415, 262</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterScreen</value>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>XenAdmin</RootNamespace>
|
||||
<AssemblyName>[XenCenter]</AssemblyName>
|
||||
<AssemblyName>XCP-ng Center</AssemblyName>
|
||||
<ApplicationIcon>AppIcon.ico</ApplicationIcon>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
|
@ -1,103 +0,0 @@
|
||||
/* Copyright (c) Citrix Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using XenAdmin;
|
||||
using XenCenterLib.Archive;
|
||||
|
||||
namespace XenAdminTests.ArchiveTests
|
||||
{
|
||||
class ArchiveFactoryTests
|
||||
{
|
||||
[Test]
|
||||
public void TestValidReaderGeneration()
|
||||
{
|
||||
Dictionary<ArchiveFactory.Type, Type> validIterators = new Dictionary<ArchiveFactory.Type, Type>()
|
||||
{
|
||||
{ ArchiveFactory.Type.Tar, typeof( SharpZipTarArchiveIterator )},
|
||||
{ ArchiveFactory.Type.TarGz, typeof( SharpZipTarArchiveIterator )},
|
||||
{ ArchiveFactory.Type.TarBz2, typeof( SharpZipTarArchiveIterator )}
|
||||
};
|
||||
|
||||
foreach (KeyValuePair<ArchiveFactory.Type, Type> pair in validIterators)
|
||||
{
|
||||
string target = Path.Combine(Directory.GetCurrentDirectory(), @"XenAdminTests\TestResources\emptyfile.bz2");
|
||||
using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(target)))
|
||||
{
|
||||
ArchiveIterator providedStream = ArchiveFactory.Reader(pair.Key, ms);
|
||||
Assert.AreEqual(providedStream.GetType(), pair.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestValidWriterGeneration()
|
||||
{
|
||||
Dictionary<ArchiveFactory.Type, Type> validIterators = new Dictionary<ArchiveFactory.Type, Type>()
|
||||
{
|
||||
{ ArchiveFactory.Type.Tar, typeof( SharpZipTarArchiveWriter )},
|
||||
{ ArchiveFactory.Type.Zip, typeof( DotNetZipZipWriter )}
|
||||
};
|
||||
|
||||
foreach (KeyValuePair<ArchiveFactory.Type, Type> pair in validIterators)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
ArchiveWriter providedStream = ArchiveFactory.Writer(pair.Key, ms);
|
||||
Assert.AreEqual(providedStream.GetType(), pair.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInvalidTarGzWriterGeneration()
|
||||
{
|
||||
Assert.That(()=> CreateInvalidWriterType(ArchiveFactory.Type.TarGz), Throws.Exception.With.TypeOf(typeof(NotSupportedException)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInvalidTarBz2WriterGeneration()
|
||||
{
|
||||
Assert.That(() => CreateInvalidWriterType(ArchiveFactory.Type.TarBz2), Throws.Exception.With.TypeOf(typeof(NotSupportedException)));
|
||||
}
|
||||
|
||||
private void CreateInvalidWriterType(ArchiveFactory.Type type)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
ArchiveFactory.Writer(type, ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,235 +0,0 @@
|
||||
/* Copyright (c) Citrix Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using XenCenterLib.Archive;
|
||||
|
||||
namespace XenAdminTests.ArchiveTests
|
||||
{
|
||||
[TestFixture, Category(TestCategories.UICategoryA)]
|
||||
class ArchiveIteratorTests
|
||||
{
|
||||
private ArchiveIteratorFake fakeIterator;
|
||||
|
||||
#region ArchiveIterator Fake
|
||||
private class ArchiveIteratorFake : ArchiveIterator
|
||||
{
|
||||
private int numberOfCallsLeft;
|
||||
private Stream extractedFile;
|
||||
private string currentFileName;
|
||||
private long currentFileSize;
|
||||
private DateTime modTime;
|
||||
private bool isDirectory;
|
||||
private bool disposed;
|
||||
|
||||
public int NumberOfCallsLeftReturn
|
||||
{
|
||||
set { numberOfCallsLeft = value; }
|
||||
}
|
||||
public Stream ExtractedFileReturn
|
||||
{
|
||||
set
|
||||
{
|
||||
extractedFile = value;
|
||||
disposed = false;
|
||||
}
|
||||
}
|
||||
public string CurrentFileNameReturn
|
||||
{
|
||||
set { currentFileName = value; }
|
||||
}
|
||||
public long CurrentFileSizeReturn
|
||||
{
|
||||
set { currentFileSize = value; }
|
||||
}
|
||||
public DateTime ModTimeReturn
|
||||
{
|
||||
set { modTime = value; }
|
||||
}
|
||||
public bool IsDirectoryReturn
|
||||
{
|
||||
set { isDirectory = value; }
|
||||
}
|
||||
|
||||
public ArchiveIteratorFake()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
CurrentFileNameReturn = "TestFileName.fake";
|
||||
CurrentFileSizeReturn = 100;
|
||||
ExtractedFileReturn = new MemoryStream(Encoding.ASCII.GetBytes("This is a test"));
|
||||
IsDirectoryReturn = false;
|
||||
ModTimeReturn = new DateTime(2011, 4, 1, 11, 04, 01);
|
||||
NumberOfCallsLeftReturn = 1;
|
||||
}
|
||||
|
||||
public override bool HasNext()
|
||||
{
|
||||
if (numberOfCallsLeft < 1)
|
||||
return false;
|
||||
|
||||
numberOfCallsLeft--;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void ExtractCurrentFile(Stream extractedFileContents)
|
||||
{
|
||||
byte[] buffer = new byte[2 * 1024 * 1024];
|
||||
int read;
|
||||
while ((read = extractedFile.Read(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
extractedFileContents.Write(buffer, 0, read);
|
||||
}
|
||||
extractedFile.Position = 0;
|
||||
}
|
||||
|
||||
public override string CurrentFileName()
|
||||
{
|
||||
if (String.IsNullOrEmpty(currentFileName))
|
||||
return currentFileName;
|
||||
|
||||
return numberOfCallsLeft + currentFileName;
|
||||
}
|
||||
|
||||
public override long CurrentFileSize()
|
||||
{
|
||||
return currentFileSize;
|
||||
}
|
||||
|
||||
public override DateTime CurrentFileModificationTime()
|
||||
{
|
||||
return modTime;
|
||||
}
|
||||
|
||||
public override bool IsDirectory()
|
||||
{
|
||||
return isDirectory;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if( !disposed )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(extractedFile != null)
|
||||
extractedFile.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void Setup()
|
||||
{
|
||||
fakeIterator = new ArchiveIteratorFake();
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
fakeIterator.Dispose();
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void TestSetup()
|
||||
{
|
||||
fakeIterator.Reset();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void AnExceptionIsThrownForNullArgumentWhenCallingExtractAllContents()
|
||||
{
|
||||
Assert.That(() => fakeIterator.ExtractAllContents(null), Throws.ArgumentNullException);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnExceptionIsThrownForANullFileNameWhenCallingExtractAllContents()
|
||||
{
|
||||
fakeIterator.CurrentFileNameReturn = null;
|
||||
Assert.That(() => fakeIterator.ExtractAllContents(Path.GetTempPath()), Throws.ArgumentNullException);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void VerifyAFileIsWrittenWhenCallingExtractAllContents()
|
||||
{
|
||||
string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
||||
const int numberOfFiles = 3;
|
||||
fakeIterator.NumberOfCallsLeftReturn = numberOfFiles;
|
||||
fakeIterator.ExtractAllContents(tempPath);
|
||||
|
||||
//Test file has been created
|
||||
string targetFile = Path.Combine(tempPath, fakeIterator.CurrentFileName());
|
||||
Assert.IsTrue(File.Exists(targetFile), "File Exists");
|
||||
|
||||
Assert.IsTrue(File.ReadAllBytes(targetFile).Length > 1, "File length > 1");
|
||||
|
||||
//Check recursively that there are only the correct number of files
|
||||
Assert.IsTrue(Directory.GetFiles(tempPath, "*.*", SearchOption.AllDirectories).Length == numberOfFiles, "File number is correct");
|
||||
|
||||
Assert.IsFalse((File.GetAttributes(targetFile) & FileAttributes.Directory) == FileAttributes.Directory, "Is not a dir");
|
||||
|
||||
Directory.Delete(tempPath,true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void VerifyADirectoryIsWrittenWhenCallingExtractAllContents()
|
||||
{
|
||||
string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
||||
fakeIterator.IsDirectoryReturn = true;
|
||||
fakeIterator.CurrentFileNameReturn = "FakePath" + Path.DirectorySeparatorChar;
|
||||
fakeIterator.ExtractAllContents(tempPath);
|
||||
|
||||
//Test file has been created
|
||||
string targetPath = Path.Combine(tempPath, fakeIterator.CurrentFileName());
|
||||
Assert.IsFalse(File.Exists(targetPath), "No files exist");
|
||||
Assert.IsTrue(Directory.Exists(targetPath), "Directories exist");
|
||||
|
||||
//No files - just a directory
|
||||
Assert.IsTrue(Directory.GetFiles(tempPath).Length < 1, "No file in the directory" );
|
||||
|
||||
//Check it's a directory
|
||||
Assert.IsTrue((File.GetAttributes(targetPath) & FileAttributes.Directory) == FileAttributes.Directory, "Has directory attributes");
|
||||
|
||||
Directory.Delete(tempPath, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,231 +0,0 @@
|
||||
/* Copyright (c) Citrix Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using XenCenterLib.Archive;
|
||||
|
||||
namespace XenAdminTests.ArchiveTests
|
||||
{
|
||||
[TestFixture, Category(TestCategories.UICategoryA), Category(TestCategories.SmokeTest)]
|
||||
class ArchiveWriterTests
|
||||
{
|
||||
private class FakeArchiveWriter : ArchiveWriter
|
||||
{
|
||||
private List<Stream> streamAdded;
|
||||
private List<string> fileNameAdded;
|
||||
private List<DateTime> dateAdded;
|
||||
private bool disposed;
|
||||
|
||||
public List<Stream> AddedStreamData
|
||||
{
|
||||
get { return streamAdded; }
|
||||
}
|
||||
|
||||
public List<string> AddedFileNameData
|
||||
{
|
||||
get { return fileNameAdded; }
|
||||
}
|
||||
|
||||
public List<DateTime> AddedDates
|
||||
{
|
||||
get { return dateAdded; }
|
||||
}
|
||||
|
||||
public FakeArchiveWriter()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
DisposeStreamList();
|
||||
streamAdded = new List<Stream>();
|
||||
fileNameAdded = new List<string>();
|
||||
dateAdded = new List<DateTime>();
|
||||
}
|
||||
|
||||
private void DisposeStreamList()
|
||||
{
|
||||
if (streamAdded != null)
|
||||
{
|
||||
foreach (Stream stream in streamAdded)
|
||||
{
|
||||
if( stream != null )
|
||||
stream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void Add(Stream filetoAdd, string fileName, DateTime modificationTime)
|
||||
{
|
||||
disposed = false;
|
||||
streamAdded.Add(filetoAdd);
|
||||
fileNameAdded.Add(fileName);
|
||||
dateAdded.Add(modificationTime);
|
||||
}
|
||||
|
||||
public override void AddDirectory(string directoryName, DateTime modificationTime)
|
||||
{
|
||||
fileNameAdded.Add(directoryName);
|
||||
dateAdded.Add(modificationTime);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if(disposing)
|
||||
{
|
||||
if( !disposed )
|
||||
{
|
||||
DisposeStreamList();
|
||||
}
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FakeArchiveWriter fakeWriter;
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void FixtureSetup()
|
||||
{
|
||||
fakeWriter = new FakeArchiveWriter();
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void FixtureTearDown()
|
||||
{
|
||||
fakeWriter.Dispose();
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void TestSetup()
|
||||
{
|
||||
fakeWriter.Reset();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DatelessAddCallsImplementation()
|
||||
{
|
||||
const string fileName = "test.file";
|
||||
using (MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes("This is a test")))
|
||||
{
|
||||
fakeWriter.Add(ms, fileName);
|
||||
Assert.AreEqual(1, fakeWriter.AddedFileNameData.Count);
|
||||
Assert.AreEqual(1, fakeWriter.AddedStreamData.Count);
|
||||
Assert.AreEqual(1, fakeWriter.AddedDates.Count);
|
||||
Assert.AreEqual(fileName, fakeWriter.AddedFileNameData[0], "File name");
|
||||
Assert.IsTrue(fakeWriter.AddedStreamData[0].Length == 14, "Stream has data");
|
||||
AssertCurrentDateIsPlausible(fakeWriter.AddedDates[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private void AssertCurrentDateIsPlausible(DateTime currentDate)
|
||||
{
|
||||
//If this is failing check that the number of seconds is enough
|
||||
const double seconds = 5.0;
|
||||
DateTime maxDate = DateTime.Now.AddSeconds(seconds);
|
||||
DateTime minDate = DateTime.Now.AddSeconds(-1.0 * seconds);
|
||||
Assert.IsTrue(currentDate > minDate, "Date is > minimum");
|
||||
Assert.IsTrue(currentDate < maxDate, "Date is < maximum");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DatelessAddDirectoryCallsImplementation()
|
||||
{
|
||||
const string dirName = "test.file";
|
||||
const int totalAdded = 3;
|
||||
for (int i = 0; i < totalAdded; i++)
|
||||
{
|
||||
fakeWriter.AddDirectory(dirName);
|
||||
}
|
||||
|
||||
Assert.AreEqual(totalAdded, fakeWriter.AddedFileNameData.Count);
|
||||
Assert.AreEqual(0, fakeWriter.AddedStreamData.Count);
|
||||
Assert.AreEqual(totalAdded, fakeWriter.AddedDates.Count);
|
||||
Assert.AreEqual(dirName, fakeWriter.AddedFileNameData[0], "File name");
|
||||
AssertCurrentDateIsPlausible(fakeWriter.AddedDates[0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateArchiveThrowsWithBadPath()
|
||||
{
|
||||
Assert.That(()=> fakeWriter.CreateArchive("Yellow brick road - not a path!"), Throws.Exception.With.TypeOf(typeof(FileNotFoundException)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateArchiveWorksWithValidDirectoryStructure()
|
||||
{
|
||||
string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
||||
Directory.CreateDirectory(tempPath);
|
||||
CreateFiles(tempPath, 2);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
string subfolder = Path.Combine(tempPath, Path.GetRandomFileName());
|
||||
Directory.CreateDirectory(subfolder);
|
||||
CreateFiles( subfolder, i);
|
||||
}
|
||||
|
||||
fakeWriter.CreateArchive(tempPath);
|
||||
|
||||
Assert.AreEqual(12, fakeWriter.AddedDates.Count );
|
||||
Assert.AreEqual(12, fakeWriter.AddedFileNameData.Count);
|
||||
Assert.AreEqual(8, fakeWriter.AddedStreamData.Count);
|
||||
|
||||
foreach( DateTime date in fakeWriter.AddedDates )
|
||||
AssertCurrentDateIsPlausible(date);
|
||||
|
||||
foreach (string name in fakeWriter.AddedFileNameData)
|
||||
Assert.AreEqual(-1, name.IndexOfAny(@":\".ToArray()), "Unwanted chars found in path");
|
||||
|
||||
Directory.Delete(tempPath, true);
|
||||
}
|
||||
|
||||
private void CreateFiles(string tempPath, int numberOfFiles)
|
||||
{
|
||||
for (int i = 0; i < numberOfFiles; i++)
|
||||
{
|
||||
using( FileStream fs = File.OpenWrite(Path.Combine(tempPath, Path.GetRandomFileName())))
|
||||
{
|
||||
fs.Write(Encoding.ASCII.GetBytes("This is a test"), 0, 14);
|
||||
fs.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,180 +0,0 @@
|
||||
/* Copyright (c) Citrix Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using XenCenterLib.Archive;
|
||||
|
||||
namespace XenAdminTests.ArchiveTests
|
||||
{
|
||||
[TestFixture, Category(TestCategories.UICategoryA), Category(TestCategories.SmokeTest)]
|
||||
public class TarArchiveWriterTests : ThirdPartyArchiveWriterTest
|
||||
{
|
||||
[OneTimeSetUp]
|
||||
public void TestFixtureSetUp()
|
||||
{
|
||||
Writer = new SharpZipTarArchiveWriter();
|
||||
Reader = new SharpZipTarArchiveIterator();
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture, Category(TestCategories.UICategoryA), Category(TestCategories.SmokeTest)]
|
||||
public class ZipArchiveWriterTests : ThirdPartyArchiveWriterTest
|
||||
{
|
||||
[OneTimeSetUp]
|
||||
public void TestFixtureSetUp()
|
||||
{
|
||||
Writer = new DotNetZipZipWriter();
|
||||
Reader = null;
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public void TestFixtureTearDown()
|
||||
{
|
||||
Writer.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class ThirdPartyArchiveWriterTest
|
||||
{
|
||||
private ArchiveWriter writer;
|
||||
private ArchiveIterator reader;
|
||||
|
||||
protected ArchiveWriter Writer
|
||||
{
|
||||
set { writer = value; }
|
||||
get { return writer; }
|
||||
}
|
||||
|
||||
protected ArchiveIterator Reader
|
||||
{
|
||||
set { reader = value; }
|
||||
get { return reader; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateAnArchiveAndRereadWhenPossible()
|
||||
{
|
||||
string tempPath = CreateTempFolder();
|
||||
|
||||
string tarFileName = Path.Combine( tempPath, Path.GetRandomFileName() );
|
||||
|
||||
WriteAnArchive(tarFileName);
|
||||
|
||||
if( reader != null )
|
||||
RereadAnArchiveAndTest(tarFileName);
|
||||
else
|
||||
Trace.WriteLine(String.Format("A reader for the writer class {0} was not found so the contents are unvalidated by this test", writer.GetType()));
|
||||
|
||||
Directory.Delete(tempPath, true);
|
||||
}
|
||||
|
||||
// This test knows the contents of the file written in the archive
|
||||
private void RereadAnArchiveAndTest(string archiveName)
|
||||
{
|
||||
List<string> expectedDirs = new List<string>()
|
||||
{
|
||||
"adir/",
|
||||
"adir2/a/"
|
||||
};
|
||||
|
||||
List<string> expectedFiles = new List<string>()
|
||||
{
|
||||
"tf1",
|
||||
"adir2/a/tf2"
|
||||
};
|
||||
|
||||
using (FileStream fs = File.OpenRead(archiveName))
|
||||
{
|
||||
reader.SetBaseStream(fs);
|
||||
while (reader.HasNext())
|
||||
{
|
||||
if (reader.IsDirectory() && expectedDirs.Contains(reader.CurrentFileName()))
|
||||
expectedDirs.Remove(reader.CurrentFileName());
|
||||
|
||||
if (!reader.IsDirectory() && expectedFiles.Contains(reader.CurrentFileName()))
|
||||
{
|
||||
expectedFiles.Remove(reader.CurrentFileName());
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
reader.ExtractCurrentFile(ms);
|
||||
Assert.IsTrue( ms.Length > 0, "Extracted file contents have data");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Assert.AreEqual(0, expectedFiles.Count, "Expected files count");
|
||||
Assert.AreEqual(0, expectedDirs.Count, "Expected dir count");
|
||||
|
||||
}
|
||||
|
||||
Reader.Dispose();
|
||||
}
|
||||
|
||||
private string CreateTempFolder()
|
||||
{
|
||||
string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
||||
Directory.CreateDirectory(tempPath);
|
||||
return tempPath;
|
||||
}
|
||||
|
||||
private void WriteAnArchive(string tarFileName)
|
||||
{
|
||||
using (FileStream ms = File.OpenWrite(tarFileName))
|
||||
{
|
||||
Assert.AreEqual(0, ms.Length);
|
||||
writer.SetBaseStream(ms);
|
||||
|
||||
using (MemoryStream ms1 = new MemoryStream(Encoding.ASCII.GetBytes("This is a test")))
|
||||
{
|
||||
writer.Add(ms1, "tf1");
|
||||
}
|
||||
|
||||
using (MemoryStream ms2 = new MemoryStream(Encoding.ASCII.GetBytes("This is a test")))
|
||||
{
|
||||
writer.Add(ms2, "adir2/a/tf2", DateTime.Now);
|
||||
}
|
||||
|
||||
writer.AddDirectory("adir/");
|
||||
writer.AddDirectory("adir2/a", DateTime.Now);
|
||||
writer.Dispose();
|
||||
}
|
||||
|
||||
Assert.IsTrue(File.Exists(tarFileName), "archive exists");
|
||||
Assert.IsTrue(File.ReadAllBytes(tarFileName).Length > 0, "archive has contents");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using XenCenterLib.Compression;
|
||||
|
||||
namespace XenAdminTests.CompressionTests
|
||||
{
|
||||
[TestFixture, Category(TestCategories.Unit)]
|
||||
public class CompressionFactoryTests
|
||||
{
|
||||
[TestCase(CompressionFactory.Type.Gz, ExpectedResult = typeof(GZipOutputStream))]
|
||||
[Test]
|
||||
public Type TestWriterGeneration(int archiveType)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
using (var providedStream = CompressionFactory.Writer((CompressionFactory.Type)archiveType, ms))
|
||||
return providedStream.GetType();
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(CompressionFactory.Type.Gz, ExpectedResult = typeof(GZipInputStream))]
|
||||
[Test]
|
||||
public Type TestReaderGenerationWithFile(int archiveType)
|
||||
{
|
||||
string target = TestUtils.GetTestResource("emptyfile.gz");
|
||||
|
||||
using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(target)))
|
||||
{
|
||||
using (var providedStream = CompressionFactory.Reader((CompressionFactory.Type)archiveType, ms))
|
||||
return providedStream.GetType();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using XenCenterLib.Compression;
|
||||
|
||||
namespace XenAdminTests.CompressionTests
|
||||
{
|
||||
[Category(TestCategories.Unit)]
|
||||
[TestFixture(typeof(GZipInputStream), typeof(GZipOutputStream))]
|
||||
public class ThirdPartyCompressionTests<TI, TO>
|
||||
where TI : CompressionStream, new()
|
||||
where TO : CompressionStream, new()
|
||||
{
|
||||
private TO compressor;
|
||||
private TI decompressor;
|
||||
|
||||
private const string loremIpsum =
|
||||
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod " +
|
||||
"tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, " +
|
||||
"quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo " +
|
||||
"consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse " +
|
||||
"cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat " +
|
||||
"non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
|
||||
|
||||
[SetUp]
|
||||
public void TestSetup()
|
||||
{
|
||||
compressor = new TO();
|
||||
decompressor = new TI();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFileCompressionAndDecompression()
|
||||
{
|
||||
string basePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
||||
Directory.CreateDirectory(basePath);
|
||||
|
||||
//Write a file to compress
|
||||
string uncompressedFileName = Path.Combine(basePath, Path.GetRandomFileName());
|
||||
string compressedFileName = Path.Combine(basePath, Path.GetRandomFileName());
|
||||
string decompressedFileName = Path.Combine(basePath, Path.GetRandomFileName());
|
||||
|
||||
CreateADummyFile(uncompressedFileName);
|
||||
CompressAFile(compressedFileName, uncompressedFileName);
|
||||
DecompressAFile(decompressedFileName, compressedFileName);
|
||||
|
||||
int uncompressedFileLength = File.ReadAllBytes(uncompressedFileName).Length;
|
||||
int compressedFileLength = File.ReadAllBytes(compressedFileName).Length;
|
||||
int decompressedFileLength = File.ReadAllBytes(decompressedFileName).Length;
|
||||
|
||||
Assert.IsTrue(uncompressedFileLength > 0);
|
||||
Assert.IsTrue(decompressedFileLength > 0);
|
||||
Assert.IsTrue(compressedFileLength > 0);
|
||||
|
||||
Assert.AreNotEqual(uncompressedFileLength, compressedFileLength);
|
||||
Assert.AreNotEqual(decompressedFileLength, compressedFileLength);
|
||||
Assert.AreEqual(decompressedFileLength, uncompressedFileLength);
|
||||
|
||||
Assert.IsTrue(File.ReadAllBytes(uncompressedFileName).SequenceEqual(File.ReadAllBytes(decompressedFileName)));
|
||||
|
||||
Directory.Delete(basePath, true);
|
||||
}
|
||||
|
||||
private void DecompressAFile(string targetFileName, string compressedFileName)
|
||||
{
|
||||
using (FileStream ifs = File.OpenRead(compressedFileName))
|
||||
{
|
||||
decompressor.SetBaseStream(ifs);
|
||||
using (FileStream fs = File.OpenWrite(targetFileName))
|
||||
{
|
||||
decompressor.BufferedRead(fs);
|
||||
}
|
||||
|
||||
decompressor.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void CompressAFile(string targetFileName, string uncompressedFileName)
|
||||
{
|
||||
using (FileStream ifs = File.OpenWrite(targetFileName))
|
||||
{
|
||||
compressor.SetBaseStream(ifs);
|
||||
|
||||
using (FileStream fs = File.OpenRead(uncompressedFileName))
|
||||
{
|
||||
compressor.BufferedWrite(fs);
|
||||
}
|
||||
|
||||
compressor.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateADummyFile(string uncompressedFileName)
|
||||
{
|
||||
using (FileStream ims = File.OpenWrite(uncompressedFileName))
|
||||
{
|
||||
ims.Write(Encoding.ASCII.GetBytes(loremIpsum), 0, loremIpsum.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using NUnit.Framework;
|
||||
using XenAdmin.Core;
|
||||
|
||||
namespace XenAdminTests.UnitTests
|
||||
{
|
||||
[TestFixture, Category(TestCategories.Unit)]
|
||||
public class CPUMaskingTest
|
||||
{
|
||||
const string cpu1 = "040ce33d-bfebfbff-00000001-20100800";
|
||||
const string cpu2 = "000ce3bd-bfebfbff-00000001-20100800";
|
||||
const string cpu3 = "040ce33d-bfebfbff-00000001-20100801";
|
||||
const string mask = "ffffff7f-ffffffff-ffffffff-ffffffff";
|
||||
|
||||
[Test]
|
||||
// Can always mask a CPU to itself
|
||||
[TestCase("base", cpu1, cpu1, null, ExpectedResult = true)]
|
||||
[TestCase("base", cpu1, cpu1, mask, ExpectedResult = true)]
|
||||
[TestCase("base", cpu2, cpu2, null, ExpectedResult = true)]
|
||||
[TestCase("base", cpu2, cpu2, mask, ExpectedResult = true)]
|
||||
[TestCase("base", cpu3, cpu3, null, ExpectedResult = true)]
|
||||
[TestCase("base", cpu3, cpu3, mask, ExpectedResult = true)]
|
||||
[TestCase("full", cpu1, cpu1, null, ExpectedResult = true)]
|
||||
[TestCase("full", cpu1, cpu1, mask, ExpectedResult = true)]
|
||||
[TestCase("full", cpu2, cpu2, null, ExpectedResult = true)]
|
||||
[TestCase("full", cpu2, cpu2, mask, ExpectedResult = true)]
|
||||
[TestCase("full", cpu3, cpu3, null, ExpectedResult = true)]
|
||||
[TestCase("full", cpu3, cpu3, mask, ExpectedResult = true)]
|
||||
|
||||
// Masking CPUs to other CPUs: base masking only
|
||||
[TestCase("base", cpu1, cpu2, null, ExpectedResult = false)] // cpu1 can only become cpu2 in the presence of the mask
|
||||
[TestCase("base", cpu1, cpu2, mask, ExpectedResult = true)]
|
||||
[TestCase("base", cpu1, cpu3, null, ExpectedResult = false)] // cpu1 is less than cpu3
|
||||
[TestCase("base", cpu1, cpu3, mask, ExpectedResult = false)]
|
||||
[TestCase("base", cpu2, cpu1, null, ExpectedResult = false)] // cpu2 is less than cpu1 and cpu3
|
||||
[TestCase("base", cpu2, cpu1, mask, ExpectedResult = false)]
|
||||
[TestCase("base", cpu2, cpu3, null, ExpectedResult = false)]
|
||||
[TestCase("base", cpu2, cpu3, mask, ExpectedResult = false)]
|
||||
[TestCase("base", cpu3, cpu1, null, ExpectedResult = false)] // cpu3 is greater than cpu1 and cpu2 in the extended bits, so can't be masked with only base masking
|
||||
[TestCase("base", cpu3, cpu1, mask, ExpectedResult = false)]
|
||||
[TestCase("base", cpu3, cpu2, null, ExpectedResult = false)]
|
||||
[TestCase("base", cpu3, cpu2, mask, ExpectedResult = false)]
|
||||
|
||||
// Masking CPUs to other CPUs: full masking
|
||||
[TestCase("full", cpu1, cpu2, null, ExpectedResult = false)] // cpu1 can only become cpu2 in the presence of the mask
|
||||
[TestCase("full", cpu1, cpu2, mask, ExpectedResult = true)]
|
||||
[TestCase("full", cpu1, cpu3, null, ExpectedResult = false)] // cpu1 is less than cpu3
|
||||
[TestCase("full", cpu1, cpu3, mask, ExpectedResult = false)]
|
||||
[TestCase("full", cpu2, cpu1, null, ExpectedResult = false)] // cpu2 is less than cpu1 and cpu3
|
||||
[TestCase("full", cpu2, cpu1, mask, ExpectedResult = false)]
|
||||
[TestCase("full", cpu2, cpu3, null, ExpectedResult = false)]
|
||||
[TestCase("full", cpu2, cpu3, mask, ExpectedResult = false)]
|
||||
[TestCase("full", cpu3, cpu1, null, ExpectedResult = true)] // cpu3 is greater than cpu1
|
||||
[TestCase("full", cpu3, cpu1, mask, ExpectedResult = true)]
|
||||
[TestCase("full", cpu3, cpu2, null, ExpectedResult = false)] // cpu3 can only become cpu2 in the presence of the mask
|
||||
[TestCase("full", cpu3, cpu2, mask, ExpectedResult = true)]
|
||||
|
||||
// Masking always fails with mask_type "no", even masking a CPU to itself.
|
||||
// (In the real program, masking a CPU to itself never gets to the "is it maskable?" code).
|
||||
[TestCase("no", cpu1, cpu1, null, ExpectedResult = false)]
|
||||
[TestCase("no", cpu1, cpu1, mask, ExpectedResult = false)]
|
||||
[TestCase("no", cpu2, cpu2, null, ExpectedResult = false)]
|
||||
[TestCase("no", cpu2, cpu2, mask, ExpectedResult = false)]
|
||||
[TestCase("no", cpu3, cpu3, null, ExpectedResult = false)]
|
||||
[TestCase("no", cpu3, cpu3, mask, ExpectedResult = false)]
|
||||
[TestCase("no", cpu1, cpu2, null, ExpectedResult = false)]
|
||||
[TestCase("no", cpu1, cpu2, mask, ExpectedResult = false)]
|
||||
[TestCase("no", cpu1, cpu3, null, ExpectedResult = false)]
|
||||
[TestCase("no", cpu1, cpu3, mask, ExpectedResult = false)]
|
||||
[TestCase("no", cpu2, cpu1, null, ExpectedResult = false)]
|
||||
[TestCase("no", cpu2, cpu1, mask, ExpectedResult = false)]
|
||||
[TestCase("no", cpu2, cpu3, null, ExpectedResult = false)]
|
||||
[TestCase("no", cpu2, cpu3, mask, ExpectedResult = false)]
|
||||
[TestCase("no", cpu3, cpu1, null, ExpectedResult = false)]
|
||||
[TestCase("no", cpu3, cpu1, mask, ExpectedResult = false)]
|
||||
[TestCase("no", cpu3, cpu2, null, ExpectedResult = false)]
|
||||
[TestCase("no", cpu3, cpu2, mask, ExpectedResult = false)]
|
||||
public bool Run(string maskType, string supporterCpu, string coordinatorCpu, string maskBits)
|
||||
{
|
||||
return PoolJoinRules.MaskableTo(maskType, supporterCpu, coordinatorCpu, maskBits);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using XenAdmin;
|
||||
|
||||
namespace XenAdminTests.UnitTests
|
||||
{
|
||||
[TestFixture, Category(TestCategories.Unit)]
|
||||
class TimeUtilTests
|
||||
{
|
||||
[Test]
|
||||
public void TicksBefore1970Check()
|
||||
{
|
||||
Assert.AreEqual(621355968000000000, Util.TicksBefore1970);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TicksToSecondsSince1970Conversion()
|
||||
{
|
||||
Assert.AreEqual((-1 * Util.TicksBefore1970 / TimeSpan.TicksPerSecond), Util.TicksToSecondsSince1970(0));
|
||||
Assert.AreEqual(0, Util.TicksToSecondsSince1970(Util.TicksBefore1970));
|
||||
Assert.AreEqual(1324771200, Util.TicksToSecondsSince1970(new DateTime(2011, 12, 25).Ticks));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ISODateTimeParse()
|
||||
{
|
||||
Assert.True(Util.TryParseIso8601DateTime("20111225T10:20:37Z", out var derived));
|
||||
Assert.AreEqual(new DateTime(2011, 12, 25, 10, 20, 37), derived);
|
||||
Assert.AreEqual(DateTimeKind.Utc, derived.Kind);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ISODateTimeParseWithBadFormat()
|
||||
{
|
||||
Assert.False(Util.TryParseIso8601DateTime("20111225T1020:37Z", out _));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ISODateTimeParseWithNullArg()
|
||||
{
|
||||
Assert.False(Util.TryParseIso8601DateTime(null, out _));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToISODateTime()
|
||||
{
|
||||
string derived = Util.ToISO8601DateTime(new DateTime(2011, 12, 25, 10, 20, 37, DateTimeKind.Utc));
|
||||
Assert.AreEqual("20111225T10:20:37Z", derived);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ISODateTimeRoundTrip()
|
||||
{
|
||||
const string dateToParse = "20111225T10:20:37Z";
|
||||
|
||||
string derived = Util.TryParseIso8601DateTime(dateToParse, out var result)
|
||||
? Util.ToISO8601DateTime(result)
|
||||
: string.Empty;
|
||||
Assert.AreEqual(dateToParse, derived);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,216 +0,0 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using XenAdmin.Wlb;
|
||||
|
||||
|
||||
namespace XenAdminTests.UnitTests.WlbTests
|
||||
{
|
||||
[TestFixture, Category(TestCategories.Unit)]
|
||||
public class WlbPoolConfigurationTests
|
||||
{
|
||||
private WlbPoolConfiguration wlbPool;
|
||||
private const int NUMBER_OF_PROPERTIES = 32;
|
||||
|
||||
[Test]
|
||||
public void NullCtorThrows()
|
||||
{
|
||||
Assert.Throws(typeof(Exception), () => new WlbPoolConfiguration(null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConstructedWithEmptyDictionaryVerifyGettersReturnValues()
|
||||
{
|
||||
wlbPool = new WlbPoolConfiguration(new Dictionary<string, string>());
|
||||
PropertyInfo[] pi = wlbPool.GetType().GetProperties();
|
||||
|
||||
Assert.AreEqual(NUMBER_OF_PROPERTIES, pi.Length, "Number of properties");
|
||||
|
||||
List<string> fieldsToSkip = new List<string>
|
||||
{
|
||||
"AutoBalanceAggressiveness", //Enum
|
||||
"AutoBalanceSeverity", //Enum
|
||||
"ReportingSMTPServer", //Not set
|
||||
"PoolAuditGranularity" //Enum
|
||||
};
|
||||
|
||||
foreach (PropertyInfo propertyInfo in pi)
|
||||
{
|
||||
if( !fieldsToSkip.Contains( propertyInfo.Name ))
|
||||
{
|
||||
string extractedValue = propertyInfo.GetValue(wlbPool, null).ToString();
|
||||
Assert.That(extractedValue, Is.Not.Null.And.Not.Empty, $"PB: {propertyInfo.Name}");
|
||||
}
|
||||
}
|
||||
|
||||
Assert.That(wlbPool.ReportingSMTPServer, Is.Null.Or.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SettersTest()
|
||||
{
|
||||
var inputData = new Dictionary<string, string>
|
||||
{
|
||||
{"WlbVersion", "6.0"},
|
||||
{"AutoBalanceEnabled", "false"},
|
||||
{"AutoBalancePollIntervals", "0.333333"},
|
||||
{"AutoBalanceSeverity", "High"},
|
||||
{"AutoBalanceAggressiveness", "High"},
|
||||
{"PowerManagementEnabled", "false"},
|
||||
{"PowerManagementPollIntervals", "5.321264"},
|
||||
{"EnableOptimizationModeSchedules", "false"} //Equal to AutomateOptimizationMode
|
||||
};
|
||||
|
||||
var expectedData = new MRSensitiveData
|
||||
{
|
||||
AutoBalanceEnabled = true,
|
||||
AutoBalancePollIntervals = 2.0,
|
||||
AutoBalanceSeverity = WlbPoolAutoBalanceSeverity.Low,
|
||||
AutoBalanceAggressiveness = WlbPoolAutoBalanceAggressiveness.Medium,
|
||||
PowerManagementEnabled = true,
|
||||
PowerManagementPollIntervals = 7.0,
|
||||
AutomateOptimizationMode = true
|
||||
};
|
||||
|
||||
ClassVerifiers.VerifySettersAndGetters(new WlbPoolConfiguration(inputData), expectedData);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SettersThatSetVerbatim()
|
||||
{
|
||||
var inputData = new Dictionary<string, string>
|
||||
{
|
||||
//Simple setters.....
|
||||
{"OptimizationMode", "MaximizeDensity"}, //PerformanceMode
|
||||
{"RecentMoveMinutes", "2.0"},
|
||||
//{"ReportingUseRSServer", "false"},
|
||||
{"ReportingSMTPServer", "some string"},
|
||||
//These set ranges of values.....
|
||||
{"HostCpuThresholdCritical", "3"},
|
||||
{"HostMemoryThresholdCritical", "3.0"},
|
||||
{"HostPifReadThresholdCritical", "4.0"}, //HostNetworkReadThresholdCritical
|
||||
{"HostPifWriteThresholdCritical", "5.0"}, //HostNetworkWriteThresholdCritical
|
||||
{"HostPbdReadThresholdCritical", "6.0"}, //HostDiskReadThresholdCritical
|
||||
{"HostPbdWriteThresholdCritical", "7.0"}, //HostDiskWriteThresholdCritical
|
||||
{"VmCpuUtilizationWeightHigh", "8"},
|
||||
{"VmMemoryWeightHigh", "9"},
|
||||
{"VmDiskReadWeightHigh", "10"},
|
||||
{"VmDiskWriteWeightHigh", "11"},
|
||||
{"VmNetworkReadWeightHigh", "12"},
|
||||
{"VmNetworkWriteWeightHigh", "13"}
|
||||
};
|
||||
|
||||
var data = new MRInSensitiveData
|
||||
{
|
||||
PerformanceMode = WlbPoolPerformanceMode.MaximizePerformance,
|
||||
RecentMoveMinutes = 6.0,
|
||||
//ReportingUseRSServer = true,
|
||||
ReportingSMTPServer = "who knows what?!",
|
||||
HostCpuThresholdCritical = 1,
|
||||
HostMemoryThresholdCritical = 2,
|
||||
HostNetworkReadThresholdCritical = 1.0,
|
||||
HostNetworkWriteThresholdCritical = 2.0,
|
||||
HostDiskReadThresholdCritical = 3.0,
|
||||
HostDiskWriteThresholdCritical = 4.0,
|
||||
VmCpuUtilizationWeightHigh = 5,
|
||||
VmMemoryWeightHigh = 6,
|
||||
VmDiskReadWeightHigh = 7,
|
||||
VmDiskWriteWeightHigh = 8,
|
||||
VmNetworkReadWeightHigh = 9,
|
||||
VmNetworkWriteWeightHigh = 10
|
||||
};
|
||||
|
||||
ClassVerifiers.VerifySettersAndGetters(new WlbPoolConfiguration(inputData), data);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OvercommitCPUsGetTheCorrectValueForDifferentModes()
|
||||
{
|
||||
var inputData = new Dictionary<string, string>
|
||||
{
|
||||
{"OverCommitCpuInDensityMode", "false"},
|
||||
{"OverCommitCpuInPerfMode", "true"}
|
||||
};
|
||||
|
||||
wlbPool = new WlbPoolConfiguration(inputData);
|
||||
|
||||
//Setter drops through if the key has not been added to the dictionary so won't set the values
|
||||
wlbPool.PerformanceMode = WlbPoolPerformanceMode.MaximizeDensity;
|
||||
//This should be false if the key were there
|
||||
Assert.IsTrue(wlbPool.OvercommitCPUs, "OvercommitCPUs in MaximizeDensity mode without key");
|
||||
|
||||
//Add the key and set the data - this is now the default behaviour
|
||||
wlbPool.AddParameter("OptimizationMode", "MaximizeDensity");
|
||||
wlbPool.PerformanceMode = WlbPoolPerformanceMode.MaximizeDensity;
|
||||
Assert.IsFalse(wlbPool.OvercommitCPUs, "OvercommitCPUs in MaximizeDensity mode");
|
||||
|
||||
wlbPool.PerformanceMode = WlbPoolPerformanceMode.MaximizePerformance;
|
||||
Assert.IsTrue(wlbPool.OvercommitCPUs, "OvercommitCPUs in MaximizePerformance");
|
||||
}
|
||||
|
||||
#region Helper structs
|
||||
|
||||
private struct MRSensitiveData
|
||||
{
|
||||
public bool AutoBalanceEnabled;
|
||||
public double AutoBalancePollIntervals;
|
||||
public WlbPoolAutoBalanceSeverity AutoBalanceSeverity;
|
||||
public WlbPoolAutoBalanceAggressiveness AutoBalanceAggressiveness;
|
||||
public bool PowerManagementEnabled;
|
||||
public double PowerManagementPollIntervals;
|
||||
public bool AutomateOptimizationMode;
|
||||
}
|
||||
|
||||
private struct MRInSensitiveData
|
||||
{
|
||||
public WlbPoolPerformanceMode PerformanceMode;
|
||||
public double RecentMoveMinutes;
|
||||
public string ReportingSMTPServer;
|
||||
public int HostCpuThresholdCritical;
|
||||
public double HostMemoryThresholdCritical;
|
||||
public double HostNetworkReadThresholdCritical;
|
||||
public double HostNetworkWriteThresholdCritical;
|
||||
public double HostDiskReadThresholdCritical;
|
||||
public double HostDiskWriteThresholdCritical;
|
||||
public int VmCpuUtilizationWeightHigh;
|
||||
public int VmMemoryWeightHigh;
|
||||
public int VmDiskReadWeightHigh;
|
||||
public int VmDiskWriteWeightHigh;
|
||||
public int VmNetworkReadWeightHigh;
|
||||
public int VmNetworkWriteWeightHigh;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,233 +0,0 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using XenAdmin.Controls.Wlb;
|
||||
using XenAdmin.Wlb;
|
||||
|
||||
|
||||
namespace XenAdminTests.UnitTests.WlbTests
|
||||
{
|
||||
[TestFixture, Category(TestCategories.Unit)]
|
||||
public class WlbScheduledTaskTests
|
||||
{
|
||||
#region Private Class Data
|
||||
private const int NUMBER_OF_PROPERTIES = 18;
|
||||
private WlbScheduledTask task;
|
||||
|
||||
private ScheduledTaskData exampleData = new ScheduledTaskData()
|
||||
{
|
||||
DeleteTask = true,
|
||||
Name = "John Doe",
|
||||
Description = "Friendly",
|
||||
Enabled = true,
|
||||
Owner = "You",
|
||||
LastRunResult = true,
|
||||
LastTouchedBy = "Me",
|
||||
LastTouched = new DateTime(2011, 12, 25),
|
||||
TriggerInterval = WlbScheduledTask.WlbTaskTriggerType.Daily,
|
||||
DaysOfWeek = WlbScheduledTask.WlbTaskDaysOfWeek.Weekdays,
|
||||
RunTime = new DateTime(2011, 12, 26),
|
||||
LastRunDate = new DateTime(2011, 12, 27),
|
||||
EnableDate = new DateTime(2011, 12, 28),
|
||||
DisableTime = new DateTime(2011, 12, 29),
|
||||
ActionType =
|
||||
WlbScheduledTask.WlbTaskActionType.SetOptimizationMode,
|
||||
TaskParameters =
|
||||
new Dictionary<string, string>() {{"key", "value"}}
|
||||
};
|
||||
#endregion
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
task = new WlbScheduledTask("73");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void VerifyGettersAndSetters()
|
||||
{
|
||||
ClassVerifiers.VerifySettersAndGetters(task, exampleData);
|
||||
ClassVerifiers.VerifyPropertyCounter(task, NUMBER_OF_PROPERTIES);
|
||||
Assert.AreEqual(73, task.TaskId, "Task ID as set in ctor");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NonNumericItemIDInCtor()
|
||||
{
|
||||
WlbScheduledTask task = new WlbScheduledTask("not a number");
|
||||
Assert.AreEqual(0, task.TaskId, "Non-numeric task ID");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CheckClone()
|
||||
{
|
||||
WlbScheduledTask clone = task.Clone();
|
||||
Assert.AreNotEqual(task, clone);
|
||||
|
||||
//Check contents are all equal to the expected
|
||||
ClassVerifiers.VerifyPropertyCounter(task, NUMBER_OF_PROPERTIES);
|
||||
ClassVerifiers.VerifyPropertyCounter(clone, NUMBER_OF_PROPERTIES);
|
||||
|
||||
ClassVerifiers.VerifySettersAndGetters(task, exampleData);
|
||||
ClassVerifiers.VerifySettersAndGetters(clone, exampleData);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExceptionRaisedIfOptModeNotSetButRequested()
|
||||
{
|
||||
Assert.Throws(typeof(KeyNotFoundException), () => WlbScheduledTask.GetTaskOptMode(task));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void VerifyGetTaskOptModeOperationMaximizePerformance()
|
||||
{
|
||||
task.AddTaskParameter("OptMode", "0");
|
||||
Assert.AreEqual(WlbPoolPerformanceMode.MaximizePerformance, WlbScheduledTask.GetTaskOptMode(task));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void VerifyGetTaskOptModeOperationMaximizeDensity()
|
||||
{
|
||||
task.AddTaskParameter("OptMode", "1");
|
||||
Assert.AreEqual(WlbPoolPerformanceMode.MaximizeDensity, WlbScheduledTask.GetTaskOptMode(task));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddingTaskParameters()
|
||||
{
|
||||
int initialTaskCount = task.TaskParameters.Count;
|
||||
task.AddTaskParameter("OptMode", "1");
|
||||
Assert.AreEqual( initialTaskCount + 1, task.TaskParameters.Count, "Adding task parameters" );
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TaskRunningTime()
|
||||
{
|
||||
const string expectedTime = "11:34 AM";
|
||||
string runTime = WlbOptModeScheduler.GetTaskRunTime(new DateTime(2011, 11, 20, 11, 34, 01));
|
||||
Assert.AreEqual(expectedTime, runTime);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NextAndPreviousDayOfTheWeek()
|
||||
{
|
||||
//Single days
|
||||
Dictionary<WlbScheduledTask.WlbTaskDaysOfWeek, WlbScheduledTask.WlbTaskDaysOfWeek> dotw =
|
||||
new Dictionary<WlbScheduledTask.WlbTaskDaysOfWeek, WlbScheduledTask.WlbTaskDaysOfWeek>()
|
||||
{
|
||||
{ WlbScheduledTask.WlbTaskDaysOfWeek.Saturday, WlbScheduledTask.WlbTaskDaysOfWeek.Sunday},
|
||||
{ WlbScheduledTask.WlbTaskDaysOfWeek.Sunday, WlbScheduledTask.WlbTaskDaysOfWeek.Monday},
|
||||
{ WlbScheduledTask.WlbTaskDaysOfWeek.Monday, WlbScheduledTask.WlbTaskDaysOfWeek.Tuesday},
|
||||
{ WlbScheduledTask.WlbTaskDaysOfWeek.Tuesday, WlbScheduledTask.WlbTaskDaysOfWeek.Wednesday},
|
||||
{ WlbScheduledTask.WlbTaskDaysOfWeek.Wednesday, WlbScheduledTask.WlbTaskDaysOfWeek.Thursday},
|
||||
{ WlbScheduledTask.WlbTaskDaysOfWeek.Thursday, WlbScheduledTask.WlbTaskDaysOfWeek.Friday},
|
||||
{ WlbScheduledTask.WlbTaskDaysOfWeek.Friday, WlbScheduledTask.WlbTaskDaysOfWeek.Saturday}
|
||||
};
|
||||
foreach (var day in dotw)
|
||||
{
|
||||
Assert.AreEqual(day.Value, WlbScheduledTask.NextDay(day.Key), "next day of the week");
|
||||
Assert.AreEqual(day.Key, WlbScheduledTask.PreviousDay(day.Value), "previous day of the week");
|
||||
}
|
||||
|
||||
//Weekends
|
||||
const WlbScheduledTask.WlbTaskDaysOfWeek beforeWeekend = (WlbScheduledTask.WlbTaskDaysOfWeek.Friday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Saturday);
|
||||
const WlbScheduledTask.WlbTaskDaysOfWeek afterWeekend = (WlbScheduledTask.WlbTaskDaysOfWeek.Sunday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Monday);
|
||||
Assert.AreEqual(afterWeekend, WlbScheduledTask.NextDay(WlbScheduledTask.WlbTaskDaysOfWeek.Weekends));
|
||||
Assert.AreEqual(beforeWeekend, WlbScheduledTask.PreviousDay(WlbScheduledTask.WlbTaskDaysOfWeek.Weekends));
|
||||
|
||||
//Weekdays
|
||||
const WlbScheduledTask.WlbTaskDaysOfWeek beforeWeek = (WlbScheduledTask.WlbTaskDaysOfWeek.Sunday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Monday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Tuesday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Wednesday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Thursday);
|
||||
|
||||
const WlbScheduledTask.WlbTaskDaysOfWeek afterWeek = (WlbScheduledTask.WlbTaskDaysOfWeek.Tuesday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Wednesday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Thursday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Friday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Saturday);
|
||||
|
||||
Assert.AreEqual(afterWeek, WlbScheduledTask.NextDay(WlbScheduledTask.WlbTaskDaysOfWeek.Weekdays));
|
||||
Assert.AreEqual(beforeWeek, WlbScheduledTask.PreviousDay(WlbScheduledTask.WlbTaskDaysOfWeek.Weekdays));
|
||||
|
||||
|
||||
const WlbScheduledTask.WlbTaskDaysOfWeek everyDay = (WlbScheduledTask.WlbTaskDaysOfWeek.Sunday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Monday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Tuesday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Wednesday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Thursday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Friday |
|
||||
WlbScheduledTask.WlbTaskDaysOfWeek.Saturday);
|
||||
|
||||
Assert.AreEqual(everyDay, WlbScheduledTask.NextDay(WlbScheduledTask.WlbTaskDaysOfWeek.All));
|
||||
Assert.AreEqual(everyDay, WlbScheduledTask.PreviousDay(WlbScheduledTask.WlbTaskDaysOfWeek.All));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DayOfWeekConversionRoundTrip()
|
||||
{
|
||||
foreach (DayOfWeek day in Enum.GetValues(typeof(DayOfWeek)))
|
||||
{
|
||||
DayOfWeek roundTrippedDay =
|
||||
WlbScheduledTask.ConvertFromWlbTaskDayOfWeek(WlbScheduledTask.ConvertToWlbTaskDayOfWeek(day));
|
||||
Assert.AreEqual( day, roundTrippedDay);
|
||||
}
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
private struct ScheduledTaskData
|
||||
{
|
||||
public bool DeleteTask;
|
||||
public string Name;
|
||||
public string Description;
|
||||
public bool Enabled;
|
||||
public string Owner;
|
||||
public bool LastRunResult;
|
||||
public string LastTouchedBy;
|
||||
public DateTime LastTouched;
|
||||
public WlbScheduledTask.WlbTaskTriggerType TriggerInterval;
|
||||
public WlbScheduledTask.WlbTaskDaysOfWeek DaysOfWeek;
|
||||
public DateTime RunTime;
|
||||
public DateTime LastRunDate;
|
||||
public DateTime EnableDate;
|
||||
public DateTime DisableTime;
|
||||
public WlbScheduledTask.WlbTaskActionType ActionType;
|
||||
public Dictionary<string, string> TaskParameters;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,168 +0,0 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using XenAdmin.Wlb;
|
||||
|
||||
namespace XenAdminTests.UnitTests.WlbTests
|
||||
{
|
||||
[TestFixture, Category(TestCategories.Unit)]
|
||||
public class WlbScheduledTasksTests
|
||||
{
|
||||
[Test]
|
||||
public void MethodCallsFromAnEmptyConstructor()
|
||||
{
|
||||
WlbScheduledTasks tasks = new WlbScheduledTasks();
|
||||
Assert.AreEqual(0, tasks.TaskList.Count, "TaskList");
|
||||
Assert.AreEqual(0, tasks.SortedTaskList.Count, "SortedTaskList");
|
||||
Assert.AreEqual(0, tasks.VirtualTaskList.Count, "VirtualTaskList");
|
||||
Assert.IsNull(tasks.ToDictionary(), "Conversion to dictionary");
|
||||
Assert.IsNull(tasks.GetNextRunningTask(), "GetNextRunningTask");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EmptyConstructorCausesCurrentScheduledPerformanceModeToThrow()
|
||||
{
|
||||
var tasks = new WlbScheduledTasks();
|
||||
Assert.Throws(typeof(IndexOutOfRangeException), () => tasks.GetCurrentScheduledPerformanceMode());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EmptyConstructorCausesLastTaskToThrow()
|
||||
{
|
||||
var tasks = new WlbScheduledTasks();
|
||||
Assert.Throws(typeof(IndexOutOfRangeException), () => tasks.GetLastRunningTask());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MethodCallsFromADictionaryConstructedObject()
|
||||
{
|
||||
var tasks = new WlbScheduledTasks(new Dictionary<string, string>
|
||||
{
|
||||
{"schedTask_dosomething", "now"},
|
||||
{"schedTask_3", "later"},
|
||||
{"schedTask_1", "sooner"},
|
||||
{"domoresomethings", "will not be added"}
|
||||
});
|
||||
|
||||
//Task List Construction
|
||||
Assert.AreEqual(3, tasks.TaskList.Count );
|
||||
Assert.AreEqual(0, tasks.TaskList["dosomething"].TaskId);
|
||||
Assert.AreEqual(1, tasks.TaskList["1"].TaskId);
|
||||
Assert.AreEqual(3, tasks.TaskList["3"].TaskId);
|
||||
|
||||
//Dictionary Conversion
|
||||
Assert.AreEqual(3, tasks.ToDictionary().Count, "Conversion to dictionary");
|
||||
|
||||
//Sorted Tasks
|
||||
SortedDictionary<int, WlbScheduledTask> sortedTasks = tasks.SortedTaskList;
|
||||
Assert.AreEqual(3, sortedTasks.Count, "SortedTaskList");
|
||||
List<WlbScheduledTask> tasksValues = new List<WlbScheduledTask>(sortedTasks.Values);
|
||||
Assert.AreEqual(0, tasksValues[0].TaskId);
|
||||
Assert.AreEqual(3, tasksValues[1].TaskId);
|
||||
Assert.AreEqual(1, tasksValues[2].TaskId);
|
||||
|
||||
//Virtual Tasks
|
||||
Assert.AreEqual(0, tasks.VirtualTaskList.Count, "VirtualTaskList");
|
||||
|
||||
//Next task
|
||||
WlbScheduledTask nextTask = tasks.GetNextRunningTask();
|
||||
Assert.IsNull( nextTask, "GetNextRunningTask");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void VirtualTaskListWithAddedTasks()
|
||||
{
|
||||
WlbScheduledTasks tasks = BuildSampleTasksWithTimes();
|
||||
SortedDictionary<int, WlbScheduledTask> virtualTasks = tasks.VirtualTaskList;
|
||||
Assert.AreEqual(3, tasks.TaskList.Count);
|
||||
Assert.AreEqual(3, tasks.SortedTaskList.Count);
|
||||
Assert.AreEqual(4, virtualTasks.Count);
|
||||
|
||||
//Verify sort keys from the virtual list and their task id
|
||||
List<WlbScheduledTask> virtualTasksValues = new List<WlbScheduledTask>(virtualTasks.Values);
|
||||
Assert.AreEqual(3, virtualTasksValues[0].TaskId);
|
||||
Assert.AreEqual(2, virtualTasksValues[1].TaskId);
|
||||
Assert.AreEqual(1, virtualTasksValues[2].TaskId);
|
||||
Assert.AreEqual(3, virtualTasksValues[3].TaskId);
|
||||
|
||||
//Next Task
|
||||
Assert.IsNull(tasks.GetNextRunningTask());
|
||||
|
||||
//Last Task
|
||||
Assert.IsNotNull(tasks.GetLastRunningTask());
|
||||
|
||||
//Check performance mode fetch from last task
|
||||
Assert.AreEqual(WlbPoolPerformanceMode.MaximizeDensity, tasks.GetCurrentScheduledPerformanceMode());
|
||||
}
|
||||
|
||||
private WlbScheduledTasks BuildSampleTasksWithTimes()
|
||||
{
|
||||
WlbScheduledTasks tasks = new WlbScheduledTasks();
|
||||
|
||||
var taskParameters = new Dictionary<string, string>()
|
||||
{
|
||||
{"OptMode", "1"} // Performance mode
|
||||
};
|
||||
|
||||
var taskA = new WlbScheduledTask("1")
|
||||
{
|
||||
DaysOfWeek = WlbScheduledTask.WlbTaskDaysOfWeek.Friday,
|
||||
TaskParameters = taskParameters
|
||||
};
|
||||
|
||||
var taskB = new WlbScheduledTask("2")
|
||||
{
|
||||
DaysOfWeek = WlbScheduledTask.WlbTaskDaysOfWeek.Monday,
|
||||
TaskParameters = taskParameters
|
||||
};
|
||||
|
||||
//Weekend tasks adds 2 to the virtual task list, one for each day
|
||||
var taskC = new WlbScheduledTask("3")
|
||||
{
|
||||
DaysOfWeek = WlbScheduledTask.WlbTaskDaysOfWeek.Weekends,
|
||||
TaskParameters = taskParameters
|
||||
};
|
||||
|
||||
var taskCollection = new Dictionary<string, WlbScheduledTask>()
|
||||
{
|
||||
{"schedTask_1", taskA},
|
||||
{"schedTask_2", taskB},
|
||||
{"schedTask_3", taskC}
|
||||
};
|
||||
|
||||
Assert.AreEqual(3, taskCollection.Count, "Setting up task collection");
|
||||
tasks.TaskList = taskCollection;
|
||||
return tasks;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,424 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="17.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{21B9482C-D255-40D5-ABA7-C8F00F99547C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>XenAdminTests</RootNamespace>
|
||||
<AssemblyName>XenAdminTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CookComputing.XmlRpcV2, Version=2.5.0.1, Culture=neutral, PublicKeyToken=d247b8b0ac7959e9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CookComputing.XmlRpcV2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=d247b8b0ac7959e9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Moq, Version=4.5.3.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json.CH, Version=13.0.1.0, Culture=neutral, PublicKeyToken=d247b8b0ac7959e9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.CH.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>Properties\CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="ArchiveTests\ArchiveFactoryTests.cs" />
|
||||
<Compile Include="ArchiveTests\ArchiveIteratorTests.cs" />
|
||||
<Compile Include="ArchiveTests\ArchiveWriterTests.cs" />
|
||||
<Compile Include="ArchiveTests\ThirdPartyArchiveWriterTests.cs" />
|
||||
<Compile Include="ClassVerifiers.cs" />
|
||||
<Compile Include="CodeTests\AssemblyTests.cs" />
|
||||
<Compile Include="CodeTests\XenModelReferencesTest.cs" />
|
||||
<Compile Include="CompressionTests\CompressionFactoryTests.cs" />
|
||||
<Compile Include="CompressionTests\CompressionStreamTests.cs" />
|
||||
<Compile Include="CompressionTests\ThirdPartyCompressionStreamTests.cs" />
|
||||
<Compile Include="Controls\DecentGroupBoxTests.cs" />
|
||||
<Compile Include="Controls\Folders\FolderListItemTests.cs" />
|
||||
<Compile Include="Controls\LongStringComboBoxTest.cs" />
|
||||
<Compile Include="LicensingTests\LicenceTimerTests.cs" />
|
||||
<Compile Include="LicensingTests\ProductColumnComparerTests.cs" />
|
||||
<Compile Include="MainWindowWrapper\MockMainWindow.cs" />
|
||||
<Compile Include="MainWindowWrapper\NameAndConnectionPromptWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\HostMenuWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\MainToolBarWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\StartShutdownMenuWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\StorageMenuWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\ToolsMenuWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\VMMenuWrapper.cs" />
|
||||
<Compile Include="PluginTests\MenuItemFeatureTests.cs" />
|
||||
<Compile Include="PluginTests\ParentMenuItemFeatureTests.cs" />
|
||||
<Compile Include="PluginTests\ShellCmdTestBatchFile.cs" />
|
||||
<Compile Include="PluginTests\ShellCmdTests.cs" />
|
||||
<Compile Include="PluginTests\TabPageFeatureTests.cs" />
|
||||
<Compile Include="PluginTests\TestPluginLoader.cs" />
|
||||
<Compile Include="SearchTests\SearcherTests.cs" />
|
||||
<Compile Include="SearchTests\SearchWindow.cs" />
|
||||
<Compile Include="SearchTests\SearchWindowUpdateTests.cs" />
|
||||
<Compile Include="TabsAndMenus\DisconnectedTests.cs" />
|
||||
<Compile Include="MainWindowWrapper\MainWindowWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\TestWrapper.cs" />
|
||||
<Compile Include="TreeTests\FlickerFreeTreeViewTests.cs" />
|
||||
<Compile Include="TreeTests\MainWindowTreeBuilderTests.cs" />
|
||||
<Compile Include="TreeTests\MainWindowTreeTests.cs" />
|
||||
<Compile Include="TreeTests\MainWindowTreeTestsDefault.cs" />
|
||||
<Compile Include="TreeTests\TreeViewSerializer.cs" />
|
||||
<Compile Include="TreeTests\MultiSelectTreeViewTests.cs" />
|
||||
<Compile Include="TreeTests\VirtualTreeViewTests.cs" />
|
||||
<Compile Include="DialogTests\AdPasswordPromptTest.cs" />
|
||||
<Compile Include="DialogTests\DialogsForConnection.cs" />
|
||||
<Compile Include="DialogTests\DialogsForHost.cs" />
|
||||
<Compile Include="DialogTests\DialogsForPool.cs" />
|
||||
<Compile Include="DialogTests\DialogsForVM.cs" />
|
||||
<Compile Include="DialogTests\DialogsWithDefaultConstructor.cs" />
|
||||
<Compile Include="DialogTests\DialogTest.cs" />
|
||||
<Compile Include="DialogTests\NetworkingPropertiesTest.cs" />
|
||||
<Compile Include="DialogTests\NewDiskDialogTest.cs" />
|
||||
<Compile Include="DialogTests\OptionsDialogTest.cs" />
|
||||
<Compile Include="DialogTests\OtherDialogs.cs" />
|
||||
<Compile Include="DialogTests\PropertiesDialogTest.cs" />
|
||||
<Compile Include="DialogTests\VerticallyTabbedDialogTest.cs" />
|
||||
<Compile Include="FolderTests\FolderTest.cs" />
|
||||
<Compile Include="LicensingTests\AssignLicenseDialogWrapper.cs" />
|
||||
<Compile Include="LicensingTests\OpenFileDialogWrapper.cs" />
|
||||
<Compile Include="MainWindowTester.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SearchTests\VirtualisationStatePropertyQueryTests.cs" />
|
||||
<Compile Include="SearchTests\DatePropertyQueryTests.cs" />
|
||||
<Compile Include="SearchTests\XenSearchQueryTest.cs" />
|
||||
<Compile Include="StringExtensionsTests\EllipsiseStringTests.cs" />
|
||||
<Compile Include="StringExtensionsTests\EscapeAmpersandsTests.cs" />
|
||||
<Compile Include="TabsAndMenus\GeneralTabLicenseStatusStringifierTests.cs" />
|
||||
<Compile Include="UnitTests\MiscTests\UtilTests.cs" />
|
||||
<Compile Include="UnitTests\UnitTestHelper\MockObjectBuilders\MockPoolOfVersionedHosts.cs" />
|
||||
<Compile Include="UnitTests\UnitTestHelper\MockObjectBuilders\MockVersionedHost.cs" />
|
||||
<Compile Include="WizardTests\CrossPoolMigrateWizard\Filters\WlbEnabledFilterTests.cs" />
|
||||
<Compile Include="WizardTests\ExportWizard\ApplianceExistsCheckTests.cs" />
|
||||
<Compile Include="WizardTests\PatchingWizard\PatchingWizard_PrecheckPageTests.cs" />
|
||||
<Compile Include="XenModelTests\ActionTests\AD\AddRemoveRolesActionTest.cs" />
|
||||
<Compile Include="XenModelTests\ActionTests\ExportVMActionTest.cs" />
|
||||
<Compile Include="XenModelTests\ActionTests\VM\GpuAssignActionTests.cs" />
|
||||
<Compile Include="XenModelTests\ActionTests\Hosts\GetServerTimeActionTests.cs" />
|
||||
<Compile Include="XenModelTests\ActionTests\NetworkingActionsTests.cs" />
|
||||
<Compile Include="ArchiveTests\ArchiveFactoryTests.cs" />
|
||||
<Compile Include="ArchiveTests\ArchiveIteratorTests.cs" />
|
||||
<Compile Include="ArchiveTests\ArchiveWriterTests.cs" />
|
||||
<Compile Include="ArchiveTests\ThirdPartyArchiveWriterTests.cs" />
|
||||
<Compile Include="CommandTests\AddHostCommandTest.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CommandTests\AddHostToPoolCommandTest.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CommandTests\AddNewHostToPoolCommandTest.cs" />
|
||||
<Compile Include="CommandTests\AddVirtualDiskCommandTest.cs" />
|
||||
<Compile Include="CommandTests\AttachVirtualDiskCommandTest.cs" />
|
||||
<Compile Include="CommandTests\BackupHostCommandTest.cs" />
|
||||
<Compile Include="CommandTests\CommandTest.cs" />
|
||||
<Compile Include="CommandTests\CrossPoolMigrateCommandTests.cs" />
|
||||
<Compile Include="CommandTests\DeleteFolderCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DeleteSnapshotCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DeleteTagCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DeleteTemplateCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DeleteVMCommandTest.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CommandTests\DeleteVMsAndTemplatesCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DisconnectHostCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DisconnectPoolCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DRConfigureCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DRDryrunCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DRFailbackCommandTest.cs" />
|
||||
<Compile Include="CommandTests\DRFailoverCommandTest.cs" />
|
||||
<Compile Include="CommandTests\EditTagsCommandTest.cs" />
|
||||
<Compile Include="CommandTests\MigrateVirtualDiskCommandTest.cs" />
|
||||
<Compile Include="CommandTests\NewFolderCommandTest.cs" />
|
||||
<Compile Include="CommandTests\PutFolderIntoRenameModeCommandTest.cs" />
|
||||
<Compile Include="CommandTests\RemoveFromFolderCommandTest.cs" />
|
||||
<Compile Include="CommandTests\RenameTagCommandTest.cs" />
|
||||
<Compile Include="CommandTests\ShutDownHostCommandTest.cs" />
|
||||
<Compile Include="CommandTests\UntagCommandTest.cs" />
|
||||
<Compile Include="CommandTests\VMLifecycleCommandTest.cs" />
|
||||
<Compile Include="CompressionTests\CompressionFactoryTests.cs" />
|
||||
<Compile Include="CompressionTests\CompressionStreamTests.cs" />
|
||||
<Compile Include="CompressionTests\ThirdPartyCompressionStreamTests.cs" />
|
||||
<Compile Include="Controls\LunComboBoxItemTests.cs" />
|
||||
<Compile Include="Controls\LunPerVdiPickerItemTests.cs" />
|
||||
<Compile Include="Controls\SrPickerLunPerVDIItemTests.cs" />
|
||||
<Compile Include="ManagedTester.cs" />
|
||||
<Compile Include="MockConnectionManager.cs" />
|
||||
<Compile Include="TabsAndMenus\TabsAndMenusTampa.cs" />
|
||||
<Compile Include="UnitTester.cs" />
|
||||
<Compile Include="UnitTests\Controls\LongStringComboBoxTest.cs" />
|
||||
<Compile Include="Controls\SrPickerItemTests.cs" />
|
||||
<Compile Include="DatabaseTester.cs" />
|
||||
<Compile Include="Diagnostics\DiagnosticsTests.cs" />
|
||||
<Compile Include="DialogTests\BostonDialogTest.cs" />
|
||||
<Compile Include="DialogTests\CertificateDialogTests.cs" />
|
||||
<Compile Include="DialogTests\IscsiDeviceConfigDialogTests.cs" />
|
||||
<Compile Include="DialogTests\MessageBoxTestTests.cs" />
|
||||
<Compile Include="DialogTests\MoveVirtualDiskDialogTests.cs" />
|
||||
<Compile Include="DialogTests\ReconnectAsDialogTests.cs" />
|
||||
<Compile Include="DialogTests\RestoreVMsDialogTests.cs" />
|
||||
<Compile Include="DialogTests\ScreenShotDialogTest.cs" />
|
||||
<Compile Include="DialogTests\UpsellDialogTests.cs" />
|
||||
<Compile Include="DialogTests\WlbCredentialsDialogTests.cs" />
|
||||
<Compile Include="DialogTests\WlbEditScheduledTaskTests.cs" />
|
||||
<Compile Include="I18nResourceFilesTests.cs" />
|
||||
<Compile Include="LicensingTests\LicenceTimerTests.cs" />
|
||||
<Compile Include="MainWindowLauncher.cs" />
|
||||
<Compile Include="MainWindowWrapper\CommandErrorDialogWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\DRConfigureDialogWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\DRFailoverWizardWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\NetworkTabPageWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\NewNetworkWizardWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\NewTagDialogWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\OptionsDialogWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\RoleElevationDialogWrapper.cs" />
|
||||
<Compile Include="MainWindowWrapper\TestUtils.cs" />
|
||||
<Compile Include="MiscTests\BasicXMLResolverTests.cs" />
|
||||
<Compile Include="MiscTests\ContextMenuBuilderTests.cs" />
|
||||
<Compile Include="MiscTests\ContextMenuBuilderTests.Serializer.cs" />
|
||||
<Compile Include="TabsAndMenus\NetworkTabTests.cs" />
|
||||
<Compile Include="TestCategories.cs" />
|
||||
<Compile Include="TestDatabaseManager.cs" />
|
||||
<Compile Include="TestObjectProvider.cs" />
|
||||
<Compile Include="UnitTests\AlertTests\AlertClassUnitTestData.cs" />
|
||||
<Compile Include="UnitTests\AlertTests\MissingIqnAlertTests.cs" />
|
||||
<Compile Include="DialogTests\MultipleWarningDialogTests.cs" />
|
||||
<Compile Include="UnitTests\AlertTests\XenCenterUpdateAlertTests.cs" />
|
||||
<Compile Include="UnitTests\AlertTests\XenServerPatchAlertTests.cs" />
|
||||
<Compile Include="UnitTests\AlertTests\XenServerUpdateAlertTests.cs" />
|
||||
<Compile Include="UnitTests\Diagnostics\HotFixFactoryTests.cs" />
|
||||
<Compile Include="UnitTests\Diagnostics\MultipleHotfixTests.cs" />
|
||||
<Compile Include="UnitTests\Dialogs\DataGridViewEx\CollapsingPoolHostDataGridViewColumnStableSorterTests.cs" />
|
||||
<Compile Include="UnitTests\Dialogs\DataGridViewEx\CollapsingPoolHostDataGridViewRowSorterTests.cs" />
|
||||
<Compile Include="UnitTests\MiscTests\EmailAddressValidatorTests.cs" />
|
||||
<Compile Include="UnitTests\MiscTests\NamesAndMessagesTests.cs" />
|
||||
<Compile Include="MiscTests\HelpStringTests.cs" />
|
||||
<Compile Include="MiscTests\ShowHideTests.cs" />
|
||||
<Compile Include="MiscTests\StreamUtilitiesTests.cs" />
|
||||
<Compile Include="MiscTests\TimeUtilTests.cs" />
|
||||
<Compile Include="MiscTests\UpdateManagerTests.cs" />
|
||||
<Compile Include="MiscTests\WebBrowser2Tests.cs" />
|
||||
<Compile Include="PluginTests\PlaceholdersTests.cs" />
|
||||
<Compile Include="TabsAndMenus\TabsAndMenusBoston.cs" />
|
||||
<Compile Include="TabsAndMenus\HistoryPageTests.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindowWrapper\InputPromptDialogWrapper.cs" />
|
||||
<Compile Include="DialogTests\VIFDialogTest.cs" />
|
||||
<Compile Include="MainWindowWrapper\ViewMenuWrapper.cs" />
|
||||
<Compile Include="SearchTests\ExpectedResults.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SearchTests\LoadAllSearches.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TabsAndMenus\MainMenuGeorge.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TabsAndMenus\PluginTabsAndMenus.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TabsAndMenus\StartUpStateTests.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TabsAndMenus\ToolbarGeorge.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TabsAndMenus\ToolbarMidnightRide.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UnitTests\AlertTests\DuplicateIqnAlertTests.cs" />
|
||||
<Compile Include="UnitTests\AlertTests\GuiOldAlertTest.cs" />
|
||||
<Compile Include="UnitTests\CPUMaskingTest.cs" />
|
||||
<Compile Include="UnitTests\EmailAddressValidatorTests.cs" />
|
||||
<Compile Include="UnitTests\ExceptionSerializationTest.cs" />
|
||||
<Compile Include="UnitTests\NamesAndMessagesTests.cs" />
|
||||
<Compile Include="UnitTests\NaturalCompareTest.cs" />
|
||||
<Compile Include="UnitTests\RpmVersionTests.cs" />
|
||||
<Compile Include="UnitTests\StreamUtilitiesTests.cs" />
|
||||
<Compile Include="UnitTests\SubnetworkMaskValidatorTest.cs" />
|
||||
<Compile Include="UnitTests\TimeUtilTests.cs" />
|
||||
<Compile Include="UnitTests\UpdateManagerTests.cs" />
|
||||
<Compile Include="UnitTests\RegexTests.cs" />
|
||||
<Compile Include="UnitTests\EncryptionUtilTests.cs" />
|
||||
<Compile Include="UnitTests\UtilTests.cs" />
|
||||
<Compile Include="UnitTests\WlbTests\WlbPoolConfigurationTests.cs" />
|
||||
<Compile Include="UnitTests\WlbTests\WlbReportSubscriptionTests.cs" />
|
||||
<Compile Include="UnitTests\WlbTests\WlbScheduledTasksTests.cs" />
|
||||
<Compile Include="UnitTests\WlbTests\WlbScheduledTaskTests.cs" />
|
||||
<Compile Include="WizardTests\CrossPoolMigrateCanMigrateFilterTest.cs" />
|
||||
<Compile Include="WizardTests\CrossPoolMigrateWizardTest.cs" />
|
||||
<Compile Include="WizardTests\DRFailoverWizardSummaryReportTests.cs" />
|
||||
<Compile Include="WizardTests\DRFailoverWizardTests.cs" />
|
||||
<Compile Include="WizardTests\ImportWizardTest.cs" />
|
||||
<Compile Include="WizardTests\ExportWizardTest.cs" />
|
||||
<Compile Include="WizardTests\NewPolicyWizardTest.cs" />
|
||||
<Compile Include="WizardTests\NewVMWizardBiosStringsTest.cs" />
|
||||
<Compile Include="WizardTests\NewVMWizardDisklessVMs.cs" />
|
||||
<Compile Include="WizardTests\ResidentHostIsSameAsSelectionFilterTests.cs" />
|
||||
<Compile Include="WizardTests\RollingUpgradeWizardTest.cs" />
|
||||
<Compile Include="XenModelTests\ActionTestBase.cs" />
|
||||
<Compile Include="XenModelTests\AddressTests.cs" />
|
||||
<Compile Include="XenModelTests\AreEqual2Tests.cs" />
|
||||
<Compile Include="XenModelTests\DestroyPolicyActionTests.cs" />
|
||||
<Compile Include="XenModelTests\DestroyVMTests.cs" />
|
||||
<Compile Include="UnitTests\UnitTestHelper\MockObjectBuilders\MockActionFactory.cs" />
|
||||
<Compile Include="XenModelTests\HostExtensionTests.cs" />
|
||||
<Compile Include="XenModelTests\SessionTests.cs" />
|
||||
<Compile Include="XenModelTests\TestXenAdminConfigProvider.cs" />
|
||||
<Compile Include="XenModelTests\PureAsyncActionTests.cs" />
|
||||
<Compile Include="XenModelTests\TestAPICallVersions.cs" />
|
||||
<Compile Include="XenModelTests\UpgradePoolActionTests.cs" />
|
||||
<Compile Include="XenModelTests\VMBuilder.cs" />
|
||||
<Compile Include="XenModelTests\VMExtensionsTests.cs" />
|
||||
<Compile Include="XenModelTests\JsonConverterTests.cs" />
|
||||
<Compile Include="XenModelTests\XenModelReferencesTest.cs" />
|
||||
<Compile Include="XenOvf\FileDigestTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="TestResources\emptyfile.gz">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="TestResources\sample.xva">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="TestResources\sample_app.ovf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="TestResources\TestDevCertificate.cer">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="TestResources\searchresults.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\single-host-krakout.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\small_vms.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\state1.treeview.orgview.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\state1.treeview.serverview.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\state1.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\state2.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\state3.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\state4.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\tampa-db_inc_snapshots.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\tampa-poolof16and23-xapi-db.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\TampaTwoHostPoolSelectioniSCSI.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\tampa_livevdimove_xapi-db.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\tampa_poolofone_40.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\updatesState.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\state5.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="TestResources\xapidb_app.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\XenAdmin\XenAdmin.csproj">
|
||||
<Project>{70BDA4BC-F062-4302-8ACD-A15D8BF31D65}</Project>
|
||||
<Name>XenAdmin</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\XenCenterLib\XenCenterLib.csproj">
|
||||
<Project>{9861DFA1-B41F-432D-A43F-226257DEBBB9}</Project>
|
||||
<Name>XenCenterLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\XenModel\XenModel.csproj">
|
||||
<Project>{B306FC59-4441-4A5F-9F54-D3F68D4EE38D}</Project>
|
||||
<Name>XenModel</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\XenOvfApi\XenOvfApi.csproj">
|
||||
<Project>{2D78AC6C-B867-484A-A447-3C6FC8B8EAF7}</Project>
|
||||
<Name>XenOvfApi</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\NUnit.3.10.1\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.10.1\build\NUnit.props'))" />
|
||||
</Target>
|
||||
<!-- 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>
|
@ -36,9 +36,9 @@ using System.Runtime.InteropServices;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("XenCenterLib")]
|
||||
[assembly: AssemblyDescription("[XenCenter] library")]
|
||||
[assembly: AssemblyDescription("XCP-ng Center library")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("[XenCenter]")]
|
||||
[assembly: AssemblyProduct("XCP-ng Center")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
@ -39,9 +39,9 @@ using XenAdmin.Properties;
|
||||
// associated with an assembly.
|
||||
|
||||
[assembly: AssemblyTitle("XenModel")]
|
||||
[assembly: AssemblyDescription("[XenCenter] library")]
|
||||
[assembly: AssemblyDescription("XCP-ng Center library")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("[XenCenter]")]
|
||||
[assembly: AssemblyProduct("XCP-ng Center")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
@ -54,20 +54,20 @@ using XenAdmin.Properties;
|
||||
[assembly: InternalsVisibleTo("XenAdminTests")]
|
||||
|
||||
[assembly: CustomBranding(
|
||||
"[XenCenter]",
|
||||
"[Vendor]",
|
||||
"[XenServerProduct]",
|
||||
"[XenServer version]",
|
||||
"[Xc updates url]",
|
||||
"[Cfu url]",
|
||||
"[Guest Tools]",
|
||||
"[XenServer host]",
|
||||
"[YumRepoBaseBin]",
|
||||
"[YumRepoBaseSource]",
|
||||
"[YumRepoEarlyAccessBin]",
|
||||
"[YumRepoEarlyAccessSource]",
|
||||
"[YumRepoNormalBin]",
|
||||
"[YumRepoNormalSource]")]
|
||||
"XCP-ng Center",
|
||||
"XCP-ng",
|
||||
"XCP-ng",
|
||||
"",
|
||||
"https://raw.githubusercontent.com/xcp-ng/xenadmin-updates/master/updates.xml",
|
||||
"",
|
||||
"XCP-ng VM Tools",
|
||||
"XCP-ng",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"")]
|
||||
|
||||
namespace XenAdmin.Properties
|
||||
{
|
||||
|
@ -35,9 +35,9 @@ using System.Runtime.InteropServices;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("XenCenterOVF")]
|
||||
[assembly: AssemblyDescription("[XenCenter] library")]
|
||||
[assembly: AssemblyDescription("XCP-ng Center library")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("[XenCenter]")]
|
||||
[assembly: AssemblyProduct("XCP-ng Center")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
</startup>
|
||||
</configuration>
|
69
splash-xcp-ng/Form1.Designer.cs
generated
69
splash-xcp-ng/Form1.Designer.cs
generated
@ -1,69 +0,0 @@
|
||||
namespace splash_xcp_ng
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.labelVersion = new System.Windows.Forms.Label();
|
||||
this.panelMain = new System.Windows.Forms.Panel();
|
||||
this.panelMain.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelVersion
|
||||
//
|
||||
this.labelVersion.AutoSize = true;
|
||||
this.labelVersion.BackColor = System.Drawing.Color.Transparent;
|
||||
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.labelVersion.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelVersion.Location = new System.Drawing.Point(10, 531);
|
||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
this.labelVersion.Size = new System.Drawing.Size(0, 13);
|
||||
this.labelVersion.TabIndex = 0;
|
||||
//
|
||||
// panelMain
|
||||
//
|
||||
this.panelMain.AutoSize = true;
|
||||
this.panelMain.BackColor = System.Drawing.Color.Transparent;
|
||||
this.panelMain.Controls.Add(this.labelVersion);
|
||||
this.panelMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelMain.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelMain.Name = "panelMain";
|
||||
this.panelMain.Padding = new System.Windows.Forms.Padding(10, 0, 0, 10);
|
||||
this.panelMain.Size = new System.Drawing.Size(800, 554);
|
||||
this.panelMain.TabIndex = 1;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 554);
|
||||
this.Controls.Add(this.panelMain);
|
||||
this.Font = new System.Drawing.Font("Arial Narrow", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "Form1";
|
||||
this.Text = "XCP-ng Center Launcher";
|
||||
this.Shown += new System.EventHandler(this.Form1_Shown);
|
||||
this.panelMain.ResumeLayout(false);
|
||||
this.panelMain.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
private System.Windows.Forms.Label labelVersion;
|
||||
private System.Windows.Forms.Panel panelMain;
|
||||
}
|
||||
}
|
||||
|
@ -1,101 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace splash_xcp_ng
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
private System.IO.Stream stream;
|
||||
private System.Reflection.Assembly assembly;
|
||||
const string exe = "XenCenterMain.exe";
|
||||
Version AssemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
string ProductVersion = System.Windows.Forms.Application.ProductVersion;
|
||||
|
||||
private BackgroundWorker bworker = new BackgroundWorker();
|
||||
private ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
private Process proc;
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
Style();
|
||||
}
|
||||
|
||||
private void Form1_Shown(object sender, EventArgs e)
|
||||
{
|
||||
Application.DoEvents();
|
||||
Launch();
|
||||
}
|
||||
|
||||
private void Style()
|
||||
{
|
||||
labelVersion.Text = ProductVersion + " (" + AssemblyVersion + ")";
|
||||
|
||||
Image bitmap;
|
||||
assembly = System.Reflection.Assembly.LoadFrom(Application.ExecutablePath);
|
||||
stream = assembly.GetManifestResourceStream("splash_xcp_ng.Resources.splash.bmp");
|
||||
bitmap = Image.FromStream(stream);
|
||||
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
|
||||
this.BackgroundImage = bitmap;
|
||||
this.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
this.Width = bitmap.Width;
|
||||
this.Height = bitmap.Height;
|
||||
this.CenterToScreen();
|
||||
}
|
||||
|
||||
private void Launch()
|
||||
{
|
||||
if (!File.Exists(exe))
|
||||
{
|
||||
MessageBox.Show("[ERROR] Application not found: " + exe);
|
||||
Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
startInfo.CreateNoWindow = false;
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.FileName = exe;
|
||||
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
startInfo.Arguments = String.Empty;
|
||||
|
||||
bworker.WorkerSupportsCancellation = true;
|
||||
bworker.DoWork += new DoWorkEventHandler(Start);
|
||||
bworker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bworkerCompleted);
|
||||
bworker.RunWorkerAsync();
|
||||
|
||||
//FixMe: Add some safty counter to exit if something goes wrong
|
||||
while (proc == null || string.IsNullOrEmpty(proc.MainWindowTitle))
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
if(proc != null) proc.Refresh();
|
||||
}
|
||||
|
||||
Exit();
|
||||
|
||||
}
|
||||
|
||||
private void Start(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
proc = Process.Start(startInfo);
|
||||
}
|
||||
|
||||
private void bworkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void Exit()
|
||||
{
|
||||
if (bworker != null && bworker.WorkerSupportsCancellation) bworker.CancelAsync();
|
||||
System.Environment.Exit(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace splash_xcp_ng
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new SplashForm());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
//FixMe: insert Branding
|
||||
[assembly: AssemblyTitle("[XenCenter] Splash")]
|
||||
[assembly: AssemblyDescription("XCP-ng Center Launcher")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("[Citrix]")]
|
||||
[assembly: AssemblyProduct("[XenCenter]")]
|
||||
[assembly: AssemblyCopyright("[BRANDING_COPYRIGHT]")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: Guid("cd563857-6159-4415-b7b2-a21991f572e3")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0000")]
|
||||
[assembly: AssemblyInformationalVersion("[BRANDING_PRODUCT_VERSION]")]
|
63
splash-xcp-ng/Properties/Resources.Designer.cs
generated
63
splash-xcp-ng/Properties/Resources.Designer.cs
generated
@ -1,63 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace splash_xcp_ng.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// </summary>
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("splash_xcp_ng.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
26
splash-xcp-ng/Properties/Settings.Designer.cs
generated
26
splash-xcp-ng/Properties/Settings.Designer.cs
generated
@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace splash_xcp_ng.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
Binary file not shown.
Before Width: | Height: | Size: 352 KiB |
69
splash-xcp-ng/SplashForm.Designer.cs
generated
69
splash-xcp-ng/SplashForm.Designer.cs
generated
@ -1,69 +0,0 @@
|
||||
namespace splash_xcp_ng
|
||||
{
|
||||
partial class SplashForm
|
||||
{
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.labelVersion = new System.Windows.Forms.Label();
|
||||
this.panelMain = new System.Windows.Forms.Panel();
|
||||
this.panelMain.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelVersion
|
||||
//
|
||||
this.labelVersion.AutoSize = true;
|
||||
this.labelVersion.BackColor = System.Drawing.Color.Transparent;
|
||||
this.labelVersion.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.labelVersion.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelVersion.Location = new System.Drawing.Point(10, 531);
|
||||
this.labelVersion.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.labelVersion.Name = "labelVersion";
|
||||
this.labelVersion.Size = new System.Drawing.Size(0, 13);
|
||||
this.labelVersion.TabIndex = 0;
|
||||
//
|
||||
// panelMain
|
||||
//
|
||||
this.panelMain.AutoSize = true;
|
||||
this.panelMain.BackColor = System.Drawing.Color.Transparent;
|
||||
this.panelMain.Controls.Add(this.labelVersion);
|
||||
this.panelMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelMain.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelMain.Name = "panelMain";
|
||||
this.panelMain.Padding = new System.Windows.Forms.Padding(10, 0, 0, 10);
|
||||
this.panelMain.Size = new System.Drawing.Size(800, 554);
|
||||
this.panelMain.TabIndex = 1;
|
||||
//
|
||||
// SplashForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 554);
|
||||
this.Controls.Add(this.panelMain);
|
||||
this.Font = new System.Drawing.Font("Arial Narrow", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "SplashForm";
|
||||
this.Text = "XCP-ng Center Launcher";
|
||||
this.Shown += new System.EventHandler(this.Form1_Shown);
|
||||
this.panelMain.ResumeLayout(false);
|
||||
this.panelMain.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
private System.Windows.Forms.Label labelVersion;
|
||||
private System.Windows.Forms.Panel panelMain;
|
||||
}
|
||||
}
|
||||
|
@ -1,172 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace splash_xcp_ng
|
||||
{
|
||||
public partial class SplashForm : Form
|
||||
{
|
||||
private System.IO.Stream stream;
|
||||
private System.Reflection.Assembly assembly;
|
||||
const string exe = "XenCenterMain.exe";
|
||||
private string exeFullPath = string.Empty;
|
||||
private string appdir = string.Empty;
|
||||
|
||||
Version AssemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
string ProductVersion = System.Windows.Forms.Application.ProductVersion;
|
||||
|
||||
private BackgroundWorker bworker = new BackgroundWorker();
|
||||
private ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
private Process proc;
|
||||
|
||||
public SplashForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
Style();
|
||||
}
|
||||
|
||||
private void Form1_Shown(object sender, EventArgs e)
|
||||
{
|
||||
Application.DoEvents();
|
||||
Launch();
|
||||
}
|
||||
|
||||
private void Style()
|
||||
{
|
||||
labelVersion.Text = ProductVersion + " (Build " + AssemblyVersion + ")";
|
||||
|
||||
Image bitmap;
|
||||
assembly = System.Reflection.Assembly.LoadFrom(Application.ExecutablePath);
|
||||
stream = assembly.GetManifestResourceStream("splash_xcp_ng.Resources.splash.bmp");
|
||||
bitmap = Image.FromStream(stream);
|
||||
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
|
||||
this.BackgroundImage = bitmap;
|
||||
this.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
this.Width = bitmap.Width;
|
||||
this.Height = bitmap.Height;
|
||||
this.CenterToScreen();
|
||||
}
|
||||
|
||||
private void Launch()
|
||||
{
|
||||
appdir = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
|
||||
exeFullPath = Path.Combine(appdir, exe);
|
||||
|
||||
if (!File.Exists(exeFullPath))
|
||||
{
|
||||
MessageBox.Show("[ERROR] Application not found: " + Environment.NewLine + exeFullPath);
|
||||
Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
#region Arguments
|
||||
|
||||
// test for agruments: "XCP-ng Center.exe" messageboxtest
|
||||
|
||||
string arguments = String.Empty;
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
|
||||
if (args != null && args.Length > 0)
|
||||
{
|
||||
//remove first argument that always is the current
|
||||
List<string> temp = new List<string>(args);
|
||||
temp.RemoveAt(0);
|
||||
string[] argsonly = temp.ToArray();
|
||||
|
||||
arguments = string.Join(" ", argsonly);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
startInfo.CreateNoWindow = false;
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.FileName = exeFullPath;
|
||||
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
startInfo.Arguments = arguments;
|
||||
startInfo.WorkingDirectory = appdir;
|
||||
|
||||
|
||||
|
||||
bworker.WorkerSupportsCancellation = true;
|
||||
bworker.DoWork += new DoWorkEventHandler(Start);
|
||||
bworker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bworkerCompleted);
|
||||
bworker.RunWorkerAsync();
|
||||
|
||||
//safty counter to exit if something goes wrong
|
||||
int timeoutSeconds = 60;
|
||||
int sleepMilliseconds = 100;
|
||||
int max = timeoutSeconds * 1000;
|
||||
|
||||
int counter = 0;
|
||||
|
||||
while (proc == null)
|
||||
{
|
||||
System.Threading.Thread.Sleep(sleepMilliseconds);
|
||||
if (proc != null) proc.Refresh();
|
||||
|
||||
counter++;
|
||||
if ((counter * sleepMilliseconds) >= max) break;
|
||||
}
|
||||
|
||||
if (proc == null)
|
||||
{
|
||||
MessageBox.Show("[ERROR] Something went wrong, program did not start in time: " + Environment.NewLine + exeFullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (proc.HasExited)
|
||||
{
|
||||
MessageBox.Show("[ERROR] Something went wrong, program stopped already: " + Environment.NewLine + exeFullPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i * sleepMilliseconds <= max; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
while (string.IsNullOrEmpty(proc.MainWindowTitle))
|
||||
{
|
||||
System.Threading.Thread.Sleep(sleepMilliseconds);
|
||||
if (proc != null) proc.Refresh();
|
||||
|
||||
counter++;
|
||||
if ((counter * sleepMilliseconds) >= max) break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("[ERROR] Something went wrong, failed to start: " + Environment.NewLine + exeFullPath);
|
||||
Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Exit();
|
||||
}
|
||||
|
||||
private void Start(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
proc = Process.Start(startInfo);
|
||||
}
|
||||
|
||||
private void bworkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void Exit()
|
||||
{
|
||||
if (bworker != null && bworker.WorkerSupportsCancellation) bworker.CancelAsync();
|
||||
System.Environment.Exit(1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{CD563857-6159-4415-B7B2-A21991F572E3}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>splash_xcp_ng</RootNamespace>
|
||||
<AssemblyName>XCP-ng Center</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Resources\AppIcon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SplashForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SplashForm.Designer.cs">
|
||||
<DependentUpon>SplashForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="SplashForm.resx">
|
||||
<DependentUpon>SplashForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\splash.bmp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AppIcon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
77
xe/Xe.csproj
77
xe/Xe.csproj
@ -1,77 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{727E885D-14BE-40F0-9D0B-3853D44D3984}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ThinCLI</RootNamespace>
|
||||
<AssemblyName>xe</AssemblyName>
|
||||
<ApplicationIcon>..\Branding\Images\AppIcon.ico</ApplicationIcon>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\XenAdmin\bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\XenAdmin\bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<SignManifests>true</SignManifests>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="xe.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommandLib\CommandLib.csproj">
|
||||
<Project>{6CE6A8FF-CF49-46B6-BEA4-6464A2F0A4D7}</Project>
|
||||
<Name>CommandLib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\Branding\Images\AppIcon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</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>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent Condition=" '$(Configuration)' == 'Release' ">mt.exe -verbose -manifest "$(ProjectDir)xe.manifest" -outputresource:"$(TargetDir)$(TargetFileName)";#1</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent />
|
||||
</PropertyGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user