Reduce dependency on Guava (#1589)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-02-02 22:21:46 +02:00
committed by GitHub
parent 0ee916e8cb
commit bce69676d2
63 changed files with 222 additions and 332 deletions

View File

@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
@@ -72,8 +73,6 @@ import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MvcResult;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.jayway.jsonpath.JsonPath;
import io.qameta.allure.Description;
@@ -218,7 +217,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
// verify quota enforcement
final int maxSoftwareModules = quotaManagement.getMaxSoftwareModulesPerDistributionSet();
final List<Long> moduleIDs = Lists.newArrayList();
final List<Long> moduleIDs = new ArrayList<>();
for (int i = 0; i < maxSoftwareModules + 1; ++i) {
moduleIDs.add(testdataFactory.createSoftwareModuleApp("sm" + i).getId());
}
@@ -1271,8 +1270,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
final String knownValuePrefix = "knownValue";
final DistributionSet testDS = testdataFactory.createDistributionSet("one");
for (int index = 0; index < totalMetadata; index++) {
distributionSetManagement.createMetaData(testDS.getId(), Lists
.newArrayList(entityFactory.generateDsMetadata(knownKeyPrefix + index, knownValuePrefix + index)));
distributionSetManagement.createMetaData(testDS.getId(), List.of(entityFactory.generateDsMetadata(knownKeyPrefix + index, knownValuePrefix + index)));
}
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
@@ -1383,7 +1381,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
private Set<DistributionSet> createDistributionSetsAlphabetical(final int amount) {
char character = 'a';
final Set<DistributionSet> created = Sets.newHashSetWithExpectedSize(amount);
final Set<DistributionSet> created = new HashSet<>(amount);
for (int index = 0; index < amount; index++) {
final String str = String.valueOf(character);
created.add(testdataFactory.createDistributionSet(str));

View File

@@ -23,6 +23,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -256,7 +257,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn
// create software module types
final int maxSoftwareModuleTypes = quotaManagement.getMaxSoftwareModuleTypesPerDistributionSetType();
final List<Long> moduleTypeIds = Lists.newArrayList();
final List<Long> moduleTypeIds = new ArrayList<>();
for (int i = 0; i < maxSoftwareModuleTypes + 1; ++i) {
final SoftwareModuleTypeCreate smCreate = entityFactory.softwareModuleType().create().name("smType_" + i)
.description("smType_" + i).maxAssignments(1).colour("blue").key("smType_" + i);

View File

@@ -44,7 +44,6 @@ import java.util.stream.Stream;
import jakarta.validation.ConstraintViolationException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.RandomStringUtils;
import org.awaitility.Awaitility;
import org.eclipse.hawkbit.exception.SpServerError;
@@ -2014,7 +2013,7 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
final String knownValuePrefix = "knownValue";
final Target testTarget = testdataFactory.createTarget("targetId");
for (int index = 0; index < totalMetadata; index++) {
targetManagement.createMetaData(testTarget.getControllerId(), Lists.newArrayList(
targetManagement.createMetaData(testTarget.getControllerId(), List.of(
entityFactory.generateTargetMetadata(knownKeyPrefix + index, knownValuePrefix + index)));
}

View File

@@ -544,7 +544,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
// create distribution set types
final int maxDistributionSetTypes = quotaManagement.getMaxDistributionSetTypesPerTargetType();
final List<Long> dsTypeIds = Lists.newArrayList();
final List<Long> dsTypeIds = new ArrayList<>();
for (int i = 0; i < maxDistributionSetTypes + 1; ++i) {
final DistributionSetType ds = testdataFactory.findOrCreateDistributionSetType("dsType_" + i,
"dsType_" + i);