Code Monkey home page Code Monkey logo

fmu-core's Introduction

##Project fmu-core

##JIRA Link: Inera FMU

##Technology Stack (Languages, Tools & Frameworks):

  1. Language: Java 1.7
  2. IDE: IntelliJ (Recommended), STS, or NetBeans
  3. Production Database: MySql 5.6.4+
  4. Test Database: H2
  5. Code Management: Git
  6. Dependency & Build Management: Maven 3.0
  7. Database Migration Tool: Liquibase 3
  8. Logging Abstraction: SFL4J
  9. Logging Implementation: logback
  10. Unit Testing: JUnit 4 — The de-facto standard for unit testing Java applications.
  11. Persistence (Data Access): JPA, Hibernate 4 (One of the most popular JPA implementations.), Spring Data JPA (Makes it easy to easily implement JPA based repositories), Spring ORMs (Core ORM support from the Spring Framework)
  12. BPM: Activiti 5.15
  13. Mocking: Mockito
  14. Application Server: Tomcat
  15. Object to JSON Mapping: Jackson
  16. Date Time Utility: Joda-Time
  17. Assertion Library: Hamcrest - A library of matcher objects (also known as constraints or predicates) allowing assertThat style JUnit assertions.
  18. Integration Test Support: Spring Test — integration test support for Spring applications.
  19. JDBC Connection Pool: HikariCP - HikariCP is a high performance JDBC connection pool.
  20. Properties file format: YAML
  21. @ToString: lombok
  22. AOP: Spring AOP Logging, Transactions,
  23. Profiles: Maven & Spring Profiles
  24. Scripting Language: Groovy

###Code Base

  1. Download and install Git.
  2. Right the folder which you want to be the home for the codebase, and choose Git Bash.(For integration of IntelliJ with Git, refer to the section below Setting Up the Environment->IntelliJ point 4 onward)
  3. Paste git clone https://github.com/rasheedamir/fmu-core.git
  4. Give the password when prompted.

###Project Structure

##Setting up the Environment:

###- JAVA

###- Maven

###- IntelliJ

  1. Install an IDE. Here we will assume the usage of IntelliJ. Download IntelliJ IDEA. Ultimate version needs to be bought. Install IntelliJ.
  2. Configure Groovy in IntelliJ.
    • At startup after IntelliJ installation, add support for the plugin of Grails.
    • Otherwise, you can later change it from File -> Settings. Then choose plugins, and check Grails.
  3. Enable Git in IntelliJ, as mentioned in the step above.
  4. After that, go to Project->Settings, under Version Control, click Git. On the right hand panel, you need to give the address to the git executable, named git.exe, present in .../Git/bin/.
  5. For the ssh drop down right below the executable field, its preferable to choose "Built In".
  6. For more information on this issue, refer to jetbrains website.
  7. For projects being developed on cross-platform operatins systems, windows uses CRLF line endings(a format) and Linux, OS X use LF line ending format. If not taken care of these line endings will be changed from one format to the other, causing in merge conflicts. There are 2 possible solutions:
    • If using from Git, you need to change the 'core.autocrlf' property in the Git config to 'true'(for Windows) or to 'input' in case of Linux.
    • From IntelliJ itself wth Git integrated, you need to place an xml file here: .IntelliJIdea12\config\codestyles\Default _1_.xml, which contains policies for the commiting.

More info on this topic can be found here

###- Eclipse (for Activiti Diagram Only) In addition to installing the maven package and the eclipse package, and all their dependencies, you need to install the m2e extension. The best way to do this is using the Eclipse Marketplace, but the marketplace is not installed by default in the Ubuntu package.

Install the Eclipse Marketplace

  1. Open Eclipse, go to Help -> Install New Software...
  2. Select All Available Sites in the Work with dropdown menu.
  3. Wait for the list of software to populate; sometimes it takes a very long time.
  4. Expand the General Purpose Tools group, and tick Marketplace Client.
  5. Click Next, and again, accept the terms and conditions and click Finish.

This will install the marketplace. You will need to restart Eclipse for the change to take effect.

Install m2e

  1. Open Eclipse, go to Help -> Eclipse Marketplace...
  2. Wait for it to finish loading.
  3. Enter "maven" in the search box and press return.
  4. Click the Install button next to Maven Integration for Eclipse by Eclipse.org (NB: there is a similar item above called "Maven Integration for Eclipse WTP" by Red Hat, Inc; this is not the correct one).

Again, you will need to restart Eclipse for this to take effect.

Install Activiti BPMN 2.0 Designer

The following installation instructions are verified on Eclipse Juno.

Go to Help -> Install New Software. In the following panel, click on Add button and fill in the following fields:

Name: Activiti BPMN 2.0 designer Location: http://activiti.org/designer/update/

Make sure the "Contact all updates sites.." checkbox is checked, because all the necessary plugins will then be downloaded by Eclipse.

###- Git

  1. Download latest version of git
  2. Select point 3 Run git and included unix tools from the windows command prompt, when needed. Path will be updated during installation.
  3. Open console and check git --version. The result should be like git version 1.9.0.msysgit.0.
  4. If git installation successful, generate ssh keys and add it to Bitbucket account, follow to the official guide.

###- MySql

  • Window users:
  1. Download latest version of MySql community server
  2. Run .exe or .msi file and follow the instructions.
  3. Select Developer default.
  4. Specify password for root user.

Follow this guide, if there is any questions.

  • Ubuntu/Debian users: sudo apt-get install mysql-server mysql-client

###- Database Setup

  1. Create a new database named ---.
  2. MySql Settings:
    • username = ----,
    • password = ----,
    • host = ----,
    • port = 3306.
  3. Open the terminal and type mysql -u root -p
  4. Enter the password when prompted ---
  5. Create database create database --- (The output should be "Query OK, 1 row affected")

DROP DATABASE fmu;

CREATE DATABASE fmu CHARACTER SET utf8 COLLATE utf8_general_ci;

https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration

###Using Codebase

###fmu-core on IntelliJ

###Debug on Intellij

  1. Open Run -> Edit configurations

  2. Click green + and choose remote

  3. Set name e.g. debug,

    Use following settings:

    • Transport: Socket
    • Debugger mode: Attach
    • Host: localhost
    • Port: 5005 - it's default grails debug port

##Logs

  • Application logs can be found here: fmu-core/logs

##TroubleShooting

  • There may be errors while running the application

##Generating Liquibase ChangeLog

mvn resources:resources liquibase:diff -Pprod

##Running/Debugging the Application

###Add 'resources' directory to classpath in IntelliJ 13

  1. Click on the Project view or unhide it by clicking on the "1: Project" button on the left border of the window or by pressing Alt + 1
  2. Find your project or sub-module and click on it to highlight it, then press F4, or right click and choose "Open Module Settings"
  3. Click on the dependencies tab
  4. Click the "+" button on the right and select "Jars or directories..."
  5. Find your path and click OK
  6. In the dialog with "Choose Categories of Selected File", choose classes (even if it's properties), press OK and OK again

You can now run your application and it will have the selected path in the classpath.

###As a "main" Java class From your IDE, right-click on the "Application" class at the root of your Java package hierarchy, and run it directly. You should also be able to debug it as easily.

The application will be available on http://localhost:8080.

###As a Maven project You can launch the Java server with Maven:

mvn spring-boot:run -Pprod The application will be available on http://localhost:9090

If you want more information on using Maven, please go to http://maven.apache.org

##Profiles

fmu-core comes with two "profiles":

  • "dev" for development: it focuses on ease of development and productivity
  • "prod" for production: it focuses on performance and scalability

Those profiles come in two different configurations:

  1. The Maven profiles are used at build time. For example mvn -Pprod package will package a production application.
  2. The Spring profiles work a run time. Some Spring beans will behave differently, depending on the profile.

Spring profiles are set by Maven, so we have a consistency between the two methods: of course, we have a "prod" profile on Maven and Spring at the same time.

###dev In default mode, fmu-core will use the "dev" profile If you run the application without Maven, launch the "Application" class (you can probably run it easily from your IDE by right-clicking on it).

If you run the application with Maven, run mvn -Pdev spring-boot:run

###prod In production, fmu-core has to run with the "prod" profile Use Maven to build the application with the "prod" profile: mvn -Pprod spring-boot:run

##Plugins

###EditorConfig EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. Read more here

mvn resources:resources liquibase:update -P<profile_name> Invoking the resources is necessary in order to have the liquibase.properties placeholders filtered. The -P option tells Maven the profile to use and thus the set of values (from the filter properties file) to use for filtering.

##Testing

###Unit Tests We use the Surefire Maven plugin to run our unit tests. Run following command to run unit tests:

mvn clean test

###Integration Tests The Failsafe Maven plugin is used to execute our integration tests. Run following command to run integration tests:

mvn clean verify -P integration-test

fmu-core's People

Contributors

rasheedamir avatar

Watchers

James Cloos avatar Karl Johan Andreasson avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.