Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
129 views
in Technique[技术] by (71.8m points)

Scala error after maven to gradle conversion

this is my scala code for running gatling test and i ve read the folder it should be in should be marked as scala. i have converted this project to gradle from maven and the code is all fine and all the reports are generating in maven but not in gradle. The code in pic is working fine without any compliation errors in maven but in gradle its showing two errors

1: noOfScenarios-> Too many arguments for constructor 2: setUp-> cannot resolve overload method

Please do provide something. This is my image of errorcode

package performance
import io.gatling.core.Predef._
import scala.language.postfixOps
import com.intuit.karate.gatling.PreDef._
import io.gatling.core.structure.{PopulationBuilder, ScenarioBuilder}
import powerfulseal.PowerfulSeal
import utils.{Parser, Performance}

import scala.collection.mutable
import scala.concurrent.duration._
import scala.collection.JavaConverters._

class PrestoSimulation extends Simulation{
  val performanceinstance: Performance = Parser.initalizer()
  val chaostesttoggle = System.getProperty("chaostoggle","false")

  before{
    if(chaostesttoggle.equalsIgnoreCase("true")) {
      println("INFO: Running powerfulseal script")
      PowerfulSeal.runScript("kubectl apply -f src/main/resources/rbac.yml")
      PowerfulSeal.runScript("kubectl apply -f src/main/resources/powerfulseal.yml")
    }
  }
  /**
   * Build Dynamic scenarios
   * @return
   */
  val maxTime: Int = performanceinstance.getMaxTime
  def scnList(): mutable.ArraySeq[PopulationBuilder] = {
    val noOfScenarios = performanceinstance.getNoOfScenarios
    val scnList = new mutable.ArraySeq[PopulationBuilder](noOfScenarios)
    var i = 0
    val listOfScenarios = performanceinstance.getScenarios
    for (scenarioinfo <- listOfScenarios.asScala) {
      val tag ="T"+(i+1)
      println("Created scenario: "+scenarioinfo.toString)
      val scen = scenario(scenarioinfo.getScenarioName)
        .exec(karateFeature("classpath:performance/presto.feature",tag))
        .inject(rampUsers(scenarioinfo.getNoOfUsers) during (scenarioinfo.getTimeDuration seconds))

      scnList(i) = scen
      i+=1
    }
    scnList
  }
  //this is used to execute scenario
  setUp(
    scnList: _*
  ).maxDuration(maxTime.minutes).assertions(global.successfulRequests.percent.gte(100))

  after{
    if(chaostesttoggle.equalsIgnoreCase("true")) {
      println("INFO: Stopping powerfulseal script")
      PowerfulSeal.runScript("kubectl delete -f src/main/resources/powerfulseal.yml")
    }
  }
}
question from:https://stackoverflow.com/questions/65661537/scala-error-after-maven-to-gradle-conversion

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...