Преглед изворни кода

Hexagon data update test improvements (#4320)

* Update Hexagon benchmark

* Update Hexagon benchmark

* Remove features not used in tests

* Remove MySql storage

* Enable Resin test

* Upgrade Hexagon to v0.11

* Disable Resin

* Fix dependencies

* Improve template rendering

* Test in travis

* Fix build script

* Restore Travis script

* Restore Travis script

* MySQL store support and MongoDB fix

* Fix MySQL test

* Fix MySQL test

* Fix MySQL test

* Travis testing

* Fix MySQL test

* Restore Travis

* Take MySQL URL from other test

* Add PostgreSQL support

* Update version and tests

* Update version and tests

* Only test Hexagon in fork

* Fix config

* Fix config

* Update version and tests

* Remove Resin tests

* Restore Travis

* Restore Travis

* Upgrade framework version

* Reduce local tests temporarily

* Disable Resin tests

* Fix Gradle Wrapper issues

* Restore Resin tests

* Add Bintray repository

* Disable Resin backend

* Restore master's

* Upgrade framework version

* Test only Hexagon changes (temporary)

* Test Hexagon in Travis CI

* Add Undertow support

* Test only Undertow

* Restore Travis jobs

* Enable all Hexagon's variants

* Optimize benchmark

* Fix documentation

* Fix documentation

* Add Gradle Wrapper

* Move code to conform with Kotlin's coding standards

* Trace more information (only in tests)

* Add mini performance tests (to be sure everything would be fine in TFB)

* Support different template engines

* Add configuration properties

* Drop Undertow engine

* Update versions and dependencies

* Update documentation

* Ignore Gradle directories

* Update configuration

* Update benchmark

* Improve benchmark

* Improve benchmark dockerfiles

* Next Hexagon release

* Delete Gatlin simulation

* Fix url for testing

* Remove Gatling test

* Update Hexagon benchmark

* Improve data update test
Juanjo Aguililla пре 6 година
родитељ
комит
aab0ef77ac

+ 10 - 12
frameworks/Kotlin/hexagon/src/main/kotlin/BenchmarkStorage.kt

@@ -9,8 +9,6 @@ import com.zaxxer.hikari.HikariConfig
 import com.zaxxer.hikari.HikariDataSource
 
 import java.sql.Connection
-import java.sql.ResultSet.CONCUR_READ_ONLY
-import java.sql.ResultSet.TYPE_FORWARD_ONLY
 import java.util.concurrent.ThreadLocalRandom
 
 internal const val WORLD_ROWS: Int = 10000
@@ -112,24 +110,24 @@ internal class BenchmarkSqlStore(engine: String) : BenchmarkStore {
         var worlds: List<World> = listOf()
 
         dataSource.connection.use { con: Connection ->
-            val stmtSelect = con.prepareStatement(SELECT_WORLD, TYPE_FORWARD_ONLY, CONCUR_READ_ONLY)
+            val stmtSelect = con.prepareStatement(SELECT_WORLD)
             val stmtUpdate = con.prepareStatement(UPDATE_WORLD)
 
             for (ii in 0 until count) {
-                stmtSelect.setInt(1, randomWorld())
+                val worldId = randomWorld()
+                val newRandomNumber = randomWorld()
+
+                stmtSelect.setInt(1, worldId)
                 val rs = stmtSelect.executeQuery()
                 rs.next()
+                rs.getInt(2) // Read 'randomNumber' to comply with Test type 5, point 6
+                rs.close()
 
-                val id = rs.getInt(1)
-                val world = World(id, id, rs.getInt(2)).copy(randomNumber = randomWorld())
-                worlds += world
+                worlds += World(worldId, worldId, newRandomNumber)
 
-                stmtUpdate.setInt(1, world.randomNumber)
-                stmtUpdate.setInt(2, world.id)
+                stmtUpdate.setInt(1, newRandomNumber)
+                stmtUpdate.setInt(2, worldId)
                 stmtUpdate.addBatch()
-
-                if (ii % 25 == 0)
-                    stmtUpdate.executeBatch()
             }
 
             stmtUpdate.executeBatch()

+ 1 - 1
frameworks/Kotlin/hexagon/src/main/resources/service.yaml

@@ -11,4 +11,4 @@ fortuneCollection : fortune
 databaseUsername : benchmarkdbuser
 databasePassword : benchmarkdbpass
 
-maximumPoolSize : 64
+maximumPoolSize : 96