Posts

Showing posts from February 18, 2018

Build pipeline with Jenkins

Image
Jenkins pipeline with different stages Currently, we are using Jenkins for one of our projects. It is possible to have multiple stages in your jenkins to address the different areas of your testing like End to End testing, UI Testing, API Testing, Integration testing. Here is the current pipeline.

Adding validation to a field and tested using mockMVC

The controller class (controller.java) has this code. if (farmerIds.contains(farmerId)) { farmerUnionRequest farmerUnionRequest = new farmerUnionRequest(farmerId, customerId);                 String encryptedRequest = encryptor.encrypt(StringUtil.toJsonString(farmerUnionRequest));                 response = redirectService.getConfirmAccountResponse(headers, ImmutableMap.of("encryptedUnionId", encryptedRequest));  } else {             LOG.warn("Unknown farmer id: {}", farmerId);             response = new ResponseEntity("Unknown farmer id", BAD_REQUEST);          } I noticed that there is another main field called customerId and it is not checked for null or empty. I changed the controller class like this. if (farmerIds.contains(farmerId)) {             if (!customerId.isEmpty()) { .  / / isEmpty takes care of null as well as empty                 farmerFeedRequest farmerFeedRequest = new farmerFeedRequest(farmerId, customerId);          

Squashing the merges

When you want to merge into master, sometimes you want to squash all your commits (for that branch), so that they appear as a single commit on master. You will always go into master and pull the changes from the branch. Here are the git commands for you to do it. Say your bug fix branch is called  fixedAllBugs  and you want to merge it into  master : git checkout master git merge --squash fixedAllBugs git commit

Setting up IntelliJ IDEA for the first time and connecting to github

After installing IntelliJ IDEA, if you try to access "Check out from Version Control - GitHub", you will get the following error. "Unable to find git.exe This is due to git not being installed as part of the IDE installation. Go to this url => https://git-scm.com/downloads and download the file as per your operating system. Afterwards, if you do the same action on IDE, you will be able to connect to GitHub.