Getting REST version from request mapping of controller for mockmvc

When we write a spring rest controller we give version url and start writing different functions as endpoints like below @RestController @RequestMapping("/api/v1") public class ControllerApi { final LoginSender loginSender; public ControllerApi(LoginSender loginSender) { this.loginSender = loginSender; } @PostMapping("/login") boolean login(@RequestBody LoginParams params) { return loginSender.login(params.server(), params.login(), params.password(), params.build(), params.webManager()); } @GetMapping("/get1") LoginParams get1(@RequestParam String login, @RequestParam(required = false) String webMan, @RequestParam(required = false) String server, @RequestParam(required = false) String pass, @RequestParam(required = false) String build) { return LoginParams.builder() .webManager(webMan) .server(server) .password(pass) .login(login) .build(build) .build(); } } ib the future this controller will have different version number from v1 to v2 or in the future someone will change login endpoint from “/login” to “/loginJwt” but function order probably will not change. So in order to prevent your tests to fail we can collect these data from controller class like the code below. ...

December 12, 2022 · 2 min · Özkan Pakdil

How to setup gatling test scenario

In a Gatling test, the setUp method is used to specify the scenario that will be run during the test. In the code below, the scenario is specified using the scn variable, which presumably refers to a scenario that has been defined elsewhere in the code. val nbUsers = Integer.getInteger("users", 1000) val myRepeat = java.lang.Long.getLong("repeat", 2) val httpProtocol = http.baseUrl("http://localhost:8080") val scn = scenario("hello").repeat(myRepeat.toInt) { exec(http("GetApplicationInfo") .get("/hello") .check(status.is(200)) .check(jsonPath("$.name"))) } setUp( scn.inject( rampUsers(nbUsers) during (5 seconds) ).protocols(httpProtocol) ) The inject method is used to specify how the users will be introduced into the system under test. In this case, the rampUsers method is used to gradually increase the number of users over a period of 5 seconds. This is known as a ramp-up. The total number of users to be injected is specified by the nbUsers variable. ...

December 12, 2022 · 2 min · Özkan Pakdil

Ktor build with graalvm

I wanted to test ktor.io with graalvm build, main problem is all code I found using gradle and my project is using mvn here is the code. like other modules I needed to create reflect config json, otherwise ktor serialize is not working properly with graal and when I send a request to “/hello” endpoint I got empty response. I tried to write myself but did not work and at the end I used command below ...

November 13, 2022 · 1 min · Özkan Pakdil

My first eclipse plugin

I used Eclipse between 2008-2018. After 2018 I saw everyone was using Intellij I moved too. Then today I was trying to write some aspectj code and created an .aj file. I realized intellij community edition does not really support aj files. I checked vscode it also did not support it, then the old friend eclipse came. It caused some issues because of the old plugin version, but after installation of the new version ajdt plugin it worked. ...

October 10, 2022 · 1 min · Özkan Pakdil

Oracle XE database install on Linux Mint

Fallowed this answer looked like it would work. Show bash output installation steps below ```bash mintozzy@mintozzy-MACH-WX9:~/Downloads$ sudo apt install alien libaio1 unixodbc [sudo] password for mintozzy: Reading package lists... Done Building dependency tree Reading state information... Done libaio1 is already the newest version (0.3.112-5). The following additional packages will be installed: autoconf automake autopoint autotools-dev debhelper debugedit dh-autoreconf dh-strip-nondeterminism dwz libarchive-cpio-perl libdebhelper-perl libfile-stripnondeterminism-perl libltdl-dev libmail-sendmail-perl libodbc1 librpm8 librpmbuild8 librpmio8 librpmsign8 libsub-override-perl libsys-hostname-long-perl libtool odbcinst odbcinst1debian2 po-debconf rpm rpm-common rpm2cpio Suggested packages: autoconf-archive gnu-standards autoconf-doc dh-make rpm-i18n libtool-doc libmyodbc odbc-postgresql tdsodbc unixodbc-bin gfortran | fortran95-compiler gcj-jdk libmail-box-perl python elfutils rpmlint rpm2html The following NEW packages will be installed alien autoconf automake autopoint autotools-dev debhelper debugedit dh-autoreconf dh-strip-nondeterminism dwz libarchive-cpio-perl libdebhelper-perl libfile-stripnondeterminism-perl libltdl-dev libmail-sendmail-perl libodbc1 librpm8 librpmbuild8 librpmio8 librpmsign8 libsub-override-perl libsys-hostname-long-perl libtool odbcinst odbcinst1debian2 po-debconf rpm rpm-common rpm2cpio unixodbc 0 to upgrade, 30 to newly install, 0 to remove and 5 not to upgrade. Need to get 3,860 kB of archives. After this operation, 12.8 MB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 autotools-dev all 20180224.1 [39.6 kB] Get:2 http://archive.ubuntu.com/ubuntu focal/main amd64 autoconf all 2.69-11.1 [321 kB] Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 automake all 1:1.16.1-4ubuntu6 [522 kB] Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 autopoint all 0.19.8.1-10build1 [412 kB] Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 libtool all 2.4.6-14 [161 kB] Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 dh-autoreconf all 19 [16.1 kB] Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 libdebhelper-perl all 12.10ubuntu1 [62.1 kB] Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 libsub-override-perl all 0.09-2 [9,532 B] Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 libfile-stripnondeterminism-perl all 1.7.0-1 [15.9 kB] Get:10 http://archive.ubuntu.com/ubuntu focal/main amd64 dh-strip-nondeterminism all 1.7.0-1 [5,228 B] Get:11 http://archive.ubuntu.com/ubuntu focal/main amd64 dwz amd64 0.13-5 [151 kB] Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 po-debconf all 1.0.21 [233 kB] Get:13 http://archive.ubuntu.com/ubuntu focal/main amd64 debhelper all 12.10ubuntu1 [877 kB] Get:14 http://archive.ubuntu.com/ubuntu focal/universe amd64 librpmio8 amd64 4.14.2.1+dfsg1-1build2 [75.2 kB] Get:15 http://archive.ubuntu.com/ubuntu focal/universe amd64 librpm8 amd64 4.14.2.1+dfsg1-1build2 [174 kB] Get:16 http://archive.ubuntu.com/ubuntu focal/universe amd64 librpmbuild8 amd64 4.14.2.1+dfsg1-1build2 [70.9 kB] Get:17 http://archive.ubuntu.com/ubuntu focal/universe amd64 librpmsign8 amd64 4.14.2.1+dfsg1-1build2 [8,280 B] Get:18 http://archive.ubuntu.com/ubuntu focal/universe amd64 rpm-common amd64 4.14.2.1+dfsg1-1build2 [28.8 kB] Get:19 http://archive.ubuntu.com/ubuntu focal/universe amd64 rpm2cpio amd64 4.14.2.1+dfsg1-1build2 [8,096 B] Get:20 http://archive.ubuntu.com/ubuntu focal/universe amd64 debugedit amd64 4.14.2.1+dfsg1-1build2 [19.5 kB] Get:21 http://archive.ubuntu.com/ubuntu focal/universe amd64 rpm amd64 4.14.2.1+dfsg1-1build2 [119 kB] Get:22 http://archive.ubuntu.com/ubuntu focal/universe amd64 alien all 8.95 [54.5 kB] Get:23 http://archive.ubuntu.com/ubuntu focal/main amd64 libarchive-cpio-perl all 0.10-1 [9,644 B] Get:24 http://archive.ubuntu.com/ubuntu focal/main amd64 libltdl-dev amd64 2.4.6-14 [162 kB] Get:25 http://archive.ubuntu.com/ubuntu focal/main amd64 libsys-hostname-long-perl all 1.5-1 [11.7 kB] Get:26 http://archive.ubuntu.com/ubuntu focal/main amd64 libmail-sendmail-perl all 0.80-1 [22.6 kB] Get:27 http://archive.ubuntu.com/ubuntu focal/main amd64 libodbc1 amd64 2.3.6-0.1build1 [189 kB] Get:28 http://archive.ubuntu.com/ubuntu focal/main amd64 odbcinst1debian2 amd64 2.3.6-0.1build1 [41.1 kB] Get:29 http://archive.ubuntu.com/ubuntu focal/main amd64 odbcinst amd64 2.3.6-0.1build1 [14.8 kB] Get:30 http://archive.ubuntu.com/ubuntu focal/universe amd64 unixodbc amd64 2.3.6-0.1build1 [24.6 kB] Fetched 3,860 kB in 1s (7,011 kB/s) Selecting previously unselected package autotools-dev. (Reading database ... 363531 files and directories currently installed.) Preparing to unpack .../00-autotools-dev_20180224.1_all.deb ... Unpacking autotools-dev (20180224.1) ... Selecting previously unselected package autoconf. Preparing to unpack .../01-autoconf_2.69-11.1_all.deb ... Unpacking autoconf (2.69-11.1) ... Selecting previously unselected package automake. Preparing to unpack .../02-automake_1%3a1.16.1-4ubuntu6_all.deb ... Unpacking automake (1:1.16.1-4ubuntu6) ... Selecting previously unselected package autopoint. Preparing to unpack .../03-autopoint_0.19.8.1-10build1_all.deb ... Unpacking autopoint (0.19.8.1-10build1) ... Selecting previously unselected package libtool. Preparing to unpack .../04-libtool_2.4.6-14_all.deb ... Unpacking libtool (2.4.6-14) ... Selecting previously unselected package dh-autoreconf. Preparing to unpack .../05-dh-autoreconf_19_all.deb ... Unpacking dh-autoreconf (19) ... Selecting previously unselected package libdebhelper-perl. Preparing to unpack .../06-libdebhelper-perl_12.10ubuntu1_all.deb ... Unpacking libdebhelper-perl (12.10ubuntu1) ... Selecting previously unselected package libsub-override-perl. Preparing to unpack .../07-libsub-override-perl_0.09-2_all.deb ... Unpacking libsub-override-perl (0.09-2) ... Selecting previously unselected package libfile-stripnondeterminism-perl. Preparing to unpack .../08-libfile-stripnondeterminism-perl_1.7.0-1_all.deb ... Unpacking libfile-stripnondeterminism-perl (1.7.0-1) ... Selecting previously unselected package dh-strip-nondeterminism. Preparing to unpack .../09-dh-strip-nondeterminism_1.7.0-1_all.deb ... Unpacking dh-strip-nondeterminism (1.7.0-1) ... Selecting previously unselected package dwz. Preparing to unpack .../10-dwz_0.13-5_amd64.deb ... Unpacking dwz (0.13-5) ... Selecting previously unselected package po-debconf. Preparing to unpack .../11-po-debconf_1.0.21_all.deb ... Unpacking po-debconf (1.0.21) ... Selecting previously unselected package debhelper. Preparing to unpack .../12-debhelper_12.10ubuntu1_all.deb ... Unpacking debhelper (12.10ubuntu1) ... Selecting previously unselected package librpmio8. Preparing to unpack .../13-librpmio8_4.14.2.1+dfsg1-1build2_amd64.deb ... Unpacking librpmio8 (4.14.2.1+dfsg1-1build2) ... Selecting previously unselected package librpm8. Preparing to unpack .../14-librpm8_4.14.2.1+dfsg1-1build2_amd64.deb ... Unpacking librpm8 (4.14.2.1+dfsg1-1build2) ... Selecting previously unselected package librpmbuild8. Preparing to unpack .../15-librpmbuild8_4.14.2.1+dfsg1-1build2_amd64.deb ... Unpacking librpmbuild8 (4.14.2.1+dfsg1-1build2) ... Selecting previously unselected package librpmsign8. Preparing to unpack .../16-librpmsign8_4.14.2.1+dfsg1-1build2_amd64.deb ... Unpacking librpmsign8 (4.14.2.1+dfsg1-1build2) ... Selecting previously unselected package rpm-common. Preparing to unpack .../17-rpm-common_4.14.2.1+dfsg1-1build2_amd64.deb ... Unpacking rpm-common (4.14.2.1+dfsg1-1build2) ... Selecting previously unselected package rpm2cpio. Preparing to unpack .../18-rpm2cpio_4.14.2.1+dfsg1-1build2_amd64.deb ... Unpacking rpm2cpio (4.14.2.1+dfsg1-1build2) ... Selecting previously unselected package debugedit. Preparing to unpack .../19-debugedit_4.14.2.1+dfsg1-1build2_amd64.deb ... Unpacking debugedit (4.14.2.1+dfsg1-1build2) ... Selecting previously unselected package rpm. Preparing to unpack .../20-rpm_4.14.2.1+dfsg1-1build2_amd64.deb ... Unpacking rpm (4.14.2.1+dfsg1-1build2) ... Selecting previously unselected package alien. Preparing to unpack .../21-alien_8.95_all.deb ... Unpacking alien (8.95) ... Selecting previously unselected package libarchive-cpio-perl. Preparing to unpack .../22-libarchive-cpio-perl_0.10-1_all.deb ... Unpacking libarchive-cpio-perl (0.10-1) ... Selecting previously unselected package libltdl-dev:amd64. Preparing to unpack .../23-libltdl-dev_2.4.6-14_amd64.deb ... Unpacking libltdl-dev:amd64 (2.4.6-14) ... Selecting previously unselected package libsys-hostname-long-perl. Preparing to unpack .../24-libsys-hostname-long-perl_1.5-1_all.deb ... Unpacking libsys-hostname-long-perl (1.5-1) ... Selecting previously unselected package libmail-sendmail-perl. Preparing to unpack .../25-libmail-sendmail-perl_0.80-1_all.deb ... Unpacking libmail-sendmail-perl (0.80-1) ... Selecting previously unselected package libodbc1:amd64. Preparing to unpack .../26-libodbc1_2.3.6-0.1build1_amd64.deb ... Unpacking libodbc1:amd64 (2.3.6-0.1build1) ... Selecting previously unselected package odbcinst1debian2:amd64. Preparing to unpack .../27-odbcinst1debian2_2.3.6-0.1build1_amd64.deb ... Unpacking odbcinst1debian2:amd64 (2.3.6-0.1build1) ... Selecting previously unselected package odbcinst. Preparing to unpack .../28-odbcinst_2.3.6-0.1build1_amd64.deb ... Unpacking odbcinst (2.3.6-0.1build1) ... Selecting previously unselected package unixodbc. Preparing to unpack .../29-unixodbc_2.3.6-0.1build1_amd64.deb ... Unpacking unixodbc (2.3.6-0.1build1) ... Setting up librpmio8 (4.14.2.1+dfsg1-1build2) ... Setting up librpm8 (4.14.2.1+dfsg1-1build2) ... Setting up po-debconf (1.0.21) ... Setting up libdebhelper-perl (12.10ubuntu1) ... Setting up rpm-common (4.14.2.1+dfsg1-1build2) ... Setting up autotools-dev (20180224.1) ... Setting up librpmbuild8 (4.14.2.1+dfsg1-1build2) ... Setting up autopoint (0.19.8.1-10build1) ... Setting up libodbc1:amd64 (2.3.6-0.1build1) ... Setting up autoconf (2.69-11.1) ... Setting up librpmsign8 (4.14.2.1+dfsg1-1build2) ... Setting up dwz (0.13-5) ... Setting up libarchive-cpio-perl (0.10-1) ... Setting up debugedit (4.14.2.1+dfsg1-1build2) ... Setting up libsub-override-perl (0.09-2) ... Setting up libsys-hostname-long-perl (1.5-1) ... Setting up automake (1:1.16.1-4ubuntu6) ... update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode Setting up libfile-stripnondeterminism-perl (1.7.0-1) ... Setting up libtool (2.4.6-14) ... Setting up rpm2cpio (4.14.2.1+dfsg1-1build2) ... Setting up rpm (4.14.2.1+dfsg1-1build2) ... Setting up libmail-sendmail-perl (0.80-1) ... Setting up libltdl-dev:amd64 (2.4.6-14) ... Setting up dh-strip-nondeterminism (1.7.0-1) ... Setting up dh-autoreconf (19) ... Setting up odbcinst (2.3.6-0.1build1) ... Setting up debhelper (12.10ubuntu1) ... Setting up alien (8.95) ... Setting up odbcinst1debian2:amd64 (2.3.6-0.1build1) ... Setting up unixodbc (2.3.6-0.1build1) ... Processing triggers for doc-base (0.10.9) ... Processing 2 added doc-base files... Processing triggers for libc-bin (2.31-0ubuntu9.9) ... Processing triggers for man-db (2.9.1-1) ... Processing triggers for install-info (6.7.0.dfsg.2-5) ... mintozzy@mintozzy-MACH-WX9:~/Downloads$ sudo alien --script oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY warning: oracle-database-xe-21c-1.0-1.ol8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ad986da3: NOKEY oracle-database-xe-21c_1.0-2_amd64.deb generated mintozzy@mintozzy-MACH-WX9:~/Downloads$ sudo dpkg -i oracle-database-xe-21c_1.0-2_amd64.deb [sudo] password for mintozzy: Selecting previously unselected package oracle-database-xe-21c. (Reading database ... 364811 files and directories currently installed.) Preparing to unpack oracle-database-xe-21c_1.0-2_amd64.deb ... ln: failed to create symbolic link '/bin/awk': File exists Unpacking oracle-database-xe-21c (1.0-2) ... Setting up oracle-database-xe-21c (1.0-2) ... [INFO] Executing post installation scripts... [INFO] Oracle home installed successfully and ready to be configured. To configure Oracle Database XE, optionally modify the parameters in '/etc/sysconfig/oracle-xe-21c.conf' and then execute '/etc/init.d/oracle-xe-21c configure' as root. Processing triggers for libc-bin (2.31-0ubuntu9.9) ... Processing triggers for systemd (245.4-4ubuntu3.18) ... mintozzy@mintozzy-MACH-WX9:~/Downloads$ ``` then when I tried to run that configure command first got error related to machine ip and in second try I got rpm related error :) running oracle on mint is hard, below you can see the error ```bash mintozzy@mintozzy-MACH-WX9:~/Downloads$ sudo /etc/init.d/oracle-xe-21c configure Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts: Confirm the password: Configuring Oracle Listener. Listener configuration failed. Check log '/opt/oracle/cfgtoollogs/netca/netca_configure_out.log' for more details. mintozzy@mintozzy-MACH-WX9:~/Downloads$ sudo /etc/init.d/oracle-xe-21c configure Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts: Confirm the password: Configuring Oracle Listener. Listener configuration succeeded. Configuring Oracle Database XE. [FATAL] [DBT-50000] Unable to check available system memory. CAUSE: An exception occured while checking kernel parameter. *ADDITIONAL INFORMATION:* Exception details - PRVG-13702 : RPM Package Manager database files are corrupt on nodes "laptop". PRVG-2043 : Command "/bin/rpm --quiet -qa " failed on node "laptop" and produced the following output: error: cannot open Packages database in /home/oracle/.rpmdb error: cannot open Packages database in /home/oracle/.rpmdb Database configuration failed. Check logs under ‘/opt/oracle/cfgtoollogs/dbca’. ...

October 4, 2022 · 8 min · Özkan Pakdil