Esempio n. 1
0
        // methods
        public static ClusterBuilder ConfigureCluster()
        {
            var builder = new ClusterBuilder().ConfigureWithConnectionString(__connectionString);

            if (__connectionString.Ssl.HasValue && __connectionString.Ssl.Value)
            {
                var certificateFilename = Environment.GetEnvironmentVariable("MONGO_SSL_CERT_FILE");
                if (certificateFilename != null)
                {
                    // TODO: configure SSL
                    //builder.ConfigureSsl(ssl =>
                    //{
                    //    var password = Environment.GetEnvironmentVariable("MONGO_SSL_CERT_PASS");
                    //    X509Certificate cert;
                    //    if (password == null)
                    //    {
                    //        cert = new X509Certificate2(certificateFilename);
                    //    }
                    //    else
                    //    {
                    //        cert = new X509Certificate2(certificateFilename, password);
                    //    }
                    //    ssl.AddClientCertificate(cert);
                    //});
                }
            }

            return(builder);
        }
Esempio n. 2
0
        // methods
        private ICluster CreateCluster(ClusterKey clusterKey)
        {
            var builder = new ClusterBuilder()
                          .ConfigureCluster(settings => ConfigureCluster(settings, clusterKey))
                          .ConfigureServer(settings => ConfigureServer(settings, clusterKey))
                          .ConfigureConnectionPool(settings => ConfigureConnectionPool(settings, clusterKey))
                          .ConfigureConnection(settings => ConfigureConnection(settings, clusterKey))
                          .ConfigureTcp(settings => ConfigureTcp(settings, clusterKey));

            if (clusterKey.UseSsl)
            {
                builder.ConfigureSsl(settings => ConfigureSsl(settings, clusterKey));
            }

            if (clusterKey.ClusterConfigurator != null)
            {
                clusterKey.ClusterConfigurator(builder);
            }

            var cluster = builder.BuildCluster();

            cluster.Initialize();

            return(cluster);
        }
        public static ClusterBuilder ConfigureLogging(ClusterBuilder builder)
        {
            var environmentVariable = Environment.GetEnvironmentVariable("MONGO_LOGGING");

            if (environmentVariable == null)
            {
                return(builder);
            }

            SourceLevels defaultLevel;

            if (!Enum.TryParse <SourceLevels>(environmentVariable, ignoreCase: true, result: out defaultLevel))
            {
                return(builder);
            }

            __traceSource = new TraceSource("mongodb-tests", defaultLevel);
            __traceSource.Listeners.Clear(); // remove the default listener
#if NETSTANDARD1_6
            var listener = new TextWriterTraceListener(Console.Out);
#else
            var listener = new ConsoleTraceListener();
#endif
            listener.TraceOutputOptions = TraceOptions.DateTime;
            __traceSource.Listeners.Add(listener);
            return(builder.TraceWith(__traceSource));
        }
		public void Can_Build_From_Config()
		{
			const string Name = "Can_Build_From_Config";
			// Register a StepRecorder instance which will be used
			// by the fake services to mark themselves initialized.
			// If any of them is missing from the StepRecorder,
			// the ClusterBuilder is not initializing a service.
			var c = new ClusterBuilder(Name)
							.FromConfiguration("Can_Build_From_Config")
							.Use
								.Service<StepRecorder>()
							.Register();

			var cluster = c.Resolve<ICluster>();
			var m = c.Resolve<StepRecorder>();

			m.AssertSteps("FailurePolicy", "NodeLocator", "ReconnectPolicy");

			Assert.IsType<_FailurePolicy>(c.Resolve<IFailurePolicy>());
			Assert.IsType<_NodeLocator>(c.Resolve<INodeLocator>());
			Assert.IsType<_ReconnectPolicy>(c.Resolve<IReconnectPolicy>());

			Assert.Equal(10, ((_FailurePolicy)c.Resolve<IFailurePolicy>()).Property);
			Assert.Equal("10", ((_NodeLocator)c.Resolve<INodeLocator>()).Property);
			Assert.Equal(TimeSpan.FromSeconds(10), ((_ReconnectPolicy)c.Resolve<IReconnectPolicy>()).Property);

			ClusterManager.Shutdown(Name);
		}
        public void Can_Build_From_Config()
        {
            const string Name = "Can_Build_From_Config";
            // Register a StepRecorder instance which will be used
            // by the fake services to mark themselves initialized.
            // If any of them is missing from the StepRecorder,
            // the ClusterBuilder is not initializing a service.
            var c = new ClusterBuilder(Name)
                    .FromConfiguration("Can_Build_From_Config")
                    .Use
                    .Service <StepRecorder>()
                    .Register();

            var cluster = c.Resolve <ICluster>();
            var m       = c.Resolve <StepRecorder>();

            m.AssertSteps("FailurePolicy", "NodeLocator", "ReconnectPolicy");

            Assert.IsType <_FailurePolicy>(c.Resolve <IFailurePolicy>());
            Assert.IsType <_NodeLocator>(c.Resolve <INodeLocator>());
            Assert.IsType <_ReconnectPolicy>(c.Resolve <IReconnectPolicy>());

            Assert.Equal(10, ((_FailurePolicy)c.Resolve <IFailurePolicy>()).Property);
            Assert.Equal("10", ((_NodeLocator)c.Resolve <INodeLocator>()).Property);
            Assert.Equal(TimeSpan.FromSeconds(10), ((_ReconnectPolicy)c.Resolve <IReconnectPolicy>()).Property);

            ClusterManager.Shutdown(Name);
        }
        // methods
        public static ClusterBuilder ConfigureCluster()
        {
            var builder = new ClusterBuilder().ConfigureWithConnectionString(__connectionString);

            if (__connectionString.Ssl.HasValue && __connectionString.Ssl.Value)
            {
                var certificateFilename = Environment.GetEnvironmentVariable("MONGO_SSL_CERT_FILE");
                if (certificateFilename != null)
                {
                    builder.ConfigureSsl(ssl =>
                    {
                        var password = Environment.GetEnvironmentVariable("MONGO_SSL_CERT_PASS");
                        X509Certificate cert;
                        if (password == null)
                        {
                            cert = new X509Certificate2(certificateFilename);
                        }
                        else
                        {
                            cert = new X509Certificate2(certificateFilename, password);
                        }

                        return(ssl.With(
                                   clientCertificates: new[] { cert }));
                    });
                }
            }

            return(builder);
        }
        public static ICluster CreateCluster(Func <ClusterBuilder, ClusterBuilder> postConfigurator)
        {
            var builder = new ClusterBuilder();

            builder = ConfigureCluster(builder);
            builder = postConfigurator(builder);
            return(CreateCluster(builder));
        }
Esempio n. 8
0
        public void TestClusterWithCross()
        {
            // Create a list of Mum classes.
            List <MaxUniqueMatch> matches = new List <MaxUniqueMatch>();
            MaxUniqueMatch        match   = null;

            match = new MaxUniqueMatch();
            match.FirstSequenceStart  = 0;
            match.Length              = 4;
            match.SecondSequenceStart = 4;
            matches.Add(match);

            match = new MaxUniqueMatch();
            match.FirstSequenceStart  = 4;
            match.Length              = 3;
            match.SecondSequenceStart = 0;
            matches.Add(match);

            match = new MaxUniqueMatch();
            match.FirstSequenceStart  = 10;
            match.Length              = 3;
            match.SecondSequenceStart = 10;
            matches.Add(match);

            IClusterBuilder clusterBuilder = new ClusterBuilder();

            clusterBuilder.MinimumScore    = 2;
            clusterBuilder.FixedSeparation = 0;
            IList <Cluster> actualOutput = clusterBuilder.BuildClusters(matches);

            IList <Cluster> expectedOutput = new List <Cluster>();
            IList <MaxUniqueMatchExtension> clusterMatches = new List <MaxUniqueMatchExtension>();

            match = new MaxUniqueMatch();
            match.FirstSequenceStart  = 0;
            match.Length              = 4;
            match.SecondSequenceStart = 4;
            clusterMatches.Add(new MaxUniqueMatchExtension(match));
            expectedOutput.Add(new Cluster(clusterMatches));

            clusterMatches            = new List <MaxUniqueMatchExtension>();
            match                     = new MaxUniqueMatch();
            match.FirstSequenceStart  = 4;
            match.Length              = 3;
            match.SecondSequenceStart = 0;
            clusterMatches.Add(new MaxUniqueMatchExtension(match));
            expectedOutput.Add(new Cluster(clusterMatches));

            clusterMatches            = new List <MaxUniqueMatchExtension>();
            match                     = new MaxUniqueMatch();
            match.FirstSequenceStart  = 10;
            match.Length              = 3;
            match.SecondSequenceStart = 10;
            clusterMatches.Add(new MaxUniqueMatchExtension(match));
            expectedOutput.Add(new Cluster(clusterMatches));

            Assert.IsTrue(this.CompareMumList(actualOutput, expectedOutput));
        }
        /// <summary>
        /// Enables Unix domain sockets support for <paramref name="builder"/>.
        /// </summary>
        /// <param name="builder">Cluster builder.</param>
        public static ClusterBuilder EnableUnixDomainSockets(this ClusterBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.DoRegisterStreamFactory(inner => new StreamFactory(inner, builder.GetTcpStreamSettings())));
        }
        public static ClusterBuilder ConfigureLogging(ClusterBuilder builder)
        {
            var traceSource = new TraceSource("mongodb-tests", SourceLevels.Information);

            traceSource.Listeners.Clear(); // remove the default listener
            var listener = new ConsoleTraceListener();

            traceSource.Listeners.Add(listener);
            return(builder.TraceWith(traceSource));
        }
Esempio n. 11
0
        public GossipChannelDecorator(ClusterBuilder builder, GossipChannelType channelType, string connectionString)
            : base(builder)
        {
            if (string.IsNullOrEmpty(connectionString))
            {
                throw new ArgumentNullException(nameof(connectionString));
            }

            _channelType      = channelType;
            _connectionString = connectionString;
        }
Esempio n. 12
0
 public AzureTableStorageDecorator(ClusterBuilder builder, string providerName, string connectionString, string tableName = "OrleansGrainState", bool deleteOnClear = false, bool useJsonFormat = false, bool useFullAssemblyNames = false, bool indentJson = false)
     : base(builder)
 {
     _providerName         = providerName;
     _connectionString     = connectionString;
     _tableName            = tableName;
     _deleteOnClear        = deleteOnClear;
     _useJsonFormat        = useJsonFormat;
     _useFullAssemblyNames = useFullAssemblyNames;
     _indentJson           = indentJson;
 }
Esempio n. 13
0
        private static void ConfigureCluster(ClusterBuilder cb)
        {
            //string desktop =
            //Environment.GetFolderPath(Environment.SpecialFolder.Desktop); var
            //file = Path.Combine(desktop, "log.txt"); var streamWriter = new
            //StreamWriter(file); var writer =
            //TextWriter.Synchronized(streamWriter);

            //cb.AddListener(new LogListener(writer, LogLevel.Error));
            cb.UsePerformanceCounters("test", true);
        }
        public static TcpStreamSettings GetTcpStreamSettings(this ClusterBuilder clusterBuilder)
        {
            if (clusterBuilder == null)
            {
                throw new ArgumentNullException(nameof(clusterBuilder));
            }

            Debug.Assert(_tcpStreamSettings != null);

            return((TcpStreamSettings)_tcpStreamSettings.GetValue(clusterBuilder));
        }
Esempio n. 15
0
        /// <summary>
        /// Configures a MongoDB client to write its logs to the standard output
        /// </summary>
        private static void ClientSettingsClusterConfigurator(ClusterBuilder cb)
        {
            var traceSource = new TraceSource("~~ MongoDB ~~", SourceLevels.Warning);

            traceSource.Listeners.Clear();
            var listener = new TextWriterTraceListener(Console.Out)
            {
                TraceOutputOptions = TraceOptions.DateTime,
            };

            traceSource.Listeners.Add(listener);
            cb.TraceWith(traceSource);
        }
        private static bool IsReplicaSet(string uri)
        {
            var clusterBuilder = new ClusterBuilder();

            clusterBuilder.ConfigureWithConnectionString(uri);

            using (var cluster = clusterBuilder.BuildCluster())
            {
                cluster.Initialize();

                var serverSelector = new ReadPreferenceServerSelector(ReadPreference.PrimaryPreferred);
                var server         = cluster.SelectServer(serverSelector, CancellationToken.None);
                return(server.Description.Type.IsReplicaSetMember());
            }
        }
        public static ClusterBuilder ConfigureCluster(ClusterBuilder builder)
        {
            var serverSelectionTimeoutString = Environment.GetEnvironmentVariable("MONGO_SERVER_SELECTION_TIMEOUT_MS");

            if (serverSelectionTimeoutString == null)
            {
                serverSelectionTimeoutString = "10000";
            }

            builder = builder
                      .ConfigureWithConnectionString(__connectionString)
                      .ConfigureCluster(c => c.With(serverSelectionTimeout: TimeSpan.FromMilliseconds(int.Parse(serverSelectionTimeoutString))));

            if (__connectionString.Ssl.HasValue && __connectionString.Ssl.Value)
            {
                var certificateFilename = Environment.GetEnvironmentVariable("MONGO_SSL_CERT_FILE");
                if (certificateFilename != null)
                {
                    builder.ConfigureSsl(ssl =>
                    {
                        var password = Environment.GetEnvironmentVariable("MONGO_SSL_CERT_PASS");
                        X509Certificate cert;
                        if (password == null)
                        {
                            cert = new X509Certificate2(certificateFilename);
                        }
                        else
                        {
                            cert = new X509Certificate2(certificateFilename, password);
                        }
                        return(ssl.With(
                                   clientCertificates: new[] { cert }));
                    });
                }
            }

            var traceSource = new TraceSource("mongodb-tests", SourceLevels.Information);

            traceSource.Listeners.Clear(); // remove the default listener
            var listener = new ConsoleTraceListener();

            traceSource.Listeners.Add(listener);
            builder = builder.TraceWith(traceSource);

            return(builder);
        }
Esempio n. 18
0
        public static ClusterBuilder WithMongoStorage(this ClusterBuilder builder, string providerName, string url, string databaseName)
        {
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentNullException(nameof(url));
            }
            if (string.IsNullOrEmpty(databaseName))
            {
                throw new ArgumentNullException(nameof(databaseName));
            }

            IDictionary <string, string> config = new Dictionary <string, string>
            {
                { MongoStorageProvider.Properties.Url, url },
                { MongoStorageProvider.Properties.Database, databaseName }
            };

            return(new ClusterStorageDecorator <MongoStorageProvider>(builder, providerName, config));
        }
        public static ClusterBuilder ConfigureLogging(ClusterBuilder builder)
        {
            var environmentVariable = Environment.GetEnvironmentVariable("MONGO_LOGGING");

            if (environmentVariable == null)
            {
                return(builder);
            }

            SourceLevels defaultLevel;

            if (!Enum.TryParse <SourceLevels>(environmentVariable, ignoreCase: true, result: out defaultLevel))
            {
                return(builder);
            }

            __traceSource = new TraceSource("mongodb-tests", defaultLevel);
            __traceSource.Listeners.Clear();
            return(builder.TraceWith(__traceSource));
        }
Esempio n. 20
0
        public void Run(int numConcurrentWorkers, Action <ClusterBuilder> configurator)
        {
            try
            {
                var clusterBuilder = new ClusterBuilder();
                configurator(clusterBuilder);

                using (var cluster = clusterBuilder.BuildCluster())
                {
                    RunAsync(numConcurrentWorkers, cluster).GetAwaiter().GetResult();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unhandled exception:");
                Console.WriteLine(ex.ToString());
            }

            Console.WriteLine("Press Enter to exit");
            Console.ReadLine();
        }
        public static ICluster CreateCluster(ClusterBuilder builder)
        {
            var hasWritableServer = 0;
            var cluster           = builder.BuildCluster();

            cluster.DescriptionChanged += (o, e) =>
            {
                var anyWritableServer = e.NewClusterDescription.Servers.Any(
                    description => description.Type.IsWritable());
                if (__traceSource != null)
                {
                    __traceSource.TraceEvent(TraceEventType.Information, 0, $"CreateCluster: DescriptionChanged event handler called.");
                    __traceSource.TraceEvent(TraceEventType.Information, 0, $"CreateCluster: anyWritableServer = {anyWritableServer}.");
                    __traceSource.TraceEvent(TraceEventType.Information, 0, $"CreateCluster: new description: {e.NewClusterDescription.ToString()}.");
                }
                Interlocked.Exchange(ref hasWritableServer, anyWritableServer ? 1 : 0);
            };
            if (__traceSource != null)
            {
                __traceSource.TraceEvent(TraceEventType.Information, 0, "CreateCluster: initializing cluster.");
            }
            cluster.Initialize();

            // wait until the cluster has connected to a writable server
            SpinWait.SpinUntil(() => Interlocked.CompareExchange(ref hasWritableServer, 0, 0) != 0, TimeSpan.FromSeconds(30));
            if (Interlocked.CompareExchange(ref hasWritableServer, 0, 0) == 0)
            {
                var message = string.Format(
                    "Test cluster has no writable server. Client view of the cluster is {0}.",
                    cluster.Description.ToString());
                throw new Exception(message);
            }

            if (__traceSource != null)
            {
                __traceSource.TraceEvent(TraceEventType.Information, 0, "CreateCluster: writable server found.");
            }

            return(cluster);
        }
Esempio n. 22
0
        public static ClusterBuilder ConfigureCluster(ClusterBuilder builder)
        {
            var serverSelectionTimeoutString = Environment.GetEnvironmentVariable("MONGO_SERVER_SELECTION_TIMEOUT_MS");

            if (serverSelectionTimeoutString == null)
            {
                serverSelectionTimeoutString = "10000";
            }

            builder = builder
                      .ConfigureWithConnectionString(__connectionString)
                      .ConfigureCluster(c => c.With(serverSelectionTimeout: TimeSpan.FromMilliseconds(int.Parse(serverSelectionTimeoutString))));

            if (__connectionString.Ssl.HasValue && __connectionString.Ssl.Value)
            {
                var certificateFilename = Environment.GetEnvironmentVariable("MONGO_SSL_CERT_FILE");
                if (certificateFilename != null)
                {
                    builder.ConfigureSsl(ssl =>
                    {
                        var password = Environment.GetEnvironmentVariable("MONGO_SSL_CERT_PASS");
                        X509Certificate cert;
                        if (password == null)
                        {
                            cert = new X509Certificate2(certificateFilename);
                        }
                        else
                        {
                            cert = new X509Certificate2(certificateFilename, password);
                        }
                        return(ssl.With(
                                   clientCertificates: new[] { cert }));
                    });
                }
            }

            return(builder);
        }
        public void Can_Build_Using_Extensions()
        {
            // Register a StepRecorder instance which will be used
            // by the fake services to mark themselves initialized.
            // If any of them is missing from the StepRecorder,
            // the ClusterBuilder is not initializing a service.
            const string Name = "Can_Build_Using_Extensions";
            var          c    = new ClusterBuilder(Name)
                                .Endpoints("127.0.0.1")
                                .Use
                                .Service <StepRecorder>()
                                .FailurePolicy <_FailurePolicy>()
                                .NodeLocator <_NodeLocator>()
                                .ReconnectPolicy <_ReconnectPolicy>()
                                .Register();

            var cluster = c.Resolve <ICluster>();
            var m       = c.Resolve <StepRecorder>();

            m.AssertSteps("FailurePolicy", "NodeLocator", "ReconnectPolicy");

            ClusterManager.Shutdown(Name);
        }
		public void Can_Build_Using_Extensions()
		{
			// Register a StepRecorder instance which will be used
			// by the fake services to mark themselves initialized.
			// If any of them is missing from the StepRecorder,
			// the ClusterBuilder is not initializing a service.
			const string Name = "Can_Build_Using_Extensions";
			var c = new ClusterBuilder(Name)
							.Endpoints("127.0.0.1")
							.Use
								.Service<StepRecorder>()
								.FailurePolicy<_FailurePolicy>()
								.NodeLocator<_NodeLocator>()
								.ReconnectPolicy<_ReconnectPolicy>()
							.Register();

			var cluster = c.Resolve<ICluster>();
			var m = c.Resolve<StepRecorder>();

			m.AssertSteps("FailurePolicy", "NodeLocator", "ReconnectPolicy");

			ClusterManager.Shutdown(Name);
		}
        public static ClusterBuilder DoRegisterStreamFactory(this ClusterBuilder clusterBuilder, Func <IStreamFactory, IStreamFactory> wrapper)
        {
            if (clusterBuilder == null)
            {
                throw new ArgumentNullException(nameof(clusterBuilder));
            }
            if (wrapper == null)
            {
                throw new ArgumentNullException(nameof(wrapper));
            }

            if (CanRegisterStreamFactory)
            {
                // native RegisterStreamFactory is known to be working
                return(clusterBuilder.RegisterStreamFactory(wrapper));
            }

            Debug.Assert(_streamFactoryWrapper != null);

            var streamFactoryWrapper = (Func <IStreamFactory, IStreamFactory>)_streamFactoryWrapper.GetValue(clusterBuilder);

            _streamFactoryWrapper.SetValue(clusterBuilder, (Func <IStreamFactory, IStreamFactory>)(inner => wrapper(streamFactoryWrapper(inner))));
            return(clusterBuilder);
        }
Esempio n. 26
0
 public static ClusterBuilder WithCustomLog(this ClusterBuilder builder, string providerName, string primaryCluster = null)
 {
     return(new CustomLogDecorator(builder, providerName, primaryCluster));
 }
Esempio n. 27
0
        bool ValidateUniqueMatches(IList <Match> matches,
                                   string nodeName, AdditionalParameters additionalParam, bool isFilePath)
        {
            switch (additionalParam)
            {
            case AdditionalParameters.PerformClusterBuilder:
                // Validates the Cluster builder MUMs
                string firstSeqOrderExpected =
                    utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ClustFirstSequenceStartNode);
                string lengthExpected =
                    utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ClustLengthNode);
                string secondSeqOrderExpected =
                    utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ClustSecondSequenceStartNode);

                StringBuilder firstSeqOrderActual  = new StringBuilder();
                StringBuilder lengthActual         = new StringBuilder();
                StringBuilder secondSeqOrderActual = new StringBuilder();

                ClusterBuilder cb = new ClusterBuilder();
                cb.MinimumScore = 0;

                List <MatchExtension> meObj = new List <MatchExtension>();

                foreach (Match m in matches)
                {
                    meObj.Add(new MatchExtension(m));
                }

                // Order the mum list with query sequence order and
                // Assign query sequence to the MUM's
                for (int index = 0; index < meObj.Count(); index++)
                {
                    meObj.ElementAt(index).ReferenceSequenceMumOrder = index + 1;
                    meObj.ElementAt(index).QuerySequenceMumOrder     = index + 1;
                }

                List <Cluster> clusts = cb.BuildClusters(meObj);

                foreach (Cluster clust in clusts)
                {
                    foreach (MatchExtension maxMatchExtension in clust.Matches)
                    {
                        firstSeqOrderActual.Append(maxMatchExtension.ReferenceSequenceMumOrder);
                        secondSeqOrderActual.Append(maxMatchExtension.QuerySequenceMumOrder);
                        lengthActual.Append(maxMatchExtension.Length);
                    }
                }

                if ((0 != string.Compare(firstSeqOrderExpected.Replace(",", ""),
                                         firstSeqOrderActual.ToString(), true, CultureInfo.CurrentCulture)) ||
                    (0 != string.Compare(lengthExpected.Replace(",", ""),
                                         lengthActual.ToString(), true, CultureInfo.CurrentCulture)) ||
                    (0 != string.Compare(secondSeqOrderExpected.Replace(",", ""),
                                         secondSeqOrderActual.ToString(), true, CultureInfo.CurrentCulture)))
                {
                    Console.WriteLine("NUCmer BVT : Unique match not matching");
                    ApplicationLog.WriteLine("NUCmer BVT : Unique match not matching");
                    return(false);
                }
                break;

            case AdditionalParameters.FindUniqueMatches:
                // Gets all the unique matches properties to be validated as in xml.
                string[] firstSeqOrder  = null;
                string[] length         = null;
                string[] secondSeqOrder = null;

                if (isFilePath)
                {
                    firstSeqOrder = utilityObj.xmlUtil.GetFileTextValue(nodeName,
                                                                        Constants.FirstSequenceMumOrderNode).Split(',');
                    length = utilityObj.xmlUtil.GetFileTextValue(nodeName,
                                                                 Constants.LengthNode).Split(',');
                    secondSeqOrder = utilityObj.xmlUtil.GetFileTextValue(nodeName,
                                                                         Constants.SecondSequenceMumOrderNode).Split(',');
                }
                else
                {
                    firstSeqOrder = utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                    Constants.FirstSequenceMumOrderNode).Split(',');
                    length = utilityObj.xmlUtil.GetTextValue(nodeName,
                                                             Constants.LengthNode).Split(',');
                    secondSeqOrder = utilityObj.xmlUtil.GetTextValue(nodeName,
                                                                     Constants.SecondSequenceMumOrderNode).Split(',');
                }

                int i = 0;

                IList <MatchExtension> meNewObj = new List <MatchExtension>();

                foreach (Match m in matches)
                {
                    meNewObj.Add(new MatchExtension(m));
                }

                // Order the mum list with query sequence order and
                // Assign query sequence to the MUM's
                for (int index = 0; index < meNewObj.Count(); index++)
                {
                    meNewObj.ElementAt(index).ReferenceSequenceMumOrder = index + 1;
                    meNewObj.ElementAt(index).QuerySequenceMumOrder     = index + 1;
                }

                // Loops through all the matches and validates the same.
                foreach (MatchExtension match in meNewObj)
                {
                    if ((0 != string.Compare(firstSeqOrder[i],
                                             match.ReferenceSequenceMumOrder.ToString((IFormatProvider)null), true,
                                             CultureInfo.CurrentCulture)) ||
                        (0 != string.Compare(length[i],
                                             match.Length.ToString((IFormatProvider)null), true,
                                             CultureInfo.CurrentCulture)) ||
                        (0 != string.Compare(secondSeqOrder[i],
                                             match.QuerySequenceMumOrder.ToString((IFormatProvider)null), true,
                                             CultureInfo.CurrentCulture)))
                    {
                        Console.WriteLine(string.Format((IFormatProvider)null,
                                                        "NUCmer BVT : Unique match not matching at index '{0}'", i.ToString((IFormatProvider)null)));
                        ApplicationLog.WriteLine(string.Format((IFormatProvider)null,
                                                               "NUCmer BVT : Unique match not matching at index '{0}'", i.ToString((IFormatProvider)null)));
                        return(false);
                    }
                    i++;
                }
                break;

            default:
                break;
            }
            return(true);
        }
Esempio n. 28
0
 private static void ConfigureCluster(ClusterBuilder cb)
 {
     cb.UsePerformanceCounters("test", true);
 }
Esempio n. 29
0
 public static ClusterBuilder WithAzureTableStorage(this ClusterBuilder builder, string providerName, string connectionString, string tableName = "OrleansGrainState", bool deleteOnClear = false, bool useJsonFormat = false, bool useFullAssemblyNames = false, bool indentJson = false)
 {
     return(new AzureTableStorageDecorator(builder, providerName, connectionString, tableName, deleteOnClear, useJsonFormat, useFullAssemblyNames, indentJson));
 }
Esempio n. 30
0
 public static ClusterBuilder WithMultiCluster(this ClusterBuilder builder, params string[] clusters)
 {
     return(new MultiClusterDecorator(builder, clusters));
 }
Esempio n. 31
0
        private static void ConfigureCluster(ClusterBuilder cb)
        {
#if NET452
            cb.UsePerformanceCounters("test", true);
#endif
        }
Esempio n. 32
0
 public static ClusterBuilder WithGossipChannel(this ClusterBuilder builder, GossipChannelType channelType, string connectionString)
 {
     return(new GossipChannelDecorator(builder, channelType, connectionString));
 }