diff --git a/LaunchServer/build.gradle b/LaunchServer/build.gradle index 8c9398ed..c381093a 100644 --- a/LaunchServer/build.gradle +++ b/LaunchServer/build.gradle @@ -80,6 +80,7 @@ pack project(':LauncherAPI') bundle group: 'org.slf4j', name: 'slf4j-simple', version: rootProject['verSlf4j'] bundle group: 'org.slf4j', name: 'slf4j-api', version: rootProject['verSlf4j'] bundle group: 'org.hibernate', name: 'hibernate-core', version: rootProject['verHibernate'] + bundle group: 'org.hibernate', name: 'hibernate-hikaricp', version: rootProject['verHibernate'] bundle group: 'mysql', name: 'mysql-connector-java', version: rootProject['verMySQLConn'] bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn'] bundle group: 'net.sf.proguard', name: 'proguard-base', version: rootProject['verProguard'] diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/basic/TestCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/basic/TestCommand.java index 0bc41517..ebccc90a 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/basic/TestCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/basic/TestCommand.java @@ -1,10 +1,14 @@ package pro.gravit.launchserver.command.basic; import org.bouncycastle.cert.X509CertificateHolder; +import pro.gravit.launcher.request.auth.password.AuthPlainPassword; import pro.gravit.launchserver.LaunchServer; +import pro.gravit.launchserver.auth.AuthException; +import pro.gravit.launchserver.auth.AuthProviderPair; import pro.gravit.launchserver.command.Command; import pro.gravit.launchserver.socket.handlers.NettyServerSocketHandler; import pro.gravit.utils.helper.CommonHelper; +import pro.gravit.utils.helper.LogHelper; import java.nio.file.Paths; import java.security.KeyPair; @@ -54,5 +58,33 @@ public void invoke(String... args) throws Exception { server.certificateManager.writePrivateKey(Paths.get(name.concat(".key")), pair.getPrivate()); server.certificateManager.writeCertificate(Paths.get(name.concat(".crt")), cert); } + if(args[0].equals("authstresser")) + { + AuthProviderPair pair = server.config.getAuthProviderPair(); + AuthPlainPassword plainPassword = new AuthPlainPassword("test"); + Runnable runnable = () -> { + long startTime = System.currentTimeMillis(); + for(int i=0;i<100000;++i) + { + try { + pair.provider.auth("Test", plainPassword, "127.0.0.1"); + } catch (AuthException ignored) + { + + } catch (Exception e) { + throw new RuntimeException(e); + } + if((i % 10000) == 0) + { + LogHelper.info("Completed %d requests", i); + } + } + LogHelper.info("Completed all requests. Time %d ms", System.currentTimeMillis() - startTime); + }; + for(int i=0;i<7;++i) + { + CommonHelper.newThread(String.format("Stresser #%d", i), true, runnable).start(); + } + } } } diff --git a/props.gradle b/props.gradle index 188d9517..955bc0e9 100644 --- a/props.gradle +++ b/props.gradle @@ -14,5 +14,5 @@ verPostgreSQLConn = '42.2.11' verProguard = '6.2.2' verLaunch4j = '3.12' - verHibernate = '5.4.12.Final' + verHibernate = '5.4.21.Final' }