Test for an Annotation

September 12, 2019

This test will make sure that a spring boot application has @Transactional on all the (non getter/setter) methods in a service. It looks for classes that end in ServiceImpl.java, in a specific package.

package com.company.test.global;

import static org.junit.Assert.assertTrue;

import java.io.IOException ...

POSTing with CURL with timings

June 7, 2019

I wanted to do a POST with CURL with a JSON payload and produce some performance stats in the process.

First create this file as curl-format.txt:

time_namelookup:  %{time_namelookup}\n
time_connect:  %{time_connect}\n
time_appconnect:  %{time_appconnect}\n
time_pretransfer:  %{time_pretransfer}\n
time_redirect:  %{time_redirect}\n
time_starttransfer:  %{time_starttransfer}\n
time_total:  %{time_total}\n

Next ...

SpringBoot: No injection source found for a parameter

May 24, 2019

I'm trying an example Spring Boot project with jersey for REST services. I got the following error:

No injection source found for a parameter of type public javax.ws.rs.core.Response 
com.example.jersey.UserResource.updateUser(int,com.example.jersey.User) throws 

My service is ...

Bash Uppercase Input with Defaults

April 25, 2019

I needed to modify a bash function that accepted user input, so that it uppercased that input. This was implemented using a function that provided a default value.

   local entered_value
   read -p "$1 [default: $2]: " entered_value
   export $3="${entered_value:-$2}"
   export $3="${!3^^}"

fetchInputUpper "Enter Text?" "Default" VARIABLE
echo ...

Uppercase In Bash

April 25, 2019

If your bash version is greater than 4.0, you can use the ^^ syntax to uppercase variable values:

export LOWER="abc"
export UPPER=${LOWER^^}
echo $UPPER