示例#1
0
 public static MockModel Build()
 {
     var model = new MockModel();
     var customers = CreateCustomers();
     model.Customers = customers;
     model.OriginStrategies = CreateOriginStrategies();
     model.PortalRoles = CreatePortalRoles();
     model.ImageOptimisationPolicies = CreateImageOptimisationPolicies();
     model.ThumbnailPolicies = CreateThumbnailPolicies();
     model.PortalUserRoles = new Dictionary<string, List<string>>();
     model.PortalUsers = CreatePortalUsers(customers, model.PortalRoles, model.PortalUserRoles);
     model.NamedQueries = CreateNamedQueries(customers);
     model.CustomerOriginStrategies = CreateCustomerOriginStrategies(customers, model.OriginStrategies);
     model.AuthServiceParentChild = new Dictionary<string, List<string>>();
     var authServices = CreateAuthServices(customers, model.AuthServiceParentChild);
     model.AuthServices = authServices;
     model.RoleProviders = CreateRoleProviders(authServices);
     model.RoleAuthService = new Dictionary<string, string>();
     var roles = CreateRoles(customers, authServices, model.RoleAuthService);
     model.Roles = roles;
     model.SpaceDefaultRoles = new Dictionary<string, List<string>>();
     var spaces = CreateSpaces(customers, roles, model.SpaceDefaultRoles);
     model.Spaces = spaces;
     model.Queues = CreateQueues(customers);
     model.ImageRoles = new Dictionary<string, List<string>>();
     var images = CreateImages(spaces, model.SpaceDefaultRoles, model.ImageRoles, model.ImageOptimisationPolicies, model.ThumbnailPolicies);
     model.Images = images;
     model.BatchImages = new Dictionary<string, List<string>>();
     model.Batches = CreateBatches(images, model.BatchImages);
     RecalculateCounters(model);
     return model;
 }
示例#2
0
 public MockModel RebuildModel()
 {
     lock (ModelLock)
     {
         _model = MockModel.Build();
     }
     return _model;
 }
示例#3
0
 public MockModel GetModel()
 {
     if (_model == null)
     {
         lock (ModelLock)
         {
             if (_model == null)
             {
                 _model = MockModel.Build();
             }
         }
     }
     return _model;
 }
示例#4
0
 public static void RecalculateCounters(MockModel model)
 {
     model.SetBatchCounts();
     model.SetQueueSizes();
 }