text:
#author - vhisav@microsoft.com

Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
#$isDeployed = "ICA-HS-M1S1-sscent71p-4-7-19-21-28"
if ($isDeployed)
{
	try
	{
        $allVMData = GetAllDeployementData -DeployedServices $isDeployed
		$noServer = $true
		$noClient = $true
        $clientMachines = @()
        $slaveHostnames = ""
		foreach ( $vmData in $allVMData )
		{
			if ( $vmData.RoleName -imatch "Server" )
			{
                $serverVMData = $vmData
				$noServer = $false

			}
			elseif ( $vmData.RoleName -imatch "Client" )
			{
				$clientMachines = $vmData
				$noClient = $fase
                if ( $slaveHostnames )
                {
                    $slaveHostnames += "," + $vmData.RoleName
                }
                else
                {
                    $slaveHostnames = $vmData.RoleName
                }
			}
		}
		if ( $noServer )
		{
			Throw "No any server VM defined. Be sure that, server VM role name matches with the pattern `"*server*`". Aborting Test."
		}
		if ( $noSlave )
		{
			Throw "No any client VM defined. Be sure that, client machine role names matches with pattern `"*client*`" Aborting Test."
		}
		#region CONFIGURE VMs for TEST

		LogMsg "SERVER VM details :"
		LogMsg "  RoleName : $($serverVMData.RoleName)"
		LogMsg "  Public IP : $($serverVMData.PublicIP)"
		LogMsg "  SSH Port : $($serverVMData.SSHPort)"
        $i = 1
        foreach ( $clientVMData in $clientMachines )
        {
		    LogMsg "CLIENT VM #$i details :"
		    LogMsg "  RoleName : $($clientVMData.RoleName)"
		    LogMsg "  Public IP : $($clientVMData.PublicIP)"
		    LogMsg "  SSH Port : $($clientVMData.SSHPort)"
        }
		#
		# PROVISION VMS FOR LISA WILL ENABLE ROOT USER AND WILL MAKE ENABLE PASSWORDLESS AUTHENTICATION ACROSS ALL VMS IN SAME HOSTED SERVICE.
		#

		ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames "none"

		#endregion

        #region Provision VMs for RDMA tests

        #region Generate constants.sh

		LogMsg "Generating constansts.sh ..."
        $constantsFile = ".\$LogDir\constants.sh"
		#foreach ($testParam in $currentTestData.params )
		#{
		#	Add-Content -Value "$testParam" -Path $constantsFile
		#	LogMsg "$testParam added to constansts.sh"
		#}

		Add-Content -Value "master=`"$($serverVMData.RoleName)`"" -Path $constantsFile
        LogMsg "master=$($serverVMData.RoleName) added to constansts.sh"

        Add-Content -Value "slaves=`"$slaveHostnames`"" -Path $constantsFile
        LogMsg "slaves=$slaveHostnames added to constansts.sh"

		Add-Content -Value "rdmaPrepare=`"yes`"" -Path $constantsFile
		LogMsg "rdmaPrepare=yes added to constansts.sh"

		Add-Content -Value "rdmaRun=`"yes`"" -Path $constantsFile
		LogMsg "rdmaRun=yes added to constansts.sh"

		LogMsg "constanst.sh created successfully..."
		#endregion

        #region Generate etc-hosts.txt file
        $hostsFile = ".\$LogDir\etc-hosts.txt"
        foreach ( $vmDetails in $allVMData )
        {
            Add-Content -Value "$($vmDetails.InternalIP)`t$($vmDetails.RoleName)" -Path "$hostsFile"
            LogMsg "$($vmDetails.InternalIP)`t$($vmDetails.RoleName) added to etc-hosts.txt"
        }
        #endregion

        #region Upload files to master VM...
        Set-Content -Value "/root/TestRDMA.sh &> rdmaConsole.txt" -Path "$LogDir\StartRDMA.sh"
        Set-Content -Value "*               hard    memlock            unlimited" -Path "$LogDir\limits.conf"
        Add-Content -Value "*               soft    memlock            unlimited" -Path "$LogDir\limits.conf"
        RemoteCopy -uploadTo $serverVMData.PublicIP -port $serverVMData.SSHPort -files "$constantsFile,$hostsFile,.\remote-scripts\TestRDMA.sh,.\$LogDir\StartRDMA.sh,.\$LogDir\limits.conf" -username "root" -password $password -upload
        #endregion

        #region Install LIS-RDMA drivers..

        $osRelease = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "cat /etc/*release*"
        if ( $osRelease -imatch "CentOS Linux release 7.1.")
        {
            $LIS4folder = "RHEL71"
        }
        if ( $osRelease -imatch "CentOS Linux release 7.0.")
        {
            $LIS4folder = "RHEL70"
        }
        if ( $osRelease -imatch "CentOS Linux release 6.5")
        {
            $LIS4folder = "RHEL65"
        }

        $LIS4IntallCommand = "tar -xf lis-4.0.11-RDMA.tar && chmod +x $LIS4folder/install.sh && cd $LIS4folder && ./install.sh"
        $LIS4InstallJobs = @()
        foreach ( $vm in $allVMData )
        {
            #Install LIS4 RDMA drivers...
            LogMsg "Setting contents of /etc/security/limits.conf..."
		    $out = .\tools\dos2unix.exe ".\$LogDir\limits.conf" 2>&1
		    LogMsg $out
            RemoteCopy -uploadTo $vm.PublicIP -port $vm.SSHPort -files ".\$LogDir\limits.conf" -username "root" -password $password -upload
            $out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "cat limits.conf >> /etc/security/limits.conf"

            LogMsg "Downlaoding LIS-RDMA drivers ..."
            $out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "wget https://ciwestus.blob.core.windows.net/linuxbinaries/lis-4.0.11-RDMA.tar"

			LogMsg "Executing $LIS4IntallCommand ..."
			$jobID = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "$LIS4IntallCommand" -RunInBackground
			$LIS4InstallObj = New-Object PSObject
			Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name ID -Value $jobID
			Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name RoleName -Value $vm.RoleName
			Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name PublicIP -Value $vm.PublicIP
			Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name SSHPort -Value $vm.SSHPort
			$LIS4InstallJobs += $LIS4InstallObj
        }

	    $LIS4InstallJobsRunning = $true
        $lisInstallErrorCount = 0
	    while ($LIS4InstallJobsRunning)
	    {
		    $LIS4InstallJobsRunning = $false
		    foreach ( $job in $LIS4InstallJobs )
		    {
			    if ( (Get-Job -Id $($job.ID)).State -eq "Running" )
			    {
				    LogMsg "LIS4-rdma Installation Status for $($job.RoleName) : Running"
				    $LIS4InstallJobsRunning = $true
			    }
			    else
			    {
                    $jobOut = Receive-Job -ID $($job.ID)
                    if ( $jobOut -imatch "Please reboot your system")
                    {
                        LogMsg "LIS-rdma installed successfully for $($job.RoleName)"
                    }
                    else
                    {
                        #LogErr "LIS-rdma installation failed $($job.RoleName)"
                        #$lisInstallErrorCount += 1
                    }
			    }

		    }
		    if ( $LIS4InstallJobsRunning )
		    {
			    WaitFor -seconds 10
		    }
            #else
            #{
            #    if ( $lisInstallErrorCount -ne 0 )
            #    {
            #        Throw "LIS-rdma installation failed for some VMs.Aborting Test."
            #    }
            #}
	    }

        $isRestarted = RestartAllDeployments -allVMData $allVMData
        if ( ! $isRestarted )
        {
            Throw "Failed to restart deployments in $isDeployed. Aborting Test."
        }
		#endregion

		#region EXECUTE TEST
		$out = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh"
		$testJob = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "/root/StartRDMA.sh" -RunInBackground
		#endregion

		#region MONITOR TEST
		while ( (Get-Job -Id $testJob).State -eq "Running" )
		{
			$currentStatus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "tail -n 1 /root/rdmaConsole.txt"
			LogMsg "Current Test Staus : $currentStatus"
			WaitFor -seconds 10
		}

		RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/rdmaConsole.txt"
		RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/summary.log"
		$finalStatus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "cat /root/state.txt"
		$rdmaSummary = Get-Content -Path "$LogDir\summary.log" -ErrorAction SilentlyContinue

		if ($finalStatus -imatch "TestCompleted")
		{
            LogMsg "Test finished successfully. Please check $LogDir\rdmaConsole.txt for detailed results."
		}
        else
        {
            LogErr "Test did not finished successfully. Please check $LogDir\rdmaConsole.txt for detailed results."
        }
		#endregion

		if ( $finalStatus -imatch "TestFailed")
		{
			LogErr "Test failed. Last known status : $currentStatus."
			$testResult = "FAIL"
		}
		elseif ( $finalStatus -imatch "TestAborted")
		{
			LogErr "Test Aborted. Last known status : $currentStatus."
			$testResult = "ABORTED"
		}
		elseif ( $finalStatus -imatch "TestCompleted")
		{
			LogMsg "Test Completed. Result : $finalStatus."
			$testResult = "PASS"
		}
		elseif ( $finalStatus -imatch "TestRunning")
		{
			LogMsg "Powershell backgroud job for test is completed but VM is reporting that test is still running. Please check $LogDir\mdConsoleLogs.txt"
			LogMsg "Contests of state.txt : $finalStatus"
			$testResult = "PASS"
		}
		LogMsg "Test result : $testResult"
		LogMsg "Test Completed"
	}
	catch
	{
		$ErrorMessage =  $_.Exception.Message
		LogMsg "EXCEPTION : $ErrorMessage"
	}
	Finally
	{
		$metaData = "Status"
		if (!$testResult)
		{
			$testResult = "Aborted"
		}
		$resultArr += $testResult
		$resultSummary +=  CreateResultSummary -testResult $finalStatus -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName# if you want to publish all result then give here all test status possibilites. if you want just failed results, then give here just "FAIL". You can use any combination of PASS FAIL ABORTED and corresponding test results will be published!
	}
}

else
{
	$testResult = "Aborted"
	$resultArr += $testResult
}

$result = GetFinalResultHeader -resultarr $resultArr

#Clean up the setup
DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed

#Return the result and summery to the test suite script..
return $result, $resultSummary


text:
package collins.util.parsers

import org.specs2._
import org.specs2.specification.Scope
import org.specs2.matcher.Matcher

import play.api.test.WithApplication
import play.api.test.FakeApplication

import com.typesafe.config.ConfigFactory

import collins.util.LshwRepresentation

class LshwParserSpec extends mutable.Specification {

  def beNonEmptyStringSeq: Matcher[Seq[String]] = { s:Seq[String] =>
    s.forall { x => x.nonEmpty && x.size >= 5 }
  }

  class LshwParserHelper(val filename: String, val ac: Map[String, _ <: Any] = Map.empty)
    extends WithApplication(FakeApplication(additionalConfiguration = ac)) with Scope with CommonParserSpec[LshwRepresentation] {
    override def getParser(txt: String) =
      new LshwParser(txt)
    def parsed() = getParseResults(filename)
  }

  "The Lshw Parser" should {

    "Parse Dell (AMD) lshw output" in {

      "with a 10-Gig card" in new LshwParserHelper("lshw-10g.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 12
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(2.3, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(32L, 1)
          rep.memoryBanksUsed mustEqual 4
          rep.memoryBanksUnused mustEqual 8
          rep.memoryBanksTotal mustEqual 12

          rep.totalStorage.toHuman mustEqual "5.46 TB"
          rep.diskCount mustEqual 6

          rep.nicCount mustEqual 3
          rep.hasGbNic must beTrue
          rep.has10GbNic must beTrue
          rep.macAddresses must have length 3
          rep.macAddresses must beNonEmptyStringSeq

          rep.base.product mustEqual "PowerEdge C6105 (N/A)"
          rep.base.vendor mustEqual "Winbond Electronics"
          rep.base.serial mustEqual "FZ1NXQ1"
        }
      } // with a 10-gig card

      "quad nic missing capacity having size" in new LshwParserHelper("lshw-size.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.nicCount mustEqual 4
          rep.hasGbNic must beTrue
          rep.has10GbNic must beTrue
          rep.macAddresses must have length 4
          rep.macAddresses must beNonEmptyStringSeq

          rep.base.product mustEqual "PowerEdge C6220 II (N/A)"
          rep.base.vendor mustEqual "Dell Inc."
        }
      }

      "basic" in new LshwParserHelper("lshw-basic.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 12
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(2.3, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(32L, 1)
          rep.memoryBanksUsed mustEqual 4
          rep.memoryBanksUnused mustEqual 8
          rep.memoryBanksTotal mustEqual 12

          rep.totalStorage.toHuman mustEqual "5.46 TB"
          rep.diskCount mustEqual 6

          rep.hasFlashStorage must beFalse
          rep.totalFlashStorage.toHuman mustEqual "0 Bytes"
          rep.totalUsableStorage.toHuman mustEqual "5.46 TB"

          rep.nicCount mustEqual 2
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 2
          rep.macAddresses must beNonEmptyStringSeq
        }
      } // basic

      "quad nic" in new LshwParserHelper("lshw-quad.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 12
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(2.3, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(96L, 1)
          rep.memoryBanksUsed mustEqual 12
          rep.memoryBanksUnused mustEqual 0
          rep.memoryBanksTotal mustEqual 12

          rep.totalStorage.toHuman mustEqual "931.52 GB"
          rep.diskCount mustEqual 2

          rep.hasFlashStorage must beFalse
          rep.totalFlashStorage.toHuman mustEqual "0 Bytes"
          rep.totalUsableStorage.toHuman mustEqual "931.52 GB"

          rep.nicCount mustEqual 6
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 6
          rep.macAddresses must beNonEmptyStringSeq
        }
      }

      "quad nic missing capacity" in new LshwParserHelper("lshw-quad-no-capacity.xml", Map("lshw.defaultNicCapacity" -> "10000000000")) {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 12
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(2.3, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(96L, 1)
          rep.memoryBanksUsed mustEqual 12
          rep.memoryBanksUnused mustEqual 0
          rep.memoryBanksTotal mustEqual 12

          rep.totalStorage.toHuman mustEqual "931.52 GB"
          rep.diskCount mustEqual 2

          rep.hasFlashStorage must beFalse
          rep.totalFlashStorage.toHuman mustEqual "0 Bytes"
          rep.totalUsableStorage.toHuman mustEqual "931.52 GB"

          rep.nicCount mustEqual 6
          rep.hasGbNic must beTrue
          rep.has10GbNic aka "has 10 gig card" must beTrue // picked up from default in config
          rep.macAddresses must have length 6
          rep.macAddresses must beNonEmptyStringSeq
        }
      } // basic

      "with a virident card" in new LshwParserHelper("lshw-virident.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 12
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(2.3, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(32L, 1)
          rep.memoryBanksUsed mustEqual 4
          rep.memoryBanksUnused mustEqual 8
          rep.memoryBanksTotal mustEqual 12

          rep.hasFlashStorage must beTrue
          rep.totalFlashStorage.toHuman mustEqual "1.27 TB"
          rep.totalUsableStorage.toHuman mustEqual "1.55 TB"

          rep.totalStorage.toHuman mustEqual "278.46 GB"
          rep.diskCount mustEqual 4

          rep.nicCount mustEqual 2
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 2
          rep.macAddresses must beNonEmptyStringSeq
        }
      }

    } // Parse dell (AMD) lshw output

    "Parse different versioned formats" in {
      "B.02.12 format" in new LshwParserHelper("lshw-old.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 2
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(1.6, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(72L, 1)
          rep.memoryBanksUsed mustEqual 18
          rep.memoryBanksUnused mustEqual 0
          rep.memoryBanksTotal mustEqual 18

          rep.totalStorage.toHuman mustEqual "930.99 GB"
          rep.diskCount mustEqual 3

          rep.nicCount mustEqual 4
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 4
          rep.macAddresses must beNonEmptyStringSeq

          rep.base.product mustEqual "X8DTN"
          rep.base.vendor mustEqual "Supermicro"
        }
      } // B.02.12 format

      "B.02.14 format" in new LshwParserHelper("lshw-b0214.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 2
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(2.3, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(96L, 1)
          rep.memoryBanksUsed mustEqual 12
          rep.memoryBanksUnused mustEqual 0
          rep.memoryBanksTotal mustEqual 12

          rep.totalStorage.toHuman mustEqual "931.52 GB"
          rep.diskCount mustEqual 2

          rep.nicCount mustEqual 6
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 6
          rep.macAddresses must beNonEmptyStringSeq
        }
      }

      "B.02.15 format" in new LshwParserHelper("lshw-intel.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 12
          rep.hasHyperthreadingEnabled must beTrue
          rep.cpuSpeed must beCloseTo(1.6, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(72L, 1)
          rep.memoryBanksUsed mustEqual 18
          rep.memoryBanksUnused mustEqual 0
          rep.memoryBanksTotal mustEqual 18

          rep.totalStorage.toHuman mustEqual "930.99 GB"
          rep.diskCount mustEqual 3

          rep.nicCount mustEqual 4
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 4
          rep.macAddresses must beNonEmptyStringSeq
        }
      }

      "B.02.16 format" in new LshwParserHelper("lshw-b0216.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 12
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(2.3, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(32L, 1)
          rep.memoryBanksUsed mustEqual 4
          rep.memoryBanksUnused mustEqual 8
          rep.memoryBanksTotal mustEqual 12

          rep.totalStorage.toHuman mustEqual "465.76 GB"
          rep.hasFlashStorage must beFalse
          rep.totalFlashStorage.toHuman mustEqual "0 Bytes"
          rep.diskCount mustEqual 1
          rep.hasCdRom must beFalse

          rep.nicCount mustEqual 2
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 2
          rep.macAddresses must beNonEmptyStringSeq

          rep.base.product mustEqual "PowerEdge C6105 (N/A)"
          rep.base.vendor mustEqual "Dell Inc."

        }
      }
    }

    "Leverage config for flash disks" in {
      "Different flash description and size" in new LshwParserHelper("lshw-virident.xml", Map(
          "lshw.flashProduct" -> "flashmax",
          "lshw.flashSize" -> "1048576"
        )) {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.hasFlashStorage must beTrue
          rep.totalFlashStorage.toHuman mustEqual "1.00 MB"
          rep.totalUsableStorage.toHuman mustEqual "278.47 GB"
        }
      }

      /*"Bad flash description" in new LshwParserHelper("lshw-bad-flash.xml", Map(
          "lshw.flashProduct" -> "flashing memory",
          "lshw.flashSize" -> "1048576"
        )) {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.hasFlashStorage must beFalse
          rep.totalFlashStorage.toHuman mustEqual "0 Bytes"
          rep.totalUsableStorage.toHuman mustEqual "278.46 GB"
        }
      }*/
    }

    "Parse softlayer supermicro (Intel) lshw output" in {
      "A Production SL Web LSHW Output" in new LshwParserHelper("lshw-old-web.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 2
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(1.6, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(24L, 1)
          rep.memoryBanksUsed mustEqual 6
          rep.memoryBanksUnused mustEqual 6
          rep.memoryBanksTotal mustEqual 12

          rep.totalStorage.toHuman mustEqual "465.76 GB"
          rep.hasFlashStorage must beFalse
          rep.totalFlashStorage.toHuman mustEqual "0 Bytes"
          rep.diskCount mustEqual 2
          rep.hasCdRom must beTrue

          rep.nicCount mustEqual 4
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 4
          rep.macAddresses must beNonEmptyStringSeq
        }
      } // B.02.12 format

      "A New Production SL Web LSHW Output" in new LshwParserHelper("lshw-new-web-old-lshw.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
          rep.cpuCoreCount mustEqual 2
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(2.0, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(32L, 1)
          rep.memoryBanksUsed mustEqual 8
          rep.memoryBanksUnused mustEqual 16
          rep.memoryBanksTotal mustEqual 24

          rep.totalStorage.toHuman mustEqual "465.76 GB"
          rep.hasFlashStorage must beFalse
          rep.totalFlashStorage.toHuman mustEqual "0 Bytes"
          rep.diskCount mustEqual 2
          rep.hasCdRom must beTrue

          rep.nicCount mustEqual 4
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 4
          rep.macAddresses must beNonEmptyStringSeq
        }
      } // B.02.12 format

    } // Parse softlayer supermicro (Intel) lshw output"

    "Parse Dell LSHW Output" in {
      "R620 LSHW Output" in new LshwParserHelper("lshw-dell-r620-single-cpu.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 1
          rep.cpuCoreCount mustEqual 8
          rep.hasHyperthreadingEnabled must beTrue
          rep.cpuSpeed must beCloseTo(2.0, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(32L, 1)
          rep.memoryBanksUsed mustEqual 4
          rep.memoryBanksUnused mustEqual 20
          rep.memoryBanksTotal mustEqual 24

          rep.nicCount mustEqual 4
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 4
          rep.macAddresses must beNonEmptyStringSeq

          rep.base.product mustEqual "PowerEdge R620 ()"
          rep.base.vendor mustEqual "Winbond Electronics"
        }
      }
      "with LVM disk" in new LshwParserHelper("lshw-lvm.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 1
          rep.cpuCoreCount mustEqual 8
          rep.hasHyperthreadingEnabled must beTrue
          rep.cpuSpeed must beCloseTo(2.0, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(32L, 1)
          rep.memoryBanksUsed mustEqual 4
          rep.memoryBanksUnused mustEqual 20
          rep.memoryBanksTotal mustEqual 24

          rep.totalStorage.toHuman mustEqual "381.94 GB"
          rep.diskCount mustEqual 2

          rep.hasFlashStorage must beFalse
          rep.totalFlashStorage.toHuman mustEqual "0 Bytes"
          rep.totalUsableStorage.toHuman mustEqual "381.94 GB"

          rep.nicCount mustEqual 4
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 4
          rep.macAddresses must beNonEmptyStringSeq
        }
      } // LVM
    }

    "parse amd-opteron-wonky" in {
      "wonky amd-opteron output" in new LshwParserHelper("lshw-amd-opteron-wonky.xml") {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 1
          rep.cpuCoreCount mustEqual 1 // This really has 6, but sadly lshw has no clue
          rep.hasHyperthreadingEnabled must beFalse
          rep.cpuSpeed must beCloseTo(2.8, 0.1)

          rep.totalMemory.inGigabytes must beCloseTo(16L, 1)
          rep.memoryBanksUsed mustEqual 4
          rep.memoryBanksUnused mustEqual 8
          rep.memoryBanksTotal mustEqual 12

          rep.nicCount mustEqual 2
          rep.hasGbNic must beTrue
          rep.has10GbNic must beFalse
          rep.macAddresses must have length 2
          rep.macAddresses must beNonEmptyStringSeq

          rep.base.description mustEqual "Multi-system"
          rep.base.product mustEqual "ProLiant SL335s G7"
          rep.base.vendor mustEqual "HP"
          }
       }

      "wonky amd-opteron output w/ show empty sockets" in new LshwParserHelper("lshw-amd-opteron-wonky.xml", Map(
          "lshw.includeEmptySocket" -> "true"
        )) {
        val parseResults = parsed()
        parseResults must beRight
        parseResults.right.toOption must beSome.which { rep =>
          rep.cpuCount mustEqual 2
        }
      }
    } // wonky opterons

  } // The LSHW parser should
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
org.pentaho.di.ui.i18n
</TITLE>

<META NAME="date" CONTENT="2012-11-21">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes

Package org.pentaho.di.ui.i18n

Class Summary

KeyOccurrence
Contains the occurrence of a key in a java source code file

LocaleStore
This class stores all the messages for a locale for all the used packages...

MessagesSourceCrawler
This class takes care of crawling through the source code

MessagesStore
This class contains a messages store: for a certain Locale and for a certain
 messages package, it keeps all the keys and values.

SourceCrawlerPackageException

SourceCrawlerXMLElement

SourceCrawlerXMLFolder
Contains the definition of which elements to scan in which XML files in which folder

TranslationsStore
This class contains and handles all the translations for the keys specified in the Java source code.

      Overview
    Package
      Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

  All Classes