コード例 #1
0
 public SecurityDepositReturnService(ISecurityDepositReturnRepository depositReturnRepository, ILeaseRepository leaseRepository, ILeaseService leaseService, ClaimsPrincipal user)
 {
     _securityDepositReturnRepository = depositReturnRepository;
     _leaseRepository = leaseRepository;
     _leaseService    = leaseService;
     _user            = user;
 }
コード例 #2
0
ファイル: LeaseTermService.cs プロジェクト: asanchezr/PSP
 public LeaseTermService(Repositories.ILeaseTermRepository leaseTermRepository, Repositories.ILeaseRepository leaseRepository, ILeaseService leaseService, ClaimsPrincipal user)
 {
     _leaseTermRepository = leaseTermRepository;
     _leaseRepository     = leaseRepository;
     _leaseService        = leaseService;
     _user = user;
 }
コード例 #3
0
        public ContactService(
            IRepository<ElasticContact> contactRepo,
            IContactIdentityMapService contactIdentityService,
            ILeaseService contactLeaseService,
            IDateTimeController dateTime)
        {
            if (contactRepo == null)
            {
                throw new ArgumentNullException("contactRepo");
            }

            if (contactIdentityService == null)
            {
                throw new ArgumentNullException("contactIdentityService");
            }

            if (contactLeaseService == null)
            {
                throw new ArgumentNullException("contactLeaseService");
            }

            if (dateTime == null)
            {
                throw new ArgumentNullException("dateTime");
            }

            this.contactRepo = contactRepo;
            this.contactIdentityService = contactIdentityService;
            this.contactLeaseService = contactLeaseService;
            this.dateTime = dateTime;
        }
コード例 #4
0
 public LeaseController(ILeaseService leaseService, IPropertyService propertyService, IStatusService statusService, IRepairService repairService, ICommonListService commonListService, ITenantService tenantService)
 {
     _leaseService      = leaseService;
     _propertyService   = propertyService;
     _statusService     = statusService;
     _commonListService = commonListService;
     _tenantService     = tenantService;
 }
コード例 #5
0
ファイル: VaultHostedService.cs プロジェクト: BillZiss/Convey
 public VaultHostedService(IVaultClient client, ILeaseService leaseService, VaultOptions options,
                           ILogger <VaultHostedService> logger)
 {
     _client       = client;
     _leaseService = leaseService;
     _options      = options;
     _logger       = logger;
     _interval     = 5;
 }
コード例 #6
0
 public VaultHostedService(IVaultClient client, ILeaseService leaseService, ICertificatesIssuer certificatesIssuer,
                           ICertificatesService certificatesService, VaultOptions options, ILogger <VaultHostedService> logger)
 {
     _client              = client;
     _leaseService        = leaseService;
     _certificatesIssuer  = certificatesIssuer;
     _certificatesService = certificatesService;
     _options             = options;
     _logger              = logger;
     _interval            = _options.RenewalsInterval <= 0 ? 10 : _options.RenewalsInterval;
 }
コード例 #7
0
 public void TryObtainLock_NoLeaseExists_LockObtained(
     ILeaseService service,
     ISystemContext ctx,
     ElasticLease lease,
     TestIndexUtils contactIndex)
 {
     using (contactIndex)
     {
         ElasticLease winner;
         service.TryObtainLock(lease, ctx, out winner).Should().BeTrue();
         lease.ShouldBeEquivalentTo(winner);
     }
 }
コード例 #8
0
        public SqlServerProvider(string connectionString,
                                 ILogger logger                   = null,
                                 ILeaseService leaseService       = null,
                                 IResourceService resourceService = null,
                                 IClientService clientService     = null)
        {
            this.connectionString = connectionString;
            this.store            = new ResourceGroupStore();

            if (logger == null)
            {
                this.logger = new NullLogger();
            }
            else
            {
                this.logger = logger;
            }

            if (leaseService == null)
            {
                this.leaseService = new LeaseService(this.connectionString, this.logger);
            }
            else
            {
                this.leaseService = leaseService;
            }

            if (resourceService == null)
            {
                this.resourceService = new ResourceService(this.connectionString);
            }
            else
            {
                this.resourceService = resourceService;
            }

            if (clientService == null)
            {
                this.clientService = new ClientService(this.connectionString);
            }
            else
            {
                this.clientService = clientService;
            }

            this.clientId    = Guid.NewGuid();
            this.coordinator = new Coordinator(this.logger, this.resourceService, this.clientService, this.store);
            this.follower    = new Follower(this.logger, this.clientService, this.store);
        }
コード例 #9
0
        public BaseValidationMessageHandler(
            IOptionsSnapshot <ValidationConfiguration> validationConfigsAccessor,
            IEntityService <TEntity> entityService,
            IValidationSetProvider <TEntity> validationSetProvider,
            IValidationSetProcessor validationSetProcessor,
            IValidationOutcomeProcessor <TEntity> validationOutcomeProcessor,
            ILeaseService leaseService,
            IPackageValidationEnqueuer validationEnqueuer,
            IFeatureFlagService featureFlagService,
            ITelemetryService telemetryService,
            ILogger logger)
        {
            if (validationConfigsAccessor == null)
            {
                throw new ArgumentNullException(nameof(validationConfigsAccessor));
            }

            if (validationConfigsAccessor.Value == null)
            {
                throw new ArgumentException(
                          $"The {nameof(IOptionsSnapshot<ValidationConfiguration>)}.{nameof(IOptionsSnapshot<ValidationConfiguration>.Value)} property cannot be null",
                          nameof(validationConfigsAccessor));
            }

            if (validationConfigsAccessor.Value.MissingPackageRetryCount < 1)
            {
                throw new ArgumentOutOfRangeException(
                          nameof(validationConfigsAccessor),
                          $"{nameof(ValidationConfiguration)}.{nameof(ValidationConfiguration.MissingPackageRetryCount)} must be at least 1");
            }

            _configs                    = validationConfigsAccessor.Value;
            _entityService              = entityService ?? throw new ArgumentNullException(nameof(entityService));
            _validationSetProvider      = validationSetProvider ?? throw new ArgumentNullException(nameof(validationSetProvider));
            _validationSetProcessor     = validationSetProcessor ?? throw new ArgumentNullException(nameof(validationSetProcessor));
            _validationOutcomeProcessor = validationOutcomeProcessor ?? throw new ArgumentNullException(nameof(validationOutcomeProcessor));
            _leaseService               = leaseService ?? throw new ArgumentNullException(nameof(leaseService));
            _validationEnqueuer         = validationEnqueuer ?? throw new ArgumentNullException(nameof(leaseService));
            _featureFlagService         = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
            _telemetryService           = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
        }
コード例 #10
0
 public PackageValidationMessageHandler(
     IOptionsSnapshot <ValidationConfiguration> validationConfigsAccessor,
     IEntityService <Package> entityService,
     IValidationSetProvider <Package> validationSetProvider,
     IValidationSetProcessor validationSetProcessor,
     IValidationOutcomeProcessor <Package> validationOutcomeProcessor,
     ILeaseService leaseService,
     IPackageValidationEnqueuer validationEnqueuer,
     IFeatureFlagService featureFlagService,
     ITelemetryService telemetryService,
     ILogger <PackageValidationMessageHandler> logger) : base(
         validationConfigsAccessor,
         entityService,
         validationSetProvider,
         validationSetProcessor,
         validationOutcomeProcessor,
         leaseService,
         validationEnqueuer,
         featureFlagService,
         telemetryService,
         logger)
 {
 }
コード例 #11
0
        public void TryObtainLock_InactiveLeaseExistsByDifferentOwner_LockObtained(
            ILeaseService service,
            ISystemContext ctx,
            ElasticLease owner1InactiveLease,
            TestIndexUtils contactIndex,
            IFixture fixture)
        {
            using (contactIndex)
            {
                service.TryObtainLock(owner1InactiveLease, ctx, out owner1InactiveLease).Should().BeTrue();

                var owner2ActiveLease = new ElasticLease(
                    owner1InactiveLease.ResourceId,
                    DateTime.UtcNow + TimeSpan.FromHours(2),
                    fixture.Create<ElasticLeaseOwner>(),
                    owner1InactiveLease.Version);

                ElasticLease winner;
                service.TryObtainLock(owner2ActiveLease, ctx, out winner).Should().BeTrue();
                owner2ActiveLease.ShouldBeEquivalentTo(winner);
            }
        }
コード例 #12
0
 public LandlordController(IHomeService homeService, ILeaseService leaseService)
 {
     _homeService  = homeService;
     _leaseService = leaseService;
 }
コード例 #13
0
        public void DeleteContact_ContactExistsWithActiveLeaseByDifferentOwner_DeleteStillHonoured(
            IElasticAnalyticsContactService contactService,
            ILeaseService leaseService,
            ElasticContact contact,
            ElasticLeaseOwner us,
            ElasticLeaseOwner them,
            ISystemContext ctx,
            TestIndexUtils contactIndex)
        {
            using (contactIndex)
            {
                contactService.Save(contact, them, false, ctx).Should().BeTrue();

                // deletes seem to be brutal
                contactService.Delete(contact.Id, ctx);

                contactService
                    .LoadForReadOnly(contact.Id, ctx)
                    .Should()
                    .BeNull();

                // lease is deleted so if we wanted, we can just go and create another contact with the
                // same id straight away...
                contact.Lease = null;
                contactService.Save(contact, us, false, ctx).Should().BeTrue();
            }
        }
コード例 #14
0
 public void DeleteContact_ContactDoesntExist_ReturnsSuccessfully(
     IElasticAnalyticsContactService contactService,
     ILeaseService leaseService,
     ElasticContact contact,
     ElasticLeaseOwner us,
     ElasticLeaseOwner them,
     ISystemContext ctx,
     TestIndexUtils contactIndex) 
 {
     using (contactIndex)
     {
         AssertionExtensions.ShouldNotThrow(() => 
             contactService.Delete(contact.Id, ctx));
     }
 }
コード例 #15
0
        public void TryObtainLock_InactiveLeaseExistsBySameOwner_LockObtained(
            ILeaseService service,
            ISystemContext ctx,
            ElasticLease inactiveLease,
            TestIndexUtils contactIndex)
        {
            using (contactIndex)
            {
                // write inactive lease
                service.TryObtainLock(inactiveLease, ctx, out inactiveLease).Should().BeTrue();

                var activeLease = new ElasticLease(
                    inactiveLease.ResourceId,
                    DateTime.UtcNow + TimeSpan.FromHours(1),
                    inactiveLease.Owner,
                    inactiveLease.Version);

                ElasticLease winner;
                service.TryObtainLock(activeLease, ctx, out winner).Should().BeTrue();
                activeLease.ShouldBeEquivalentTo(winner);
            }
        }
コード例 #16
0
 public HomeController(ILeaseService serv)
 {
     leaseService = serv;
 }
コード例 #17
0
        public void TryObtainLock_ActiveLeaseExistsBySameOwner_LockObtained(
            ILeaseService service,
            ISystemContext ctx,
            ElasticLease activeLease,
            TestIndexUtils contactIndex,
            IFixture fixture
            )
        {
            using (contactIndex)
            {
                service.TryObtainLock(activeLease, ctx, out activeLease);

                var activeLease2 = new ElasticLease(
                    activeLease.ResourceId,
                    DateTime.UtcNow + TimeSpan.FromHours(2),
                    activeLease.Owner,
                    activeLease.Version);

                ElasticLease winner;
                service.TryObtainLock(activeLease2, ctx, out winner);
                activeLease2.ShouldBeEquivalentTo(winner);
            }
        }
コード例 #18
0
 public LeasesController(ILeaseService serv, IStudentsService studServ, IBooksService bookServ)
 {
     leasesService   = serv;
     studentsService = studServ;
     booksService    = bookServ;
 }
コード例 #19
0
        public void TryObtainLock_ActiveLeaseExistsByDifferentOwner_LockRefused(
            ILeaseService service,
            ISystemContext ctx,
            ElasticLease owner1ActiveLease,
            TestIndexUtils contactIndex,
            IFixture fixture)
        {
            using (contactIndex)
            {
                ElasticLease winner;
                service.TryObtainLock(owner1ActiveLease, ctx, out winner).Should().BeTrue();

                var owner2ActiveLease = new ElasticLease(
                    winner.ResourceId,
                    DateTime.UtcNow + TimeSpan.FromHours(1),
                    fixture.Create<ElasticLeaseOwner>(),
                    winner.Version);

                service.TryObtainLock(owner2ActiveLease, ctx, out winner).Should().BeFalse();
            }
        }