예제 #1
0
 public System.Collections.Generic.IEnumerable<PluginCommand> GetSupportedCommands(RepositoryMode repositoryMode)
 {
     return new[]
     {
         new PluginCommand { CommandVerb = PluginCommands.SynchronizeGherkinFilesVerb, DisplayText = "Synchronize Gherkin Files" }
     };
 }
 public void OnConfigurationSaved(RepositoryMode repositoryMode, PluginConfigurationDialogResult configuration, IDialogService dialogService, ICommandExecutionService commandExecutionService)
 {
     if (!previouslyEnabled && configuration.IsEnabled)
     {
         commandExecutionService.IssueCommand("RefreshNow");
     }
 }
예제 #3
0
        public void OnConfigurationSaved(RepositoryMode repositoryMode, PluginConfigurationDialogResult configuration, IDialogService dialogService, ICommandExecutionService commandExecutionService)
        {
            if (repositoryMode != RepositoryMode.ClientServer) return;
            if (!configuration.IsEnabled) return;
            if (isEnabledBeforeConfig) return;

            dialogService.ShowDialog(new OfferResynchronizationViewModel(commandExecutionService));
        }
 public IGherkinStatsProvider CreateStatsProvider(RepositoryMode repositoryMode, string configuration, IGherkinStatsRepository statsRepository)
 {
     using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(configuration)))
     {
         var serializer = new XmlSerializer(typeof(JenkinsStatsPluginConfiguration));
         var config     = (JenkinsStatsPluginConfiguration)serializer.Deserialize(stream);
         return(new JenkinsTestStatsProvider(logger, timeService, statsRepository, config));
     }
 }
예제 #5
0
        public void GetVerseTest_Optimistic_First_BadBook()
        {
            //Repository_Accessor target = new Repository_Accessor();
            string         book     = "not a book";
            int            chapter  = 5;
            int            verse    = 19;
            string         suffix   = "b";
            VersePosition  position = VersePosition.First;
            RepositoryMode mode     = RepositoryMode.Optimistic;
            Verse          expected = null;
            Verse          actual;

            actual = Verse.Create(si, book, chapter, verse, suffix, position, mode);
            Assert.AreEqual(expected, actual);
        }
예제 #6
0
        public void GetVerseTest_Strict_Last_VerseTooLarge()
        {
            //Repository_Accessor target = new Repository_Accessor();
            string         book     = "lev";
            int            chapter  = 5;
            int            verse    = 5000;
            string         suffix   = null;
            VersePosition  position = VersePosition.Last;
            RepositoryMode mode     = RepositoryMode.Strict;
            Verse          expected = null;
            Verse          actual;

            actual = Verse.Create(si, book, chapter, verse, suffix, position, mode);
            Assert.AreEqual(expected, actual);
        }
예제 #7
0
        public EntityCache(IRepositoryProvider repositoryProvider, IConverter <T> converter, RepositoryMode loadingMode = RepositoryMode.Eager)
        {
            _repositoryProvider = repositoryProvider;
            _converter          = converter;
            _loadingMode        = loadingMode;

            switch (_loadingMode)
            {
            case RepositoryMode.Eager:
                GetAllEntities();
                break;

            case RepositoryMode.Lazy:
                break;
            }
        }
예제 #8
0
        public void GetRangeTest_Safe_Basic()
        {
            RawRange input = new RawRange
            {
                FirstBook          = "gen",
                FirstChapterString = "1",
                FirstVerseString   = "1",

                SecondBook          = "gen",
                SecondChapterString = "1",
                SecondVerseString   = "2"
            };

            RepositoryMode mode     = RepositoryMode.Safe;
            Range          expected = //null;
                                      new Range
            {
                Start = new Verse
                {
                    Index         = 1,
                    BookName      = "Genesis",
                    BookNumber    = 1,
                    ChapterNumber = 1,
                    VerseNumber   = 1,
                    Suffix        = null
                },
                End = new Verse
                {
                    Index         = 2,
                    BookName      = "Genesis",
                    BookNumber    = 1,
                    ChapterNumber = 1,
                    VerseNumber   = 2,
                    Suffix        = null
                }
            };
            Range actual;

            //actual = target.GetRange(s, mode);
            actual = Range.Create(si, input, mode);
            Assert.AreEqual(expected, actual);
        }
예제 #9
0
        public void GetRangeTest_Optimistic_ChapterTooLarge()
        {
            RawRange input = new RawRange
            {
                FirstBook          = "gen",
                FirstChapterString = "1",
                FirstVerseString   = null,

                SecondBook          = "gen",
                SecondChapterString = "90",
                SecondVerseString   = null
            };

            RepositoryMode mode     = RepositoryMode.Optimistic;
            Range          expected = new Range
            {
                Start = new Verse
                {
                    Index         = 1,
                    BookName      = "Genesis",
                    BookNumber    = 1,
                    ChapterNumber = 1,
                    VerseNumber   = 1,
                    Suffix        = null
                },
                End = new Verse
                {
                    Index         = 1533,
                    BookName      = "Genesis",
                    BookNumber    = 1,
                    ChapterNumber = 50,
                    VerseNumber   = 26,
                    Suffix        = null
                }
            };
            Range actual;

            //actual = target.GetRange(s, mode);
            actual = Range.Create(si, input, mode);
            Assert.AreEqual(expected, actual);
        }
예제 #10
0
        public void GetVerseTest_Strict_Last_NoVerse()
        {
            //Repository_Accessor target = new Repository_Accessor();
            string         book     = "lev";
            int            chapter  = 5;
            int            verse    = -1;
            string         suffix   = null;
            VersePosition  position = VersePosition.Last;
            RepositoryMode mode     = RepositoryMode.Strict;
            Verse          expected = new Verse
            {
                Index         = 2850,
                BookName      = "Leviticus",
                BookNumber    = 3,
                ChapterNumber = 5,
                VerseNumber   = 19,
                Suffix        = null
            };
            Verse actual;

            actual = Verse.Create(si, book, chapter, verse, suffix, position, mode);
            Assert.AreEqual(expected, actual);
        }
예제 #11
0
        public void GetVerseTest_Optimistic_First_Normal()
        {
            //Repository_Accessor target = new Repository_Accessor();
            string         book     = "lev";
            int            chapter  = 5;
            int            verse    = 19;
            string         suffix   = "b";
            VersePosition  position = VersePosition.First;
            RepositoryMode mode     = RepositoryMode.Optimistic;
            Verse          expected = new Verse
            {
                Index         = 2850,
                BookName      = "Leviticus",
                BookNumber    = 3,
                ChapterNumber = 5,
                VerseNumber   = 19,
                Suffix        = "b"
            };
            Verse actual;

            actual = Verse.Create(si, book, chapter, verse, suffix, position, mode);
            Assert.AreEqual(expected, actual);
        }
예제 #12
0
        public void GetVerseTest_Optimistic_Last_ChapterTooLarge()
        {
            //Repository_Accessor target = new Repository_Accessor();
            string         book     = "lev";
            int            chapter  = 5000;
            int            verse    = -1;
            string         suffix   = null;
            VersePosition  position = VersePosition.Last;
            RepositoryMode mode     = RepositoryMode.Optimistic;
            Verse          expected = new Verse
            {
                Index         = 3605,
                BookName      = "Leviticus",
                BookNumber    = 3,
                ChapterNumber = 27,
                VerseNumber   = 34,
                Suffix        = null
            };
            Verse actual;

            actual = Verse.Create(si, book, chapter, verse, suffix, position, mode);
            Assert.AreEqual(expected, actual);
        }
 public bool IsConfigurable(RepositoryMode repositoryMode)
 {
     return(true);
 }
예제 #14
0
        internal static Verse Create(Scripture.Version.ScriptureInfo scriptureInfo, string book, int chapter, int verse, string suffix, VersePosition position, RepositoryMode mode)
        {
            BookInfo bookInfo = scriptureInfo.GetBookInfo(book);

            return(Create(scriptureInfo, bookInfo, chapter, verse, suffix, position, mode));
        }
예제 #15
0
        internal static Verse Create(Scripture.Version.ScriptureInfo scriptureInfo, BookInfo bookInfo, int chapter, int verse, string suffix, VersePosition position, RepositoryMode mode)
        {
            Verse result = new Verse();

            result._scriptureInfo = scriptureInfo;

            result._bookInfo = bookInfo; // scriptureInfo.GetBookInfo(bookNumber);

            if (result._bookInfo == null)
            {
                result = null;
            }
            else
            {
                switch (position)
                {
                case VersePosition.First:
                    if (chapter < 1)
                    {
                        if (chapter == -1 || mode == RepositoryMode.Optimistic)
                        {
                            chapter = 1;
                            verse   = -1;
                        }
                        else
                        {
                            result = null;
                        }
                    }

                    if (result != null && verse < 1)
                    {
                        if (verse == -1 || mode == RepositoryMode.Optimistic)
                        {
                            verse = 1;
                        }
                        else
                        {
                            result = null;
                        }
                    }
                    break;

                case VersePosition.Last:
                    if (chapter < 1)
                    {
                        if (chapter == -1 || mode == RepositoryMode.Optimistic)
                        {
                            chapter = scriptureInfo.GetLastChapter(result._bookInfo.Number);
                            verse   = -1;
                        }
                        else
                        {
                            result = null;
                        }
                    }

                    if (result != null && verse < 0)
                    {
                        if (verse == -1 || mode == RepositoryMode.Optimistic)
                        {
                            try
                            {
                                verse = scriptureInfo.GetLastVerse(result._bookInfo.Number, chapter);
                            }
                            catch (Exception)
                            {
                                if (mode == RepositoryMode.Optimistic)
                                {
                                    chapter = scriptureInfo.GetLastChapter(result._bookInfo.Number);
                                    verse   = scriptureInfo.GetLastVerse(result._bookInfo.Number, chapter);
                                }
                                else
                                {
                                    result = null;
                                }
                            }
                        }
                        else
                        {
                            result = null;
                        }
                    }

                    break;
                }

                int maxChapter = scriptureInfo.GetLastChapter(result._bookInfo.Number);
                if (chapter > maxChapter)
                {
                    if (mode == RepositoryMode.Optimistic)
                    {
                        chapter = maxChapter;
                        verse   = int.MaxValue;
                    }
                    else
                    {
                        result = null;
                    }
                }
                if (result != null)
                {
                    int maxVerse = scriptureInfo.GetLastVerse(result._bookInfo.Number, chapter);
                    if (verse > maxVerse)
                    {
                        if (mode == RepositoryMode.Optimistic)
                        {
                            verse = maxVerse;
                        }
                        else
                        {
                            result = null;
                        }
                    }
                }

                if (result != null)
                {
                    int index         = -1;
                    int chapterResult = -1;
                    int verseResult   = -1;

                    scriptureInfo.GetVerseData(result._bookInfo.Number, chapter, verse, out index, out chapterResult, out verseResult);

                    result.Index         = index;
                    result.ChapterNumber = chapterResult;
                    result.VerseNumber   = verseResult;
                    result.Suffix        = string.IsNullOrWhiteSpace(suffix) ? null : suffix.Trim().ToLower();
                }
            }

            return(result);
        }
예제 #16
0
 public IEnumerable <PluginCommand> GetSupportedCommands(RepositoryMode repositoryMode)
 {
     return(Enumerable.Empty <PluginCommand>());
 }
예제 #17
0
 public IGherkinLinkProviderViewModel GetGherkinLinkViewModel(RepositoryMode repositoryMode)
 {
     return(null);
 }
예제 #18
0
 public IGherkinStatsProvider CreateStatsProvider(RepositoryMode repositoryMode, string configuration, IGherkinStatsRepository statsRepository) { return null; }
 public bool IsGherkinStatsProvider(RepositoryMode repositoryMode)
 {
     return(true);
 }
예제 #20
0
 public IGherkinLinkProviderViewModel GetGherkinLinkViewModel(RepositoryMode repositoryMode)
 {
     return new GitPluginGherkinLinkProviderViewModel();
 }
예제 #21
0
 public bool IsConfigurable(RepositoryMode repositoryMode)
 {
     return(repositoryMode == RepositoryMode.ClientServer);
 }
예제 #22
0
 public bool IsGherkinLinkProvider(RepositoryMode repositoryMode) { return repositoryMode == RepositoryMode.ClientServer; }
예제 #23
0
 public IDialogViewModel GetConfigDialog(RepositoryMode repositoryMode, bool isEnabled, string config)
 {
     isEnabledBeforeConfig = isEnabled;
     return new GitPluginConfigurationDialogViewModel(dialogService, config, isEnabled);
 }
예제 #24
0
 public bool IsConfigurable(RepositoryMode repositoryMode) { return repositoryMode == RepositoryMode.ClientServer; }
 public bool IsGherkinLinkProvider(RepositoryMode repositoryMode)
 {
     return(false);
 }
 public IGherkinLinkProviderViewModel GetGherkinLinkViewModel(RepositoryMode repositoryMode)
 {
     throw new NotSupportedException();
 }
 public bool IsWorkItemSynchronizer(RepositoryMode repositorMode)
 {
     return(false);
 }
 public IEnumerable <PluginCommand> GetSupportedCommands(RepositoryMode repositoryMode)
 {
     return(new[] { new PluginCommand {
                        CommandVerb = "RefreshNow", DisplayText = "Refresh all Statistics"
                    } });
 }
 public IDialogViewModel GetConfigDialog(RepositoryMode repositoryMode, bool isEnabled, string configuration)
 {
     previouslyEnabled = isEnabled;
     return(new JenkinsPluginConfigurationDialogViewModel(dialogService, configuration, isEnabled));
 }
예제 #30
0
 public IGherkinStatsProvider CreateStatsProvider(RepositoryMode repositoryMode, string configuration, IGherkinStatsRepository statsRepository)
 {
     return(null);
 }
예제 #31
0
        internal static Range Create(ScriptureInfo scriptureInfo, Data.RawRange range, int offset, RepositoryMode mode)
        {
            Range result = new Range();

            result._scriptureInfo = scriptureInfo;
            result.Offset         = offset;

            result.Start = Verse.Create(scriptureInfo, range.FirstBook, range.FirstChapter, range.FirstVerse, range.FirstVerseSuffix, VersePosition.First, mode);
            result.End   = Verse.Create(scriptureInfo, range.SecondBook, range.SecondChapter, range.SecondVerse, range.SecondVerseSuffix, VersePosition.Last, mode);

            int firstChapterLimitsOffset = 1 - result.Start.VerseNumber;

            result._offsetChapterLimits =
                OffsetChapterLimits.Create(
                    firstChapterLimitsOffset,
                    scriptureInfo.ChapterLimits.Where(c => result.Start <= c && c <= result.End)
                    );

            result.Length =
                result._offsetChapterLimits.Select(c => c.ChapterLimits).Sum(c => c.EndVerseNumber)
                + firstChapterLimitsOffset
                - (result._offsetChapterLimits.Last().ChapterLimits.EndVerseNumber - result.End.VerseNumber);

            if (mode != RepositoryMode.Optimistic && (result.Start == null || result.End == null))
            {
                result = null;
            }

            return(result);
        }
예제 #32
0
 public bool IsWorkItemSynchronizer(RepositoryMode repositorMode)
 {
     return false;
 }
예제 #33
0
 public bool IsGherkinStatsProvider(RepositoryMode repositoryMode) { return false; }
예제 #34
0
 public IDialogViewModel GetConfigDialog(RepositoryMode repositoryMode, bool isEnabled, string configuration)
 {
     return(new HtmlExportPluginConfigDialogViewModel(configuration, isEnabled));
 }