public void Restart(string cassandraTemplateVersion)
        {
            var templateDirectory = DirectoryHelpers.FindDirectory(AppDomain.CurrentDomain.BaseDirectory, $@"cassandra-local/cassandra/v{cassandraTemplateVersion}");

            Console.Out.WriteLine($"templateDirectory: {templateDirectory}");

            var deployDirectory = Path.Combine(Path.GetTempPath(), $"deployed_cassandra_v{cassandraTemplateVersion}");

            Console.Out.WriteLine($"deployDirectory: {deployDirectory}");

            var beforeStartTimestamp = DateTime.Now;
            var node = new LocalCassandraNode(templateDirectory, deployDirectory)
            {
                LocalNodeName = Guid.NewGuid().ToString("N")
            };

            node.Restart();

            Assert.That(Directory.Exists(deployDirectory));
            var nodePid     = LocalCassandraProcessManager.GetAllLocalCassandraProcessIds().Single();
            var nodeProcess = Process.GetProcessById(nodePid);

            Console.Out.WriteLine($"cassandra node process: [{nodePid}] {nodeProcess.ProcessName}");
            Assert.That(nodeProcess.StartTime > beforeStartTimestamp);

            node.Stop();

            Assert.That(nodeProcess.HasExited);
        }
コード例 #2
0
        private static void StartLocalCassandra(string cassandraTemplateVersion, int instanceId)
        {
            var templateDirectory = DirectoryHelpers.FindDirectory(AppDomain.CurrentDomain.BaseDirectory, $@"cassandra-local/cassandra/v{cassandraTemplateVersion}");

            Console.Out.WriteLine($"templateDirectory: {templateDirectory}");

            var deployDirectory = Path.Combine(Path.GetTempPath(), $"deployed_cassandra_v{cassandraTemplateVersion}");

            Console.Out.WriteLine($"deployDirectory: {deployDirectory}");

            var localNodeName = Guid.NewGuid().ToString("N");
            var node          = new LocalCassandraNode(templateDirectory, deployDirectory)
            {
                LocalNodeName = localNodeName,
                ClusterName   = cassandraTemplateVersion,
                RpcPort       = 9160 + instanceId,
                CqlPort       = 9042 + instanceId,
                JmxPort       = 7199 + instanceId,
                GossipPort    = 7000 + instanceId,
            };

            node.Deploy();

            var actualLocalNodeName = LocalCassandraProcessManager.StartLocalCassandraProcess(node.DeployDirectory);

            Assert.That(actualLocalNodeName, Is.EqualTo(localNodeName));

            LocalCassandraProcessManager.WaitForLocalCassandraPortsToOpen(node.RpcPort, node.CqlPort);
        }
コード例 #3
0
        public void CheckSystemTimerResolution(int testDurationSeconds)
        {
            var java8Home = JavaHomeHelpers.TryGetJavaHome(JavaHomeHelpers.Jdk8Key);

            if (string.IsNullOrWhiteSpace(java8Home))
            {
                throw new InvalidOperationException("JDK 8 64-bit home directory is not found");
            }

            var systemTimerTesterDirectory = DirectoryHelpers.FindDirectory(AppDomain.CurrentDomain.BaseDirectory, "SystemTimerTester");

            Console.Out.WriteLine($"systemTimerTesterDirectory: {systemTimerTesterDirectory}");

            Run(command: Path.Combine(java8Home, "bin/javac.exe"), args: "-target 1.8 SystemTimerTester.java", workingDirectory: systemTimerTesterDirectory);

            Run(command: Path.Combine(java8Home, "bin/java.exe"), args: $"-classpath ./ SystemTimerTester {testDurationSeconds}", workingDirectory: systemTimerTesterDirectory);
        }