exclude dependencies causing classpath duplicates (FINERACT-919)

This commit is contained in:
Michael Vorburger
2020-05-03 19:52:12 +02:00
committed by Michael Vorburger ⛑️
parent b0367099bc
commit 83cdb17d8f
5 changed files with 54 additions and 34 deletions
@@ -20,13 +20,13 @@ package org.apache.fineract.integrationtests.common;
import static org.junit.Assert.assertEquals;
import com.google.common.base.Strings;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.commons.lang3.StringUtils;
@SuppressWarnings({ "rawtypes", "unchecked" })
public class CenterHelper {
@@ -85,9 +85,15 @@ public class CenterHelper {
hm.put("officeId", officeId);
hm.put("active", false);
if (externalId != null) hm.put("externalId", externalId);
if (staffId != -1) hm.put("staffId", staffId);
if (groupMembers != null) hm.put("groupMembers", groupMembers);
if (externalId != null) {
hm.put("externalId", externalId);
}
if (staffId != -1) {
hm.put("staffId", staffId);
}
if (groupMembers != null) {
hm.put("groupMembers", groupMembers);
}
if (activationDate != null) {
hm.put("active", true);
hm.put("locale", "en");
@@ -235,7 +241,7 @@ public class CenterHelper {
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
if (StringUtils.isNotEmpty(activationDate)) {
if (!Strings.isNullOrEmpty(activationDate)) {
map.put("activationDate", activationDate);
} else {
map.put("activationDate", "CREATED_DATE");
@@ -249,10 +255,6 @@ public class CenterHelper {
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix);
}
private static String randomIDGenerator(final String prefix, final int lenOfRandomSuffix) {
return Utils.randomStringGenerator(prefix, lenOfRandomSuffix, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
public static Object assignStaff(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String groupId, final Long staffId) {
final String GROUP_ASSIGN_STAFF_URL = "/fineract-provider/api/v1/groups/" + groupId + "?" + Utils.TENANT_IDENTIFIER
@@ -22,13 +22,13 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.google.common.base.Strings;
import com.google.gson.Gson;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
public class GroupHelper {
@@ -144,7 +144,7 @@ public class GroupHelper {
}
public static String associateClientAsJSON(final String clientMember) {
final HashMap<String, List<String>> map = new HashMap<String, List<String>>();
final HashMap<String, List<String>> map = new HashMap<>();
final List<String> list = new ArrayList<>();
list.add(clientMember);
map.put("clientMembers", list);
@@ -156,7 +156,7 @@ public class GroupHelper {
final HashMap<String, String> map = new HashMap<>();
map.put("dateFormat", "dd MMMM yyyy");
map.put("locale", "en");
if (StringUtils.isNotEmpty(activationDate)) {
if (!Strings.isNullOrEmpty(activationDate)) {
map.put("activationDate", activationDate);
} else {
map.put("activationDate", "04 March 2011");
@@ -87,7 +87,8 @@ public class ClasspathHellDuplicatesChecker {
private boolean skipJAR(String jarPath) {
// ./gradlew test finds classes from the Gradle Wrapper (which don't show up in-IDE), exclude those
return jarPath.contains("/.gradle/wrapper/dists/");
return jarPath.contains("/.gradle/wrapper/dists/")
|| jarPath.contains("/io.rest-assured/"); // TODO FINERACT-884 remove when RestAssured was bumped from 3.3.0 to 4.3.0 in Spring BOM
}
protected boolean isHarmlessDuplicate(String resourcePath) {
@@ -95,6 +96,7 @@ public class ClasspathHellDuplicatesChecker {
return resourcePath.equals("META-INF/MANIFEST.MF")
|| resourcePath.equals("META-INF/INDEX.LIST")
|| resourcePath.equals("META-INF/ORACLE_J.SF")
|| resourcePath.toUpperCase().startsWith("META-INF/ASL")
|| resourcePath.toUpperCase().startsWith("META-INF/NOTICE")
|| resourcePath.toUpperCase().startsWith("META-INF/LICENSE")
|| resourcePath.toUpperCase().startsWith("LICENSE")
@@ -112,8 +114,9 @@ public class ClasspathHellDuplicatesChecker {
|| resourcePath.equals("META-INF/jersey-module-version")
|| resourcePath.startsWith("OSGI-INF/blueprint/")
|| resourcePath.startsWith("org/opendaylight/blueprint/")
|| resourcePath.equals("WEB-INF/web.xml")
|| resourcePath.endsWith("reference.conf") // in Akka's JARs
|| resourcePath.equals("WEB-INF/web.xml")
|| resourcePath.equals("META-INF/web-fragment.xml")
|| resourcePath.equals("META-INF/eclipse.inf")
|| resourcePath.equals("META-INF/ECLIPSE_.SF")
|| resourcePath.equals("META-INF/ECLIPSE_.RSA")
@@ -121,6 +124,12 @@ public class ClasspathHellDuplicatesChecker {
|| resourcePath.equals("META-INF/BC2048KE.SF")
|| resourcePath.equals("META-INF/BC1024KE.SF")
|| resourcePath.equals("OSGI-INF/bundle.info")
// Spring Framework knows what they are do..
|| resourcePath.startsWith("META-INF/spring")
|| resourcePath.startsWith("META-INF/additional-spring")
|| resourcePath.startsWith("META-INF/terracotta")
// Groovy is groovy
|| resourcePath.startsWith("META-INF/groovy-release-info.properties")
// Something doesn't to be a perfectly clean in Maven Surefire:
|| resourcePath.startsWith("META-INF/maven/")
|| resourcePath.contains("surefire")