Example #1
0
        public void TestMigration()
        {
            string dir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            Directory.CreateDirectory(dir);

            var assembly = Assembly.GetExecutingAssembly();

            using (Stream fs = assembly.GetManifestResourceStream("longomatch.tar.gz")) {
                using (Stream gzipStream = new GZipInputStream(fs)) {
                    using (TarArchive tarArchive = TarArchive.CreateInputTarArchive(gzipStream)) {
                        tarArchive.ExtractContents(dir);
                    }
                }
            }

            CouchbaseStorageLongoMatch storage = new CouchbaseStorageLongoMatch(dir, "longomatch");

            Assert.AreEqual(2, storage.RetrieveAll <Team> ().Count());
            Assert.AreEqual(1, storage.RetrieveAll <Dashboard> ().Count());
            Assert.AreEqual(1, storage.RetrieveAll <LMProject> ().Count());

            Team team = storage.RetrieveAll <Team> ().First();

            Assert.DoesNotThrow(team.Load);

            Dashboard dashboard = storage.RetrieveAll <Dashboard> ().First();

            Assert.DoesNotThrow(dashboard.Load);

            LMProject project = storage.RetrieveAll <LMProject> ().First();

            Assert.DoesNotThrow(project.Load);
        }
Example #2
0
 public TemplatesService(IStorage storage = null)
 {
     if (storage == null)
     {
         storage = new CouchbaseStorageLongoMatch(App.Current.TemplatesDir, "templates");
     }
     TeamTemplateProvider       = new TeamTemplatesProvider(storage);
     CategoriesTemplateProvider = new CategoriesTemplatesProvider(storage);
 }
 public TimelineEventsView(CouchbaseStorageLongoMatch storage) : base(storage)
 {
     DocumentType = "TimelineEvent";
     /* We emit 1 row per player changing the Players property to Player */
     FilterProperties.Remove("Players");
     FilterProperties.Remove("Teams");
     FilterProperties.Add("Player", true);
     FilterProperties.Add("Team", true);
 }
Example #4
0
        public void InitDB()
        {
            App.Current.DependencyRegistry.Register <IFileStorage, LMDB.FileStorage> (0);
            string dbPath = Path.Combine(Path.GetTempPath(), "TestDB");

            if (Directory.Exists(dbPath))
            {
                Directory.Delete(dbPath, true);
            }
            try {
                storage = new CouchbaseStorageLongoMatch(dbPath, "test-db");
            } catch (Exception ex) {
                throw ex;
            }
            db = storage.Database;
        }
Example #5
0
        public void Setup()
        {
            string tmpPath  = Path.GetTempPath();
            string homePath = Path.Combine(tmpPath, "LongoMatch");
            string dbPath   = Path.Combine(homePath, "db");

            if (Directory.Exists(dbPath))
            {
                Directory.Delete(dbPath, true);
            }
            Directory.CreateDirectory(tmpPath);
            Directory.CreateDirectory(homePath);
            Directory.CreateDirectory(dbPath);

            storage      = new CouchbaseStorageLongoMatch(dbPath, "test-db");
            progressMock = new Mock <IProgressReport> ();
            migration    = new TemplatesMigration(progressMock.Object);

            mockPreview = new Mock <IPreviewService> ();
            App.Current.PreviewService = mockPreview.Object;
        }
Example #6
0
 public PlayersView(CouchbaseStorageLongoMatch storage) : base(storage)
 {
     DocumentType = "Player";
 }
 public EventTypeView(CouchbaseStorageLongoMatch storage) : base(storage)
 {
     DocumentType = "EventType";
 }
Example #8
0
 public ProjectsView(CouchbaseStorageLongoMatch storage) : base(storage)
 {
     DocumentType = "Project";
 }
 public DashboardsView(CouchbaseStorageLongoMatch storage) : base(storage)
 {
     DocumentType = "Dashboard";
 }