diff --git a/NEWS.rst b/NEWS.rst index fa02a2d02..ed525d9ba 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -70,11 +70,12 @@ Changes * Update JodaTime * Update Jasper Reports * Update EasyMock -* Update JDBC driver +* Update JDBC drivers (PostgreSQL + MySQL) * Update AspectJ Weaver * Update JAX-RS API * Update BeanShell * Update Quartz Framework +* Update Hibernate * Update LibrePlan version to 1.6.0 diff --git a/doc/src/technical/howto-start-development-with-intellij-idea.rst b/doc/src/technical/howto-start-development-with-intellij-idea.rst index aebb2e6d6..9fbceaddf 100644 --- a/doc/src/technical/howto-start-development-with-intellij-idea.rst +++ b/doc/src/technical/howto-start-development-with-intellij-idea.rst @@ -92,11 +92,11 @@ Develop LibrePlan in Intellij IDEA using MySQL LibrePlan using MySQL you have to do 2 small changes: * In section `Configure project to run`_ you have to set the *Profiles* to: - ``-dev -mysql -userguide -reports -i18n`` + ``dev mysql -userguide -reports -i18n`` * Remember that the three last profiles that are being disabled is just to save compilation time and not mandatory. However, to develop using MySQL you have - to set at least the first two: ``-dev`` and ``-mysql``. + to set at least the first two: ``dev`` and ``mysql``. .. _LibrePlan: http://www.libreplan.com/ diff --git a/ganttzk/pom.xml b/ganttzk/pom.xml index 2562e55c6..3ce4f474d 100644 --- a/ganttzk/pom.xml +++ b/ganttzk/pom.xml @@ -21,8 +21,8 @@ - org.xnap.commons - maven-gettext-plugin + com.googlecode.gettext-commons + gettext-maven-plugin app.i18n.Messages ${project.build.sourceDirectory}/../resources/i18n @@ -40,16 +40,16 @@ org.apache.maven.plugins maven-source-plugin + 3.0.0 default package - - jar-no-fork - + + jar-no-fork + - @@ -59,7 +59,7 @@ - org.xnap.commons + com.googlecode.gettext-commons gettext-commons diff --git a/ganttzk/src/main/java/org/zkoss/ganttz/i18n/I18nHelper.java b/ganttzk/src/main/java/org/zkoss/ganttz/i18n/I18nHelper.java index 8bcf4d052..2bbed8892 100644 --- a/ganttzk/src/main/java/org/zkoss/ganttz/i18n/I18nHelper.java +++ b/ganttzk/src/main/java/org/zkoss/ganttz/i18n/I18nHelper.java @@ -31,20 +31,24 @@ import org.zkoss.util.Locales; public class I18nHelper { - private static HashMap localesCache = new HashMap(); + private static HashMap localesCache = new HashMap<>(); public static I18n getI18n() { - if (localesCache.keySet().contains(Locales.getCurrent())) { + if ( localesCache.keySet().contains(Locales.getCurrent()) ) { return localesCache.get(Locales.getCurrent()); } - I18n i18n = I18nFactory.getI18n(I18nHelper.class, "app.i18n.Messages", Locales.getCurrent(), + I18n i18n = I18nFactory.getI18n( + I18nHelper.class, + "app.i18n.Messages", + Locales.getCurrent(), org.xnap.commons.i18n.I18nFactory.FALLBACK); + localesCache.put(Locales.getCurrent(), i18n); return i18n; } - + // TODO refactor symbol _ public static String _(String str) { return getI18n().tr(str); } diff --git a/libreplan-business/pom.xml b/libreplan-business/pom.xml index 9401db1b6..469c06819 100644 --- a/libreplan-business/pom.xml +++ b/libreplan-business/pom.xml @@ -14,7 +14,7 @@ - org.xnap.commons + com.googlecode.gettext-commons gettext-commons @@ -149,7 +149,7 @@ org.liquibase liquibase-maven-plugin - 3.5.0 + 3.5.1 process-resources @@ -178,7 +178,7 @@ org.liquibase liquibase-maven-plugin - 3.5.0 + 3.5.1 process-resources diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/daos/ConnectorDAO.java b/libreplan-business/src/main/java/org/libreplan/business/common/daos/ConnectorDAO.java index 884b13879..b7ce376be 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/daos/ConnectorDAO.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/daos/ConnectorDAO.java @@ -38,8 +38,7 @@ import org.springframework.transaction.annotation.Transactional; */ @Repository @Scope(BeanDefinition.SCOPE_SINGLETON) -public class ConnectorDAO extends GenericDAOHibernate - implements IConnectorDAO { +public class ConnectorDAO extends GenericDAOHibernate implements IConnectorDAO { @Override @Transactional(readOnly = true) @@ -50,8 +49,8 @@ public class ConnectorDAO extends GenericDAOHibernate @Override @Transactional(readOnly = true) public Connector findUniqueByName(String name) { - Criteria c = getSession().createCriteria(Connector.class).add( - Restrictions.eq("name", name)); + Criteria c = getSession().createCriteria(Connector.class).add(Restrictions.eq("name", name)); + return (Connector) c.uniqueResult(); } @@ -63,6 +62,7 @@ public class ConnectorDAO extends GenericDAOHibernate private boolean existsOtherConnectorByName(Connector connector) { Connector found = findUniqueByName(connector.getName()); + return found != null && found != connector; } diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/daos/IJobSchedulerConfigurationDAO.java b/libreplan-business/src/main/java/org/libreplan/business/common/daos/IJobSchedulerConfigurationDAO.java index 4f1bfe23a..fecad0e82 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/daos/IJobSchedulerConfigurationDAO.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/daos/IJobSchedulerConfigurationDAO.java @@ -28,8 +28,7 @@ import org.libreplan.business.common.entities.JobSchedulerConfiguration; * * @author Miciele Ghiorghis */ -public interface IJobSchedulerConfigurationDAO extends - IGenericDAO { +public interface IJobSchedulerConfigurationDAO extends IGenericDAO { /** * Returns all {@link JobSchedulerConfiguration} @@ -52,8 +51,7 @@ public interface IJobSchedulerConfigurationDAO extends * @param jobGroup * @param jobName */ - JobSchedulerConfiguration findByJobGroupAndJobName(String jobGroup, - String jobName); + JobSchedulerConfiguration findByJobGroupAndJobName(String jobGroup, String jobName); /** * Returns true if there exists other @{link JobSchedulerConfiguration} with @@ -63,8 +61,7 @@ public interface IJobSchedulerConfigurationDAO extends * @param jobSchedulerConfiguration * the {@link JobSchedulerConfiguration} */ - boolean existsByJobGroupAndJobNameAnotherTransaction( - JobSchedulerConfiguration jobSchedulerConfiguration); + boolean existsByJobGroupAndJobNameAnotherTransaction(JobSchedulerConfiguration jobSchedulerConfiguration); /** * Returns unique {@link JobSchedulerConfiguration} for the specified @@ -75,6 +72,5 @@ public interface IJobSchedulerConfigurationDAO extends * @param jobName * the jobName */ - JobSchedulerConfiguration findUniqueByJobGroupAndJobNameAnotherTransaction( - String jobGroup, String jobName); + JobSchedulerConfiguration findUniqueByJobGroupAndJobNameAnotherTransaction(String jobGroup, String jobName); } diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/daos/JobSchedulerConfigurationDAO.java b/libreplan-business/src/main/java/org/libreplan/business/common/daos/JobSchedulerConfigurationDAO.java index f07ad1fce..b0bf23581 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/daos/JobSchedulerConfigurationDAO.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/daos/JobSchedulerConfigurationDAO.java @@ -38,9 +38,8 @@ import org.springframework.transaction.annotation.Transactional; */ @Repository @Scope(BeanDefinition.SCOPE_SINGLETON) -public class JobSchedulerConfigurationDAO extends - GenericDAOHibernate implements - IJobSchedulerConfigurationDAO { +public class JobSchedulerConfigurationDAO extends GenericDAOHibernate + implements IJobSchedulerConfigurationDAO { @Override @Transactional(readOnly = true) @@ -50,28 +49,24 @@ public class JobSchedulerConfigurationDAO extends @Override @Transactional(readOnly = true) - public JobSchedulerConfiguration findByJobGroupAndJobName(String jobGroup, - String jobName) { - return (JobSchedulerConfiguration) getSession() - .createCriteria(JobSchedulerConfiguration.class) + public JobSchedulerConfiguration findByJobGroupAndJobName(String jobGroup, String jobName) { + return (JobSchedulerConfiguration) getSession().createCriteria(JobSchedulerConfiguration.class) .add(Restrictions.eq("jobGroup", jobGroup)) .add(Restrictions.eq("jobName", jobName)).uniqueResult(); } @Override @Transactional(readOnly = true) - public List findByConnectorName( - String connectorName) { - Criteria c = getSession().createCriteria( - JobSchedulerConfiguration.class).add( - Restrictions.eq("connectorName", connectorName)); + public List findByConnectorName(String connectorName) { + Criteria c = getSession().createCriteria(JobSchedulerConfiguration.class) + .add(Restrictions.eq("connectorName", connectorName)); + return ((List) c.list()); } @Override @Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) - public boolean existsByJobGroupAndJobNameAnotherTransaction( - JobSchedulerConfiguration jobSchedulerConfiguration) { + public boolean existsByJobGroupAndJobNameAnotherTransaction(JobSchedulerConfiguration jobSchedulerConfiguration) { return existsOtherJobByGroupAndName(jobSchedulerConfiguration); } @@ -82,18 +77,17 @@ public class JobSchedulerConfigurationDAO extends * @param jobSchedulerConfiguration * the {@link JobSchedulerConfiguration} */ - private boolean existsOtherJobByGroupAndName( - JobSchedulerConfiguration jobSchedulerConfiguration) { + private boolean existsOtherJobByGroupAndName(JobSchedulerConfiguration jobSchedulerConfiguration) { JobSchedulerConfiguration found = findByJobGroupAndJobName( jobSchedulerConfiguration.getJobGroup(), jobSchedulerConfiguration.getJobName()); + return found != null && found != jobSchedulerConfiguration; } @Override @Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW) - public JobSchedulerConfiguration findUniqueByJobGroupAndJobNameAnotherTransaction( - String jobGroup, String jobName) { + public JobSchedulerConfiguration findUniqueByJobGroupAndJobNameAnotherTransaction(String jobGroup, String jobName) { return findByJobGroupAndJobName(jobGroup, jobName); } diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/entities/Connector.java b/libreplan-business/src/main/java/org/libreplan/business/common/entities/Connector.java index 5aa50fee6..b17292028 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/entities/Connector.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/entities/Connector.java @@ -55,7 +55,7 @@ public class Connector extends BaseEntity { private String name; - private List properties = new ArrayList(); + private List properties = new ArrayList<>(); /** * Constructor for Hibernate. Do not use! @@ -90,34 +90,33 @@ public class Connector extends BaseEntity { } public Map getPropertiesAsMap() { - Map map = new HashMap(); + Map map = new HashMap<>(); for (ConnectorProperty property : properties) { map.put(property.getKey(), property.getValue()); } + return map; } @AssertTrue(message = "connector name is already being used") public boolean isUniqueConnectorNameConstraint() { - if (StringUtils.isBlank(name)) { + if ( StringUtils.isBlank(name) ) { return true; } IConnectorDAO connectorDAO = Registry.getConnectorDAO(); - if (isNewObject()) { + if ( isNewObject() ) { return !connectorDAO.existsByNameAnotherTransaction(this); } else { - Connector found = connectorDAO - .findUniqueByNameAnotherTransaction(name); + Connector found = connectorDAO.findUniqueByNameAnotherTransaction(name); + return found == null || found.getId().equals(getId()); } } public boolean isActivated() { - return getPropertiesAsMap() - .get(PredefinedConnectorProperties.ACTIVATED).equalsIgnoreCase( - "Y"); + return getPropertiesAsMap().get(PredefinedConnectorProperties.ACTIVATED).equalsIgnoreCase("Y"); } /** @@ -126,23 +125,15 @@ public class Connector extends BaseEntity { * @return true if connection values are valid */ public boolean areConnectionValuesValid() { - String serverUrl = getPropertiesAsMap().get( - PredefinedConnectorProperties.SERVER_URL); + String serverUrl = getPropertiesAsMap().get(PredefinedConnectorProperties.SERVER_URL); try { new URL(serverUrl); } catch (MalformedURLException e) { return false; } - if (StringUtils.isBlank(getPropertiesAsMap().get( - PredefinedConnectorProperties.USERNAME))) { - return false; - } + return !StringUtils.isBlank(getPropertiesAsMap().get(PredefinedConnectorProperties.USERNAME)) && + !StringUtils.isBlank(getPropertiesAsMap().get(PredefinedConnectorProperties.PASSWORD)); - if (StringUtils.isBlank(getPropertiesAsMap().get( - PredefinedConnectorProperties.PASSWORD))) { - return false; - } - return true; } } diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/entities/ConnectorBootstrap.java b/libreplan-business/src/main/java/org/libreplan/business/common/entities/ConnectorBootstrap.java index a47ff19be..e765df7a2 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/entities/ConnectorBootstrap.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/entities/ConnectorBootstrap.java @@ -41,12 +41,11 @@ public class ConnectorBootstrap implements IConnectorBootstrap { @Override @Transactional public void loadRequiredData() { - for (PredefinedConnectors predefinedConnector : PredefinedConnectors - .values()) { + for (PredefinedConnectors predefinedConnector : PredefinedConnectors.values()) { String name = predefinedConnector.getName(); Connector connector = connectorDAO.findUniqueByName(name); - if (connector == null) { + if ( connector == null ) { connector = Connector.create(name); connector.setProperties(predefinedConnector.getProperties()); connectorDAO.save(connector); diff --git a/libreplan-business/src/main/resources/db.changelog-1.0.xml b/libreplan-business/src/main/resources/db.changelog-1.0.xml index 9ef8336f8..2e725bb43 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.0.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.0.xml @@ -1,9 +1,7 @@ - + Convert from duration + notAssignable (not over assignable) to capacity property diff --git a/libreplan-business/src/main/resources/db.changelog-1.1.xml b/libreplan-business/src/main/resources/db.changelog-1.1.xml index c5ababa13..f9fe1ed40 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.1.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.1.xml @@ -1,8 +1,8 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> + Add new column to store ldap host diff --git a/libreplan-business/src/main/resources/db.changelog-1.2.xml b/libreplan-business/src/main/resources/db.changelog-1.2.xml index a61b348af..85809c397 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.2.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.2.xml @@ -1,8 +1,7 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> diff --git a/libreplan-business/src/main/resources/db.changelog-1.3.xml b/libreplan-business/src/main/resources/db.changelog-1.3.xml index fdc1b4d9d..bf341e40b 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.3.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.3.xml @@ -1,8 +1,7 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> diff --git a/libreplan-business/src/main/resources/db.changelog-1.4.xml b/libreplan-business/src/main/resources/db.changelog-1.4.xml index 4e6844603..680a76662 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.4.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.4.xml @@ -1,8 +1,7 @@ + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> Add column to criterion table to store the relationship with cost category diff --git a/libreplan-business/src/main/resources/db.changelog-1.5.xml b/libreplan-business/src/main/resources/db.changelog-1.5.xml index 0de608934..796c36f6c 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.5.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.5.xml @@ -1,8 +1,7 @@ + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> @@ -25,10 +24,10 @@ tableName="email_template" /> - + - + INSERT INTO email_template VALUES(1, 0, 3, 'Task assigned to resource : Autogenerated content text', 'Autogenerated subject text'); diff --git a/libreplan-business/src/main/resources/db.changelog-database.xml b/libreplan-business/src/main/resources/db.changelog-database.xml index 4242fc6b8..5d4ca2c91 100644 --- a/libreplan-business/src/main/resources/db.changelog-database.xml +++ b/libreplan-business/src/main/resources/db.changelog-database.xml @@ -1,7 +1,7 @@ + xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> diff --git a/libreplan-business/src/main/resources/db.changelog-initial.xml b/libreplan-business/src/main/resources/db.changelog-initial.xml index 9c72e1b12..b331ed9f1 100644 --- a/libreplan-business/src/main/resources/db.changelog-initial.xml +++ b/libreplan-business/src/main/resources/db.changelog-initial.xml @@ -1,9 +1,7 @@ - + Resize precision for 'progress_by_duration' and 'progress_by_num_hours' fields diff --git a/libreplan-business/src/main/resources/db.changelog.xml b/libreplan-business/src/main/resources/db.changelog.xml index b4b676b78..0347e055d 100644 --- a/libreplan-business/src/main/resources/db.changelog.xml +++ b/libreplan-business/src/main/resources/db.changelog.xml @@ -1,9 +1,7 @@ - + diff --git a/libreplan-business/src/main/resources/liquibase.properties b/libreplan-business/src/main/resources/liquibase.properties index a6921e37d..43e31f92a 100644 --- a/libreplan-business/src/main/resources/liquibase.properties +++ b/libreplan-business/src/main/resources/liquibase.properties @@ -1,11 +1,11 @@ -changeLogFile src/main/resources/db.changelog.xml -driver ${jdbcDriver.className} -url ${dataSource.url} -username ${dataSource.user} -password ${dataSource.password} -verbose true -dropFirst false -promptOnNonLocalDatabase false +changeLogFile: src/main/resources/db.changelog.xml +driver: ${jdbcDriver.className} +url: ${dataSource.url} +username: ${dataSource.user} +password: ${dataSource.password} +verbose: true +dropFirst: false +promptOnNonLocalDatabase: false # If there will be an error with checksum use this command: -#clearCheckSums true \ No newline at end of file +#clearCheckSums: true \ No newline at end of file diff --git a/libreplan-business/src/test/java/org/libreplan/business/common/test/dbunit/DBUnitTestExecutionListener.java b/libreplan-business/src/test/java/org/libreplan/business/common/test/dbunit/DBUnitTestExecutionListener.java index d401de712..3ad033cb9 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/common/test/dbunit/DBUnitTestExecutionListener.java +++ b/libreplan-business/src/test/java/org/libreplan/business/common/test/dbunit/DBUnitTestExecutionListener.java @@ -50,7 +50,7 @@ import org.springframework.test.context.transaction.TransactionalTestExecutionLi * @author Bob McCune * @version 1.0 */ -public class DBUnitTestExecutionListener extends TransactionalTestExecutionListener { +class DBUnitTestExecutionListener extends TransactionalTestExecutionListener { private static final Log logger = LogFactory.getLog(DBUnitTestExecutionListener.class); @@ -65,6 +65,7 @@ public class DBUnitTestExecutionListener extends TransactionalTestExecutionListe DataSource dataSource = getDataSource(testContext); Connection conn = DataSourceUtils.getConnection(dataSource); IDatabaseConnection dbUnitConn = getDBUnitConnection(conn); + try { IDataSet dataSets[] = getDataSets(testContext); for (IDataSet dataSet : dataSets) { @@ -78,63 +79,65 @@ public class DBUnitTestExecutionListener extends TransactionalTestExecutionListe private DataSource getDataSource(TestContext context) { DataSource dataSource; - Map beans = context.getApplicationContext().getBeansOfType( - DataSource.class); - if (beans.size() > 1) { + Map beans = context.getApplicationContext().getBeansOfType(DataSource.class); + + if ( beans.size() > 1 ) { dataSource = (DataSource) beans.get(DEFAULT_DATASOURCE_NAME); - if (dataSource == null) { - throw new NoSuchBeanDefinitionException( - "Unable to locate default data source."); + + if ( dataSource == null ) { + throw new NoSuchBeanDefinitionException("Unable to locate default data source."); } } else { dataSource = (DataSource) beans.values().iterator().next(); } + return dataSource; } - private IDatabaseConnection getDBUnitConnection(Connection c) - throws DatabaseUnitException - { + private IDatabaseConnection getDBUnitConnection(Connection c) throws DatabaseUnitException { IDatabaseConnection conn = new DatabaseConnection(c); DatabaseConfig config = conn.getConfig(); - config.setFeature("http://www.dbunit.org/features/qualifiedTableNames", - true); - config.setProperty("http://www.dbunit.org/properties/tableType", - TABLE_TYPES); + // TODO resolve depracated method + config.setFeature("http://www.dbunit.org/features/qualifiedTableNames", true); + config.setProperty("http://www.dbunit.org/properties/tableType", TABLE_TYPES); + return conn; } private IDataSet[] getDataSets(TestContext context) throws Exception { String dataFiles[] = getDataLocations(context); IDataSet dataSets[] = new IDataSet[dataFiles.length]; + for (int i = 0; i < dataFiles.length; i++) { Resource resource = new ClassPathResource(dataFiles[i]); Class clazz = getDataSetType(context); Constructor con = clazz.getConstructor(InputStream.class); dataSets[i] = (IDataSet) con.newInstance(resource.getInputStream()); } + return dataSets; } - protected Class getDataSetType(TestContext context) { + private Class getDataSetType(TestContext context) { Class testClass = context.getTestClass(); - DBUnitConfiguration config = testClass - .getAnnotation(DBUnitConfiguration.class); + DBUnitConfiguration config = testClass.getAnnotation(DBUnitConfiguration.class); + return config.type(); } private String[] getDataLocations(TestContext context) { Class testClass = context.getTestClass(); - DBUnitConfiguration config = testClass - .getAnnotation(DBUnitConfiguration.class); - if (config == null) { - throw new IllegalStateException("Test class '" + testClass - + " has is missing @DBUnitConfiguration annotation."); + DBUnitConfiguration config = testClass.getAnnotation(DBUnitConfiguration.class); + + if ( config == null ) { + throw new IllegalStateException( + "Test class '" + testClass + " has is missing @DBUnitConfiguration annotation."); } - if (config.locations().length == 0) { + if ( config.locations().length == 0 ) { throw new IllegalStateException( "@DBUnitConfiguration annotation doesn't specify any DBUnit configuration locations."); } + return config.locations(); } } \ No newline at end of file diff --git a/libreplan-business/src/test/resources/libreplan-business-spring-config-test.xml b/libreplan-business/src/test/resources/libreplan-business-spring-config-test.xml index 8cdfe75ea..6d7dcdcf8 100644 --- a/libreplan-business/src/test/resources/libreplan-business-spring-config-test.xml +++ b/libreplan-business/src/test/resources/libreplan-business-spring-config-test.xml @@ -1,9 +1,7 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"> - org.xnap.commons - maven-gettext-plugin + com.googlecode.gettext-commons + gettext-maven-plugin i18n.Messages ${project.build.sourceDirectory}/../resources/i18n @@ -273,10 +273,6 @@ org.springframework spring-web - - org.springframework.security - spring-security-config - org.springframework spring-context-support @@ -297,6 +293,10 @@ org.springframework.security spring-security-acl + + org.springframework.security + spring-security-config + @@ -418,6 +418,8 @@ org.apache.cxf cxf-rt-rs-client + + com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java b/libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java index cbcfbeedc..5e758e34f 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java @@ -297,7 +297,8 @@ public class SchedulerManager implements ISchedulerManager { @Override public String getNextFireTime(JobSchedulerConfiguration jobSchedulerConfiguration) { try { - CronTrigger trigger = (CronTrigger) this.scheduler.getTrigger(TriggerKey.triggerKey( + CronTrigger trigger = (CronTrigger) + this.scheduler.getTrigger(TriggerKey.triggerKey( jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX, jobSchedulerConfiguration.getJobGroup() + TRIGGER_SUFFIX)); diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/files/OrderFilesController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/files/OrderFilesController.java index 8adb61286..ef11f557a 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/files/OrderFilesController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/files/OrderFilesController.java @@ -61,7 +61,8 @@ import static org.libreplan.web.I18nHelper._; /** - * Controller for managing Order files + * Controller for managing Order files. + * * Created by * @author Vova Perebykivskiy * on 12.24.2015. @@ -69,6 +70,7 @@ import static org.libreplan.web.I18nHelper._; public class OrderFilesController extends GenericForwardComposer { + // TODO refactor Autowired? @Autowired IConfigurationModel configurationModel; @@ -88,6 +90,7 @@ public class OrderFilesController extends GenericForwardComposer { @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); + // TODO resolve deprecated comp.setVariable("orderFilesController", this, true); messages = new MessagesForUser(messagesContainer); } @@ -99,15 +102,12 @@ public class OrderFilesController extends GenericForwardComposer { if ( !(configurationModel.getRepositoryLocation() == null) ) repositoryDirectory = new File(configurationModel.getRepositoryLocation()); - if ( repositoryDirectory != null && repositoryDirectory.exists() ) return true; + return repositoryDirectory != null && repositoryDirectory.exists(); - return false; } public boolean isUploadButtonDisabled(){ - if ( isRepositoryExists() ) return false; - - return true; + return !isRepositoryExists(); } public ListitemRenderer getFilesRenderer(){ @@ -119,6 +119,7 @@ public class OrderFilesController extends GenericForwardComposer { Listcell nameCell = new Listcell(); listitem.appendChild(nameCell); Label label = new Label(file.getName()); + label.addEventListener("onClick", new EventListener() { @Override public void onEvent(Event event) throws Exception { @@ -130,6 +131,7 @@ public class OrderFilesController extends GenericForwardComposer { Filedownload.save(fileToDownload.getAbsoluteFile(), null); } }); + label.setClass("label-highlight"); label.setTooltiptext("Download file"); nameCell.appendChild(label); @@ -170,7 +172,7 @@ public class OrderFilesController extends GenericForwardComposer { if ( Messagebox.OK != status ) { return; } - } catch (InterruptedException e) {} + } catch (InterruptedException ignored) {} if ( isRepositoryExists() ) { @@ -206,20 +208,18 @@ public class OrderFilesController extends GenericForwardComposer { public void upload() { configurationModel.init(); - String directory = ""; + String directory; if ( isRepositoryExists() ){ String projectCode = orderElementModel.getOrderElement().getCode(); directory = configurationModel.getRepositoryLocation() + "orders" + "/" + projectCode; try { - Fileupload fileupload = new Fileupload(); - // Location of file: libreplan-webapp/src/main/webapp/planner/fileupload.zul - fileupload.setTemplate("fileupload.zul"); + Fileupload.setTemplate("fileupload.zul"); - Media media = fileupload.get(); + Media media = Fileupload.get(); File dir = new File(directory); String filename = media.getName(); @@ -277,13 +277,14 @@ public class OrderFilesController extends GenericForwardComposer { public void openWindow(IOrderElementModel orderElementModel) { setOrderElementModel(orderElementModel); - if ( isRepositoryExists() ) updateListbox(); + if ( isRepositoryExists() ) + updateListbox(); } /** * Listbox is updating after re set the model for it */ - public void updateListbox(){ + private void updateListbox(){ OrderElement currentOrder = orderElementModel.getOrderElement(); filesList.setModel(new ListModelList(orderFileModel.findByParent(currentOrder))); } diff --git a/libreplan-webapp/src/main/resources/libreplan-webapp-spring-security-config.xml b/libreplan-webapp/src/main/resources/libreplan-webapp-spring-security-config.xml index c6b2c597c..b86011fbb 100644 --- a/libreplan-webapp/src/main/resources/libreplan-webapp-spring-security-config.xml +++ b/libreplan-webapp/src/main/resources/libreplan-webapp-spring-security-config.xml @@ -135,7 +135,7 @@ username-parameter="j_username" password-parameter="j_password"/> - + diff --git a/libreplan-webapp/src/main/webapp/common/layout/template.zul b/libreplan-webapp/src/main/webapp/common/layout/template.zul index a5449c3a9..b7a4eb8a4 100644 --- a/libreplan-webapp/src/main/webapp/common/layout/template.zul +++ b/libreplan-webapp/src/main/webapp/common/layout/template.zul @@ -104,7 +104,11 @@ ${i18n:_('user')}: ${templateCtrl.username} - [${i18n:_('Log out')}] + + + [${i18n:_('Log out')}] + + @@ -113,7 +117,6 @@
- diff --git a/libreplan-webapp/src/test/resources/libreplan-webapp-spring-config-test.xml b/libreplan-webapp/src/test/resources/libreplan-webapp-spring-config-test.xml index d7f6e17bb..e3485f46a 100644 --- a/libreplan-webapp/src/test/resources/libreplan-webapp-spring-config-test.xml +++ b/libreplan-webapp/src/test/resources/libreplan-webapp-spring-config-test.xml @@ -1,15 +1,18 @@ + p:driverClass="${jdbcDriver.className}" + p:jdbcUrl="${testDataSource.url}" + p:username="${testDataSource.user}" + p:password="${testDataSource.password}" + p:maxConnectionsPerPartition="10" + p:minConnectionsPerPartition="4" + p:partitionCount="3"/> - + mysql + + + mysql mysql-connector-java - 5.1.38 + 5.1.39 com.mysql.jdbc.Driver jdbc:mysql://localhost/libreplan${libreplan.mode} @@ -212,9 +218,9 @@ - org.xnap.commons + com.googlecode.gettext-commons gettext-commons - 0.9.6 + 0.9.8 @@ -761,8 +767,8 @@ 3.5.1 true - 1.7 - 1.7 + 1.8 + 1.8 UTF-8 @@ -820,8 +826,7 @@ true @@ -891,7 +896,7 @@ org.liquibase liquibase-maven-plugin - 3.5.0 + 3.5.1