Setting Up Environment
Open PowerShell as administrator (“run as administrator” on right-click), and peform the steps below:
- Set the execution policy as remotesigned in order to install chocolatey:
set-executionpolicy remotesigned
- Install chocolatey package manager
- Install instructions available here
- Install the following packages with “chocolatey install <packageName>”
- Mandatory packages (running, compiling and installing)
- jdk7 and/or jdk8 (depending on C* version to develop)
- ant
- git
- python2
- easy.install
- pip
- Optional packages (productivity)
- gnuwin
- poshgit
- Mandatory packages (running, compiling and installing)
Running cassandra-dtests
- Set $CASSANDRA_DIR environment variable (the environment variable will only be exported during next terminal session)
[Environment]::SetEnvironmentVariable("CASSANDRA_DIR", "c:\Users\<username>\<cassandra_dir>", "User")
- Download and install Microsoft Visual C++ Compiler for Python 2.7
- Available on this link
- Instal necessary python modules
pip install blist git+https://github.com/datastax/python-driver.git@cassandra-test git+https://github.com/pcmanus/ccm.git cql decorator enum34 flaky futures nose nose-test-select pycassa six thrift psutil
- Check https://github.com/riptano/cassandra-dtest/blob/master/requirements.txt for new requirements
Running CCM
- You need to set the execution policy to unrestricted to run CCM on PowerShell as administrator:
set-executionpolicy unrestricted
- Add .PY extension to environment variable $PATHEXT, to allow ccm to be executed from any location (run on PowerShell as administrator):
[Environment]::SetEnvironmentVariable("PATHEXT", "$env:PATHEXT;.PY", "MACHINE")
- Create a symbolinc link (as administrator) to make chocolatey ant work with ccm, since ccm expects an ant.bat executable, while chocolatey creates and ant.exe file:
cmd /c mklink C:\ProgramData\chocolatey\bin\ant.bat C:\ProgramData\chocolatey\bin\ant.exe
Script for switching JDKs
In a mixed JDK7/JDK8 the following PowerShell functions might be useful for switching jdks (place them on $ENV:HOME\Documents\WindowsPowerShell\profile.ps1
):
function updateJavaHome($newHome) { $env:JAVA_HOME=$newHome [Environment]::SetEnvironmentVariable("JAVA_HOME", $env:JAVA_HOME, "Machine") } function updateRegistry($newVersion) { Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\' CurrentVersion $newVersion } function updatePath { $PathWithoutJava=(($Env:Path).Split(";") | where {$_ -notmatch 'java'}) -join ";" $NewPath="$env:JAVA_HOME\bin;$pathWithoutJava" $Env:Path=$NewPath [Environment]::SetEnvironmentVariable("PATH",$NewPath,"Machine"); } function java8 { updateJavaHome("C:\Program Files\Java\jdk1.8.0_51") updateRegistry("1.8") updatePath } function java7 { updateJavaHome("C:\Program Files\Java\jdk1.7.0_76") updateRegistry("1.7") updatePath }