CA-254412: Moved the XenObjectDownloader out of the XenAPI folder as it is

XenCenter specific and it is not retrieved from the SDK any more. Renamed
EventNextBlockedException to EventFromBlockedException since event.next() is now removed.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2017-05-24 09:23:47 +01:00
parent 6b4dd1d269
commit 1a94ab1c5f
4 changed files with 17 additions and 17 deletions

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using NUnit.Framework;
using XenAdmin.Core;
using XenAPI;
namespace XenAdminTests.UnitTests
@ -155,16 +156,16 @@ namespace XenAdminTests.UnitTests
[Test]
public void TestEventNextBlockedException()
{
var exception = new EventNextBlockedException();
EventNextBlockedException deserializedException;
var exception = new EventFromBlockedException();
EventFromBlockedException deserializedException;
// Serialize and de-serialize with a BinaryFormatter
BinaryFormatter bf = new BinaryFormatter();
using (MemoryStream ms = new MemoryStream())
{
bf.Serialize(ms, exception);
ms.Seek(0, 0);
deserializedException = (EventNextBlockedException)(bf.Deserialize(ms));
ms.Seek(0, 0);
deserializedException = (EventFromBlockedException)(bf.Deserialize(ms));
}
// Check that properties are preserved

View File

@ -1399,7 +1399,7 @@ namespace XenAdmin.Network
error = e;
log.Debug(e.Message);
}
catch (EventNextBlockedException e)
catch (EventFromBlockedException e)
{
EventNextBlocked = true;
error = e;

View File

@ -527,7 +527,7 @@
<Compile Include="XenAPI\vm_power_state.cs" />
<Compile Include="XenAPI\VTPM.cs" />
<Compile Include="XenAPI\XenObject.cs" />
<Compile Include="XenAPI\XenObjectDownloader.cs" />
<Compile Include="XenObjectDownloader.cs" />
<Compile Include="XenAPI\XenRef.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -32,23 +32,22 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Runtime.Serialization;
using XenAdmin.Core;
using XenAPI;
namespace XenAPI
namespace XenAdmin.Core
{
[Serializable]
public class EventNextBlockedException : Exception
public class EventFromBlockedException : Exception
{
public EventNextBlockedException() : base() { }
public EventFromBlockedException() { }
public EventNextBlockedException(string message) : base(message) { }
public EventFromBlockedException(string message) : base(message) { }
public EventNextBlockedException(string message, Exception exception) : base(message, exception) { }
public EventFromBlockedException(string message, Exception exception) : base(message, exception) { }
protected EventNextBlockedException(SerializationInfo info, StreamingContext context) : base(info, context) { }
protected EventFromBlockedException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
public static class XenObjectDownloader
@ -57,7 +56,7 @@ namespace XenAPI
private const double EVENT_FROM_TIMEOUT = 30; // 30 seconds
/// <sumary>
/// <summary>
/// Gets all objects from the server. Used in order to fill the cache.
/// This function implements the new event system, available from in API version 1.9.
/// In the new event system, (GetAllRecords + GetEvents) sequence will replace (RegisterForEvents + DownloadObjects + GetNextEvents).
@ -102,9 +101,9 @@ namespace XenAPI
}
catch (WebException e)
{
// Catch timeout, and turn it into an EventNextBlockedException so we can recognise it later (CA-33145)
// Catch timeout, and turn it into an EventFromBlockedException so we can recognise it later (CA-33145)
if (e.Status == WebExceptionStatus.Timeout)
throw new EventNextBlockedException();
throw new EventFromBlockedException();
else
throw;
}