-
Notifications
You must be signed in to change notification settings - Fork 421
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09fd707
commit b90599b
Showing
13 changed files
with
128 additions
and
624 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
perf-tests/src/main/scala/sttp/tapir/perf/apis/TypeScanner.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package sttp.tapir.perf.apis | ||
|
||
import io.github.classgraph.ClassGraph | ||
|
||
import scala.jdk.CollectionConverters._ | ||
import scala.reflect.ClassTag | ||
import scala.util.{Failure, Success, Try} | ||
|
||
import sttp.tapir.perf.Common._ | ||
|
||
/** Uses the classgraph library to quickly find all possible server runners (objects extending ServerRunner) | ||
*/ | ||
object TypeScanner { | ||
def findAllImplementations[T: ClassTag](rootPackage: String): List[Class[_]] = { | ||
val superClass = scala.reflect.classTag[T].runtimeClass | ||
|
||
val scanResult = new ClassGraph() | ||
.enableClassInfo() | ||
.acceptPackages(rootPackage) | ||
.scan() | ||
|
||
try { | ||
val classes = | ||
if (superClass.isInterface) | ||
scanResult.getClassesImplementing(superClass.getName) | ||
else | ||
scanResult.getSubclasses(superClass.getName) | ||
classes.loadClasses().asScala.toList | ||
} finally { | ||
scanResult.close() | ||
} | ||
} | ||
|
||
lazy val allServers: List[String] = | ||
findAllImplementations[ServerRunner](rootPackage) | ||
.map(_.getName) | ||
.map(c => c.stripPrefix(s"${rootPackage}.").stripSuffix("Server$")) | ||
} |
32 changes: 0 additions & 32 deletions
32
perf-tests/src/test/scala/sttp/tapir/perf/CsvReportPrinter.scala
This file was deleted.
Oops, something went wrong.
93 changes: 0 additions & 93 deletions
93
perf-tests/src/test/scala/sttp/tapir/perf/GatlingLogProcessor.scala
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
perf-tests/src/test/scala/sttp/tapir/perf/GatlingRunner.scala
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.