mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
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:
parent
6b4dd1d269
commit
1a94ab1c5f
@ -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
|
||||
|
@ -1399,7 +1399,7 @@ namespace XenAdmin.Network
|
||||
error = e;
|
||||
log.Debug(e.Message);
|
||||
}
|
||||
catch (EventNextBlockedException e)
|
||||
catch (EventFromBlockedException e)
|
||||
{
|
||||
EventNextBlocked = true;
|
||||
error = e;
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user