From 9401e2bf0cd137b0cb57b2ac86cbd643d5460b60 Mon Sep 17 00:00:00 2001 From: Michal Cmarada Date: Tue, 9 Apr 2019 11:16:17 +0200 Subject: HONEYCOMB-443: fix benchmark after ODL Neon bump Change-Id: I5e53b8404a437bf0d08eefcfc417e5d6d46fa0b4 Signed-off-by: Michal Cmarada --- infra/it/benchmark/pom.xml | 2 +- .../benchmark/data/DataBrokerConfigWriteBenchmark.java | 4 ++-- .../benchmark/data/DataBrokerOperReadBenchmark.java | 12 +++++++++--- .../java/io/fd/honeycomb/benchmark/util/DataProvider.java | 2 +- .../java/io/fd/honeycomb/benchmark/util/DataSubmitter.java | 4 ++-- .../main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java | 3 +-- .../java/io/fd/honeycomb/benchmark/util/StaticReader.java | 9 ++++----- 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/infra/it/benchmark/pom.xml b/infra/it/benchmark/pom.xml index abaec23d6..fa3e2759e 100644 --- a/infra/it/benchmark/pom.xml +++ b/infra/it/benchmark/pom.xml @@ -34,7 +34,7 @@ jar - 1.15 + 1.21 benchmarks diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerConfigWriteBenchmark.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerConfigWriteBenchmark.java index 245b8654c..4e5c50d5a 100644 --- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerConfigWriteBenchmark.java +++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerConfigWriteBenchmark.java @@ -41,9 +41,9 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.WriteTransaction; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.ContainerWithList; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.SimpleContainer; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.container.with.list.ListInContainer; @@ -191,7 +191,7 @@ public class DataBrokerConfigWriteBenchmark extends AbstractModule implements Fi // Commit based on frequency set if (counter % submitFrequency == 0) { try { - tx.submit().get(); + tx.commit().get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("Submit failed", e); } diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerOperReadBenchmark.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerOperReadBenchmark.java index 941978103..a4810bd78 100644 --- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerOperReadBenchmark.java +++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/data/DataBrokerOperReadBenchmark.java @@ -16,6 +16,11 @@ package io.fd.honeycomb.benchmark.data; +import com.google.inject.AbstractModule; +import com.google.inject.Guice; +import com.google.inject.Injector; +import com.google.inject.Key; +import com.google.inject.Module; import com.google.inject.multibindings.Multibinder; import com.google.inject.name.Names; import io.fd.honeycomb.benchmark.util.DataProvider; @@ -36,9 +41,10 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.ReadTransaction; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.ContainerWithList; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.ContainerWithListBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hc.test.rev150105.SimpleContainer; @@ -116,7 +122,7 @@ public class DataBrokerOperReadBenchmark extends AbstractModule implements FileM private List> noopReaders = new ArrayList<>(); private DataBroker dataBroker; private long counter = 0; - private ReadOnlyTransaction tx; + private @NonNull ReadTransaction tx; private HoneycombConfiguration instance; @Setup(Level.Iteration) diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/DataProvider.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/DataProvider.java index 7d3df2691..642c5dd63 100644 --- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/DataProvider.java +++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/DataProvider.java @@ -171,7 +171,7 @@ public interface DataProvider { private final List values; private int valueSize; - public MultiValueDataProvider(final List values) { + MultiValueDataProvider(final List values) { // Wrap as array list so that index lookup is fast this.values = Lists.newArrayList(values); this.valueSize = values.size(); diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/DataSubmitter.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/DataSubmitter.java index 8f5413502..1a263cf49 100644 --- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/DataSubmitter.java +++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/DataSubmitter.java @@ -16,8 +16,8 @@ package io.fd.honeycomb.benchmark.util; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.mdsal.binding.api.WriteTransaction; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -26,7 +26,7 @@ public interface DataSubmitter { void submit(LogicalDatastoreType type, WriteTransaction tx, InstanceIdentifier id, DataObject data); - public static DataSubmitter from(String operation) { + static DataSubmitter from(String operation) { switch (operation) { case "put": { return (type, tx, id, data) -> tx.put(type, (InstanceIdentifier) id, data); diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java index c42474754..9d4898b0a 100644 --- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java +++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/NoopWriter.java @@ -17,7 +17,6 @@ package io.fd.honeycomb.benchmark.util; import io.fd.honeycomb.translate.write.WriteContext; -import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.translate.write.Writer; import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -43,7 +42,7 @@ public final class NoopWriter implements Writer { public void processModification(@Nonnull final InstanceIdentifier id, @Nullable final DataObject dataBefore, @Nullable final DataObject dataAfter, - @Nonnull final WriteContext ctx) throws WriteFailedException { + @Nonnull final WriteContext ctx) { counter++; // NOOP } diff --git a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/StaticReader.java b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/StaticReader.java index 8e776e1c0..bfbe8d618 100644 --- a/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/StaticReader.java +++ b/infra/it/benchmark/src/main/java/io/fd/honeycomb/benchmark/util/StaticReader.java @@ -17,7 +17,6 @@ package io.fd.honeycomb.benchmark.util; import io.fd.honeycomb.translate.read.ReadContext; -import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.read.Reader; import java.util.Optional; import javax.annotation.Nonnull; @@ -56,22 +55,22 @@ public final class StaticReader> impl } @Override - public boolean isPresent(final InstanceIdentifier id, final T built, final ReadContext ctx) { + public boolean isPresent(@Nonnull final InstanceIdentifier id, @Nonnull final T built, + @Nonnull final ReadContext ctx) { return true; } @Nonnull @Override public Optional read(@Nonnull final InstanceIdentifier id, - @Nonnull final ReadContext ctx) throws ReadFailedException { + @Nonnull final ReadContext ctx) { counter++; return Optional.of(data.getData(counter)); } @Override public void readCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final B builder, - @Nonnull final ReadContext ctx) - throws ReadFailedException { + @Nonnull final ReadContext ctx) { throw new UnsupportedOperationException("No read current attrs!"); } -- cgit 1.2.3-korg