aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject [1/2] aurora git commit: Revert "Shim interfaces to preface args system overhaul."
Date Wed, 20 Jan 2016 01:47:38 GMT
Repository: aurora
Updated Branches:
  refs/heads/master fe13e4ed5 -> 749f83502


http://git-wip-us.apache.org/repos/asf/aurora/blob/749f8350/src/main/java/org/apache/aurora/scheduler/storage/log/LogStorageModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/storage/log/LogStorageModule.java b/src/main/java/org/apache/aurora/scheduler/storage/log/LogStorageModule.java
index 07ec54c..ed63a74 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/log/LogStorageModule.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/log/LogStorageModule.java
@@ -62,42 +62,13 @@ public class LogStorageModule extends PrivateModule {
   public static final Arg<Amount<Integer, Data>> MAX_LOG_ENTRY_SIZE =
       Arg.create(Amount.of(512, Data.KB));
 
-  interface Params {
-    Amount<Long, Time> dlogShutdownGracePeriod();
-
-    Amount<Long, Time> dlogSnapshotInterval();
-
-    Amount<Integer, Data> dlogMaxEntrySize();
-  }
-
-  private final Params params;
-
-  public LogStorageModule() {
-    this.params = new Params() {
-      @Override
-      public Amount<Long, Time> dlogShutdownGracePeriod() {
-        return SHUTDOWN_GRACE_PERIOD.get();
-      }
-
-      @Override
-      public Amount<Long, Time> dlogSnapshotInterval() {
-        return SNAPSHOT_INTERVAL.get();
-      }
-
-      @Override
-      public Amount<Integer, Data> dlogMaxEntrySize() {
-        return MAX_LOG_ENTRY_SIZE.get();
-      }
-    };
-  }
-
   @Override
   protected void configure() {
     bind(Settings.class)
-        .toInstance(new Settings(params.dlogShutdownGracePeriod(), params.dlogSnapshotInterval()));
+        .toInstance(new Settings(SHUTDOWN_GRACE_PERIOD.get(), SNAPSHOT_INTERVAL.get()));
 
     bind(new TypeLiteral<Amount<Integer, Data>>() { }).annotatedWith(MaxEntrySize.class)
-        .toInstance(params.dlogMaxEntrySize());
+        .toInstance(MAX_LOG_ENTRY_SIZE.get());
     bind(LogManager.class).in(Singleton.class);
     bind(LogStorage.class).in(Singleton.class);
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/749f8350/src/main/java/org/apache/aurora/scheduler/storage/mem/InMemStoresModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/storage/mem/InMemStoresModule.java
b/src/main/java/org/apache/aurora/scheduler/storage/mem/InMemStoresModule.java
index 8909833..1b491f9 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/mem/InMemStoresModule.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/mem/InMemStoresModule.java
@@ -41,20 +41,9 @@ public final class InMemStoresModule extends PrivateModule {
   private static final Arg<Amount<Long, Time>> SLOW_QUERY_LOG_THRESHOLD =
       Arg.create(Amount.of(25L, Time.MILLISECONDS));
 
-  interface Params {
-    Amount<Long, Time> slowQueryLogThreshold();
-  }
-
-  private final Params params;
   private final KeyFactory keyFactory;
 
   public InMemStoresModule(KeyFactory keyFactory) {
-    this.params = new Params() {
-      @Override
-      public Amount<Long, Time> slowQueryLogThreshold() {
-        return SLOW_QUERY_LOG_THRESHOLD.get();
-      }
-    };
     this.keyFactory = requireNonNull(keyFactory);
   }
 
@@ -69,7 +58,7 @@ public final class InMemStoresModule extends PrivateModule {
   @Override
   protected void configure() {
     bind(new TypeLiteral<Amount<Long, Time>>() { }).annotatedWith(SlowQueryThreshold.class)
-        .toInstance(params.slowQueryLogThreshold());
+        .toInstance(SLOW_QUERY_LOG_THRESHOLD.get());
     bindStore(TaskStore.Mutable.class, MemTaskStore.class);
     expose(TaskStore.Mutable.class);
     bindStore(CronJobStore.Mutable.class, MemCronJobStore.class);

http://git-wip-us.apache.org/repos/asf/aurora/blob/749f8350/src/main/java/org/apache/aurora/scheduler/zookeeper/guice/client/flagged/FlaggedClientConfig.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/zookeeper/guice/client/flagged/FlaggedClientConfig.java
b/src/main/java/org/apache/aurora/scheduler/zookeeper/guice/client/flagged/FlaggedClientConfig.java
index 4838293..5b59d55 100644
--- a/src/main/java/org/apache/aurora/scheduler/zookeeper/guice/client/flagged/FlaggedClientConfig.java
+++ b/src/main/java/org/apache/aurora/scheduler/zookeeper/guice/client/flagged/FlaggedClientConfig.java
@@ -52,19 +52,7 @@ public final class FlaggedClientConfig {
 
   @CmdLine(name = "zk_digest_credentials",
            help = "user:password to use when authenticating with ZooKeeper.")
-  private static final Arg<String> DIGEST_CREDENTIALS = Arg.create(null);
-
-  interface Params {
-    boolean zkInProc();
-
-    List<InetSocketAddress> zkEndpoints();
-
-    Optional<String> zkChrootPath();
-
-    Amount<Integer, Time> zkSessionTimeout();
-
-    Optional<String> zkDigestCredentials();
-  }
+  private static final Arg<String> DIGEST_CREDENTIALS = Arg.create();
 
   private FlaggedClientConfig() {
     // Utility class.
@@ -76,41 +64,15 @@ public final class FlaggedClientConfig {
    * @return Configuration instance.
    */
   public static ClientConfig create() {
-    Params params = new Params() {
-      @Override
-      public boolean zkInProc() {
-        return IN_PROCESS.get();
-      }
-
-      @Override
-      public List<InetSocketAddress> zkEndpoints() {
-        return ZK_ENDPOINTS.get();
-      }
-
-      @Override
-      public Optional<String> zkChrootPath() {
-        return Optional.fromNullable(CHROOT_PATH.get());
-      }
-
-      @Override
-      public Amount<Integer, Time> zkSessionTimeout() {
-        return SESSION_TIMEOUT.get();
-      }
-
-      @Override
-      public Optional<String> zkDigestCredentials() {
-        return Optional.fromNullable(DIGEST_CREDENTIALS.get());
-      }
-    };
-
     return new ClientConfig(
-        params.zkEndpoints(),
-        params.zkChrootPath(),
-        params.zkInProc(),
-        params.zkSessionTimeout(),
-        params.zkDigestCredentials()
-            .transform(FlaggedClientConfig::getCredentials)
-            .or(Credentials.NONE));
+        ZK_ENDPOINTS.get(),
+        Optional.fromNullable(CHROOT_PATH.get()),
+        IN_PROCESS.get(),
+        SESSION_TIMEOUT.get(),
+        DIGEST_CREDENTIALS.hasAppliedValue()
+            ? getCredentials(DIGEST_CREDENTIALS.get())
+            : Credentials.NONE
+    );
   }
 
   private static Credentials getCredentials(String userAndPass) {

http://git-wip-us.apache.org/repos/asf/aurora/blob/749f8350/src/test/java/org/apache/aurora/scheduler/app/SchedulerIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/app/SchedulerIT.java b/src/test/java/org/apache/aurora/scheduler/app/SchedulerIT.java
index 35292a2..9fb8aad 100644
--- a/src/test/java/org/apache/aurora/scheduler/app/SchedulerIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/app/SchedulerIT.java
@@ -163,8 +163,9 @@ public class SchedulerIT extends BaseZooKeeperTest {
     log = control.createMock(Log.class);
     logStream = control.createMock(Stream.class);
     streamMatcher = LogOpMatcher.matcherFor(logStream);
-    entrySerializer =
-        new EntrySerializer.EntrySerializerImpl(Amount.of(512, Data.KB), Hashing.md5());
+    entrySerializer = new EntrySerializer.EntrySerializerImpl(
+        LogStorageModule.MAX_LOG_ENTRY_SIZE.get(),
+        Hashing.md5());
 
     zkClient = createZkClient();
   }
@@ -185,14 +186,7 @@ public class SchedulerIT extends BaseZooKeeperTest {
             0);
         bind(ExecutorSettings.class)
             .toInstance(TestExecutorSettings.thermosOnlyWithOverhead(executorOverhead));
-        install(new BackupModule(
-            new BackupModule.Params() {
-              @Override
-              public File backupDir() {
-                return backupDir;
-              }
-            },
-            SnapshotStoreImpl.class));
+        install(new BackupModule(backupDir, SnapshotStoreImpl.class));
 
         bind(IServerInfo.class).toInstance(
             IServerInfo.build(

http://git-wip-us.apache.org/repos/asf/aurora/blob/749f8350/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java b/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java
index 650cde6..4716b66 100644
--- a/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java
+++ b/src/test/java/org/apache/aurora/scheduler/app/local/LocalSchedulerMain.java
@@ -83,18 +83,6 @@ public final class LocalSchedulerMain {
       }
     };
 
-    SchedulerMain.Params testParams = new SchedulerMain.Params() {
-      @Override
-      public String clusterName() {
-        return "local";
-      }
-
-      @Override
-      public String serversetPath() {
-        return "/aurora/local/scheduler";
-      }
-    };
-
     Module fakeMesos = new AbstractModule() {
       @Override
       protected void configure() {
@@ -106,6 +94,6 @@ public final class LocalSchedulerMain {
       }
     };
 
-    SchedulerMain.main(testParams, Modules.combine(fakeMesos, persistentStorage));
+    SchedulerMain.flagConfiguredMain(Modules.combine(fakeMesos, persistentStorage));
   }
 }

http://git-wip-us.apache.org/repos/asf/aurora/blob/749f8350/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java b/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java
index 9c40aaf..19c8a1f 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/AbstractJettyTest.java
@@ -135,7 +135,7 @@ public abstract class AbstractJettyTest extends EasyMockTest {
             });
           }
         },
-        new JettyServerModule(new JettyServerModule.Params() { }, false));
+        new JettyServerModule(false));
     schedulerWatcher = createCapture();
     expect(schedulers.watch(capture(schedulerWatcher))).andReturn(createMock(Command.class));
   }

http://git-wip-us.apache.org/repos/asf/aurora/blob/749f8350/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
b/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
index 0c9d4f6..3e811a4 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/security/HttpSecurityIT.java
@@ -14,9 +14,7 @@
 package org.apache.aurora.scheduler.http.api.security;
 
 import java.io.IOException;
-import java.util.Optional;
 import java.util.Set;
-
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
@@ -159,7 +157,7 @@ public class HttpSecurityIT extends AbstractJettyTest {
         new H2ConsoleModule(true),
         new HttpSecurityModule(
             new IniShiroRealmModule(ini),
-            Optional.of(Key.get(Filter.class, SHIRO_AFTER_AUTH_FILTER_ANNOTATION))),
+            Key.get(Filter.class, SHIRO_AFTER_AUTH_FILTER_ANNOTATION)),
         new AbstractModule() {
           @Override
           protected void configure() {

http://git-wip-us.apache.org/repos/asf/aurora/blob/749f8350/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java
b/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java
index 0bbb687..2c3e5f3 100644
--- a/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/preemptor/PreemptorModuleTest.java
@@ -67,27 +67,9 @@ public class PreemptorModuleTest extends EasyMockTest {
   @Test
   public void testPreemptorDisabled() throws Exception {
     Injector injector = createInjector(new PreemptorModule(
-        new PreemptorModule.Params() {
-          @Override
-          public boolean enablePreemptor() {
-            return false;
-          }
-
-          @Override
-          public Amount<Long, Time> preemptionDelay() {
-            return Amount.of(0L, Time.SECONDS);
-          }
-
-          @Override
-          public Amount<Long, Time> preemptionSlotHoldTime() {
-            return Amount.of(0L, Time.SECONDS);
-          }
-
-          @Override
-          public Amount<Long, Time> preemptionSlotSearchInterval() {
-            return Amount.of(0L, Time.SECONDS);
-          }
-        }));
+        false,
+        Amount.of(0L, Time.SECONDS),
+        Amount.of(0L, Time.SECONDS)));
 
     control.replay();
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/749f8350/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java b/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java
index fe8c282..341e346 100644
--- a/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/sla/SlaModuleTest.java
@@ -13,7 +13,6 @@
  */
 package org.apache.aurora.scheduler.sla;
 
-import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
@@ -35,7 +34,6 @@ import org.apache.aurora.common.util.Clock;
 import org.apache.aurora.common.util.testing.FakeClock;
 import org.apache.aurora.scheduler.app.LifecycleModule;
 import org.apache.aurora.scheduler.base.Query;
-import org.apache.aurora.scheduler.sla.MetricCalculator.MetricCategory;
 import org.apache.aurora.scheduler.sla.SlaModule.SlaUpdater;
 import org.apache.aurora.scheduler.storage.Storage;
 import org.apache.aurora.scheduler.storage.testing.StorageTestUtil;
@@ -65,22 +63,9 @@ public class SlaModuleTest extends EasyMockTest {
     clock = new FakeClock();
     statsProvider = createMock(StatsProvider.class);
     module = new SlaModule(
-        new SlaModule.Params() {
-          @Override
-          public Amount<Long, Time> slaStatRefreshInterval() {
-            return Amount.of(5L, Time.MILLISECONDS);
-          }
-
-          @Override
-          public Set<MetricCategory> slaProdMetrics() {
-            return ImmutableSet.of(JOB_UPTIMES, MEDIANS, PLATFORM_UPTIME);
-          }
-
-          @Override
-          public Set<MetricCategory> slaNonProdMetrics() {
-            return slaProdMetrics();
-          }
-        });
+        Amount.of(5L, Time.MILLISECONDS),
+        ImmutableSet.of(JOB_UPTIMES, MEDIANS, PLATFORM_UPTIME),
+        ImmutableSet.of(JOB_UPTIMES, MEDIANS, PLATFORM_UPTIME));
     injector = Guice.createInjector(
         ImmutableList.<Module>builder()
             .add(module)


Mime
View raw message