Reduce dependency on Guava (#1589)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -22,6 +22,9 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.common.collect.ConcurrentHashMultiset;
|
||||
import com.google.common.collect.Multiset;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.awaitility.core.ConditionTimeoutException;
|
||||
import org.eclipse.hawkbit.repository.event.remote.RemoteIdEvent;
|
||||
@@ -37,10 +40,6 @@ import org.springframework.context.event.ApplicationEventMulticaster;
|
||||
import org.springframework.test.context.TestContext;
|
||||
import org.springframework.test.context.support.AbstractTestExecutionListener;
|
||||
|
||||
import com.google.common.collect.ConcurrentHashMultiset;
|
||||
import com.google.common.collect.Multiset;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Test rule to setup and verify the event count for a method.
|
||||
*/
|
||||
|
||||
@@ -11,12 +11,11 @@ package org.eclipse.hawkbit.repository.test.util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HexFormat;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
|
||||
/**
|
||||
* Hash digest utility.
|
||||
*/
|
||||
@@ -66,7 +65,7 @@ public final class HashGeneratorUtils {
|
||||
try {
|
||||
final MessageDigest digest = MessageDigest.getInstance(algorithm);
|
||||
final byte[] hashedBytes = digest.digest(message);
|
||||
return BaseEncoding.base16().lowerCase().encode(hashedBytes);
|
||||
return HexFormat.of().withLowerCase().formatHex(hashedBytes);
|
||||
} catch (final NoSuchAlgorithmException e) {
|
||||
LOG.error("Algorithm could not be found", e);
|
||||
}
|
||||
|
||||
@@ -81,8 +81,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* Data generator utility for tests.
|
||||
*/
|
||||
@@ -438,7 +436,7 @@ public class TestdataFactory {
|
||||
*/
|
||||
public List<DistributionSet> createDistributionSetsWithoutModules(final int number) {
|
||||
|
||||
final List<DistributionSet> sets = Lists.newArrayListWithExpectedSize(number);
|
||||
final List<DistributionSet> sets = new ArrayList<>(number);
|
||||
for (int i = 0; i < number; i++) {
|
||||
sets.add(distributionSetManagement
|
||||
.create(entityFactory.distributionSet().create().name("DS" + i).version(DEFAULT_VERSION + "." + i)
|
||||
@@ -913,7 +911,7 @@ public class TestdataFactory {
|
||||
}
|
||||
|
||||
public List<Target> createTargets(final String prefix, final int offset, final int number) {
|
||||
final List<TargetCreate> targets = Lists.newArrayListWithExpectedSize(number);
|
||||
final List<TargetCreate> targets = new ArrayList<>(number);
|
||||
for (int i = 0; i < number; i++) {
|
||||
targets.add(entityFactory.target().create().controllerId(prefix + (offset + i)));
|
||||
}
|
||||
@@ -936,7 +934,7 @@ public class TestdataFactory {
|
||||
public List<Target> createTargetsWithType(final int number, final String controllerIdPrefix,
|
||||
final TargetType targetType) {
|
||||
|
||||
final List<TargetCreate> targets = Lists.newArrayListWithExpectedSize(number);
|
||||
final List<TargetCreate> targets = new ArrayList<>(number);
|
||||
for (int i = 0; i < number; i++) {
|
||||
targets.add(entityFactory.target().create().controllerId(controllerIdPrefix + i)
|
||||
.targetType(targetType.getId()));
|
||||
@@ -976,7 +974,7 @@ public class TestdataFactory {
|
||||
* @return list of {@link Target} objects
|
||||
*/
|
||||
private List<Target> generateTargets(final int start, final int numberOfTargets, final String controllerIdPrefix) {
|
||||
final List<Target> targets = Lists.newArrayListWithExpectedSize(numberOfTargets);
|
||||
final List<Target> targets = new ArrayList<>(numberOfTargets);
|
||||
for (int i = start; i < start + numberOfTargets; i++) {
|
||||
targets.add(entityFactory.target().create().controllerId(controllerIdPrefix + i).build());
|
||||
}
|
||||
@@ -1075,7 +1073,7 @@ public class TestdataFactory {
|
||||
* @return the created set of {@link TargetTag}s
|
||||
*/
|
||||
public List<TargetTag> createTargetTags(final int number, final String tagPrefix) {
|
||||
final List<TagCreate> result = Lists.newArrayListWithExpectedSize(number);
|
||||
final List<TagCreate> result = new ArrayList<>(number);
|
||||
|
||||
for (int i = 0; i < number; i++) {
|
||||
result.add(entityFactory.tag().create().name(tagPrefix + i).description(tagPrefix + i)
|
||||
@@ -1094,7 +1092,7 @@ public class TestdataFactory {
|
||||
* @return the persisted {@link DistributionSetTag}s
|
||||
*/
|
||||
public List<DistributionSetTag> createDistributionSetTags(final int number) {
|
||||
final List<TagCreate> result = Lists.newArrayListWithExpectedSize(number);
|
||||
final List<TagCreate> result = new ArrayList<>(number);
|
||||
|
||||
for (int i = 0; i < number; i++) {
|
||||
result.add(
|
||||
@@ -1450,7 +1448,7 @@ public class TestdataFactory {
|
||||
* @return persisted {@link TargetType}
|
||||
*/
|
||||
public List<TargetType> createTargetTypes(final String targetTypePrefix, final int count) {
|
||||
final List<TargetTypeCreate> result = Lists.newArrayListWithExpectedSize(count);
|
||||
final List<TargetTypeCreate> result = new ArrayList<>(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
result.add(entityFactory.targetType().create()
|
||||
.name(targetTypePrefix + i).description(targetTypePrefix + " description")
|
||||
|
||||
Reference in New Issue
Block a user