<commit_before>package servicesAPI

import scala.concurrent.duration._

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._

import scala.util.parsing.json._

class GetServices1 extends Simulation {

    val httpProtocol = http
		.baseURL("http://sp.int3.sonata-nfv.eu:32001")
		.inferHtmlResources()
		.acceptHeader("*/*")
		.userAgentHeader("curl/7.35.0")

	val loginRequest = tryMax(1) {
                exec(
                    http("requesting_access_token")
                        .post("http://sp.int3.sonata-nfv.eu:32001/api/v2/sessions")
                        .headers(Map(
                            "Accept" -> "application/json, */*; q=0.01",
                            "Content-Type" -> "application/json; charset=UTF-8"
                            )
                        )
                        .body(StringBody(
                            Util.jsonFromMap(Map(
                                "username" -> "user01",
                                "password" -> "<PASSWORD>"
                            ))
                        ))
                        .check(status.is(200))
                        //.check(bodyString.saveAs("login_response"))
                        .check(
                              jsonPath("$.access_token").saveAs("access_token")
                            )
                )
                .exec(
                    session => {
                    val accessToken = session.get("access_token").asOption[String]
                    println(accessToken.getOrElse("COULD NOT FIND TOKEN"))
                    session
                })

    }.exitHereIfFailed

    val uri1 = "http://sp.int3.sonata-nfv.eu:32001/api/v2/services"

	val scn = scenario("GetServices1")
	    .exec(loginRequest)
		.exec(
		    http("services_1")
			.get("/api/v2/services")
			.headers(Map(
                "Authorization" -> "bearer ${accessToken}"
                )
			)

	setUp
	    (scn.inject(
	        nothingFor(4 seconds),
	        atOnceUsers(1000))
	    )
	.protocols(httpProtocol)<commit_msg>Fixed bug<commit_after>package servicesAPI

import scala.concurrent.duration._

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._

import scala.util.parsing.json._

class GetServices1 extends Simulation {

    val httpProtocol = http
		.baseURL("http://sp.int3.sonata-nfv.eu:32001")
		.inferHtmlResources()
		.acceptHeader("*/*")
		.userAgentHeader("curl/7.35.0")

	val loginRequest = tryMax(1) {
                exec(
                    http("requesting_access_token")
                        .post("http://sp.int3.sonata-nfv.eu:32001/api/v2/sessions")
                        .headers(Map(
                            "Accept" -> "application/json, */*; q=0.01",
                            "Content-Type" -> "application/json; charset=UTF-8"
                            )
                        )
                        .body(StringBody(
                            Util.jsonFromMap(Map(
                                "username" -> "user01",
                                "password" -> "<PASSWORD>"
                            ))
                        ))
                        .check(status.is(200))
                        //.check(bodyString.saveAs("login_response"))
                        .check(
                              jsonPath("$.access_token").saveAs("access_token")
                            )
                )
                .exec(
                    session => {
                    val accessToken = session.get("access_token").asOption[String]
                    println(accessToken.getOrElse("COULD NOT FIND TOKEN"))
                    session
                })

    }.exitHereIfFailed

    val uri1 = "http://sp.int3.sonata-nfv.eu:32001/api/v2/services"

	val scn = scenario("GetServices1")
	    .exec(loginRequest)
		.exec(
		    http("services_1")
			.get("/api/v2/services")
			.headers(Map(
                "Authorization" -> "bearer ${accessToken}"
                )
			)
        )

	setUp
	    (scn.inject(
	        nothingFor(4 seconds),
	        atOnceUsers(1000))
	    )
	.protocols(httpProtocol)
{'fraction_non_alphanumeric': 0.12260994263862332, 'fraction_numerical': 0.021032504780114723, 'mean_word_length': 1.251210328133405, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '137913', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1137, 'n_words': 154}