Activate and Enforce new Checkstyle check related to import statement order (FINERACT-821) (#704)

* Minor manually done fix up of fineractdev-eclipse-preferences.epf file

This in theory should not change anything about the conventions,
it's just a first manual clean up of this very old file here.

The few extra new lines are what I found when exporting Preferences.

Related to https://issues.apache.org/jira/browse/FINERACT-821

* fineractdev-eclipse-preferences.epf imported and re-exported in Eclipse.

This in theory should not change anything about the conventions, as
presumably Eclipse during an Import and re-Export of an EPF just adds
new settings, and perhaps removes old settings.  I've not actually made
any manual changes in Preferences in this step.

Related to https://issues.apache.org/jira/browse/FINERACT-821

* fineractdev-eclipse-preferences.epf "import" in line with Checkstyle

The non-import related Code Formatter settings may need further tuning;
this will be done in future changes; the focus in this round is on
import.

Related to https://issues.apache.org/jira/browse/FINERACT-821

* Use Eclipse's Source > Organize Import to re-order all import statements

This uses the fineractdev-eclipse-preferences.epf from the previous
commit, which just so happens ;) to exactly match the expected import
rules which the next commit is going to enforce using Checkstyle.

This is of course not specific to only Eclipse per se; other IDEs can
be similarly configured to match these coding conventions; I just happen
to have used Eclipse.

Related to https://issues.apache.org/jira/browse/FINERACT-821

* Activate and Enforce all Checkstyle import related new checks

and update the README to explain Checkstyle, and the availability of the
Eclipse Preferences configuration file which matches the import
code format conventions which are now enforced.

Contributions for a similar preferences file for other IDEs welcome! ;)

Related to https://issues.apache.org/jira/browse/FINERACT-821
This commit is contained in:
Michael Vorburger ⛑️
2020-01-28 00:28:11 +01:00
committed by Awasum Yannick
parent 3a17da44df
commit 28db242884
1670 changed files with 5100 additions and 5226 deletions
@@ -20,9 +20,7 @@ package org.apache.fineract.batch;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.UriInfo;
import org.apache.fineract.batch.domain.BatchRequest;
import org.apache.fineract.batch.domain.BatchResponse;
import org.apache.fineract.batch.service.BatchApiService;
@@ -24,18 +24,16 @@ import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.Random;
import org.apache.commons.lang.StringUtils;
import org.apache.http.conn.HttpHostConnectException;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.Random;
import org.apache.commons.lang.StringUtils;
import org.apache.http.conn.HttpHostConnectException;
/**
* Util for RestAssured tests. This class here in src/test is copy/pasted :(
@@ -19,7 +19,6 @@
package org.apache.fineract.infrastructure.configuration.spring;
import javax.sql.DataSource;
import org.apache.fineract.infrastructure.core.boot.AbstractApplicationConfiguration;
import org.apache.fineract.infrastructure.core.service.TenantDatabaseUpgradeService;
import org.apache.fineract.infrastructure.jobs.service.JobRegisterService;
@@ -21,7 +21,6 @@ package org.apache.fineract.mix.report.service;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
import org.apache.fineract.mix.service.XBRLResultServiceImpl;
import org.junit.Before;
@@ -18,6 +18,19 @@
*/
package org.apache.fineract.mix.report.service;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.when;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.sql.Date;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.fineract.mix.data.MixTaxonomyData;
import org.apache.fineract.mix.data.NamespaceData;
import org.apache.fineract.mix.service.NamespaceReadPlatformServiceImpl;
@@ -33,20 +46,6 @@ import org.mockito.runners.MockitoJUnitRunner;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.sql.Date;
import java.util.HashMap;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class XBRLBuilderTest {
@@ -18,10 +18,12 @@
*/
package org.apache.fineract.notification;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.springframework.jms.listener.SessionAwareMessageListener;
import javax.jms.*;
public class Listener implements SessionAwareMessageListener {
@Override
@@ -18,16 +18,15 @@
*/
package org.apache.fineract.notification;
import javax.jms.JMSException;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import javax.jms.JMSException;
import javax.jms.Session;
import javax.jms.TextMessage;
@RunWith(MockitoJUnitRunner.class)
public class ListenerTest {
@@ -19,6 +19,9 @@
package org.apache.fineract.notification;
import com.mockrunner.mock.jms.MockQueue;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import org.apache.fineract.notification.data.NotificationData;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -28,10 +31,6 @@ import org.springframework.jms.core.MessageCreator;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
@ContextConfiguration(locations = {
"classpath:META-INF/testNotificationContext.xml",
})
@@ -19,7 +19,16 @@
package org.apache.fineract.notification;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.refEq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.Optional;
import org.apache.fineract.notification.domain.Notification;
import org.apache.fineract.notification.domain.NotificationMapper;
import org.apache.fineract.notification.service.NotificationGeneratorReadRepositoryWrapper;
@@ -35,13 +44,6 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.security.core.userdetails.User;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Optional;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
public class StorageTest {
@@ -19,13 +19,12 @@
package org.apache.fineract.notification;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.refEq;
import static org.mockito.ArgumentMatchers.refEq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Date;
import org.apache.fineract.notification.domain.Topic;
import org.apache.fineract.notification.domain.TopicRepository;
import org.apache.fineract.notification.domain.TopicSubscriber;
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.loanaccount;
import java.lang.reflect.Field;
import java.math.RoundingMode;
import java.util.List;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
@@ -21,7 +21,6 @@ package org.apache.fineract.portfolio.loanaccount;
import java.lang.reflect.Field;
import java.math.RoundingMode;
import java.util.List;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
@@ -19,7 +19,6 @@
package org.apache.fineract.portfolio.loanaccount;
import java.math.BigDecimal;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.portfolio.common.domain.DaysInMonthType;
import org.apache.fineract.portfolio.common.domain.DaysInYearType;
@@ -19,7 +19,6 @@
package org.apache.fineract.portfolio.loanaccount;
import java.util.Set;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.loanaccount;
import java.util.Arrays;
import java.util.List;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
import org.joda.time.LocalDate;
@@ -19,7 +19,6 @@
package org.apache.fineract.portfolio.loanaccount;
import java.math.BigDecimal;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
@@ -20,6 +20,12 @@ package org.apache.fineract.template;
import static org.junit.Assert.assertEquals;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
@@ -30,14 +36,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
import org.apache.fineract.portfolio.loanaccount.LoanScheduleTestDataHelper;