Ejemplo n.º 1
0
        public void CanBeUsedWithTheUsingCSharpIdiomToAttemptOnAnISync()
        {
            // no expectations
            mocks.ReplayAll();

            MySemaphore sync = new MySemaphore(1);
            using (new SyncHolder(sync, 100))
            {
                Assert.AreEqual(0, sync.Permits);
            }
            Assert.AreEqual(1, sync.Permits);

            sync = new MySemaphore(0);
            try
            {
                using (new SyncHolder(sync, 100))
                {
                    Assert.IsTrue(false, "wrongly entered sync block");
                }
            }
            catch (TimeoutException)
            {
                Assert.AreEqual(0, sync.Permits);
            }
        }
Ejemplo n.º 2
0
 public bool TryToCauseAnError (ISync sync, long msecs)
 {
     new Thread(new ThreadStart(Go)).Start();
     bool got = sync.Attempt(msecs);
     _resetEvent.Set();
     return got;
 }
 public void SetUp ()
 {
     nReconfigured = 0;
     appName = Guid.NewGuid().ToString();
     application = new Application(appName);
     Directory.CreateDirectory(application.FullPath);
     manager = new ApplicationWatcherManager(application, 10);
     manager.Reconfigured += new EventHandler(manager_Reconfigured);
     reconfigured = new Semaphore(0);
 }
Ejemplo n.º 4
0
        public void SetUp ()
        {
            _path = Path.GetFullPath(Guid.NewGuid().ToString());
            Directory.CreateDirectory(_path);
            monitor = new FileSystemMonitor(_path);
            monitor.Start();
            tester = new FileSystemMonitorTester(_path);
            sync = new Semaphore(0);
            msecs = 1000;

            aFile = "foo.txt";
        }
Ejemplo n.º 5
0
 public void AddSync(ISync Sync)
 {
     if (_syncs.ContainsKey(Sync.Name))
     {
         throw new Exception("Sync Name already exists in the SyncManager.");
     }
     else
     {
         lock(_locker)
         {
             _syncs.Add(Sync.Name, Sync);
         }
     }
 }
Ejemplo n.º 6
0
		static NamesValuesPair DumpSyncTrait(ISync sync)
		{
			var type = sync.GetType();
			TypeInfo typeInfo;
			lock (typeInfoCache)
				typeInfo = typeInfoCache[type];
			var values = new object[typeInfo.Names.Length];
			var index = 0;

			foreach (var func in typeInfo.SerializableCopyOfMemberFunctions)
				values[index++] = func(sync);

			return Pair.New(typeInfo.Names, values);
		}
Ejemplo n.º 7
0
        /// <summary>
        /// Creates a new <see cref="SyncHolder"/> trying to <see cref="ISync.Acquire"/> the given 
        /// <see cref="ISync"/>
        /// </summary>
        /// <param name="sync">the <see cref="ISync"/> to be held</param>
	    public SyncHolder (ISync sync)
	    {
            Init (sync);
	    }
Ejemplo n.º 8
0
 public void SetUp()
 {
     mocks = new MockRepository();
     sync  = (ISync)mocks.CreateMock(typeof(ISync));
 }
Ejemplo n.º 9
0
 public Worker(ISync startPermit, ISync workedSync)
 {
     this.startPermit = startPermit;
     this.workedSync  = workedSync;
 }
Ejemplo n.º 10
0
 public EstoqueService(IRepository <Estoque> repEstoque, ISync sync)
 {
     _repEstoque = repEstoque;
     _sync       = sync;
 }
Ejemplo n.º 11
0
 public MyService (ISync sync1, ISync sync2)
 {
     this._sync1 = sync1;
     this._sync2 = sync2;
 }
 protected void InitHandler (ISync sync)
 {
     location = new FileSystemDeployLocation (dispatcher, deployPath);
     handler = NewHandler (sync);
 }
Ejemplo n.º 13
0
 public void SetUp ()
 {
     MockApplication.ResetCount();
     started = new Latch();
     new Thread(new ThreadStart(Go)).Start();
     started.Acquire();
     boxTester = new MyListBoxTester("applicationList", form);
     appStatus = new LabelTester("applicationStatus", form);
     serviceStatus = new LabelTester("serviceStatus", form);
 }
Ejemplo n.º 14
0
 internal static int Hash(ISync sync)
 {
     return(GetHashFunction(sync)(sync));
 }
Ejemplo n.º 15
0
 internal static Func <object, int> GetHashFunction(ISync sync)
 {
     return(HashFunctions[sync.GetType()]);
 }
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["InvokeExternalService"] = InvokeExternalService_Process;
 }
Ejemplo n.º 17
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["lookupByPhoneNumber"] = lookupByPhoneNumber_Process;
     processMap_["lookupNearby"]        = lookupNearby_Process;
 }
Ejemplo n.º 18
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["OnEvent"]    = OnEvent_Process;
     processMap_["OnFrameEnd"] = OnFrameEnd_Process;
 }
Ejemplo n.º 19
0
 public static void MarkAsSynced(SqlBase origin, ISync ISync) => MarkAsSynced(origin, ISync.Guid);
Ejemplo n.º 20
0
 /// <summary>
 /// initializes and acquire access to the <see cref="ISync"/>
 /// </summary>
 /// <param name="sync"></param>
 private void Init (ISync sync)
 {
     this._sync = sync;
     _sync.Acquire();
 }
Ejemplo n.º 21
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["SayHello"] = SayHello_Process;
 }
Ejemplo n.º 22
0
 public OldDataDirStream(FqStreamID FQSID, StreamFactory.StreamOp Op, CallerInfo Ci, ISync sync)
     : base(FQSID, Op, Ci, sync)
 {
     if (!typeof(IValue).IsAssignableFrom(typeof(ValType)))
     {
         throw new InvalidDataException("ValType must implement IValue");
     }
 }
 public ExceptionDispatcher (ISync started, ISync canContinue)
 {
     this.started = started;
     this.canContinue = canContinue;
 }
Ejemplo n.º 24
0
 public Processor(ISync iface) : base(iface)
 {
     iface_ = iface;
     processMap_["GetGraspPoses"] = GetGraspPoses_Process;
 }
Ejemplo n.º 25
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["ValidateSDK"] = ValidateSDK_Process;
 }
Ejemplo n.º 26
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["Subscribe"] = Subscribe_Process;
 }
Ejemplo n.º 27
0
 public StoppingHelper (ServiceSupport serviceSupport, ISync stopping, ISync stopped)
 {
     this.stopping = stopping;
     this.stopped = stopped;
     this.serviceSupport = serviceSupport;
 }
Ejemplo n.º 28
0
 public Helper(ISync sync, Latch latch)
 {
     Init(latch, sync, null);
 }
Ejemplo n.º 29
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["GetSomeWork"]  = GetSomeWork_Process;
     processMap_["MealPrepared"] = MealPrepared_Process;
 }
Ejemplo n.º 30
0
 public Helper(Latch latch, ISync sync, IObjectPool objectPool)
 {
     Init(latch, sync, objectPool);
 }
Ejemplo n.º 31
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["getVersion"] = getVersion_Process;
     processMap_["getTime"]    = getTime_Process;
 }
Ejemplo n.º 32
0
 public void Init(Latch latch, ISync sync, IObjectPool objectPool)
 {
     this.sync       = sync;
     this.latch      = latch;
     this.objectPool = objectPool;
 }
Ejemplo n.º 33
0
 public SyncedDeployer(ISync sync)
 {
     this.sync = sync;
 }
Ejemplo n.º 34
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["Invoke"] = Invoke_Process;
 }
Ejemplo n.º 35
0
	    /// <summary>
        /// Creates a new <see cref="SyncHolder"/> trying to <see cref="ISync.Attempt"/> the given 
        /// <see cref="ISync"/>
        /// </summary>
        /// <param name="sync">the <see cref="ISync"/> to be held</param>
        /// <param name="msecs">millisecond to try to acquire the lock</param>
	    public SyncHolder (ISync sync, long msecs)
	    {
            Init(new TimeoutSync(sync, msecs));
	    }
Ejemplo n.º 36
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["secondtestString"] = secondtestString_Process;
 }
Ejemplo n.º 37
0
 public void SetUp ()
 {
     mocks = new MockRepository();
     sync = mocks.StrictMock<ISync>();            
 }
Ejemplo n.º 38
0
 public SyncHash(ISync trait, int hash)
 {
     Trait = trait; Hash = hash;
 }
Ejemplo n.º 39
0
 public void SetUp()
 {
     mocks = new MockRepository();
     sync = (ISync) mocks.CreateMock(typeof(ISync));
 }
Ejemplo n.º 40
0
 public Processor(ISync iface)
 {
     iface_             = iface;
     processMap_["Add"] = Add_Process;
 }
 public void SetUp ()
 {
     base.SetUp_();
     factoryMock = new DynamicMock(typeof(IApplicationWatcherFactory));
     watcherMock = new DynamicMock(typeof(IApplicationWatcher));
     factory = (IApplicationWatcherFactory) factoryMock.Object;
     watcher = (IApplicationWatcher) watcherMock.Object;
     deployEventDispatched = false;
     forwardDispatcherSync = new Latch();
 }
Ejemplo n.º 42
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["GetPlayingUserInfo"] = GetPlayingUserInfo_Process;
 }
 protected void InitHandlerAndStartLocation (ISync sync)
 {
     GC.SuppressFinalize (location);
     InitHandler (sync);
     location.StartWatching ();
 }
Ejemplo n.º 44
0
 public SyncHash(ISync trait)
 {
     Trait = trait; hashFunction = Sync.GetHashFunction(trait);
 }
 protected TestingHandler NewHandler (ISync sync)
 {
     try
     {
         log.Debug("disconnecting testing handler");
         location.DeployEvent -= new DeployEventHandler (dontUseHandler.Handle);
     }
     catch
     {}
     dontUseHandler = new TestingHandler (sync);
     log.Debug("connecting testing handler");
     location.DeployEvent += new DeployEventHandler (dontUseHandler.Handle);
     return dontUseHandler;
 }
 private void LoadPropiedades()
 {
     syncLogRepository = new SyncLogRepository();
     _SistemaRepository = new SistemaRepository();
     _RegistroRepository = new RegistroRepository();
     _ServerLastDataRepository = new ServerLastDataRepository();
     _UploadLogRepository = new UploadLogRepository();
     _EvidenceSyncRepository = new EvidenceSyncRepository();
     _SyncRepository = new SyncRepository();
     _CondProRepository = new CondProRepository();
     _DependenciaRepository = new DependenciaRepository();
     _EstPuntoMedRepository = new EstPuntoMedRepository();
     _EstructuraRepository = new EstructuraRepository();
     _EstructuraDependenciaRepository = new EstructuraDependenciaRepository();
     _PuntoMedicionRepository = new PuntoMedicionRepository();
     _TipoPuntoMedicionRepository = new TipoPuntoMedicionRepository();
     _UnidadMedidaRepository = new UnidadMedidaRepository();
     //_ConsideracionRepository = new ConsideracionRepository();
     //_AccionProtocoloRepository = new AccionProtocoloRepository();
     _CnfSettingRepository = new CnfSettingRepository();
     routeService = ConfigurationManager.AppSettings["RutaServicioSubida"].ToString();
     routeDownload = ConfigurationManager.AppSettings["RutaServicioDescarga"].ToString();
     basicAuthUser = ConfigurationManager.AppSettings["basicAuthUser"].ToString();
     basicAuthPass = ConfigurationManager.AppSettings["basicAuthPass"].ToString();
     contador = int.Parse(ConfigurationManager.AppSettings["ContSettings"].ToString());
     TopLog = int.Parse(ConfigurationManager.AppSettings["TopLog"].ToString());
 }
 public InterruptAgainStrategy(ISync stop, ISync go)
 {
     this.stopSync = stop;
     this.goSync = go;
 }
Ejemplo n.º 48
0
 public Job(int size, int creationTime, int clientSize, ISync start, int executionTime, int repeat)
 {
     this.poolSize = size;
     this.creationTime = creationTime;
     this.clientSize = clientSize;
     this.run = start;
     this.executionTime = executionTime;
     this.repeat = repeat;
 }
Ejemplo n.º 49
0
 public void SetUp ()
 {
     sync1 = new Semaphore(0);
     sync2 = new Semaphore(0);
     serviceable = new MyService(sync1, sync2);
     serviceSupport = new ServiceSupport(serviceable);
 }
Ejemplo n.º 50
0
 public Helper(Latch latch, ISync sync, IObjectPool objectPool)
 {
     Init(latch, sync, objectPool);
 }
Ejemplo n.º 51
0
 public BlockWhileStartingExecutor (ISync starting, ISync started)
 {
     this.starting = starting;
     this.started = started;
 }
Ejemplo n.º 52
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["Search"] = Search_Process;
 }
Ejemplo n.º 53
0
 public Client(int id, ISync run, SimplePool pool, int repeat)
 {
     this.run = run;
     this.pool = pool;
     this.id = id;
     lock (this.GetType())
     {
         created++;
         //Console.Out.WriteLine("#{0} created (created/run: {1}/{2})...", id, created, nRun);
     }
     this.repeat = repeat;
 }
Ejemplo n.º 54
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["notify"] = notify_Process;
 }
Ejemplo n.º 55
0
 public Helper(ISync sync, Latch latch)
 {
     Init(latch, sync, null);
 }
Ejemplo n.º 56
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["SendMessageFromPlatform"] = SendMessageFromPlatform_Process;
 }
Ejemplo n.º 57
0
 public void Init(Latch latch, ISync sync, IObjectPool objectPool)
 {
     this.sync = sync;
     this.latch = latch;
     this.objectPool = objectPool;
 }
Ejemplo n.º 58
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["GetAllBanji"] = GetAllBanji_Process;
 }
Ejemplo n.º 59
0
 public Queuer (IObjectPool pool, IRunnable runnable)
 {
     this.pool = pool;
     this.runnable = runnable;
     this.sync = new Latch();
 }
Ejemplo n.º 60
0
 public Processor(ISync iface)
 {
     iface_ = iface;
     processMap_["TakeScreenShot"] = TakeScreenShot_Process;
 }