diff --git a/.gitignore b/.gitignore index 29937ae..b879e54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -out -logs -lib -*.iml -.idea +/out +/logs +/lib +/*.iml +/.idea +/.*.db \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b698fae --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +Based on Simple Public License (SimPL) 2.0 +The SimPL applies to the software's source and object code and comes with any rights that I have in it (other than trademarks). +You agree to the SimPL by copying, distributing, or making a derivative work of the software. + +You get the royalty free right to: +- Use the software for any purpose; +- Make derivative works of it (this is called a "Derived Work"); +- Copy and distribute it and any Derived Work. + +There are some things that you must shoulder: +- You get NO WARRANTIES. None of any kind; +- If the software damages you in any way, you may only recover direct damages up to the amount you paid for it + (that is zero if you did not pay anything). You may not recover any other damages, including those called + "consequential damages." (The state or country where you live may not allow you to limit your liability in + this way, so this may not apply to you); diff --git a/README b/README index 8a5095c..a266a9a 100644 --- a/README +++ b/README @@ -16,18 +16,26 @@ which uses google maps to browse and edit them. Or you can follow how this all have been created by pulling various branches into your own branch in this order: -- ivy -- launcher -- map -- web.xml -- logging -- jersey -- map-with-spots -- add-spot -- spring -- db -- hibernate -- tests +- start - empty project +- ivy - add ivy for dependency management +- launcher - adds Jetty launcher to run the app without any external application servers +- map - adds html with Google Map +- web.xml - first step for Java web app +- logging - adds good logging, useful for any web app +- jersey - adds Jersey (JAX-RS implementation) for handling HTTP REST requests +- map-with-spots - adds dummy photo spots to the Google Map +- add-spot - possibility to add new spots to the map +- spring - adds Spring for dependency injection +- db - adds H2 database +- hibernate - adds Hibernate for persisting of objects without hand-coded JDBC code +- tests - adds some unit tests (in real life these should be added on every step) +- db-testing - adds plain JDBC implementation for persistence as well as more tests, see 2nd presentation below -See related talk from GOTOCon and Devclub here: +By following these branches in this order you can also get an idea how to build an app step-by-step, +following Just Enough Design principle. + +See related talk from GOTOCon and Devclub here - "How to get Java back": http://www.slideshare.net/antonkeks/simplicity-8971441 + +And another one about DB testing from Topconf - "3 tales of testing of DB-enabled apps": +http://prezi.com/kq0ghszq6e-j/3-tales-of-testing-db-enabled-apps/ diff --git a/src/ee/devclub/model/JDBCPhotoSpotRepository.java b/src/ee/devclub/model/JDBCPhotoSpotRepository.java index c0b7d26..e3d674b 100644 --- a/src/ee/devclub/model/JDBCPhotoSpotRepository.java +++ b/src/ee/devclub/model/JDBCPhotoSpotRepository.java @@ -1,9 +1,6 @@ package ee.devclub.model; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcOperations; -import org.springframework.orm.hibernate3.HibernateOperations; -import org.springframework.stereotype.Repository; import javax.sql.DataSource; import java.sql.Connection; diff --git a/src/ee/devclub/model/PhotoSpot.java b/src/ee/devclub/model/PhotoSpot.java index 82f5197..f2a6b78 100644 --- a/src/ee/devclub/model/PhotoSpot.java +++ b/src/ee/devclub/model/PhotoSpot.java @@ -1,6 +1,9 @@ package ee.devclub.model; -import javax.persistence.*; +import javax.persistence.Access; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; import static javax.persistence.AccessType.FIELD; import static javax.persistence.GenerationType.AUTO; diff --git a/test/ee/devclub/model/JDBCPhotoSpotRepositoryTest.java b/test/ee/devclub/model/JDBCPhotoSpotRepositoryTest.java index 7c2da7d..bd6fc32 100644 --- a/test/ee/devclub/model/JDBCPhotoSpotRepositoryTest.java +++ b/test/ee/devclub/model/JDBCPhotoSpotRepositoryTest.java @@ -7,8 +7,9 @@ import java.sql.ResultSet; import java.util.List; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; import static org.mockito.Mockito.*; public class JDBCPhotoSpotRepositoryTest { diff --git a/webapp/WEB-INF/spring.xml b/webapp/WEB-INF/spring.xml index 3e3d0f3..e0f02a3 100644 --- a/webapp/WEB-INF/spring.xml +++ b/webapp/WEB-INF/spring.xml @@ -2,7 +2,7 @@ + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">