Esempio n. 1
0
        public Container(
            string id,
            string handle,
            IContainerUser user,
            IContainerDirectory directory,
            IContainerPropertyService propertyService,
            ILocalTcpPortManager tcpPortManager,
            JobObject jobObject,
            DiskQuotaControl diskQuotaControl,
            IProcessRunner processRunner,
            IProcessRunner constrainedProcessRunner,
            ProcessHelper processHelper,
            Dictionary <string, string> defaultEnvironment,
            ContainerHostDependencyHelper dependencyHelper
            )
        {
            this.id                       = id;
            this.handle                   = handle;
            this.user                     = user;
            this.directory                = directory;
            this.propertyService          = propertyService;
            this.tcpPortManager           = tcpPortManager;
            this.jobObject                = jobObject;
            this.diskQuotaControl         = diskQuotaControl;
            this.processRunner            = processRunner;
            this.constrainedProcessRunner = constrainedProcessRunner;
            this.processHelper            = processHelper;
            this.dependencyHelper         = dependencyHelper;
            this.defaultEnvironment       = defaultEnvironment ?? new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            this.currentState = ContainerState.Active;
        }
Esempio n. 2
0
        public Container(
            string id,
            string handle,
            IContainerUser user,
            IContainerDirectory directory,
            IContainerPropertyService propertyService,
            ILocalTcpPortManager tcpPortManager,
            JobObject jobObject,
            DiskQuotaControl diskQuotaControl,
            IProcessRunner processRunner,
            IProcessRunner constrainedProcessRunner,
            ProcessHelper processHelper,
            Dictionary<string, string> defaultEnvironment,
            ContainerHostDependencyHelper dependencyHelper
            )
        {
            this.id = id;
            this.handle = handle;
            this.user = user;
            this.directory = directory;
            this.propertyService = propertyService;
            this.tcpPortManager = tcpPortManager;
            this.jobObject = jobObject;
            this.diskQuotaControl = diskQuotaControl;
            this.processRunner = processRunner;
            this.constrainedProcessRunner = constrainedProcessRunner;
            this.processHelper = processHelper;
            this.dependencyHelper = dependencyHelper;
            this.defaultEnvironment = defaultEnvironment ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

            this.currentState = ContainerState.Active;
        }
Esempio n. 3
0
 public IContainer CreateContainer(string id,
                                   string handle,
                                   IContainerUser user,
                                   IContainerDirectory directory,
                                   IContainerPropertyService propertyService,
                                   ILocalTcpPortManager tcpPortManager,
                                   JobObject jobObject,
                                   IContainerDiskQuota containerDiskQuota,
                                   IProcessRunner processRunner,
                                   IProcessRunner constrainedProcessRunner,
                                   ProcessHelper processHelper,
                                   Dictionary <string, string> defaultEnvironment,
                                   ContainerHostDependencyHelper dependencyHelper,
                                   BindMount[] bindMounts)
 {
     return(new Container(
                id,
                handle,
                user,
                directory,
                propertyService,
                tcpPortManager,
                jobObject,
                containerDiskQuota,
                processRunner,
                constrainedProcessRunner,
                processHelper,
                defaultEnvironment,
                dependencyHelper,
                bindMounts
                ));
 }
Esempio n. 4
0
        public AbstractApp(
            IComponentContext componentContext,
            ILogFactory logFactory
            )
        {
            _componentContext    = componentContext;
            _localTcpPortManager = componentContext.Resolve <ILocalTcpPortManager>();
            _appSettings         = componentContext.Resolve <IAppSettings>();

            _log = logFactory.CreateForType(this);
        }
        public AbstractService(
            IComponentContext componentContext,
            ILogFactory logFactory
            )
        {
            _logicHandler        = componentContext.Resolve <ICqrsLogicHandler>();
            _eventPublisher      = componentContext.Resolve <IEventPublisher>();
            _localTcpPortManager = componentContext.Resolve <ILocalTcpPortManager>();
            _appSettings         = componentContext.Resolve <IAppSettings>();

            _log = logFactory.CreateForType(this);
        }
Esempio n. 6
0
 internal ContainerService(ContainerHandleHelper handleHelper, IUserManager userManager, IFileSystemManager fileSystem, IContainerPropertyService containerPropertiesService, ILocalTcpPortManager tcpPortManager, IProcessRunner processRunner, IContainerHostService containerHostService, IDiskQuotaManager diskQuotaManager, IContainerDirectoryFactory directoryFactory, string containerBasePath)
 {
     this.handleHelper = handleHelper;
     this.userManager  = userManager;
     this.fileSystem   = fileSystem;
     this.containerPropertiesService = containerPropertiesService;
     this.tcpPortManager             = tcpPortManager;
     this.processRunner        = processRunner;
     this.containerHostService = containerHostService;
     this.containerBasePath    = containerBasePath;
     this.diskQuotaManager     = diskQuotaManager;
     this.directoryFactory     = directoryFactory;
 }
 internal ContainerService(ContainerHandleHelper handleHelper, IUserManager userManager, IFileSystemManager fileSystem, IContainerPropertyService containerPropertiesService, ILocalTcpPortManager tcpPortManager, IProcessRunner processRunner, IContainerHostService containerHostService, IDiskQuotaManager diskQuotaManager, IContainerDirectoryFactory directoryFactory, string containerBasePath)
 {
     this.handleHelper = handleHelper;
     this.userManager = userManager;
     this.fileSystem = fileSystem;
     this.containerPropertiesService = containerPropertiesService;
     this.tcpPortManager = tcpPortManager;
     this.processRunner = processRunner;
     this.containerHostService = containerHostService;
     this.containerBasePath = containerBasePath;
     this.diskQuotaManager = diskQuotaManager;
     this.directoryFactory = directoryFactory;
 }
            public IContainer CreateContainer(string id,
                                              string handle,
                                              IContainerUser user,
                                              IContainerDirectory directory,
                                              IContainerPropertyService propertyService,
                                              ILocalTcpPortManager tcpPortManager,
                                              JobObject jobObject,
                                              IContainerDiskQuota containerDiskQuota,
                                              IProcessRunner processRunner,
                                              IProcessRunner constrainedProcessRunner,
                                              ProcessHelper processHelper,
                                              Dictionary <string, string> defaultEnvironment,
                                              ContainerHostDependencyHelper dependencyHelper,
                                              BindMount[] bindMounts)
            {
                if (handle == "KnownBadHandle")
                {
                    var badContainer = Substitute.For <IContainer>();
                    badContainer.Handle.Returns("KnownBadHandle");
                    badContainer.When(x => x.Destroy()).Do(x => { if (destroyCount++ == 0)
                                                                  {
                                                                      throw new Exception();
                                                                  }
                                                           });

                    return(badContainer);
                }
                else
                {
                    return(new Container(
                               id,
                               handle,
                               user,
                               directory,
                               propertyService,
                               tcpPortManager,
                               jobObject,
                               containerDiskQuota,
                               processRunner,
                               constrainedProcessRunner,
                               processHelper,
                               defaultEnvironment,
                               dependencyHelper,
                               bindMounts
                               ));
                }
            }
 public void Setup()
 {
     _localTcpPortManager = TestApplicationState.Container.Resolve <ILocalTcpPortManager>();
 }