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

            Fallen8 fallen8 = null; // TODO: Initialize to an appropriate value
            var target = new ServiceFactory(fallen8);
        }
Ejemplo n.º 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 ShutdownAllServicesIntegrationTest()
        {
            Assert.Inconclusive("TODO.");

            Fallen8 fallen8 = null; // TODO: Initialize to an appropriate value
            var target = new ServiceFactory(fallen8); // TODO: Initialize to an appropriate value
            target.ShutdownAllServices();
        }
        public void GetAvailableServicePluginsIntegrationTest()
        {
            Assert.Inconclusive("TODO.");

            Fallen8 fallen8 = null; // TODO: Initialize to an appropriate value
            var target = new ServiceFactory(fallen8); // TODO: Initialize to an appropriate value
            IEnumerable<string> expected = null; // TODO: Initialize to an appropriate value
            IEnumerable<string> actual;
            actual = target.GetAvailableServicePlugins();
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        /// <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;
            }
        }
Ejemplo n.º 6
0
 private static void LoadServices(Fallen8 fallen8, ServiceFactory newServiceFactory, List<string> serviceStreams, Boolean startServices)
 {
     //load the indices
     for (var i = 0; i < serviceStreams.Count; i++)
     {
         LoadAService(serviceStreams[i], fallen8, newServiceFactory, startServices);
     }
 }
Ejemplo n.º 7
0
        private static void LoadAService(string serviceLocaion, Fallen8 fallen8, ServiceFactory serviceFactory, Boolean startService)
        {
            //if there is no savepoint file... do nothing
            if (!File.Exists(serviceLocaion))
            {
                return;
            }

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

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

                serviceFactory.OpenService(indexName, indexPluginName, reader, fallen8, startService);
            }
        }
        public void TryAddServiceIntegrationTest()
        {
            Assert.Inconclusive("TODO.");

            Fallen8 fallen8 = null; // TODO: Initialize to an appropriate value
            var target = new ServiceFactory(fallen8); // TODO: Initialize to an appropriate value
            IService service = null; // TODO: Initialize to an appropriate value
            IService serviceExpected = null; // TODO: Initialize to an appropriate value
            string servicePluginName = string.Empty; // TODO: Initialize to an appropriate value
            string serviceName = 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.TryAddService(out service, servicePluginName, serviceName, parameter);
            Assert.AreEqual(serviceExpected, service);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 9
0
        public void StartAllServicesUnitTest()
        {
            Assert.Inconclusive("TODO");

            Fallen8 fallen8 = null; // TODO: Initialize to an appropriate value
            var target = new ServiceFactory(fallen8); // TODO: Initialize to an appropriate value
            target.StartAllServices();
        }
        public void StartAdminServiceIntegrationTest()
        {
            Assert.Inconclusive("TODO.");

            Fallen8 fallen8 = null; // TODO: Initialize to an appropriate value
            var target = new ServiceFactory(fallen8); // TODO: Initialize to an appropriate value
            IPAddress iPAddress = null; // TODO: Initialize to an appropriate value
            ushort port = 0; // TODO: Initialize to an appropriate value
            target.StartAdminService(iPAddress, port);
        }