public void Persist(Identifier id, string serializedTask)
        {
            _database[id.ToString()] = serializedTask;

            if (Logger.IsDebugEnabled)
            {
            Logger.Debug("Persisted: id='{0}'; task='{1}'", id, serializedTask);
            }
        }
 public string Get(Identifier id)
 {
     string result;
     if (_database.TryGetValue(id.ToString(), out result))
     {
         return result;
     }
     //TODO: Use own exception class
     throw new InvalidOperationException(string.Format("String with id='{0}' was not found. Possible concurrency issue.", id));
 }
Пример #3
0
        public void Remove(Identifier id)
        {
            string value;
            _tasks.TryRemove(id, out value);

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug("Removed: id='{0}'; task='{1}'", id, value);
            }
        }
Пример #4
0
 public void Persist(Identifier identifier, ITask task)
 {
 }
Пример #5
0
 public ITask Get(Identifier identifier)
 {
     return null;
 }
Пример #6
0
 public void Delete(Identifier identifier)
 {
 }
        public void Setup()
        {
            _windsor = new WindsorContainer();

            var facility = new DarkFlowFacility()
                .RouteTasks(x => x.ByNamespace("Codestellation.*").To("someExecutor"))
                .PersistTasks(x =>
                    {
                        //TODO: Calls to To() are ugly, because they are completely ignored. Need more elegant solution to this.
                        x.ByNamespace("Codestellation.*").To("xx");
                        x.MarkedWith(typeof (MarkerAttribute)).To("xx");
                    });

            _windsor.AddFacility(facility);

            _windsor.Register(
                Component
                    .For<TaskInterceptor>()
                    .LifestyleTransient());

            _persister = _windsor.Resolve<IPersister>();
            _id = new Identifier(Guid.NewGuid(), new Region("test"));
        }
Пример #8
0
 public bool Equals(Identifier other)
 {
     return _id.Equals(other._id) && _region.Equals(other._region);
 }
        public void Remove(Identifier id)
        {
            _database.Remove(id.ToString());

            if (Logger.IsDebugEnabled)
            {
                Logger.Debug("Removed: id='{0}';", id);
            }
        }
Пример #10
0
 public void SetUp()
 {
     _id = new Identifier(Guid.NewGuid(), new Region("test"));
     _persister = new Persister(new InMemoryDatabase(), new FuncMatcher("no-matter" ,x => true));
     _original = new PersistentTask(1) { TotalCount = 2 };
 }