Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 6
0
 public PlayersView(CouchbaseStorageLongoMatch storage) : base(storage)
 {
     DocumentType = "Player";
 }
Exemplo n.º 7
0
 public EventTypeView(CouchbaseStorageLongoMatch storage) : base(storage)
 {
     DocumentType = "EventType";
 }
Exemplo n.º 8
0
 public ProjectsView(CouchbaseStorageLongoMatch storage) : base(storage)
 {
     DocumentType = "Project";
 }
Exemplo n.º 9
0
 public DashboardsView(CouchbaseStorageLongoMatch storage) : base(storage)
 {
     DocumentType = "Dashboard";
 }