public void DeleteAllIndicesUnitTest()
        {
            Assert.Inconclusive("TODO");

            var target = new IndexFactory(); // TODO: Initialize to an appropriate value
            target.DeleteAllIndices();
        }
Exemple #2
0
 /// <summary>
 ///   Initializes a new instance of the Fallen-8 class.
 /// </summary>
 public Fallen8()
 {
     IndexFactory = new IndexFactory();
     _graphElements = new BigList<AGraphElement>();
     ServiceFactory = new ServiceFactory(this);
     IndexFactory.Indices.Clear();
 }
        public void GetAvailableIndexPluginsUnitTest()
        {
            Assert.Inconclusive("TODO");

            var target = new IndexFactory(); // TODO: Initialize to an appropriate value
            IEnumerable<string> expected = null; // TODO: Initialize to an appropriate value
            IEnumerable<string> actual;
            actual = target.GetAvailableIndexPlugins();
            Assert.AreEqual(expected, actual);
        }
        public void TryCreateIndexUnitTest()
        {
            Assert.Inconclusive("TODO");

            var target = new IndexFactory(); // TODO: Initialize to an appropriate value
            IIndex index = null; // TODO: Initialize to an appropriate value
            IIndex indexExpected = null; // TODO: Initialize to an appropriate value
            string indexName = string.Empty; // TODO: Initialize to an appropriate value
            string indexTypeName = string.Empty; // TODO: Initialize to an appropriate value
            IDictionary<string, object> parameter = null; // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.TryCreateIndex(out index, indexName, indexTypeName, parameter);
            Assert.AreEqual(indexExpected, index);
            Assert.AreEqual(expected, actual);
        }
        public void IndexFactoryConstructorUnitTest()
        {
            Assert.Inconclusive("TODO");

            var target = new IndexFactory();
        }
        public void TryGetIndexUnitTest()
        {
            Assert.Inconclusive("TODO");

            var target = new IndexFactory(); // TODO: Initialize to an appropriate value
            IIndex index = null; // TODO: Initialize to an appropriate value
            IIndex indexExpected = null; // TODO: Initialize to an appropriate value
            string indexName = string.Empty; // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.TryGetIndex(out index, indexName);
            Assert.AreEqual(indexExpected, index);
            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        ///   Load Fallen-8 from a save point
        /// </summary>
        /// <param name="fallen8">Fallen-8</param>
        /// <param name="graphElements">The graph elements </param>
        /// <param name="pathToSavePoint">The path to the save point.</param>
        /// <param name="currentId">The maximum graph element id</param>
        /// <param name="startServices">Start the services</param>
        internal static Boolean Load(Fallen8 fallen8, ref BigList<AGraphElement> graphElements, string pathToSavePoint, ref Int32 currentId, Boolean startServices)
        {
            //if there is no savepoint file... do nothing
            if (!File.Exists(pathToSavePoint))
            {
                Logger.LogError(String.Format("Fallen-8 could not be loaded because the path \"{0}\" does not exist.", pathToSavePoint));

                return false;
            }

            var pathName = Path.GetDirectoryName(pathToSavePoint);
            var fileName = Path.GetFileName(pathToSavePoint);

            Logger.LogInfo(String.Format("Now loading file \"{0}\" from path \"{1}\"", fileName, pathName));

            using (var file = File.Open(pathToSavePoint, FileMode.Open, FileAccess.Read))
            {
                var reader = new SerializationReader(file);
                currentId = reader.ReadInt32();

                graphElements.InitializeUntil(currentId);

                #region graph elements

                //initialize the list of graph elements
                var graphElementStreams = new List<String>();
                var numberOfGraphElemementStreams = reader.ReadInt32();
                for (var i = 0; i < numberOfGraphElemementStreams; i++)
                {
                    var graphElementBunchFilename = Path.Combine(pathName, reader.ReadString());
                    Logger.LogInfo(String.Format("Found graph element bunch {0} here: \"{1}\"", i, graphElementBunchFilename));

                    graphElementStreams.Add(graphElementBunchFilename);
                }

                LoadGraphElements(graphElements, graphElementStreams);

                #endregion

                #region indexe

                var indexStreams = new List<String>();
                var numberOfIndexStreams = reader.ReadInt32();
                for (var i = 0; i < numberOfIndexStreams; i++)
                {
                    var indexFilename = Path.Combine(pathName, reader.ReadString());
                    Logger.LogInfo(String.Format("Found index number {0} here: \"{1}\"", i, indexFilename));

                    indexStreams.Add(indexFilename);
                }
                var newIndexFactory = new IndexFactory();
                LoadIndices(fallen8, newIndexFactory, indexStreams);
                fallen8.IndexFactory = newIndexFactory;

                #endregion

                #region services

                var serviceStreams = new List<String>();
                var numberOfServiceStreams = reader.ReadInt32();
                for (var i = 0; i < numberOfServiceStreams; i++)
                {
                    var serviceFilename = Path.Combine(pathName, reader.ReadString());
                    Logger.LogInfo(String.Format("Found service number {0} here: \"{1}\"", i, serviceFilename));

                    serviceStreams.Add(serviceFilename);
                }
                var newServiceFactory = new ServiceFactory(fallen8);
                fallen8.ServiceFactory = newServiceFactory;
                LoadServices(fallen8, newServiceFactory, serviceStreams, startServices);

                #endregion

                return true;
            }
        }
 private static void LoadIndices(Fallen8 fallen8, IndexFactory indexFactory, List<String> indexStreams)
 {
     //load the indices
     for (var i = 0; i < indexStreams.Count; i++)
     {
         LoadAnIndex(indexStreams[i], fallen8, indexFactory);
     }
 }
        private static void LoadAnIndex(string indexLocaion, Fallen8 fallen8, IndexFactory indexFactory)
        {
            //if there is no savepoint file... do nothing
            if (!File.Exists(indexLocaion))
            {
                return;
            }

            using (var file = File.Open(indexLocaion, FileMode.Open, FileAccess.Read))
            {
                var reader = new SerializationReader(file);

                var indexName = reader.ReadString();
                var indexPluginName = reader.ReadString();

                indexFactory.OpenIndex(indexName, indexPluginName, reader, fallen8);
            }
        }
        public void IndexFactoryConstructorIntegrationTest()
        {
            Assert.Inconclusive("TODO.");

            var target = new IndexFactory();
        }
        public void TryDeleteIndexIntegrationTest()
        {
            Assert.Inconclusive("TODO.");

            var target = new IndexFactory(); // TODO: Initialize to an appropriate value
            string indexName = string.Empty; // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.TryDeleteIndex(indexName);
            Assert.AreEqual(expected, actual);
        }