JavaForFun
7 years agoRequired dependency for @Inject
Gustavo Martin Morcuende [Sun, 27 Nov 2016 14:08:27 +0000 (15:08 +0100)]
Required dependency for @Inject

7 years agoTripServiceShould green
Gustavo Martin Morcuende [Sun, 27 Nov 2016 14:07:07 +0000 (15:07 +0100)]
TripServiceShould green

TripService is green again, we are using BDDMockito (which integrates nicely with //given //when //then comments)
and we can delete code from our TripServiceShould unit test

7 years agoreturn_friend_trips_when_users_are_friends fails
Gustavo Martin Morcuende [Sun, 27 Nov 2016 13:55:53 +0000 (14:55 +0100)]
return_friend_trips_when_users_are_friends fails

Now test is using my Mock but it keeps failing with a different error :)

7 years agoreturn_friend_trips_when_users_are_friends stops working
Gustavo Martin Morcuende [Sun, 27 Nov 2016 13:46:55 +0000 (14:46 +0100)]
return_friend_trips_when_users_are_friends stops working

When a test fails we have a reason for refactoring our legacy code!!!
In this case the problema is related to using the static method of TripDAO

7 years agoTripDAO, always test before refactoring
Gustavo Martin Morcuende [Sun, 27 Nov 2016 13:26:05 +0000 (14:26 +0100)]
TripDAO, always test before refactoring

We need a new method in order to be able to rewrite our legacy code.
At the very end this method will be the one used by our app.
The static method will dissapear after refactoring our whole app (what should be done carefully)

7 years agoRemoving loggedInUser from Test.
Gustavo Martin Morcuende [Fri, 25 Nov 2016 00:15:11 +0000 (01:15 +0100)]
Removing loggedInUser from Test.

Less variables makes our code more simple.

7 years agoGetting rid of getLoggedInUser() method
Gustavo Martin Morcuende [Fri, 25 Nov 2016 00:10:22 +0000 (01:10 +0100)]
Getting rid of getLoggedInUser() method

7 years agoMVC, Model should know nothing about View.
Gustavo Martin Morcuende [Fri, 25 Nov 2016 00:04:26 +0000 (01:04 +0100)]
MVC, Model should know nothing about View.

Service is in Model layer, it should not be dealing with sessions (View)

7 years agoTripService refactored
Gustavo Martin Morcuende [Thu, 24 Nov 2016 23:51:30 +0000 (00:51 +0100)]
TripService refactored

7 years agoGetting rid of variable makes code easier.
Gustavo Martin Morcuende [Thu, 24 Nov 2016 23:46:58 +0000 (00:46 +0100)]
Getting rid of variable makes code easier.

There could be performance issues, but if there are not problems this code is better.

7 years agoUsing ternary operation
Gustavo Martin Morcuende [Thu, 24 Nov 2016 23:46:10 +0000 (00:46 +0100)]
Using ternary operation

7 years agoGetting rid of variables in legacy code is great.
Gustavo Martin Morcuende [Thu, 24 Nov 2016 23:41:11 +0000 (00:41 +0100)]
Getting rid of variables in legacy code is great.

It enables us to reuse methods.
Once we take away as many variables as posible we can remake optimizations.

7 years agoMoving Guard Condition to the top
Gustavo Martin Morcuende [Thu, 24 Nov 2016 23:31:02 +0000 (00:31 +0100)]
Moving Guard Condition to the top

7 years agoInline isFriendsWith(user)
Gustavo Martin Morcuende [Thu, 24 Nov 2016 23:18:35 +0000 (00:18 +0100)]
Inline isFriendsWith(user)

7 years agoUser isFriendsWith(user) method in TripService
Gustavo Martin Morcuende [Thu, 24 Nov 2016 23:15:16 +0000 (00:15 +0100)]
User isFriendsWith(user) method in TripService

7 years agoisFriendsWith(user) method added to User
Gustavo Martin Morcuende [Thu, 24 Nov 2016 23:08:26 +0000 (00:08 +0100)]
isFriendsWith(user) method added to User

7 years agoMoving UserBuilder to production code
Gustavo Martin Morcuende [Thu, 24 Nov 2016 22:49:48 +0000 (23:49 +0100)]
Moving UserBuilder to production code

7 years agoThoughts about Feature Envy and path to follow when refactoring legacy code
Gustavo Martin Morcuende [Thu, 24 Nov 2016 01:12:29 +0000 (02:12 +0100)]
Thoughts about Feature Envy and path to follow when refactoring legacy code

1. When writing tests for legacy code we go from shortest to deepest branches.
2. When refactoring legacy code (handmade modifications) we go from deepest to shortest branches (just the opposite)

Feauture envy: some class (TripService) wants to do some action that should be implemented by another class which we
are using to extract the data and perform some action. Data and action should be done by the same class (User)

7 years agoMerge branch 'master' of https://github.com/gumartinm/JavaForFun
Gustavo Martin Morcuende [Thu, 24 Nov 2016 00:56:56 +0000 (01:56 +0100)]
Merge branch 'master' of https://github.com/gumartinm/JavaForFun

7 years agoImprovement with fluent interface for our test
Gustavo Martin Morcuende [Thu, 24 Nov 2016 00:50:37 +0000 (01:50 +0100)]
Improvement with fluent interface for our test

We now have the legacy code under test. So now and not before we can refactor the legacy code.

7 years agoImprovement with fluent interface for our test
Gustavo Martin Morcuende [Thu, 24 Nov 2016 00:50:37 +0000 (01:50 +0100)]
Improvement with fluent interface for our test

8 years agoRemoving duplicated code
Gustavo Martin Morcuende [Wed, 23 Nov 2016 21:00:00 +0000 (22:00 +0100)]
Removing duplicated code

8 years agoWe must always turn static methods into protected ones.
Gustavo Martin Morcuende [Wed, 23 Nov 2016 20:52:26 +0000 (21:52 +0100)]
We must always turn static methods into protected ones.

It is the only way of testing them (without using PowerMockito and stuff like that)
Remember, every change in the legacy code must be done by the tools proviede by our IDE (Eclipse, InteliJ, etc)
you must never rewrite by hand the legacy code.

8 years agoRemoving duplicated code
Gustavo Martin Morcuende [Wed, 23 Nov 2016 20:31:23 +0000 (21:31 +0100)]
Removing duplicated code

8 years agoWe test the next branch.
Gustavo Martin Morcuende [Sun, 20 Nov 2016 22:44:01 +0000 (23:44 +0100)]
We test the next branch.

Remember: the assert must match the unit test method's name!!
In this case, no trips must be returned.

8 years agoCreating test for refactoring legacy code.
Gustavo Martin Morcuende [Sun, 20 Nov 2016 22:21:45 +0000 (23:21 +0100)]
Creating test for refactoring legacy code.

1. We may not change production code if not covered by tests.
2. Start testing the legacy code following the shortest branch.
3. We should not invoke more classes than the one being under test.
4. We try to create a fluent interface. If we are testing user is not logged in, our test must
set the value making the not logged in user (we will call it GUEST)
5. Making clear that the input parameter in getTripsByUser is useless for the Unit Test throw_an_exception_when_user_is_not_logged_in

8 years agoSandro Mancuso, tripservicekata.
Gustavo Martin Morcuende [Sun, 20 Nov 2016 21:42:43 +0000 (22:42 +0100)]
Sandro Mancuso, tripservicekata.

8 years agospring-jpa, liquibase, examples about how to update change sets in database
Gustavo Martin Morcuende [Wed, 14 Sep 2016 12:57:13 +0000 (14:57 +0200)]
spring-jpa, liquibase, examples about how to update change sets in database

8 years agoSTOMP: log4j2 improvements
Gustavo Martin Morcuende [Sat, 27 Aug 2016 22:02:53 +0000 (00:02 +0200)]
STOMP: log4j2 improvements

8 years agoSpring STOMP simple server: a few improvements
Gustavo Martin Morcuende [Sat, 27 Aug 2016 00:29:58 +0000 (02:29 +0200)]
Spring STOMP simple server: a few improvements

8 years agoSpring JPA: missing Named annotation in a few Spring services
Gustavo Martin Morcuende [Tue, 23 Aug 2016 01:35:04 +0000 (03:35 +0200)]
Spring JPA: missing Named annotation in a few Spring services

8 years agoSonarQube custom plugins, little improvement
Gustavo Martin Morcuende [Tue, 23 Aug 2016 00:47:38 +0000 (02:47 +0200)]
SonarQube custom plugins, little improvement

8 years agoSonarQube custom JavaScript plugin, unit tests
Gustavo Martin Morcuende [Mon, 22 Aug 2016 21:01:02 +0000 (23:01 +0200)]
SonarQube custom JavaScript plugin, unit tests

8 years agoSonarQube custom Java plugin, unit tests
Gustavo Martin Morcuende [Mon, 22 Aug 2016 20:42:59 +0000 (22:42 +0200)]
SonarQube custom Java plugin, unit tests

8 years agosonar java plugin: unit tests
Gustavo Martin Morcuende [Mon, 22 Aug 2016 19:28:23 +0000 (21:28 +0200)]
sonar java plugin: unit tests

8 years agoJPA project: maven site and Javadoc working
Gustavo Martin Morcuende [Mon, 22 Aug 2016 17:52:23 +0000 (19:52 +0200)]
JPA project: maven site and Javadoc working

8 years agoSonarQube JavaScript custom plugin, improvements in description
Gustavo Martin Morcuende [Sun, 21 Aug 2016 21:20:57 +0000 (23:20 +0200)]
SonarQube JavaScript custom plugin, improvements in description

8 years agosonar JavaScript plugin: use always interfaces.
Gustavo Martin Morcuende [Sun, 21 Aug 2016 20:21:52 +0000 (22:21 +0200)]
sonar JavaScript plugin: use always interfaces.

Otherwise problems with cast because implementations are loaded in different class loaders and my
plugin is not able to see the class loader where the instance was created :/

8 years agosonar JavaScript plugin: AngularJS $rootScope.$on detection
Gustavo Martin Morcuende [Sun, 21 Aug 2016 18:58:23 +0000 (20:58 +0200)]
sonar JavaScript plugin: AngularJS $rootScope.$on detection

8 years agosonar Java plugin: no time for comments
Gustavo Martin Morcuende [Sun, 21 Aug 2016 17:11:47 +0000 (19:11 +0200)]
sonar Java plugin: no time for comments

8 years agosonar Java plugin: multiple improvements
Gustavo Martin Morcuende [Sun, 21 Aug 2016 16:33:13 +0000 (18:33 +0200)]
sonar Java plugin: multiple improvements

8 years agosonar Java plugin, no time for comments
Gustavo Martin Morcuende [Sun, 21 Aug 2016 04:20:27 +0000 (06:20 +0200)]
sonar Java plugin, no time for comments

8 years agosonar JavaScript plugin: any class extending CustomJavaScriptRulesDefinition will...
Gustavo Martin Morcuende [Sun, 21 Aug 2016 04:17:50 +0000 (06:17 +0200)]
sonar JavaScript plugin: any class extending CustomJavaScriptRulesDefinition will be injected and used in JavaScriptSquidSensor.

So as in the Java plugin, I do not have to do anything :) Every time JavaScriptSquidSensor finds JavaScript code my rules will run.

8 years agosonar Java plugin: non required Sensor because we will be running whenever JavaSquidS...
Gustavo Martin Morcuende [Sun, 21 Aug 2016 03:27:37 +0000 (05:27 +0200)]
sonar Java plugin: non required Sensor because we will be running whenever JavaSquidSensor runs

JavaSquidSensor calls CustomRulesCheckRegistrar

8 years agosonar custom Java plugin: some improvements
Gustavo Martin Morcuende [Fri, 19 Aug 2016 19:18:21 +0000 (21:18 +0200)]
sonar custom Java plugin: some improvements

8 years agosonar custom java plugin: removing non required dependency
Gustavo Martin Morcuende [Wed, 17 Aug 2016 16:42:26 +0000 (18:42 +0200)]
sonar custom java plugin: removing non required dependency

8 years agosona java plugin: missing rule description
Gustavo Martin Morcuende [Wed, 10 Aug 2016 21:02:18 +0000 (23:02 +0200)]
sona java plugin: missing rule description

8 years agosonar-java-plugin: fixing profile name
Gustavo Martin Morcuende [Tue, 9 Aug 2016 20:58:16 +0000 (22:58 +0200)]
sonar-java-plugin: fixing profile name

8 years agosonar-java-plugin: check for mutable Spring Service instance fields
Gustavo Martin Morcuende [Tue, 9 Aug 2016 20:52:43 +0000 (22:52 +0200)]
sonar-java-plugin: check for mutable Spring Service instance fields

8 years agoJPA: GET revisions, HTTP examples
Gustavo Martin Morcuende [Sun, 7 Aug 2016 22:57:28 +0000 (00:57 +0200)]
JPA: GET revisions, HTTP examples

8 years agoSonarQube tryint to create a custom JavaScript plugin
Gustavo Martin Morcuende [Sun, 7 Aug 2016 22:51:40 +0000 (00:51 +0200)]
SonarQube tryint to create a custom JavaScript plugin

(no success)

8 years agono time for comments
Gustavo Martin Morcuende [Sun, 7 Aug 2016 22:51:20 +0000 (00:51 +0200)]
no time for comments

8 years agosonar java plugin: renaming packages
Gustavo Martin Morcuende [Sun, 7 Aug 2016 17:08:03 +0000 (19:08 +0200)]
sonar java plugin: renaming packages

8 years agosonar-custom-java-plugin: renaming from HelloWorld to Custom
Gustavo Martin Morcuende [Sun, 7 Aug 2016 16:43:43 +0000 (18:43 +0200)]
sonar-custom-java-plugin: renaming from HelloWorld to Custom

8 years agoSonarqube custom rules: custom plugin for JavaScript
Gustavo Martin Morcuende [Fri, 5 Aug 2016 01:01:56 +0000 (03:01 +0200)]
Sonarqube custom rules: custom plugin for JavaScript

8 years agoSonarQube, custom Java rules.
Gustavo Martin Morcuende [Fri, 5 Aug 2016 00:46:06 +0000 (02:46 +0200)]
SonarQube, custom Java rules.

8 years agoSonarqube simple rule: missing required CheckRegistrar
Gustavo Martin Morcuende [Thu, 4 Aug 2016 18:58:02 +0000 (20:58 +0200)]
Sonarqube simple rule: missing required CheckRegistrar

8 years agoSonarqube rule: improvements
Gustavo Martin Morcuende [Wed, 3 Aug 2016 18:36:36 +0000 (20:36 +0200)]
Sonarqube rule: improvements

8 years agosonarqube helloworld plugin, renaming group and artifact ids
Gustavo Martin Morcuende [Tue, 2 Aug 2016 20:52:21 +0000 (22:52 +0200)]
sonarqube helloworld plugin, renaming group and artifact ids

8 years agosonarqube 5.6.1: trying to implement custom rule.
Gustavo Martin Morcuende [Tue, 2 Aug 2016 20:46:19 +0000 (22:46 +0200)]
sonarqube 5.6.1: trying to implement custom rule.

Based on SonarQube JavaPlugin.java implementation.

This is too complicated. It is taking me too much time...

8 years agoMessing around with sonarqube
Gustavo Martin Morcuende [Sun, 31 Jul 2016 20:28:39 +0000 (22:28 +0200)]
Messing around with sonarqube

8 years agoGetting ready for integration with Sonar (using Jacoco maven plugin)
Gustavo Martin Morcuende [Sun, 31 Jul 2016 17:42:51 +0000 (19:42 +0200)]
Getting ready for integration with Sonar (using Jacoco maven plugin)

8 years agoExplanation about Spring overriding beans when running JUnit tests
Gustavo Martin Morcuende [Fri, 29 Jul 2016 18:09:44 +0000 (20:09 +0200)]
Explanation about Spring overriding beans when running JUnit tests

8 years agoSpring JPA: generic classes for implementing Controllers for revisions.
Gustavo Martin Morcuende [Wed, 27 Jul 2016 14:11:12 +0000 (16:11 +0200)]
Spring JPA: generic classes for implementing Controllers for revisions.

Servicies and entities. Following RESTHUB implementation.

8 years agoSpring JPA: AdDescription revisions
Gustavo Martin Morcuende [Tue, 26 Jul 2016 21:09:32 +0000 (23:09 +0200)]
Spring JPA: AdDescription revisions

8 years agoSpring JPA: Spring REST interceptor
Gustavo Martin Morcuende [Tue, 26 Jul 2016 20:34:31 +0000 (22:34 +0200)]
Spring JPA: Spring REST interceptor

8 years agoSpring JPA: spring-data-envers, serializing data
Gustavo Martin Morcuende [Tue, 26 Jul 2016 20:25:20 +0000 (22:25 +0200)]
Spring JPA: spring-data-envers, serializing data

8 years agoSpring JPA: MyCustomRevision, serializing revision date field.
Gustavo Martin Morcuende [Tue, 26 Jul 2016 20:24:47 +0000 (22:24 +0200)]
Spring JPA: MyCustomRevision, serializing revision date field.

8 years agoSpring JPA: jackson custom serializing
Gustavo Martin Morcuende [Tue, 26 Jul 2016 20:19:40 +0000 (22:19 +0200)]
Spring JPA: jackson custom serializing

8 years agoSpring JPA: spring-data-envers does not work yet with QueryDSL
Gustavo Martin Morcuende [Tue, 26 Jul 2016 17:28:25 +0000 (19:28 +0200)]
Spring JPA: spring-data-envers does not work yet with QueryDSL

See: https://github.com/spring-projects/spring-data-envers/pull/45

8 years agoSpring JPA: modify resource
Gustavo Martin Morcuende [Tue, 26 Jul 2016 17:27:35 +0000 (19:27 +0200)]
Spring JPA: modify resource

8 years agoSpring JPA: I must be doing something wrong because I do not manage to audit bi direc...
Gustavo Martin Morcuende [Mon, 25 Jul 2016 19:24:09 +0000 (21:24 +0200)]
Spring JPA: I must be doing something wrong because I do not manage to audit bi directional relationship

8 years agoSpring JPA: logging Hibernate query parameters with LOG4J2
Gustavo Martin Morcuende [Mon, 25 Jul 2016 19:16:53 +0000 (21:16 +0200)]
Spring JPA: logging Hibernate query parameters with LOG4J2

8 years agoSpring JPA: a few improvements
Gustavo Martin Morcuende [Mon, 25 Jul 2016 19:15:49 +0000 (21:15 +0200)]
Spring JPA: a few improvements

8 years agoSpring JPA: no way of injecting bean in JPA entities
Gustavo Martin Morcuende [Mon, 25 Jul 2016 19:14:54 +0000 (21:14 +0200)]
Spring JPA: no way of injecting bean in JPA entities

8 years agoSpring JPA: no time for comments
Gustavo Martin Morcuende [Thu, 21 Jul 2016 20:05:14 +0000 (22:05 +0200)]
Spring JPA: no time for comments

8 years agoSpring JPA: using spring-data-envers
Gustavo Martin Morcuende [Thu, 21 Jul 2016 17:39:00 +0000 (19:39 +0200)]
Spring JPA: using spring-data-envers

8 years agoSpring JPA: Envers tables, auditory.
Gustavo Martin Morcuende [Thu, 21 Jul 2016 17:28:52 +0000 (19:28 +0200)]
Spring JPA: Envers tables, auditory.

8 years agoSpring JPA: no time for comments
Gustavo Martin Morcuende [Wed, 20 Jul 2016 21:05:19 +0000 (23:05 +0200)]
Spring JPA: no time for comments

8 years agoSpring JPA: Username HTTP Handler
Gustavo Martin Morcuende [Wed, 20 Jul 2016 20:35:56 +0000 (22:35 +0200)]
Spring JPA: Username HTTP Handler

8 years agoSpring JPA: H2 datasource, comments explaining why I am not using the Spring way...
Gustavo Martin Morcuende [Wed, 20 Jul 2016 20:34:42 +0000 (22:34 +0200)]
Spring JPA: H2 datasource, comments explaining why I am not using the Spring way (jdbc:embedded-database option)

8 years agoSpring JPA: improvements in changeLogs.xml (liquibase file)
Gustavo Martin Morcuende [Wed, 20 Jul 2016 20:31:53 +0000 (22:31 +0200)]
Spring JPA: improvements in changeLogs.xml (liquibase file)

8 years agoSpring JPA: data base, column names with caps
Gustavo Martin Morcuende [Wed, 20 Jul 2016 20:01:47 +0000 (22:01 +0200)]
Spring JPA: data base, column names with caps

8 years agoSpring JPA: README, new URLs
Gustavo Martin Morcuende [Wed, 20 Jul 2016 18:16:36 +0000 (20:16 +0200)]
Spring JPA: README, new URLs

8 years agoSpring JPA: cleaning up POM files
Gustavo Martin Morcuende [Wed, 20 Jul 2016 18:11:07 +0000 (20:11 +0200)]
Spring JPA: cleaning up POM files

8 years agoSpring JPA: new structure
Gustavo Martin Morcuende [Wed, 20 Jul 2016 18:02:55 +0000 (20:02 +0200)]
Spring JPA: new structure

8 years agoUsing Envers
Gustavo Martin Morcuende [Mon, 18 Jul 2016 21:01:43 +0000 (23:01 +0200)]
Using Envers

8 years agoJPA: getting ready for Hibernate Envers
Gustavo Martin Morcuende [Sun, 17 Jul 2016 20:45:46 +0000 (22:45 +0200)]
JPA: getting ready for Hibernate Envers

8 years agoSpring STOMP: a few improvements
Gustavo Martin Morcuende [Wed, 13 Jul 2016 00:23:58 +0000 (02:23 +0200)]
Spring STOMP: a few improvements

8 years agoSpring JPA: removing useless Spring profiles
Gustavo Martin Morcuende [Tue, 12 Jul 2016 01:13:08 +0000 (03:13 +0200)]
Spring JPA: removing useless Spring profiles

8 years agoSpring JPA: little improvement (English grammar)
Gustavo Martin Morcuende [Tue, 12 Jul 2016 01:11:00 +0000 (03:11 +0200)]
Spring JPA: little improvement (English grammar)

8 years agoSpring JPA: Specifications, using lambda expressions
Gustavo Martin Morcuende [Tue, 12 Jul 2016 01:09:12 +0000 (03:09 +0200)]
Spring JPA: Specifications, using lambda expressions

8 years agoSpring JPA: liquibase
Gustavo Martin Morcuende [Tue, 12 Jul 2016 01:00:19 +0000 (03:00 +0200)]
Spring JPA: liquibase

8 years agoSpringJPA: Querydsl VS Spring Specifications
Gustavo Martin Morcuende [Mon, 11 Jul 2016 20:00:41 +0000 (22:00 +0200)]
SpringJPA: Querydsl VS Spring Specifications

Querydsl is easier than Specifications and JPA Criterias.

8 years agoSpring JPA: using Querydsl
Gustavo Martin Morcuende [Mon, 11 Jul 2016 00:45:46 +0000 (02:45 +0200)]
Spring JPA: using Querydsl

8 years agoMaven weaver: aspectj-maven-plugin integration with Eclipse (AJDT)
Gustavo Martin Morcuende [Sun, 10 Jul 2016 22:12:56 +0000 (00:12 +0200)]
Maven weaver: aspectj-maven-plugin integration with Eclipse (AJDT)

8 years agoSpring JPA: getting ready for test with H2 and docker
Gustavo Martin Morcuende [Sun, 10 Jul 2016 18:56:40 +0000 (20:56 +0200)]
Spring JPA: getting ready for test with H2 and docker

8 years agoSpring JPA: POSTMAN examples
Gustavo Martin Morcuende [Sun, 10 Jul 2016 17:59:25 +0000 (19:59 +0200)]
Spring JPA: POSTMAN examples

8 years agoSpring JPA: Jackson, avoid cyclic dependency
Gustavo Martin Morcuende [Sun, 10 Jul 2016 17:57:02 +0000 (19:57 +0200)]
Spring JPA: Jackson, avoid cyclic dependency

8 years agoSpring JPA: insert parent<->child at the same time
Gustavo Martin Morcuende [Sun, 10 Jul 2016 16:59:21 +0000 (18:59 +0200)]
Spring JPA: insert parent<->child at the same time