public void addConfigurationExoScale( String configName, int cpuValue, double ramValue, boolean windows) throws Exception { Configuration config = new Configuration(); config.setProvider(this); config.setConfigName(configName); config.setCpu(cpuValue); config.setRam(ramValue); WebElement disk = driver .findElement(By.className("summary")) .findElement(By.className("hdd")) .findElement(By.className("spec-value")); double diskValue = this.extractNumber(disk.getText()); // System.out.println("disk : "+diskValue); config.setSsd(diskValue); if (windows) { config.setOsUri(URI.windows); } else { config.setOsUri(URI.linux); } Thread.sleep(500); WebElement price = driver .findElement(By.className("summary")) .findElement(By.className("price-month")) .findElement(By.className("price-value")); double priceValue = Double.parseDouble(price.getText()); // System.out.println("price : "+priceValue); config.setPrice(priceValue); config.setDate(this.getDate()); config.println(); this.configurations.add(config); }
@Override public void crawlFillWriteConfigurations() throws InterruptedException, IOException, Exception { this.openFirefox(); this.loadWebpage(); Thread.sleep(3000); for (int transferActual = 0; transferActual < this.transferClick; transferActual += (this.transferClick * this.crawlSpeed)) { for (int diskActual = 0; diskActual < this.diskClick; diskActual += (this.diskClick * this.crawlSpeed)) { for (int ramActual = 0; ramActual < this.ramClick; ramActual += (this.ramClick * this.crawlSpeed)) { for (int cpuActual = 0; cpuActual < this.cpuClick; cpuActual += (this.cpuClick * this.crawlSpeed)) { Configuration config = new Configuration(); // For linux config config.setProvider(this); config.setCpu(this.getCpu()); config.setRam(this.getRam()); config.setHdd(this.getDisk()); config.setTransferSpeed(this.getTransfer()); config.setPrice(this.getPrice()); config.setOsUri(URI.linux); config.setDate(this.getDate()); this.configurations.add(config); config.println(); Configuration config2 = new Configuration(); // For windows config config2.setProvider(this); config2.setCpu(this.getCpu()); config2.setRam(this.getRam()); config2.setHdd(this.getDisk()); config2.setTransferSpeed(this.getTransfer()); config2.setPrice(this.getPrice() + this.getWindowsPrice()); config2.setOsUri(URI.windows); config2.setDate(this.getDate()); this.configurations.add(config2); config2.println(); this.mooveCpu((this.cpuClick * this.crawlSpeed)); } this.mooveCpu(-this.cpuClick); this.mooveRam((this.ramClick * this.crawlSpeed)); } this.mooveRam(-this.ramClick); this.mooveDisk((this.diskClick * this.crawlSpeed)); } this.mooveDisk(-this.diskClick); this.mooveTransfer((this.transferClick * this.crawlSpeed)); } Thread.sleep(3000); this.closeFirefox(); if (!SipsRdf.verbose) { System.out.println(""); } this.writeConfigurationsInCsv(); }