Spring Framework dependencies (spring-core, spring-beans, spring-context, spring-jdbc) were added with pom.xml;
in web.xml the ContextLoaderListener was set, so let it load the dao-context.xml configuration file;
adding dataSource bean to the dao-context.xml with help of jndi-lookup, so it'll look for the bean after was loaded to web.xml and find the one that was set in Tomcat config file;
User bean class was implemented;
the structure of MySQL database:
tables: users, authorities, documents;
UsersDao class with get(), getAll(), create() methods were implemented;
dao-context.xml file is scanning the UsersDao as component and wiring the dataSource bean to it, so the conection to MySQL tables could be established;
adding the required dependencies to pom.xml: should be done before the last changes, so make them possible;
mysql.DataSourceFactory: gives MysqlDataSource to establish the connection with it, that is required for test purposes;
mysql.create-tables: sql-script for UsersDaoTests.setUpBeforeClass;
properties.dbtest: property file, containing information about new database (db_for_tests), that could be used only for test purposes;
tests update:
UsersDaoTests: the tests for addUser(), addAuthority() methods were implemented;
note: before running this testCase new tables (db_for_tests.users, db_for_test.authorities) will be created, after its executing they will be deleted;
note: after every tests executing the tables data will be removed, so to give some test space for the next one;