2023-04-14 10:37:05 +00:00
|
|
|
|
using DistTestCore.Codex;
|
|
|
|
|
using Logging;
|
|
|
|
|
|
|
|
|
|
namespace DistTestCore.Marketplace
|
2023-04-14 08:51:35 +00:00
|
|
|
|
{
|
|
|
|
|
public interface IMarketplaceAccessFactory
|
|
|
|
|
{
|
2023-04-14 10:37:05 +00:00
|
|
|
|
IMarketplaceAccess CreateMarketplaceAccess(CodexAccess access);
|
2023-04-14 08:51:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class MarketplaceUnavailableAccessFactory : IMarketplaceAccessFactory
|
|
|
|
|
{
|
2023-04-14 10:37:05 +00:00
|
|
|
|
public IMarketplaceAccess CreateMarketplaceAccess(CodexAccess access)
|
2023-04-14 08:51:35 +00:00
|
|
|
|
{
|
|
|
|
|
return new MarketplaceUnavailable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class GethMarketplaceAccessFactory : IMarketplaceAccessFactory
|
|
|
|
|
{
|
2023-04-14 10:37:05 +00:00
|
|
|
|
private readonly TestLog log;
|
|
|
|
|
private readonly GethBootstrapNodeInfo bootstrapNode;
|
|
|
|
|
|
|
|
|
|
public GethMarketplaceAccessFactory(TestLog log, GethBootstrapNodeInfo bootstrapNode)
|
|
|
|
|
{
|
|
|
|
|
this.log = log;
|
|
|
|
|
this.bootstrapNode = bootstrapNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IMarketplaceAccess CreateMarketplaceAccess(CodexAccess access)
|
|
|
|
|
{
|
|
|
|
|
var companionNode = GetGethCompanionNode(access);
|
|
|
|
|
return new MarketplaceAccess(log, bootstrapNode, companionNode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private GethCompanionNodeInfo GetGethCompanionNode(CodexAccess access)
|
2023-04-14 08:51:35 +00:00
|
|
|
|
{
|
2023-04-14 10:37:05 +00:00
|
|
|
|
var node = access.Container.Recipe.Additionals.Single(a => a is GethCompanionNodeInfo);
|
|
|
|
|
return (GethCompanionNodeInfo)node;
|
2023-04-14 08:51:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|