Skip to content
Snippets Groups Projects
Commit 940cf029 authored by Benedikt Wetzel's avatar Benedikt Wetzel
Browse files

add implementation for strategie related components


composite strategy,
binary search,
lower bound restriction,
some interfaces,
composite test

Co-authored-by: default avatarSimon Ehrenstein <stu200776@mail.uni-kiel.de>
parent 1525fb49
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus,!78Resolve "Implement Quarkus/Kotlin protype"
......@@ -3,4 +3,4 @@ package theodolite
import io.quarkus.test.junit.NativeImageTest
@NativeImageTest
class NativeGreetingResourceIT : GreetingResourceTest()
\ No newline at end of file
class NativeGreetingResourceIT : CompositeStrategyTest()
\ No newline at end of file
package theodolite
import io.quarkus.test.junit.QuarkusTest
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
import theodolite.strategies.searchstrategy.LinearSearch
import theodolite.strategies.restriction.LowerBoundRestriction
import theodolite.strategies.searchstrategy.CompositeStrategy
import theodolite.execution.TestBenchmarkExecutor
import theodolite.util.LoadDimension
import theodolite.util.Resource
import theodolite.util.Results
@QuarkusTest
class CompositeStrategyTest {
@Test
fun testEnd2End() {
val mockResults = arrayOf(
arrayOf( true , true , true , true , true , true , true),
arrayOf( false, false, true , true , true , true , true),
arrayOf( false, false, true , true , true , true , true),
arrayOf( false, false, false, true , true , true , true),
arrayOf( false, false, false, false, true , true , true),
arrayOf( false, false, false, false, false, false, true),
arrayOf( false, false, false, false, false, false, false)
)
val mockLoads: List<LoadDimension> = (0..6).map{number -> LoadDimension(number)}
val mockResources: List<Resource> = (0..6).map{number -> Resource(number)}
val benchmarkExecutor: TestBenchmarkExecutor = TestBenchmarkExecutor(mockResults)
val linearSearch: LinearSearch = LinearSearch(benchmarkExecutor);
val results: Results = Results();
val lowerBoundRestriction: LowerBoundRestriction = LowerBoundRestriction(results, mockLoads);
val strategy: CompositeStrategy = CompositeStrategy(benchmarkExecutor, linearSearch, listOf(lowerBoundRestriction))
val actual: ArrayList<Resource?> = ArrayList<Resource?>()
val expected: ArrayList<Resource?> = ArrayList(listOf(0,2,2,3,4,6).map{ x -> Resource(x)})
expected.add(null)
for(load in mockLoads) {
actual.add(strategy.findSuitableResources(load, mockResources))
}
assertEquals(actual, expected)
}
}
\ No newline at end of file
package theodolite
import io.quarkus.test.junit.QuarkusTest
import io.restassured.RestAssured.given
import org.hamcrest.CoreMatchers.`is`
import org.junit.jupiter.api.Test
@QuarkusTest
class GreetingResourceTest {
@Test
fun testHelloEndpoint() {
given()
.`when`().get("/hello-resteasy")
.then()
.statusCode(200)
.body(`is`("Hello RESTEasy"))
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment