Exemple #1
0
        /// <summary>
        /// Simple setup for a PROOF server - so we can get it configured so all of our tests
        /// will run correctly.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //
            // Make sure we know what we are doing
            //

            if (args.Length == 0)
            {
                Console.WriteLine("Usage: SetupPROOFServer <proof-server>");
                return;
            }

            string proofURI = string.Format("proof://{0}", args[0]);

            //
            // Open the PROOF server up, really don't need workers for this! :-)
            //

            var connection = new ROOTNET.NTProof(proofURI);
            try
            {
                //
                // Check to see if the dataset exists or not
                //

                if (connection.ExistsDataSet(testDatasetName))
                {
                    Console.WriteLine("The test dataset exists");
                    return;
                }

                Console.WriteLine("Creating dataset {0}.", testDatasetName);

                //
                // Create & define the dataset.
                //

                var files = new ROOTNET.NTFileCollection(testDatasetName, string.Format("File list for {0}", testDatasetName));
                foreach (var f in testDataSetFileList)
                {
                    var finfo = new ROOTNET.NTFileInfo(f);
                    files.Add(finfo);
                    finfo.SetNativePointerOwner(false); // because the collection takes over ownership! :(
                }

                Console.WriteLine("Dataset {0} will contain {1} files.", testDatasetName, testDataSetFileList.Length);

                if (!connection.RegisterDataSet(testDatasetName, files))
                {
                    Console.WriteLine("Registration of the dataset unsuccessful");
                    return;
                }

                Console.WriteLine("Dataset {0} registered", testDatasetName);
            }
            finally
            {
                connection.Close();
            }
        }
Exemple #2
0
        /// <summary>
        /// Simple cleanup for a PROOF server - remove everything we've configured.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //
            // Make sure we know what we are doing
            //

            if (args.Length == 0)
            {
                Console.WriteLine("Usage: CleanupPROOFServer <proof-server>");
                return;
            }

            string proofURI = string.Format("proof://{0}", args[0]);

            //
            // Open the PROOF server up, really don't need workers for this! :-)
            //

            var connection = new ROOTNET.NTProof(proofURI);

            try
            {
                //
                // Check to see if the dataset exists or not
                //

                if (!connection.ExistsDataSet(testDatasetName))
                {
                    Console.WriteLine("The test dataset does not exists");
                    return;
                }

                Console.WriteLine("Removing the dataset {0}.", testDatasetName);

                //
                // kill off the dataset.
                //

                var r = connection.RemoveDataSet(testDatasetName);
                if (r != 0)
                {
                    Console.WriteLine("Failed to remove dataset {0}.", testDatasetName);
                    return;
                }

                Console.WriteLine("Dataset removed");

            }
            finally
            {
                connection.Close();
            }
        }