Git Product home page Git Product logo

classroom-exercise-4's Introduction

Classroom Exercise 4

Commit per exercise please!

Exercise 1

Start by fixing the QuoteRepositoryIntegrationTest.

Exercise 2

Write your own implementation of findByQuotation_OnlyReturnsQuotesByMatchingQuotes in QuoteRepositoryIntegrationTest.

Watch it fail for the right reason first. Then implement production code to make your test work.

Exercise 3

Fix the the MemorableQuotesControllerIntegrationTest too.

How to run in your IDE

In build.gradle I included the idea and eclipse plugins, so all there is to it is ./gradlew eclipse or ./gradlew idea or ./gradlew.bat ... if you're on windows.

Docker stuff

If you're not on Linux install Docker-Toolbox.

Installing on OSX

The installer might not have created a default machine, so you'll have to create it manually.

You can tell you don't have a default machine when docker-machine ip default returns Error: No machine name(s) specified and no "default" machine exists..

Run this command docker-machine create -d virtualbox default.

Then run eval $(docker-machine env) to sync your shell with the VM.

Docker stuff continued

Check which ip your docker VM is running on with docker-machine ip default.

Run docker-compose up to spin up two PostgreSQL database instances.

You can then use this as your jdbc url jdbc:postgresql://<your vm's ip>:5432/postgres in your application.

More info on Postgres' DockerHub page.

IntegrationTests

In src/test/resources/application.properties you'll find it's pointing to jdbc:postgresql://<your vm's ip>:5433/testdb (note the difference in port and db name).

Network timed out while trying to connect to ...

docker-machine restart default      # Restart the environment
`$(docker-machine env default)`     # Refresh your environment settings

FlyWay

FlyWay makes sure your database tables are up to date and uses simple convention over configuration to manage your versioned SQL scripts.

Ways to use FlyWay

Validate failed. Migration Checksum mismatch for migration 1

Validate failed. Migration Checksum mismatch for migration 1
-> Applied to database : 812944198
-> Resolved locally    : -1906377092

This means you most probably changed a sql file after it was already executed.

Either fix this by running ./gradlew flywayRepair if you're still testing out your script, or create a new migration script that only has the change necessary.

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.