summaryrefslogtreecommitdiffstats
path: root/infra
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-11-22 16:35:20 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-11-22 16:55:36 +0100
commit32c5f8d8e44298052e472bddd634a0fb684721f9 (patch)
treec97639efa5f7122d0f828a9c2cb56b39ed5de700 /infra
parentca6abb7ac148362b74d29c062df80d0ad67e723f (diff)
Cleanup various Sonar warings
Unused code, imports, etc. Change-Id: Icb19d6a877d5ddbfd85caa86c4e62880e4db3c44 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra')
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java4
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java6
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/DataBrokerTest.java7
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java3
-rw-r--r--infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/BenchmarkFilesProvider.java10
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java43
-rw-r--r--infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java1
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchyTest.java2
-rw-r--r--infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java3
9 files changed, 10 insertions, 69 deletions
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
index dfb053fa0..48b9e7913 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
@@ -18,15 +18,13 @@ package io.fd.honeycomb.data.impl;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.util.concurrent.Futures.immediateCheckedFuture;
-import static org.apache.commons.lang3.builder.ToStringStyle.MULTI_LINE_STYLE;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
-import io.fd.honeycomb.data.ModifiableDataManager;
import io.fd.honeycomb.data.DataModification;
+import io.fd.honeycomb.data.ModifiableDataManager;
import io.fd.honeycomb.translate.TranslationException;
import javax.annotation.Nonnull;
-
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java
index a746f1246..f2301d77a 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ReadWriteTransaction.java
@@ -20,9 +20,9 @@ import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.ListenableFuture;
+import javax.annotation.Nonnull;
import org.apache.commons.lang3.builder.RecursiveToStringStyle;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -37,10 +37,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Nonnull;
-
-import static org.apache.commons.lang3.builder.ToStringStyle.MULTI_LINE_STYLE;
-
/**
* Composite DOM transaction that delegates reads to a {@link DOMDataReadTransaction} delegate and writes to a {@link
* DOMDataWriteTransaction} delegate.
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/DataBrokerTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/DataBrokerTest.java
index f1bc3105a..4a0fb11a9 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/DataBrokerTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/DataBrokerTest.java
@@ -22,9 +22,9 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
-import io.fd.honeycomb.data.ReadableDataManager;
-import io.fd.honeycomb.data.ModifiableDataManager;
import io.fd.honeycomb.data.DataModification;
+import io.fd.honeycomb.data.ModifiableDataManager;
+import io.fd.honeycomb.data.ReadableDataManager;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
@@ -36,7 +36,6 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension;
import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
public class DataBrokerTest {
@@ -69,7 +68,7 @@ public class DataBrokerTest {
@Test
public void testNewWriteOnlyTransaction() {
- final DOMDataWriteTransaction writeTx = broker.newWriteOnlyTransaction();
+ broker.newWriteOnlyTransaction();
// verify that write transactions use config snapshot
verify(confiDataTree).newModification();
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java
index ed3529530..7e135a259 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java
@@ -135,8 +135,7 @@ public class PersistingDataTreeAdapterTest {
public void testPersisterCreateFile() throws Exception {
// Delete to test file creation
Files.delete(tmpPersistFile);
- final PersistingDataTreeAdapter.JsonPersister jsonPersister =
- new PersistingDataTreeAdapter.JsonPersister(tmpPersistFile, schemaService);
+ new PersistingDataTreeAdapter.JsonPersister(tmpPersistFile, schemaService);
assertTrue(Files.exists(tmpPersistFile));
}
} \ No newline at end of file
diff --git a/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/BenchmarkFilesProvider.java b/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/BenchmarkFilesProvider.java
index ab2705947..403edaee1 100644
--- a/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/BenchmarkFilesProvider.java
+++ b/infra/it/memory-benchmark/src/main/java/io/fd/honeycomb/benchmark/memory/BenchmarkFilesProvider.java
@@ -16,18 +16,16 @@
package io.fd.honeycomb.benchmark.memory;
-import org.apache.commons.csv.CSVFormat;
-import org.apache.commons.csv.CSVPrinter;
-import org.slf4j.Logger;
-
-import javax.annotation.Nonnull;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collections;
-import java.util.function.Supplier;
+import javax.annotation.Nonnull;
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVPrinter;
+import org.slf4j.Logger;
public interface BenchmarkFilesProvider {
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java
index a373bf636..643af16d2 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java
@@ -16,25 +16,14 @@
package io.fd.honeycomb.infra.distro.activation;
-import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import com.google.inject.Module;
import com.google.inject.Provider;
import io.fd.honeycomb.infra.distro.schema.ResourceLoader;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -85,14 +74,6 @@ public class ActiveModuleProvider implements Provider<ActiveModules>, ResourceLo
return new ArrayList<>(loadResourceContentsOnPath(relativePath));
}
- private static Stream<File> folderToFile(final URI uri) {
- final File[] files = new File(uri).listFiles(File::isFile);
-
- return files != null
- ? ImmutableList.copyOf(files).stream()
- : Collections.<File>emptyList().stream();
- }
-
private static boolean filterNonModules(final Class<?> clazz) {
final boolean isModule = Module.class.isAssignableFrom(clazz);
if (!isModule) {
@@ -102,30 +83,6 @@ public class ActiveModuleProvider implements Provider<ActiveModules>, ResourceLo
}
/**
- * Read lines from {@code Path}
- */
- private static Stream<String> readLines(final Path path) {
- try {
- return Files.readAllLines(path).stream();
- } catch (IOException e) {
- LOG.error("Unable to read content of {}", path, e);
- throw new IllegalStateException("Unable to read content of " + path, e);
- }
- }
-
- /**
- * Converts {@code URL} to {@code URI}
- */
- private static URI toURI(final URL url) {
- try {
- return url.toURI();
- } catch (URISyntaxException e) {
- LOG.error("Unable to convert {} to uri", url);
- throw new IllegalStateException("Unable to convert " + url + " to uri", e);
- }
- }
-
- /**
* Loads class by provided name
*/
private static Class<? extends Module> moduleNameToClass(final String name,
diff --git a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
index c3bc1ee0e..d51ece23b 100644
--- a/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
+++ b/infra/translate-impl/src/main/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistry.java
@@ -34,7 +34,6 @@ import io.fd.honeycomb.translate.write.registry.WriterRegistry;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchyTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchyTest.java
index bbccc488b..0083fb4ab 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchyTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/read/registry/TypeHierarchyTest.java
@@ -16,8 +16,6 @@
package io.fd.honeycomb.translate.impl.read.registry;
-import static org.hamcrest.CoreMatchers.hasItem;
-import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
diff --git a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
index 01852d13f..bead06ecf 100644
--- a/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
+++ b/infra/translate-impl/src/test/java/io/fd/honeycomb/translate/impl/write/registry/FlatWriterRegistryTest.java
@@ -287,9 +287,6 @@ public class FlatWriterRegistryTest {
@Test
public void testMutlipleUpdatesWithOneKeyedContainer() throws Exception {
- final InstanceIdentifier internallyKeyedIdentifier = InstanceIdentifier.create(DataObject1.class)
- .child(DataObjects.DataObject1ChildK.class, new DataObjects.DataObject1ChildKey());
-
final FlatWriterRegistry flatWriterRegistry =
new FlatWriterRegistry(
ImmutableMap.of(DataObject1.IID, writer1, DataObjects.DataObject1ChildK.IID, writer4));