How to get the running port in springboot Tests

To get the random server port in spring boot tests, you must :

  • decorate your test class with : @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
  • add a property in your Test class : @LocalServerPort private String serverPort;

full code snippet:

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class RandomPortTest{

    private int serverPort;

    public void validateRandomPort(){
       assertThat(serverPort > 0).isTrue();

Migrate svn to git repo from a local svn reposiroty

This is a how to migrate a svn repository or repository folder to git when you have full control on the svn repository.

  • I started to create a directory where I’ll do the job, (you can do the work where your current repo is located. you need svn and git to be installed on the machine)

mkdir C:\Temp\svn_migration

  • copy your repo in there, you should have something like this


  • create a authors.txt file in the conf folder, copy the user from the passwd file

the structure of passwd file is sthg like

user = password

create a new authors.txt file in C:\Temp\svn_migration and use this layout. only the left hand side of the equal is relevant for us. (for the example above : user)

user = aName aLastName <>

  • start svnserve : from a cmd prompt, start the svnserve.exe for your repo. svnserve comes with subversion installation, but also with tortoisesvn.

"C:\Program Files (x86)\Subversion\bin\svnserve.exe" -d -R --root C:/Temp/svn_migration/svn_repository

  • start the migration. just issue the following command in C:\Temp\svn_migration

git svn clone svn://localhost/path/to/your/repo --no-minimize-url --no-metadata -A authors.txt someFolderName

note : The --no-minimize-url makes sure that git svn only clones the specific directory without trying to clone the root of the repository.

  • add a remote and push : finally you want to share it with other so:

cd to your git repo C:/Temp/svn_migration/someFolderName then

git remote add origin https://yourRemotegiturl

git push --set-upstream origin master





once upon Git commands

Shortcuts to some usefull Git commands used in day to day work

//create a branch
git branch <branch_name>

//set us currently on a specific branch
git checkout <branch_name>

//shortcut for all that
git checkout -b <branch_name>

//push branch to origin 
git push -u origin <branch_name>

//delete local branch
git branch -d <branch_name>

//delete branch remotely
git push origin --delete <branch_name>
git push origin :<branch_name>

when a fix has been done on the master branch and you want the changes from that master in your branch. The best approach, in my opinion. after you done all commit in your local “feature, fix…” branch locally (and remotely)

master     : ---A---B---C--------G
                         \        \
branch-bis :              \        H--I---J---K ....
                           \         /
branch     :                D---E---F

//1. set ourselves in the master branch and pull changes locally
git checkout master
git pull

//2. create a new branch locally and optionally remotely
git checkout -b <branch_name_bis>
git push -u origin <branch_name_bis>

//3. merge changes from the original branch we want 
// the master changes merge to,
// and optionaly delete it locally and remotely
git merge <branch_name>
git branch -d <branch_name>
git push origin :<branch_name>

OSS process for open source java projects

This post is a list of my OSS process for open source java projects.


for CI integrations, I use Travis CI, easy to set up and link to github. just add a .travis.yml with the content below and your done (I am using maven and provide a pom.xml). pushing to github will start the build.

language: java
- oraclejdk8


I just list the steps. read this for more info : OSSRH Guide

  1. create a sonatype jira account and create a new project ticket. (it takes about two budiness days, but for my project, it was done in one day)
  2. create a pgp signature : dealing with PGP signatures
        1. download gpg from : (you’ll find binaries at the bottom of the page)
        2. in a command promp gpg 2–gen-key and answer the questions
        3. gpg2 –list-keys to list your keys
        4. publish your key  gpg2 –keyserver hkp:// –send-keys XXXXXXX
  3. update your pom.xml to contain all the requirements
  4. login to and get your account key (in your profile, access user account key
  5. add your user account key in your maven settings.xml (so that your password is not hardcoded.
  6. first release with  mvn clean deploy -P release if you have created a release profile in your pom.xml
  7. add a comment on your jira issue to activate the sync process to the Central Repository

Then Create a releases and Snapshots

Deploy Snapshots with

mvn clean deploy

snapshots will be liste here

Release With

mvn versions:set -DnewVersion=x.x.x
mvn clean deploy -P release

to see if the release was accepted you can login to here and check if you have sthg in your staging reprositories or searhc on your artifacts, or check here

install apache benchmarking tool (ab) on windows

  1. download apache binaries from an apache recommended download site (i.e. :apache lounge)
  2. extract the content using zip tool
  3. copy the /bin/ab.exe to a folder of your choice (i.e.: c:\temp)
  4. start a command prompt and run it
ab -n 100 -c 10 http://yourserver/yourapi


# content.json contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
# -l Accept variable document length (use this for dynamic pages)

ab -p content.json -T application/json -H 'Authorization: Bearer xxxx' -c 10 -n 2000 -l http://myserver/myapi

Configure camel -openwebbeans – deltaspike to get a standalone camel application running with cdi

here are code snippet to get camel, OpenWebBeans container and deltaspike .

  • The code that boots the app
  org.apache.camel.cdi.Main maincdi = new org.apache.camel.cdi.Main(){};;
  • camel context producer
public class CamelContextFactory {

    CamelContext customize() {
        DefaultCamelContext context = new DefaultCamelContext();
        return context;

    void cleanUp(@Disposes CamelContext context) {
        // ...

Continue reading Configure camel -openwebbeans – deltaspike to get a standalone camel application running with cdi

Install Docker on windows 7 leads to error (ENOENT…)

When trying to install docker on windows 7, if you encounter this kind of error :

Command failed: C:\Program Files\Docker Toolbox\docker-machine.exe -D create -d virtualbox --virtualbox-memory 2048 default,Docker Machine Version: 0.8.2, build e18a919,Found binary path at C:\Program Files\Docker Toolbox\docker-machine.exe,Launching plugin server for driver virtualbox,Plugin server listening at address,() Calling .GetVersion,Using API Version 1,() Calling .SetConfigRaw,() Calling .GetMachineName,(flag-lookup) Calling .GetMachineName,(flag-lookup) Calling .DriverName,(flag-lookup) Calling .GetCreateFlags,Found binary path at C:\Program Files\Docker Toolbox\docker-machine.exe,Launching plugin server for driver virtualbox,Plugin server listening at address,() Calling .GetVersion,Using API Version 1,() Calling .SetConfigRaw,() Calling .GetMachineName,(default) Calling .GetMachineName,(default) Calling .DriverName,

or this kind of error

Error: connect ENOENT //./pipe/docker_engine

It’s because you followed the default installation that uses NDIS6 driver for virtualBox by default instead of NDIS5 (optional).

so when installing the docker toolbox from here : which is required for windows 7.

simply follow instruction, but when you arrive at the step “select additional tasks”, choose NDIS5 driver