Saturday, March 9, 2019

Algorithm Performance

Full Stack Software Development Blog

I am presenting at the inaugural meeting of the Austin Algorithms Meetup group.

https://www.meetup.com/Austin-Algorithms-Meetup/

I've put together a presentation on algorithm performance and Big O.

I used https://revealjs.com to create the presentation. I committed the code to GitHub and deployed it to Heroku.

If you cannot come to the meeting then there are a few ways to view the presentation.

On Heroku for a limit time at https://algorithm-big-o.herokuapp.com/
Note: that Heroku may take up to a minute (or more) to load the website

On GitHub clone https://github.com/gpratte/algorithm-performance-presentation.git and then open index.html in a browser.

View the PDF at https://github.com/gpratte/algorithm-performance-presentation/blob/master/pdf/algorithm-performance.pdf


Sunday, March 3, 2019

More embedding dependencies when testing in Spring Boot

Full Stack Software Development Blog

In my last blog I wrote about mocking dependencies when running tests. Since then I've added Apache's Qpid (https://qpid.apache.org/) to mock out RabbitMQ.

The following is from the top of the readme in my github repository for the PoC (see https://github.com/gpratte/spring-boot-acceptance-test-mocks)

Wednesday, February 20, 2019

Embedding dependencies when testing in Spring Boot

Full Stack Software Development Blog

I am working on a proof of concept (POC) for embedding dependencies in a Spring Boot server.

The following is from the top of the readme in my github repository for the POC.

Sunday, February 3, 2019

Java Functional Programming

Full Stack Software Development Blog


I can make an analogy of my knowledge of Java functional programming to fluency in a foreign language - I can read it but have had little to no practice writing it.

I spent the last couple of days getting hands on experience using lambdas and streams.

Here is the reading I did.

Java Tutorial Lambda Expressions

Java Tutorial Aggregate Operations (Streams)

Lambda Expressions and Functional Interfaces: Tips and Best Practices

Functional Interfaces in Java 8

THE ULTIMATE 30-MINUTE CODING WORKOUT - STREAMS & LAMBDA EXPRESSIONS BY EXAMPLES


Sunday, January 27, 2019

CICD with CircleCI and Heroku

Full Stack Software Development Blog


The final task to finishing off the server work is to wire up continuous integration and continuous deployment (CICD). I already have the CI piece of it working (see previous blog). Now to do the CD piece.

Step 1. Deploy Spring Boot application to Heroku

I followed the steps in the getting started on Heroku with Java tutorial.
See https://devcenter.heroku.com/articles/getting-started-with-java

The only thing of interest is the Procfile

web: java -jar application/target/texastoc-application-1.0.jar --server.port=$PORT --spring.profiles.active=test com.texastoc.Application

As you can see the Spring Boot application is run as a jar.
Set the server port as instructed by Heroku.
Set the spring.profiles.active to test so the it would use the embedded H2 database (for now).

Step 2. Integrate CircleCI to deploy to Heroku

Next I followed the CircleCI instructions to integrate with Heroku.
See https://circleci.com/integrations/heroku/

First I had to set a couple environment variables
  • HEROKU_APP_NAME
  • HEROKU_API_KEY
The big change is in the .circleci/config.yml file to deploy after building.
See https://github.com/gpratte/texastoc-v2-spring-boot/blob/master/.circleci/config.yml

Step 3. Spring Actuator

I needed to verify the deployment. What better way than to add a new endpoint (or two) to the server, push to github master and then curl the endpoint on the server deployed to Heroku.

I added Spring Actuator and curled the health endpoint.
See https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready.html to know more about Spring Actuator.


Saturday, January 26, 2019

JWT Auth for Spring Boot

Full Stack Software Development Blog

I took what I learned in my last blog about JWT Authentication and Authorization and applied it to my Spring Boot server application.

Most of the time was spent updating the integration tests. Almost every endpoint now requires authentication. The test were enhanced to login a player which returns a token. The token is then passed in the HTTP Authorization header.

Another departure from the proof of concept in my last blog is to

  • use the player table instead of the user table 
  • use email instead of username

See branch 37-jwt-auth at TexasTOC v2 Spring Boot

Monday, January 21, 2019

JWT Authentication and Authorization with Spring Security

Full Stack Software Development Blog


Worked through how to implement Authentication and Authorization (A&A) using JSON Web Token (JWT) with Spring Security.

Instead of blogging about it here I put together a proof of concept (POC) in github. The readme tells all.

See the https://github.com/gpratte/jwtauth repo.