*/
package org.opendaylight.openflowplugin.impl.device.initialization;
-import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
private static final Logger LOG = LoggerFactory.getLogger(OF10DeviceInitializer.class);
@Override
- protected Future<Void> initializeNodeInformation(@Nonnull final DeviceContext deviceContext,
+ protected ListenableFuture<Void> initializeNodeInformation(@Nonnull final DeviceContext deviceContext,
final boolean switchFeaturesMandatory,
final boolean skipTableFeatures,
@Nullable final MultipartWriterProvider multipartWriterProvider,
}
}, MoreExecutors.directExecutor());
- return Futures.transform(future, new Function<Boolean, Void>() {
- @Override
- public Void apply(final Boolean input) {
- LOG.debug("Writing physical port information for {}", deviceInfo);
- writePhyPortInformation(deviceContext);
- return null;
- }
+ return Futures.transform(future, input -> {
+ LOG.debug("Writing physical port information for {}", deviceInfo);
+ writePhyPortInformation(deviceContext);
+ return null;
}, MoreExecutors.directExecutor());
}
*/
package org.opendaylight.openflowplugin.impl.statistics;
-import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
try {
Futures.transform(Futures.catchingAsync(future, Throwable.class, Futures::immediateFailedFuture,
- MoreExecutors.directExecutor()), (Function<Optional<FlowCapableNode>, Void>) flowCapNodeOpt -> {
+ MoreExecutors.directExecutor()), flowCapNodeOpt -> {
// we have to read actual tables with all information before we set empty Flow list,
// merge is expensive and not applicable for lists
if (flowCapNodeOpt != null && flowCapNodeOpt.isPresent()) {
package org.opendaylight.openflowplugin.impl.karaf;
-import com.google.common.base.Function;
import java.io.PrintStream;
import java.util.List;
+import java.util.function.Function;
import org.apache.felix.service.command.CommandSession;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.junit.MockitoJUnitRunner;
/**
* Created by mirehak on 7/29/15.
import static org.mockito.ArgumentMatchers.anyString;
-import com.google.common.base.Function;
-import javax.annotation.Nullable;
+import java.util.function.Function;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
public class ClearStatsCommandProviderTest extends AbstractKarafTest {
private ClearStatsCommandProvider clearStatsCommandProvider;
- private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = new Function<String, Boolean>() {
- @Nullable
- @Override
- public Boolean apply(String input) {
- return input.endsWith(": no activity detected");
- }
- };
+ private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION =
+ input -> input.endsWith(": no activity detected");
private MessageIntelligenceAgency mi5;
@Override
import static org.mockito.ArgumentMatchers.anyString;
-import com.google.common.base.Function;
-import javax.annotation.Nullable;
+import java.util.function.Function;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
public class ResetEventTimesComandProviderTest extends AbstractKarafTest {
private ResetEventTimesComandProvider resetEventTimesComandProvider;
- private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = new Function<String, Boolean>() {
- @Nullable
- @Override
- public Boolean apply(String input) {
- return input.isEmpty();
- }
- };
+ private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = String::isEmpty;
@Override
-
public void doSetUp() {
resetEventTimesComandProvider = new ResetEventTimesComandProvider();
EventsTimeCounter.resetAllCounters();
import static org.mockito.ArgumentMatchers.anyString;
-import com.google.common.base.Function;
-import javax.annotation.Nullable;
+import java.util.function.Function;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
public class ResetSessionStatsComandProviderTest extends AbstractKarafTest {
private ResetSessionStatsComandProvider resetSessionStatsComandProvider;
- private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = new Function<String, Boolean>() {
- @Nullable
- @Override
- public Boolean apply(String input) {
- return input.isEmpty();
- }
- };
+ private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = String::isEmpty;
@Override
-
public void doSetUp() {
resetSessionStatsComandProvider = new ResetSessionStatsComandProvider();
SessionStatistics.resetAllCounters();
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.karaf;
import static org.mockito.ArgumentMatchers.contains;
-import com.google.common.base.Function;
-import javax.annotation.Nullable;
+import java.util.function.Function;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
public class ShowEventTimesComandProviderTest extends AbstractKarafTest {
private ShowEventTimesComandProvider showEventTimesComandProvider;
- private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = new Function<String, Boolean>() {
- @Nullable
- @Override
- public Boolean apply(String input) {
- return input.isEmpty();
- }
- };
+ private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = String::isEmpty;
@Override
import static org.mockito.ArgumentMatchers.contains;
-import com.google.common.base.Function;
-import javax.annotation.Nullable;
+import java.util.function.Function;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
public class ShowSessionStatsCommandProviderTest extends AbstractKarafTest {
private ShowSessionStatsCommandProvider showSessionStatsCommandProvider;
- private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = new Function<String, Boolean>() {
- @Nullable
- @Override
- public Boolean apply(String input) {
- return input.isEmpty();
- }
- };
+ private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = String::isEmpty;
@Override
import static org.mockito.ArgumentMatchers.matches;
-import com.google.common.base.Function;
-import javax.annotation.Nullable;
+import java.util.function.Function;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
private ShowStatsCommandProvider showStatsCommandProvider;
private MessageIntelligenceAgency messageIntelligenceAgency;
- private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION = new Function<String, Boolean>() {
- @Nullable
- @Override
- public Boolean apply(String input) {
- return input.endsWith(": no activity detected");
- }
- };
+ private static final Function<String, Boolean> CHECK_NO_ACTIVITY_FUNCTION =
+ input -> input.endsWith(": no activity detected");
@Override
public void doSetUp() {
Assert.assertFalse(checkNoActivity(messageIntelligenceAgency.provideIntelligence(),
CHECK_NO_ACTIVITY_FUNCTION));
}
-}
\ No newline at end of file
+}
package org.opendaylight.openflowplugin.impl.util;
-import com.google.common.base.Function;
import com.google.common.collect.Lists;
import java.util.Collections;
import java.util.List;
+import java.util.function.Function;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Assert;
import org.junit.Test;