Example #1
0
        public void TestFactoryReturnsConnector240OpenEngSBVersionWithUsernamePassword()
        {
            OpenEngSB300.SetSupport();
            IDomainFactory factory = DomainFactoryProvider.GetDomainFactoryInstance <String>(Version240, NullString, NullString, NullExceptionHandler, Username, Password);

            Assert.IsNotNull(factory);
        }
Example #2
0
        public void TestFactoryReturnsConnector300OpenEngSBVersion()
        {
            OpenEngSB300.SetSupport();
            IDomainFactory factory = DomainFactoryProvider.GetDomainFactoryInstance <String>(Version300, NullString, NullString);

            Assert.IsNotNull(factory);
        }
        public override void Init()
        {
            uuid = Guid.NewGuid().ToString();
            ExampleDomainConnector exampleDomain = new ExampleDomainConnector();

            factory = DomainFactoryProvider.GetDomainFactoryInstance(Version, Destination, exampleDomain, new ForwardDefaultExceptionHandler(), Username, Password);
        }
        public override void Init()
        {
            exceptionHandler = new RetryDefaultExceptionHandler();
            ExampleDomainConnector exampleDomain = new ExampleDomainConnector();

            factory = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", Destination, exampleDomain, exceptionHandler);
        }
Example #5
0
 public PersonsStorage(ILogger logger, IDomainFactory domainFactory,
                       IEventStreamStorage <PersonAggregate> eventStreamStorage,
                       IRepository repository)
 {
     this.queryStorage    = new GeneralQueryStorage <Person>(logger, domainFactory, repository);
     this.eventingStorage = eventStreamStorage;
 }
Example #6
0
 public PersonStorage(IRecorder recorder, IDomainFactory domainFactory,
                      IEventStreamStorage <PersonEntity> eventStreamStorage,
                      IRepository repository)
 {
     this.queryStorage    = new GeneralQueryStorage <Person>(recorder, domainFactory, repository);
     this.eventingStorage = eventStreamStorage;
 }
Example #7
0
        public void TestFactoryReturnsConnector300OpenEngSBVersionWithExceptionHandlerParameter()
        {
            OpenEngSB300.SetSupport();
            IDomainFactory factory = DomainFactoryProvider.GetDomainFactoryInstance <String>(Version300, NullString, NullString, forwardDefaultExceptionHandler);

            Assert.IsNotNull(factory);
        }
Example #8
0
        public HomeController(IDataSource dataSource, IDomainFactory domainFactory)
        {
            Contract.Requires(dataSource != null);
            Contract.Requires(domainFactory != null);

            domain = domainFactory.Create(dataSource);
        }
        private PhilosopherRunner[] CreatePhilosopherRunners(TableType tableType, int count)
        {
            IDomainFactory domainFactory = domainFactory_(tableType);

            Philosopher[]       philosophers = domainFactory.CreateDiningPhilosophers(count);
            PhilosopherRunner[] runners      = philosophers.Select(_ => new PhilosopherRunner(_)).ToArray();
            return(runners);
        }
Example #10
0
 /// <summary>
 /// Sets up the context with the appropriate dependencies.
 /// </summary>
 /// <param name="repository">The repository for the domain.</param>
 /// <param name="domainFactory">The domain instance factory for the domain.</param>
 /// <param name="queryFactory">The query factory for the domain.</param>
 public static void Setup(IRepository repository,
                          IDomainFactory domainFactory,
                          IQueryFactory queryFactory)
 {
     _contextStorage.SetData(StorageKeyRepository, repository);
     _contextStorage.SetData(StorageKeyDomainFactory, domainFactory);
     _contextStorage.SetData(StorageKeyQueryFactory, queryFactory);
 }
Example #11
0
 public CreateInstitute(IDomainFactory domainFactory, IInstituteRepository instituteRepository,
                        IInstituteObserver instituteObserver, string name)
 {
     this.domainFactory       = domainFactory;
     this.instituteRepository = instituteRepository;
     this.name = name;
     this.instituteObserver = instituteObserver;
 }
        public void TestRetryExceptionHandlerRetiesTheMethod()
        {
            IDomainFactory factory = DomainFactoryProvider.GetDomainFactoryInstance(Version, "FooBar", new ExampleDomainConnector(), new RetryDefaultExceptionHandler());

            // Visual Studio unit tests does not work, when a threads are used.
            factory.StopAllConnections();
            factory.CreateDomainService(DomainName);
        }
Example #13
0
        public void CreateBusinessObjects()
        {
            IDomainFactory factory = this.container.Resolve <IDomainFactory>("AddressFactory");

            Address ad = (Address)factory.CreateDomainObject();

            Assert.IsTrue(ad != null);
        }
 public EvaluationService(IUnitOfWork unitOfWork,
                          ISubjectFactory subjectFactory,
                          IDomainFactory domainFactory)
     : base(unitOfWork)
 {
     this.subjectFactory = subjectFactory;
     this.domainFactory  = domainFactory;
 }
Example #15
0
        public TEntity ToEntity <TEntity>(IDomainFactory domainFactory)
            where TEntity : IQueryableEntity, new()
        {
            domainFactory.GuardAgainstNull(nameof(domainFactory));

            var properties = ConvertToDomainProperties(domainFactory);

            return(properties.FromObjectDictionary <TEntity>());
        }
Example #16
0
 public DefaultController(IDomainFactory domainFactory, INobleRepository nobleRepository, IInstituteRepository instituteRepository,
                          IUIFactory uifactory, ICommandProcessor commandProcessor)
 {
     this.domainFactory       = domainFactory;
     this.uiFactory           = uifactory;
     this.nobleRepository     = nobleRepository;
     this.instituteRepository = instituteRepository;
     this.commandProcessor    = commandProcessor;
 }
Example #17
0
 public GeneralQueryStorage(ILogger logger, IDomainFactory domainFactory, IRepository repository)
 {
     logger.GuardAgainstNull(nameof(logger));
     repository.GuardAgainstNull(nameof(repository));
     domainFactory.GuardAgainstNull(nameof(domainFactory));
     this.logger        = logger;
     this.repository    = repository;
     this.domainFactory = domainFactory;
     this.containerName = typeof(TDto).GetEntityNameSafe();
 }
Example #18
0
        public TEntity ToDomainEntity <TEntity>(IDomainFactory domainFactory)
            where TEntity : IPersistableEntity
        {
            domainFactory.GuardAgainstNull(nameof(domainFactory));

            var domainProperties = ConvertToDomainProperties(domainFactory);
            var result           = domainFactory.RehydrateEntity(typeof(TEntity), domainProperties);

            return((TEntity)result);
        }
Example #19
0
 public RegisterNoble(IDomainFactory domainFactory, IInstituteRepository instituteRepository,
                      INobleRepository nobleRepository, INobleObserver nobleObserver, string title, int instituteId)
 {
     this.domainFactory       = domainFactory;
     this.instituteRepository = instituteRepository;
     this.nobleRepository     = nobleRepository;
     this.nobleObserver       = nobleObserver;
     this.title       = title;
     this.instituteId = instituteId;
 }
Example #20
0
        public async Task <IActionResult> Update([FromRoute] Guid?id, [FromBody] Domain domain)
        {
            IActionResult result = null;

            try
            {
                if (result == null && (!id.HasValue || id.Value.Equals(Guid.Empty)))
                {
                    result = BadRequest("Missing domain id value");
                }
                if (result == null && domain == null)
                {
                    result = BadRequest("Missing domain data");
                }
                if (result == null && string.IsNullOrEmpty(domain.Name))
                {
                    result = BadRequest("Missing domain name value");
                }
                if (result == null)
                {
                    using ILifetimeScope scope = _container.BeginLifetimeScope();
                    SettingsFactory settingsFactory = scope.Resolve <SettingsFactory>();
                    CoreSettings    settings        = settingsFactory.CreateAccount(_settings.Value);
                    IDomainFactory  domainFactory   = scope.Resolve <IDomainFactory>();
                    IDomain         innerDomain     = await domainFactory.Get(settings, id.Value);

                    if (result == null && innerDomain == null)
                    {
                        result = NotFound();
                    }
                    if (result == null && !UserCanAccessAccount(innerDomain.AccountId))
                    {
                        result = StatusCode(StatusCodes.Status401Unauthorized);
                    }
                    if (result == null)
                    {
                        IMapper mapper = MapperConfigurationFactory.CreateMapper();
                        mapper.Map <Domain, IDomain>(domain, innerDomain);
                        IDomainSaver saver = scope.Resolve <IDomainSaver>();
                        await saver.Update(settings, innerDomain);

                        result = Ok(mapper.Map <Domain>(innerDomain));
                    }
                }
            }
            catch (Exception ex)
            {
                using (ILifetimeScope scope = _container.BeginLifetimeScope())
                {
                    await LogException(ex, scope.Resolve <IExceptionService>(), scope.Resolve <SettingsFactory>(), _settings.Value);
                }
                result = StatusCode(StatusCodes.Status500InternalServerError);
            }
            return(result);
        }
Example #21
0
        public PaymentStorage(ILogger logger, IDomainFactory domainFactory,
                              IEventStreamStorage <PaymentEntity> eventStreamStorage,
                              IRepository repository)
        {
            logger.GuardAgainstNull(nameof(logger));
            domainFactory.GuardAgainstNull(nameof(domainFactory));
            eventStreamStorage.GuardAgainstNull(nameof(eventStreamStorage));
            repository.GuardAgainstNull(nameof(repository));

            this.eventingStorage = eventStreamStorage;
        }
Example #22
0
 public GeneralCommandStorage(IRecorder recorder, IDomainFactory domainFactory,
                              IRepository repository)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     domainFactory.GuardAgainstNull(nameof(domainFactory));
     repository.GuardAgainstNull(nameof(repository));
     this.recorder      = recorder;
     this.domainFactory = domainFactory;
     this.repository    = repository;
     this.containerName = typeof(TEntity).GetEntityNameSafe();
 }
Example #23
0
 public ChangeOrganizationCommandHandler(IAmACommandProcessor commandProcessor,
                                         IOrganizationRepository repository,
                                         IDomainFactory domainFactory,
                                         IDomainTracking <Organization> domainTracking,
                                         ILog logger) : base(logger)
 {
     _commandProcessor = commandProcessor;
     _repository       = repository;
     _domainFactory    = domainFactory;
     _domainTracking   = domainTracking;
 }
Example #24
0
        public void TestGetCustomerById()
        {
            int entityId = custTestId;

            IUnityContainer container = GenericSingleton <ComponentContainer> .GetInstance().Container;

            IDomainFactory factory = container.Resolve <CustomerFactory>();

            IDomainObject c = factory.GetBusinessEntityById(entityId);

            Assert.AreEqual(entityId, c.BusinessEntityID);
        }
 /// <summary>
 /// Creates/Registers the connector at the OpenEngSB and registers the connector to XLink
 /// </summary>
 public void connectToOpenEngSbWithXLink()
 {
     outputLine("Trying to connect to OpenEngSB and XLink...");
     ooSourceConnector = new OOSourceCodeConnector();
     factory           = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", xlinkServerURL, ooSourceConnector, new ForwardDefaultExceptionHandler());
     connectorUUID     = factory.CreateDomainService(domainId);
     factory.RegisterConnector(connectorUUID, domainId);
     blueprint = factory.ConnectToXLink(connectorUUID, hostIp, programname, initModelViewRelation());
     setCurrentlyInstalledTools(blueprint.registeredTools);
     connected = true;
     outputLine("Connecting done.");
 }
 public ReadModelCheckpointStore(IRecorder recorder, IIdentifierFactory idFactory,
                                 IDomainFactory domainFactory, IRepository repository)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     idFactory.GuardAgainstNull(nameof(idFactory));
     repository.GuardAgainstNull(nameof(repository));
     domainFactory.GuardAgainstNull(nameof(domainFactory));
     this.recorder      = recorder;
     this.idFactory     = idFactory;
     this.repository    = repository;
     this.domainFactory = domainFactory;
 }
Example #27
0
        public void TestGetPhoneByMasterId()
        {
            int masterId = 504438;

            IUnityContainer container = GenericSingleton <ComponentContainer> .GetInstance().Container;

            IDomainFactory factory = container.Resolve <PhoneFactory>();

            Phone ph = (Phone)factory.GetBusinessEntityByMasterEntityId(masterId);

            Assert.AreEqual(masterId, ph.customerId);
        }
Example #28
0
        public void TestGetPhoneById()
        {
            int entityId = phoneTestId;

            IUnityContainer container = GenericSingleton <ComponentContainer> .GetInstance().Container;

            IDomainFactory factory = container.Resolve <PhoneFactory>();

            Phone ph = (Phone)factory.GetBusinessEntityById(entityId);

            Assert.AreEqual(entityId, ph.BusinessEntityID);
        }
 public GeneralEventStreamStorage(IRecorder recorder, IDomainFactory domainFactory,
                                  IChangeEventMigrator migrator, IRepository repository)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     repository.GuardAgainstNull(nameof(repository));
     domainFactory.GuardAgainstNull(nameof(domainFactory));
     migrator.GuardAgainstNull(nameof(migrator));
     this.recorder      = recorder;
     this.repository    = repository;
     this.domainFactory = domainFactory;
     this.migrator      = migrator;
     this.containerName = typeof(TAggregateRoot).GetEntityNameSafe();
 }
Example #30
0
        public CarStorage(IRecorder recorder, IDomainFactory domainFactory,
                          IEventStreamStorage <CarEntity> eventStreamStorage,
                          IRepository repository)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            domainFactory.GuardAgainstNull(nameof(domainFactory));
            eventStreamStorage.GuardAgainstNull(nameof(eventStreamStorage));
            repository.GuardAgainstNull(nameof(repository));

            this.carQueryStorage              = new GeneralQueryStorage <Car>(recorder, domainFactory, repository);
            this.carEventStreamStorage        = eventStreamStorage;
            this.unavailabilitiesQueryStorage =
                new GeneralQueryStorage <Unavailability>(recorder, domainFactory, repository);
        }
Example #31
0
        public ClinicStorage(ILogger logger, IDomainFactory domainFactory,
                             IEventStreamStorage <ClinicEntity> eventStreamStorage,
                             IRepository repository)
        {
            logger.GuardAgainstNull(nameof(logger));
            domainFactory.GuardAgainstNull(nameof(domainFactory));
            eventStreamStorage.GuardAgainstNull(nameof(eventStreamStorage));
            repository.GuardAgainstNull(nameof(repository));

            this.doctorQueryStorage           = new GeneralQueryStorage <Doctor>(logger, domainFactory, repository);
            this.clinicEventStreamStorage     = eventStreamStorage;
            this.unavailabilitiesQueryStorage =
                new GeneralQueryStorage <Unavailability>(logger, domainFactory, repository);
        }
 public CallbackNumbersController(IDomainFactory domainFactory)
 {
     _domainFactory = domainFactory;
 }
 public override void Init()
 {
     uuid = Guid.NewGuid().ToString();
     ExampleDomainConnector exampleDomain = new ExampleDomainConnector();
     factory = DomainFactoryProvider.GetDomainFactoryInstance(Version, Destination, exampleDomain, new ForwardDefaultExceptionHandler(), Username, Password);
 }
 /// <summary>
 /// Creates/Registers the connector at the OpenEngSB and registers the connector to XLink
 /// </summary>
 public void connectToOpenEngSbWithXLink()
 {
     outputLine("Trying to connect to OpenEngSB and XLink...");
     ooSourceConnector = new OOSourceCodeConnector();
     factory = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", xlinkServerURL, ooSourceConnector, new ForwardDefaultExceptionHandler());
     connectorUUID = factory.CreateDomainService(domainId);
     factory.RegisterConnector(connectorUUID, domainId);
     blueprint = factory.ConnectToXLink(connectorUUID, hostIp, programname, initModelViewRelation());
     setCurrentlyInstalledTools(blueprint.registeredTools);
     connected = true;
     outputLine("Connecting done.");
 }
 public override void Init()
 {
     IOOSourceCodeDomainSoapBinding exampleDomain = new OOSourceCodeDomainConnector();
     factory = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", Destination, exampleDomain, new ForwardDefaultExceptionHandler());
 }
 public override void Init()
 {
     exceptionHandler = new RetryDefaultExceptionHandler();
     ExampleDomainConnector exampleDomain = new ExampleDomainConnector();
     factory = DomainFactoryProvider.GetDomainFactoryInstance("3.0.0", Destination, exampleDomain, exceptionHandler);
 }
 public ServiceConnectorManager()
 {
     _configurations = null;
     _domainFactory = DomainFactoryProvider.GetDomainFactoryInstance();
     _State = State.DISCONNECTED;
 }