From 577eb6fd41239fc4b30dd718efb1d86a34de4861 Mon Sep 17 00:00:00 2001 From: Bogdan Bodnarjuk Date: Fri, 6 May 2016 11:26:18 +0300 Subject: [PATCH 1/2] Update Commons-IO and refactoring code for JUnit --- NEWS.rst | 8 ++++++++ libreplan-business/pom.xml | 7 ------- .../test/advance/entities/AdvanceAssignmentTest.java | 2 +- .../test/advance/entities/AdvanceMeasurementTest.java | 2 +- .../daos/CustomerCommunicationDAOTest.java | 9 +-------- .../business/test/orders/daos/OrderDAOTest.java | 2 +- .../business/test/orders/daos/OrderElementDAOTest.java | 2 +- .../test/orders/entities/AggregatedHoursGroupTest.java | 10 +++++----- .../test/planner/daos/ResourceAllocationDAOTest.java | 2 +- .../daos/SubcontractorCommunicationDAOTest.java | 2 +- .../entities/AggregateOfResourceAllocationsTest.java | 2 +- .../test/planner/entities/ShareDivisionTest.java | 5 +++-- .../business/test/resources/daos/CriterionDAOTest.java | 8 ++++---- .../resources/daos/CriterionSatisfactionDAOTest.java | 8 ++++---- .../test/resources/daos/CriterionTypeDAOTest.java | 6 +++--- .../resources/entities/CriterionSatisfactionTest.java | 2 +- .../test/workreports/daos/WorkReportDAOTest.java | 8 ++++---- .../test/workreports/daos/WorkReportLineDAOTest.java | 6 +++--- .../test/workreports/daos/WorkReportTypeDAOTest.java | 6 +++--- .../test/workreports/entities/WorkReportLineTest.java | 2 +- pom.xml | 10 +--------- 21 files changed, 48 insertions(+), 61 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index 56bb8e96d..6b42f2273 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -49,10 +49,18 @@ Changes * Update Jfree * Update JGraphT * Update DBUnit +* Update JodaTime +* Update Gettext +* Update Jasper Reports +* Update EasyMock +* Update JDBC driver +* Update Сommons-IO * Update LibrePlan version to 1.6.0 + * Remove Ezmorph +* Remove Json-lib * Code refactoring diff --git a/libreplan-business/pom.xml b/libreplan-business/pom.xml index 7e8079cd9..10f9e6d37 100644 --- a/libreplan-business/pom.xml +++ b/libreplan-business/pom.xml @@ -97,13 +97,6 @@ test - - - net.sf.json-lib - json-lib - jdk15 - - org.apache.commons diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/advance/entities/AdvanceAssignmentTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/advance/entities/AdvanceAssignmentTest.java index e81db2f5e..3995d869c 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/advance/entities/AdvanceAssignmentTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/advance/entities/AdvanceAssignmentTest.java @@ -21,7 +21,7 @@ package org.libreplan.business.test.advance.entities; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertTrue; import org.junit.Test; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/advance/entities/AdvanceMeasurementTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/advance/entities/AdvanceMeasurementTest.java index 3fb0dfdab..4099468cd 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/advance/entities/AdvanceMeasurementTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/advance/entities/AdvanceMeasurementTest.java @@ -21,7 +21,7 @@ package org.libreplan.business.test.advance.entities; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertTrue; import org.junit.Test; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/externalcompanies/daos/CustomerCommunicationDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/externalcompanies/daos/CustomerCommunicationDAOTest.java index c0badc135..2c9feca0f 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/externalcompanies/daos/CustomerCommunicationDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/externalcompanies/daos/CustomerCommunicationDAOTest.java @@ -19,15 +19,13 @@ package org.libreplan.business.test.externalcompanies.daos; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertFalse; import static org.junit.Assert.fail; import static org.libreplan.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE; import static org.libreplan.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE; import java.util.Date; -import java.util.List; import java.util.UUID; import org.joda.time.LocalDate; @@ -35,18 +33,13 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.libreplan.business.calendars.daos.IBaseCalendarDAO; import org.libreplan.business.calendars.entities.BaseCalendar; -import org.libreplan.business.common.IAdHocTransactionService; -import org.libreplan.business.common.IOnTransaction; import org.libreplan.business.common.exceptions.InstanceNotFoundException; import org.libreplan.business.common.exceptions.ValidationException; import org.libreplan.business.externalcompanies.daos.ICustomerCommunicationDAO; import org.libreplan.business.externalcompanies.entities.CustomerCommunication; -import org.libreplan.business.externalcompanies.entities.ExternalCompany; import org.libreplan.business.orders.daos.IOrderDAO; import org.libreplan.business.orders.entities.Order; -import org.libreplan.business.scenarios.IScenarioManager; import org.libreplan.business.test.calendars.entities.BaseCalendarTest; -import org.libreplan.business.workreports.entities.WorkReportLine; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/orders/daos/OrderDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/orders/daos/OrderDAOTest.java index 4ebef4d8a..949dfc5ff 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/orders/daos/OrderDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/orders/daos/OrderDAOTest.java @@ -19,7 +19,7 @@ package org.libreplan.business.test.orders.daos; -import static junit.framework.Assert.assertNotNull; +import static org.junit.Assert.assertNotNull; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/orders/daos/OrderElementDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/orders/daos/OrderElementDAOTest.java index 908e1c767..680b5d3a3 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/orders/daos/OrderElementDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/orders/daos/OrderElementDAOTest.java @@ -21,7 +21,7 @@ package org.libreplan.business.test.orders.daos; -import static junit.framework.Assert.assertNotNull; +import static org.junit.Assert.assertNotNull; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/orders/entities/AggregatedHoursGroupTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/orders/entities/AggregatedHoursGroupTest.java index 7edc3ce3a..f17ea8a28 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/orders/entities/AggregatedHoursGroupTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/orders/entities/AggregatedHoursGroupTest.java @@ -24,7 +24,7 @@ import static org.easymock.EasyMock.createNiceMock; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.core.AllOf.allOf; import static org.junit.Assert.assertThat; -import static org.junit.matchers.JUnitMatchers.hasItem; +import static org.hamcrest.CoreMatchers.hasItem; import java.util.Arrays; import java.util.HashSet; @@ -132,7 +132,7 @@ public class AggregatedHoursGroupTest { private Matcher withCriterions( Criterion... criterions) { - final HashSet criterionsSet = new HashSet(Arrays + final HashSet criterionsSet = new HashSet<>(Arrays .asList(criterions)); return new AggregatedHoursGroupMatcher() { @@ -150,7 +150,7 @@ public class AggregatedHoursGroupTest { private Matcher withHours( HoursGroup... hours) { - final HashSet hoursSet = new HashSet( + final HashSet hoursSet = new HashSet<>( Arrays.asList(hours)); return new AggregatedHoursGroupMatcher() { @@ -161,7 +161,7 @@ public class AggregatedHoursGroupTest { @Override public boolean matches(AggregatedHoursGroup aggregated) { - return new HashSet(aggregated.getHoursGroup()) + return new HashSet<>(aggregated.getHoursGroup()) .equals(hoursSet); } }; @@ -181,7 +181,7 @@ public class AggregatedHoursGroupTest { private Set asCriterionRequirements( Criterion... criterions) { - Set result = new HashSet(); + Set result = new HashSet<>(); for (Criterion each : criterions) { result.add(new DirectCriterionRequirement(each)); } diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/planner/daos/ResourceAllocationDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/planner/daos/ResourceAllocationDAOTest.java index 552d8c8e0..bebc8d9dd 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/planner/daos/ResourceAllocationDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/planner/daos/ResourceAllocationDAOTest.java @@ -21,7 +21,7 @@ package org.libreplan.business.test.planner.daos; -import static junit.framework.Assert.assertNotNull; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/planner/daos/SubcontractorCommunicationDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/planner/daos/SubcontractorCommunicationDAOTest.java index d369ec290..c1ecc5bae 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/planner/daos/SubcontractorCommunicationDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/planner/daos/SubcontractorCommunicationDAOTest.java @@ -19,7 +19,7 @@ package org.libreplan.business.test.planner.daos; -import static junit.framework.Assert.assertNotNull; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.libreplan.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/planner/entities/AggregateOfResourceAllocationsTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/planner/entities/AggregateOfResourceAllocationsTest.java index 63e7f68d7..9f89d5b5b 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/planner/entities/AggregateOfResourceAllocationsTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/planner/entities/AggregateOfResourceAllocationsTest.java @@ -27,7 +27,7 @@ import static org.easymock.EasyMock.replay; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.junit.matchers.JUnitMatchers.hasItem; +import static org.hamcrest.CoreMatchers.hasItem; import java.util.ArrayList; import java.util.Collection; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/planner/entities/ShareDivisionTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/planner/entities/ShareDivisionTest.java index b6b507e13..88666a069 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/planner/entities/ShareDivisionTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/planner/entities/ShareDivisionTest.java @@ -32,9 +32,10 @@ import java.util.List; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.hamcrest.Matcher; +import org.hamcrest.CoreMatchers; import org.junit.Ignore; import org.junit.Test; -import org.junit.matchers.JUnitMatchers; + import org.libreplan.business.planner.entities.Share; import org.libreplan.business.planner.entities.ShareDivision; @@ -52,7 +53,7 @@ public class ShareDivisionTest { Share share2 = createExampleShare(); ShareDivision shareDivision = ShareDivision.create(Arrays.asList( share1, share2)); - assertThat(shareDivision.getShares(), JUnitMatchers.hasItems(share1, + assertThat(shareDivision.getShares(), CoreMatchers.hasItems(share1, share2)); } diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionDAOTest.java index 6636d930f..9686f4597 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionDAOTest.java @@ -21,10 +21,10 @@ package org.libreplan.business.test.resources.daos; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.libreplan.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE; import static org.libreplan.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionSatisfactionDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionSatisfactionDAOTest.java index 58fb6496c..8149272cd 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionSatisfactionDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionSatisfactionDAOTest.java @@ -21,10 +21,10 @@ package org.libreplan.business.test.resources.daos; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.libreplan.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE; import static org.libreplan.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionTypeDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionTypeDAOTest.java index f92a4491a..ae47bcd76 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionTypeDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/resources/daos/CriterionTypeDAOTest.java @@ -21,9 +21,9 @@ package org.libreplan.business.test.resources.daos; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.libreplan.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE; import static org.libreplan.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/resources/entities/CriterionSatisfactionTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/resources/entities/CriterionSatisfactionTest.java index d99e6f8fd..1e935c28f 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/resources/entities/CriterionSatisfactionTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/resources/entities/CriterionSatisfactionTest.java @@ -21,7 +21,7 @@ package org.libreplan.business.test.resources.entities; -import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertEquals; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportDAOTest.java index e473a6e9f..29e64fe14 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportDAOTest.java @@ -21,10 +21,10 @@ package org.libreplan.business.test.workreports.daos; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.libreplan.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE; import static org.libreplan.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportLineDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportLineDAOTest.java index 93a32825a..557ab8005 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportLineDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportLineDAOTest.java @@ -21,9 +21,9 @@ package org.libreplan.business.test.workreports.daos; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.libreplan.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE; import static org.libreplan.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportTypeDAOTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportTypeDAOTest.java index c00f9a008..95878f4a7 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportTypeDAOTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/workreports/daos/WorkReportTypeDAOTest.java @@ -21,9 +21,9 @@ package org.libreplan.business.test.workreports.daos; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import static org.libreplan.business.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_FILE; import static org.libreplan.business.test.BusinessGlobalNames.BUSINESS_SPRING_CONFIG_TEST_FILE; diff --git a/libreplan-business/src/test/java/org/libreplan/business/test/workreports/entities/WorkReportLineTest.java b/libreplan-business/src/test/java/org/libreplan/business/test/workreports/entities/WorkReportLineTest.java index 78285d855..76d0b4db6 100644 --- a/libreplan-business/src/test/java/org/libreplan/business/test/workreports/entities/WorkReportLineTest.java +++ b/libreplan-business/src/test/java/org/libreplan/business/test/workreports/entities/WorkReportLineTest.java @@ -21,7 +21,7 @@ package org.libreplan.business.test.workreports.entities; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertTrue; import org.junit.Test; diff --git a/pom.xml b/pom.xml index 89d5bdecc..11b401d7d 100644 --- a/pom.xml +++ b/pom.xml @@ -382,14 +382,6 @@ test - - - net.sf.json-lib - json-lib - 2.2.3 - jdk15 - - org.apache.commons @@ -638,7 +630,7 @@ commons-io commons-io - 1.4 + 2.5 From 0f02d0fe2d8d455651a4450d092f707af3b43800 Mon Sep 17 00:00:00 2001 From: Bogdan Bodnarjuk Date: Fri, 6 May 2016 12:28:11 +0300 Subject: [PATCH 2/2] Update Commons Logging --- libreplan-webapp/src/main/webapp/WEB-INF/zk.xml | 3 +-- pom.xml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libreplan-webapp/src/main/webapp/WEB-INF/zk.xml b/libreplan-webapp/src/main/webapp/WEB-INF/zk.xml index 82d325baa..1ee93b0f9 100644 --- a/libreplan-webapp/src/main/webapp/WEB-INF/zk.xml +++ b/libreplan-webapp/src/main/webapp/WEB-INF/zk.xml @@ -15,8 +15,7 @@ true - java.lang.Throwable - + java.lang.Throwable /common/event_error.zul diff --git a/pom.xml b/pom.xml index 11b401d7d..d40c41a24 100644 --- a/pom.xml +++ b/pom.xml @@ -407,7 +407,7 @@ commons-logging commons-logging - 1.1.3 + 1.2