Fix logging mismatches
[bgpcep.git] / pcep / pcc-mock / src / main / java / org / opendaylight / protocol / pcep / pcc / mock / Main.java
index c2c04d81c028dec7f4957e89c7a764b328918e9d..3f1ce826f5a30afd2fc27fa15d7327b0eeb7a66d 100755 (executable)
@@ -12,12 +12,11 @@ import ch.qos.logback.classic.Level;
 import ch.qos.logback.classic.LoggerContext;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
 import com.google.common.net.InetAddresses;
 import java.math.BigInteger;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
+import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.protocol.pcep.PCEPCapability;
@@ -48,9 +47,10 @@ public final class Main {
         throw new UnsupportedOperationException();
     }
 
-    public static void main(final String[] args) throws InterruptedException, ExecutionException, UnknownHostException {
+    public static void main(final String[] args) throws InterruptedException, ExecutionException {
         InetSocketAddress localAddress = new InetSocketAddress(LOCALHOST, DEFAULT_LOCAL_PORT);
-        List<InetSocketAddress> remoteAddress = Lists.newArrayList(new InetSocketAddress(LOCALHOST, DEFAULT_REMOTE_PORT));
+        List<InetSocketAddress> remoteAddress = Collections
+                .singletonList(new InetSocketAddress(LOCALHOST, DEFAULT_REMOTE_PORT));
         int pccCount = 1;
         int lsps = 1;
         boolean pcError = false;
@@ -73,10 +73,10 @@ public final class Main {
                     remoteAddress = InetSocketAddressUtil.parseAddresses(args[++argIdx], DEFAULT_REMOTE_PORT);
                     break;
                 case "--pcc":
-                    pccCount = Integer.valueOf(args[++argIdx]);
+                    pccCount = Integer.parseInt(args[++argIdx]);
                     break;
                 case "--lsp":
-                    lsps = Integer.valueOf(args[++argIdx]);
+                    lsps = Integer.parseInt(args[++argIdx]);
                     break;
                 case "--pcerr":
                     pcError = true;
@@ -96,20 +96,20 @@ public final class Main {
                     password = args[++argIdx];
                     break;
                 case "--reconnect":
-                    reconnectTime = Integer.valueOf(args[++argIdx]);
+                    reconnectTime = Integer.parseInt(args[++argIdx]);
                     break;
                 case "--redelegation-timeout":
-                    redelegationTimeout = Integer.valueOf(args[++argIdx]);
+                    redelegationTimeout = Integer.parseInt(args[++argIdx]);
                     break;
                 case "--state-timeout":
-                    stateTimeout = Integer.valueOf(args[++argIdx]);
+                    stateTimeout = Integer.parseInt(args[++argIdx]);
                     break;
                 case "--state-sync-avoidance":
                     //"--state-sync-avoidance 10, 5, 10
                     includeDbv = Boolean.TRUE;
                     final Long dbVersionAfterReconnect = Long.valueOf(args[++argIdx]);
-                    disonnectAfterXSeconds = Integer.valueOf(args[++argIdx]);
-                    reconnectAfterXSeconds = Integer.valueOf(args[++argIdx]);
+                    disonnectAfterXSeconds = Integer.parseInt(args[++argIdx]);
+                    reconnectAfterXSeconds = Integer.parseInt(args[++argIdx]);
                     syncOptDBVersion = BigInteger.valueOf(dbVersionAfterReconnect);
                     break;
                 case "--incremental-sync-procedure":
@@ -118,8 +118,8 @@ public final class Main {
                     incrementalSync = Boolean.TRUE;
                     //Version of database to be used after restart
                     final Long initialDbVersionAfterReconnect = Long.valueOf(args[++argIdx]);
-                    disonnectAfterXSeconds = Integer.valueOf(args[++argIdx]);
-                    reconnectAfterXSeconds = Integer.valueOf(args[++argIdx]);
+                    disonnectAfterXSeconds = Integer.parseInt(args[++argIdx]);
+                    reconnectAfterXSeconds = Integer.parseInt(args[++argIdx]);
                     syncOptDBVersion = BigInteger.valueOf(initialDbVersionAfterReconnect);
                     break;
                 case "--triggered-initial-sync":
@@ -136,14 +136,17 @@ public final class Main {
         }
 
         if (incrementalSync) {
-            Preconditions.checkArgument(syncOptDBVersion.intValue() > lsps, "Synchronization Database Version which will be used after " +
-                "reconnectes requires to be higher than lsps");
+            Preconditions.checkArgument(syncOptDBVersion.intValue() > lsps,
+                    "Synchronization Database Version which will be used after "
+                            + "reconnectes requires to be higher than lsps");
         }
 
         final Optional<BigInteger> dBVersion = Optional.fromNullable(syncOptDBVersion);
-        final PCCsBuilder pccs = new PCCsBuilder(lsps, pcError, pccCount, localAddress, remoteAddress, ka, dt, password, reconnectTime, redelegationTimeout,
+        final PCCsBuilder pccs = new PCCsBuilder(lsps, pcError, pccCount, localAddress, remoteAddress, ka, dt,
+                password, reconnectTime, redelegationTimeout,
             stateTimeout, getCapabilities());
-        final TimerHandler timerHandler = new TimerHandler(pccs, dBVersion, disonnectAfterXSeconds, reconnectAfterXSeconds);
+        final TimerHandler timerHandler = new TimerHandler(pccs, dBVersion, disonnectAfterXSeconds,
+                reconnectAfterXSeconds);
         pccs.createPCCs(BigInteger.valueOf(lsps), Optional.fromNullable(timerHandler));
         if (!triggeredInitSync) {
             timerHandler.createDisconnectTask();
@@ -154,7 +157,8 @@ public final class Main {
         if (triggeredInitSync) {
             Preconditions.checkArgument(includeDbv);
         }
-        return new PCEPStatefulCapability(true, true, true, triggeredInitSync, triggeredResync, incrementalSync, includeDbv);
+        return new PCEPStatefulCapability(true, true, true, triggeredInitSync, triggeredResync,
+                incrementalSync, includeDbv);
     }
 
     private static ch.qos.logback.classic.Logger getRootLogger(final LoggerContext lc) {