Format Java files with google-java-format 1.6
Change-Id: I6ecc891f44e6c2744eb153e0cafa2d67f4ae30df
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsConfig.java b/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsConfig.java
index 2475d21..a7cc09b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsConfig.java
@@ -36,8 +36,7 @@
private static final int DEFAULT_INTERVAL_SECONDS = 60;
private static final Pattern PATTERN =
Pattern.compile("^\\s*(\\d+)\\s*/\\s*(.*)\\s*burst\\s*(\\d+)$");
- private static final Logger log =
- LoggerFactory.getLogger(AccountLimitsConfig.class);
+ private static final Logger log = LoggerFactory.getLogger(AccountLimitsConfig.class);
static final String GROUP_SECTION = "group";
static final SectionParser<AccountLimitsConfig> KEY =
new SectionParser<AccountLimitsConfig>() {
@@ -95,8 +94,7 @@
rateLimits = ArrayTable.create(Arrays.asList(Type.values()), groups);
for (String groupName : groups) {
Type type = Type.UPLOADPACK;
- rateLimits.put(type, groupName,
- parseRateLimit(c, groupName, type));
+ rateLimits.put(type, groupName, parseRateLimit(c, groupName, type));
}
}
@@ -111,7 +109,9 @@
if (!m.matches()) {
log.warn(
"Invalid ''{}'' ratelimit configuration ''{}'', use default ratelimit {}/hour",
- name, value, 3600.0D / DEFAULT_INTERVAL_SECONDS);
+ name,
+ value,
+ 3600.0D / DEFAULT_INTERVAL_SECONDS);
return defaultRateLimit(type);
}
@@ -124,7 +124,9 @@
} catch (NumberFormatException e) {
log.warn(
"Invalid ''{}'' ratelimit store configuration ''{}'', use default burst count ''{}''",
- name, storeCountString, burstCount);
+ name,
+ storeCountString,
+ burstCount);
}
TimeUnit inputUnit = TimeUnit.HOURS;
@@ -141,8 +143,7 @@
logNotRateUnit(GROUP_SECTION, groupName, name, value);
}
try {
- ratePerSecond = 1.0D * Long.parseLong(digits)
- / TimeUnit.SECONDS.convert(1, inputUnit);
+ ratePerSecond = 1.0D * Long.parseLong(digits) / TimeUnit.SECONDS.convert(1, inputUnit);
} catch (NumberFormatException nfe) {
logNotRateUnit(GROUP_SECTION, groupName, unitName, value);
}
@@ -160,20 +161,20 @@
return false;
}
- private void logNotRateUnit(String section, String subsection, String name,
- String valueString) {
+ private void logNotRateUnit(String section, String subsection, String name, String valueString) {
if (subsection != null) {
- log.error(MessageFormat.format("Invalid rate unit value: {0}.{1}.{2}={3}",
- section, subsection, name, valueString));
+ log.error(
+ MessageFormat.format(
+ "Invalid rate unit value: {0}.{1}.{2}={3}", section, subsection, name, valueString));
} else {
- log.error(MessageFormat.format("Invalid rate unit value: {0}.{1}={2}",
- section, name, valueString));
+ log.error(
+ MessageFormat.format("Invalid rate unit value: {0}.{1}={2}", section, name, valueString));
}
}
private RateLimit defaultRateLimit(Type type) {
- return new RateLimit(type, 1.0D / DEFAULT_INTERVAL_SECONDS,
- DEFAULT_INTERVAL_SECONDS * DEFAULT_BURST_COUNT);
+ return new RateLimit(
+ type, 1.0D / DEFAULT_INTERVAL_SECONDS, DEFAULT_INTERVAL_SECONDS * DEFAULT_BURST_COUNT);
}
/**
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsFinder.java b/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsFinder.java
index 751735c..1961efb 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsFinder.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/AccountLimitsFinder.java
@@ -21,27 +21,22 @@
import com.google.gerrit.server.group.GroupsCollection;
import com.google.gerrit.server.project.ProjectCache;
import com.google.inject.Inject;
-
import com.googlesource.gerrit.plugins.quota.AccountLimitsConfig.RateLimit;
import com.googlesource.gerrit.plugins.quota.AccountLimitsConfig.Type;
-
+import java.util.Map;
+import java.util.Optional;
import org.eclipse.jgit.lib.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Map;
-import java.util.Optional;
-
public class AccountLimitsFinder {
- private static final Logger log =
- LoggerFactory.getLogger(AccountLimitsFinder.class);
+ private static final Logger log = LoggerFactory.getLogger(AccountLimitsFinder.class);
private final ProjectCache projectCache;
private final GroupsCollection groupsCollection;
@Inject
- AccountLimitsFinder(ProjectCache projectCache,
- GroupsCollection groupsCollection) {
+ AccountLimitsFinder(ProjectCache projectCache, GroupsCollection groupsCollection) {
this.projectCache = projectCache;
this.groupsCollection = groupsCollection;
}
@@ -49,20 +44,16 @@
/**
* @param type type of rate limit
* @param user identified user
- * @return the rate limit matching the first configured group limit the given
- * user is a member of
+ * @return the rate limit matching the first configured group limit the given user is a member of
*/
- public Optional<RateLimit> firstMatching(AccountLimitsConfig.Type type,
- IdentifiedUser user) {
- Optional<Map<String, AccountLimitsConfig.RateLimit>> limits =
- getRatelimits(type);
+ public Optional<RateLimit> firstMatching(AccountLimitsConfig.Type type, IdentifiedUser user) {
+ Optional<Map<String, AccountLimitsConfig.RateLimit>> limits = getRatelimits(type);
if (limits.isPresent()) {
GroupMembership memberShip = user.getEffectiveGroups();
for (String groupName : limits.get().keySet()) {
GroupDescription.Basic d = groupsCollection.parseId(groupName);
if (d == null) {
- log.error("Ignoring limits for unknown group ''{}'' in quota.config",
- groupName);
+ log.error("Ignoring limits for unknown group ''{}'' in quota.config", groupName);
} else if (memberShip.contains(d.getGroupUUID())) {
return Optional.ofNullable(limits.get().get(groupName));
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/DeletionListener.java b/src/main/java/com/googlesource/gerrit/plugins/quota/DeletionListener.java
index 47fbafd..e625187 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/DeletionListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/DeletionListener.java
@@ -14,12 +14,10 @@
package com.googlesource.gerrit.plugins.quota;
-
import com.google.gerrit.extensions.events.ProjectDeletedListener;
import com.google.gerrit.reviewdb.client.Project;
import com.google.inject.Inject;
-
public class DeletionListener implements ProjectDeletedListener {
private final RepoSizeCache repoSizeCache;
@@ -33,4 +31,4 @@
public void onProjectDeleted(Event event) {
repoSizeCache.evict(new Project.NameKey(event.getProjectName()));
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/GCListener.java b/src/main/java/com/googlesource/gerrit/plugins/quota/GCListener.java
index 887f117..ca2e933 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/GCListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/GCListener.java
@@ -17,9 +17,8 @@
import com.google.gerrit.extensions.events.GarbageCollectorListener;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Project.NameKey;
-import com.google.inject.Singleton;
import com.google.inject.Inject;
-
+import com.google.inject.Singleton;
import java.util.Properties;
@Singleton
@@ -38,11 +37,9 @@
Properties statistics = event.getStatistics();
if (statistics != null) {
Number sizeOfLooseObjects = (Number) statistics.get("sizeOfLooseObjects");
- Number sizeOfPackedObjects =
- (Number) statistics.get("sizeOfPackedObjects");
+ Number sizeOfPackedObjects = (Number) statistics.get("sizeOfPackedObjects");
if (sizeOfLooseObjects != null && sizeOfPackedObjects != null) {
- repoSizeCache.set(key, sizeOfLooseObjects.longValue()
- + sizeOfPackedObjects.longValue());
+ repoSizeCache.set(key, sizeOfLooseObjects.longValue() + sizeOfPackedObjects.longValue());
return;
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuota.java b/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuota.java
index 19aebe3..854d9ef 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuota.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuota.java
@@ -23,9 +23,8 @@
import com.google.gerrit.server.project.ProjectResource;
import com.google.inject.Inject;
import com.google.inject.name.Named;
-
-import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.atomic.AtomicLong;
public class GetQuota implements RestReadView<ProjectResource> {
@@ -34,7 +33,9 @@
private final LoadingCache<Project.NameKey, AtomicLong> repoSizeCache;
@Inject
- public GetQuota(ProjectCache projectCache, QuotaFinder quotaFinder,
+ public GetQuota(
+ ProjectCache projectCache,
+ QuotaFinder quotaFinder,
@Named(REPO_SIZE_CACHE) LoadingCache<Project.NameKey, AtomicLong> repoSizeCache) {
this.projectCache = projectCache;
this.quotaFinder = quotaFinder;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuotas.java b/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuotas.java
index 971c414..b24eec4 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuotas.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/GetQuotas.java
@@ -26,22 +26,19 @@
import com.google.inject.Singleton;
@Singleton
-public class GetQuotas implements
- ChildCollection<ConfigResource, QuotaResource> {
+public class GetQuotas implements ChildCollection<ConfigResource, QuotaResource> {
private final Provider<ListQuotas> list;
private final DynamicMap<RestView<QuotaResource>> views;
@Inject
- public GetQuotas(Provider<ListQuotas> list,
- DynamicMap<RestView<QuotaResource>> views) {
+ public GetQuotas(Provider<ListQuotas> list, DynamicMap<RestView<QuotaResource>> views) {
this.list = list;
this.views = views;
}
@Override
- public RestView<ConfigResource> list() throws ResourceNotFoundException,
- AuthException {
+ public RestView<ConfigResource> list() throws ResourceNotFoundException, AuthException {
return list.get();
}
@@ -55,5 +52,4 @@
public DynamicMap<RestView<QuotaResource>> views() {
return views;
}
-
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/ListQuotas.java b/src/main/java/com/googlesource/gerrit/plugins/quota/ListQuotas.java
index 06d9cc1..1d8061c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/ListQuotas.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/ListQuotas.java
@@ -24,12 +24,9 @@
import com.google.gerrit.server.project.ListProjects;
import com.google.inject.Inject;
import com.google.inject.Provider;
-
import com.googlesource.gerrit.plugins.quota.GetQuota.QuotaInfo;
-
-import org.kohsuke.args4j.Option;
-
import java.util.Map;
+import org.kohsuke.args4j.Option;
public class ListQuotas implements RestReadView<ConfigResource> {
@@ -43,7 +40,10 @@
this.listProjects = listProjects;
}
- @Option(name = "--prefix", aliases = {"-p"}, metaVar = "PREFIX",
+ @Option(
+ name = "--prefix",
+ aliases = {"-p"},
+ metaVar = "PREFIX",
usage = "match project prefix")
public void setMatchPrefix(String matchPrefix) {
this.matchPrefix = matchPrefix;
@@ -51,8 +51,7 @@
@Override
public Map<String, QuotaInfo> apply(ConfigResource resource)
- throws AuthException, BadRequestException, ResourceConflictException,
- Exception {
+ throws AuthException, BadRequestException, ResourceConflictException, Exception {
Map<String, QuotaInfo> result = Maps.newTreeMap();
ListProjects lister = listProjects.get();
lister.setMatchPrefix(matchPrefix);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositoriesQuotaValidator.java b/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositoriesQuotaValidator.java
index 5135b52..16499c1 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositoriesQuotaValidator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositoriesQuotaValidator.java
@@ -23,14 +23,12 @@
import com.google.inject.Singleton;
@Singleton
-public class MaxRepositoriesQuotaValidator implements
- ProjectCreationValidationListener {
+public class MaxRepositoriesQuotaValidator implements ProjectCreationValidationListener {
private final QuotaFinder quotaFinder;
private final ProjectCache projectCache;
@Inject
- MaxRepositoriesQuotaValidator(QuotaFinder quotaFinder,
- ProjectCache projectCache) {
+ MaxRepositoriesQuotaValidator(QuotaFinder quotaFinder, ProjectCache projectCache) {
this.quotaFinder = quotaFinder;
this.projectCache = projectCache;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositorySizeQuota.java b/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositorySizeQuota.java
index 4388cd9..5e923ad 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositorySizeQuota.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositorySizeQuota.java
@@ -28,18 +28,6 @@
import com.google.inject.Module;
import com.google.inject.Singleton;
import com.google.inject.name.Named;
-
-import org.apache.commons.lang.mutable.MutableLong;
-import org.eclipse.jgit.internal.storage.file.FileRepository;
-import org.eclipse.jgit.internal.storage.file.GC;
-import org.eclipse.jgit.internal.storage.file.GC.RepoStatistics;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.transport.PostReceiveHook;
-import org.eclipse.jgit.transport.ReceiveCommand;
-import org.eclipse.jgit.transport.ReceivePack;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
@@ -51,11 +39,20 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
+import org.apache.commons.lang.mutable.MutableLong;
+import org.eclipse.jgit.internal.storage.file.FileRepository;
+import org.eclipse.jgit.internal.storage.file.GC;
+import org.eclipse.jgit.internal.storage.file.GC.RepoStatistics;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.transport.PostReceiveHook;
+import org.eclipse.jgit.transport.ReceiveCommand;
+import org.eclipse.jgit.transport.ReceivePack;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Singleton
class MaxRepositorySizeQuota implements ReceivePackInitializer, PostReceiveHook, RepoSizeCache {
- private static final Logger log = LoggerFactory
- .getLogger(MaxRepositorySizeQuota.class);
+ private static final Logger log = LoggerFactory.getLogger(MaxRepositorySizeQuota.class);
static final String REPO_SIZE_CACHE = "repo_size";
@@ -77,9 +74,11 @@
private final ProjectNameResolver projectNameResolver;
@Inject
- MaxRepositorySizeQuota(QuotaFinder quotaFinder,
+ MaxRepositorySizeQuota(
+ QuotaFinder quotaFinder,
@Named(REPO_SIZE_CACHE) LoadingCache<Project.NameKey, AtomicLong> cache,
- ProjectCache projectCache, ProjectNameResolver projectNameResolver) {
+ ProjectCache projectCache,
+ ProjectNameResolver projectNameResolver) {
this.quotaFinder = quotaFinder;
this.cache = cache;
this.projectCache = projectCache;
@@ -116,12 +115,10 @@
maxPackSize2 = Math.max(0, maxTotalSize - totalSize);
}
- long maxPackSize = Ordering.<Long> natural().nullsLast().min(
- maxPackSize1, maxPackSize2);
+ long maxPackSize = Ordering.<Long>natural().nullsLast().min(maxPackSize1, maxPackSize2);
rp.setMaxPackSizeLimit(maxPackSize);
} catch (ExecutionException e) {
- log.warn("Couldn't setMaxPackSizeLimit on receive-pack for "
- + project.get(), e);
+ log.warn("Couldn't setMaxPackSizeLimit on receive-pack for " + project.get(), e);
}
}
@@ -153,12 +150,11 @@
private final boolean useGitObjectCount;
@Inject
- Loader(GitRepositoryManager gitManager,
- PluginConfigFactory cfg,
- @PluginName String pluginName) {
+ Loader(
+ GitRepositoryManager gitManager, PluginConfigFactory cfg, @PluginName String pluginName) {
this.gitManager = gitManager;
- this.useGitObjectCount = cfg.getFromGerritConfig(pluginName)
- .getBoolean("useGitObjectCount", false);
+ this.useGitObjectCount =
+ cfg.getFromGerritConfig(pluginName).getBoolean("useGitObjectCount", false);
}
@Override
@@ -173,21 +169,22 @@
private static long getDiskUsage(File dir) throws IOException {
final MutableLong size = new MutableLong();
- Files.walkFileTree(dir.toPath(), new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult visitFile(Path path, BasicFileAttributes attrs)
- throws IOException {
- if (attrs.isRegularFile()) {
- size.add(attrs.size());
- }
- return FileVisitResult.CONTINUE;
- }
- });
+ Files.walkFileTree(
+ dir.toPath(),
+ new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult visitFile(Path path, BasicFileAttributes attrs)
+ throws IOException {
+ if (attrs.isRegularFile()) {
+ size.add(attrs.size());
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ });
return size.longValue();
}
- private long getDiskUsageByGitObjectCount(Repository repo)
- throws IOException {
+ private long getDiskUsageByGitObjectCount(Repository repo) throws IOException {
RepoStatistics stats = new GC((FileRepository) repo).getStatistics();
return stats.sizeOfLooseObjects + stats.sizeOfPackedObjects;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/Module.java b/src/main/java/com/googlesource/gerrit/plugins/quota/Module.java
index 935498a..b8c4418 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/Module.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/Module.java
@@ -50,37 +50,31 @@
protected void configure() {
DynamicSet.bind(binder(), ProjectCreationValidationListener.class)
.to(MaxRepositoriesQuotaValidator.class);
- DynamicSet.bind(binder(), ReceivePackInitializer.class)
- .to(MaxRepositorySizeQuota.class);
- DynamicSet.bind(binder(), PostReceiveHook.class)
- .to(MaxRepositorySizeQuota.class);
- DynamicSet.bind(binder(), ProjectDeletedListener.class).to(
- DeletionListener.class);
- DynamicSet.bind(binder(), GarbageCollectorListener.class).to(
- GCListener.class);
+ DynamicSet.bind(binder(), ReceivePackInitializer.class).to(MaxRepositorySizeQuota.class);
+ DynamicSet.bind(binder(), PostReceiveHook.class).to(MaxRepositorySizeQuota.class);
+ DynamicSet.bind(binder(), ProjectDeletedListener.class).to(DeletionListener.class);
+ DynamicSet.bind(binder(), GarbageCollectorListener.class).to(GCListener.class);
DynamicSet.setOf(binder(), UsageDataEventCreator.class);
install(MaxRepositorySizeQuota.module());
- install(new RestApiModule() {
- @Override
- protected void configure() {
- DynamicMap.mapOf(binder(), QUOTA_KIND);
- get(PROJECT_KIND, "quota").to(GetQuota.class);
- child(CONFIG_KIND, "quota").to(GetQuotas.class);
- }
- });
+ install(
+ new RestApiModule() {
+ @Override
+ protected void configure() {
+ DynamicMap.mapOf(binder(), QUOTA_KIND);
+ get(PROJECT_KIND, "quota").to(GetQuota.class);
+ child(CONFIG_KIND, "quota").to(GetQuotas.class);
+ }
+ });
bind(Publisher.class).in(Scopes.SINGLETON);
bind(PublisherScheduler.class).in(Scopes.SINGLETON);
bind(ProjectNameResolver.class).in(Scopes.SINGLETON);
bind(LifecycleListener.class)
- .annotatedWith(UniqueAnnotations.create())
- .to(PublisherScheduler.class);
+ .annotatedWith(UniqueAnnotations.create())
+ .to(PublisherScheduler.class);
- DynamicSet.bind(binder(), UploadValidationListener.class)
- .to(RateLimitUploadListener.class);
- cache(CACHE_NAME_ACCOUNTID, Account.Id.class, Holder.class)
- .loader(LoaderAccountId.class);
- cache(CACHE_NAME_REMOTEHOST, String.class, Holder.class)
- .loader(LoaderRemoteHost.class);
+ DynamicSet.bind(binder(), UploadValidationListener.class).to(RateLimitUploadListener.class);
+ cache(CACHE_NAME_ACCOUNTID, Account.Id.class, Holder.class).loader(LoaderAccountId.class);
+ cache(CACHE_NAME_REMOTEHOST, String.class, Holder.class).loader(LoaderRemoteHost.class);
}
static class Holder {
@@ -101,8 +95,7 @@
private AccountLimitsFinder finder;
@Inject
- LoaderAccountId(IdentifiedUser.GenericFactory userFactory,
- AccountLimitsFinder finder) {
+ LoaderAccountId(IdentifiedUser.GenericFactory userFactory, AccountLimitsFinder finder) {
this.userFactory = userFactory;
this.finder = finder;
}
@@ -110,11 +103,11 @@
@Override
public Holder load(Account.Id key) throws Exception {
IdentifiedUser user = userFactory.create(key);
- Optional<RateLimit> limit =
- finder.firstMatching(AccountLimitsConfig.Type.UPLOADPACK, user);
+ Optional<RateLimit> limit = finder.firstMatching(AccountLimitsConfig.Type.UPLOADPACK, user);
if (limit.isPresent()) {
- return new Holder(RateLimitUploadListener.createSmoothBurstyRateLimiter(
- limit.get().getRatePerSecond(), limit.get().getMaxBurstSeconds()));
+ return new Holder(
+ RateLimitUploadListener.createSmoothBurstyRateLimiter(
+ limit.get().getRatePerSecond(), limit.get().getMaxBurstSeconds()));
}
return Holder.EMPTY;
}
@@ -125,8 +118,7 @@
private String anonymous;
@Inject
- LoaderRemoteHost(SystemGroupBackend systemGroupBackend,
- AccountLimitsFinder finder) {
+ LoaderRemoteHost(SystemGroupBackend systemGroupBackend, AccountLimitsFinder finder) {
this.finder = finder;
this.anonymous = systemGroupBackend.get(ANONYMOUS_USERS).getName();
}
@@ -136,8 +128,9 @@
Optional<RateLimit> limit =
finder.getRateLimit(AccountLimitsConfig.Type.UPLOADPACK, anonymous);
if (limit.isPresent()) {
- return new Holder(RateLimitUploadListener.createSmoothBurstyRateLimiter(
- limit.get().getRatePerSecond(), limit.get().getMaxBurstSeconds()));
+ return new Holder(
+ RateLimitUploadListener.createSmoothBurstyRateLimiter(
+ limit.get().getRatePerSecond(), limit.get().getMaxBurstSeconds()));
}
return Holder.EMPTY;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/Namespace.java b/src/main/java/com/googlesource/gerrit/plugins/quota/Namespace.java
index 8a2c6f8..9b018ec 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/Namespace.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/Namespace.java
@@ -31,8 +31,7 @@
public boolean matches(Project.NameKey project) {
String p = project.get();
if (namespace.endsWith("/*")) {
- return p.startsWith(
- namespace.substring(0, namespace.length() - 1));
+ return p.startsWith(namespace.substring(0, namespace.length() - 1));
} else if (namespace.startsWith("^")) {
return p.matches(namespace.substring(1));
} else {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/ProjectNameResolver.java b/src/main/java/com/googlesource/gerrit/plugins/quota/ProjectNameResolver.java
index 5d4fbcd..038a201 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/ProjectNameResolver.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/ProjectNameResolver.java
@@ -19,25 +19,21 @@
import com.google.gerrit.server.config.SitePaths;
import com.google.inject.Inject;
import com.google.inject.Singleton;
-
+import java.nio.file.Path;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Repository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.nio.file.Path;
-
@Singleton
class ProjectNameResolver {
- private static final Logger log = LoggerFactory
- .getLogger(ProjectNameResolver.class);
+ private static final Logger log = LoggerFactory.getLogger(ProjectNameResolver.class);
private final Path basePath;
@Inject
ProjectNameResolver(SitePaths site, @GerritServerConfig final Config cfg) {
- this.basePath =
- site.resolve(cfg.getString("gerrit", null, "basePath"));
+ this.basePath = site.resolve(cfg.getString("gerrit", null, "basePath"));
}
Project.NameKey projectName(Repository repo) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/Publisher.java b/src/main/java/com/googlesource/gerrit/plugins/quota/Publisher.java
index 71181e4..319c2eb 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/Publisher.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/Publisher.java
@@ -19,12 +19,10 @@
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.inject.Inject;
import com.google.inject.Singleton;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.util.ArrayList;
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@Singleton
public class Publisher implements Runnable {
@@ -44,7 +42,7 @@
@Override
public void run() {
- if(!listeners.iterator().hasNext()) {
+ if (!listeners.iterator().hasNext()) {
return;
}
@@ -68,5 +66,4 @@
}
}
}
-
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/PublisherScheduler.java b/src/main/java/com/googlesource/gerrit/plugins/quota/PublisherScheduler.java
index 1f17110..bfa95f3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/PublisherScheduler.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/PublisherScheduler.java
@@ -21,13 +21,11 @@
import com.google.gerrit.server.config.ScheduleConfig;
import com.google.gerrit.server.git.WorkQueue;
import com.google.inject.Inject;
-
+import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.lib.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.concurrent.TimeUnit;
-
public class PublisherScheduler implements LifecycleListener {
private static final Logger log = LoggerFactory.getLogger(PublisherScheduler.class);
@@ -36,11 +34,11 @@
private final ScheduleConfig scheduleConfig;
@Inject
- PublisherScheduler(WorkQueue workQueue, Publisher publisher, @GerritServerConfig Config cfg) {
+ PublisherScheduler(WorkQueue workQueue, Publisher publisher, @GerritServerConfig Config cfg) {
this.workQueue = workQueue;
this.publisher = publisher;
- scheduleConfig = new ScheduleConfig(cfg, "plugin", "quota", "publicationInterval",
- "publicationStartTime");
+ scheduleConfig =
+ new ScheduleConfig(cfg, "plugin", "quota", "publicationInterval", "publicationStartTime");
}
@Override
@@ -52,13 +50,12 @@
} else if (delay < 0 || interval <= 0) {
log.warn("Ignoring invalid schedule configuration");
} else {
- workQueue.getDefaultQueue().scheduleAtFixedRate(publisher, delay,
- interval, TimeUnit.MILLISECONDS);
+ workQueue
+ .getDefaultQueue()
+ .scheduleAtFixedRate(publisher, delay, interval, TimeUnit.MILLISECONDS);
}
}
@Override
- public void stop() {
- }
-
+ public void stop() {}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaFinder.java b/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaFinder.java
index f748e64..f32e1ac 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaFinder.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaFinder.java
@@ -17,12 +17,10 @@
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.project.ProjectCache;
import com.google.inject.Inject;
-
-import org.eclipse.jgit.lib.Config;
-
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.jgit.lib.Config;
public class QuotaFinder {
private final ProjectCache projectCache;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaSection.java b/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaSection.java
index 6419258..07e6e20 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaSection.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/QuotaSection.java
@@ -15,7 +15,6 @@
package com.googlesource.gerrit.plugins.quota;
import com.google.gerrit.reviewdb.client.Project;
-
import org.eclipse.jgit.lib.Config;
public class QuotaSection {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListener.java b/src/main/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListener.java
index 8d5a9b9..3e0ad11 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/RateLimitUploadListener.java
@@ -30,26 +30,22 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.name.Named;
-
import com.googlesource.gerrit.plugins.quota.Module.Holder;
-
-import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.transport.UploadPack;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.concurrent.ExecutionException;
+import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.transport.UploadPack;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class RateLimitUploadListener implements UploadValidationListener {
private static final int SECONDS_PER_HOUR = 3600;
- private static final Logger log =
- LoggerFactory.getLogger(RateLimitUploadListener.class);
+ private static final Logger log = LoggerFactory.getLogger(RateLimitUploadListener.class);
private static final Method createStopwatchMethod;
private static final Constructor<?> constructor;
private static final String RATE_LIMIT_TOKEN = "${rateLimit}";
@@ -58,46 +54,38 @@
static {
try {
- Class<?> sleepingStopwatchClass = Class.forName(
- "com.google.common.util.concurrent.RateLimiter$SleepingStopwatch");
- createStopwatchMethod =
- sleepingStopwatchClass.getDeclaredMethod("createFromSystemTimer");
+ Class<?> sleepingStopwatchClass =
+ Class.forName("com.google.common.util.concurrent.RateLimiter$SleepingStopwatch");
+ createStopwatchMethod = sleepingStopwatchClass.getDeclaredMethod("createFromSystemTimer");
createStopwatchMethod.setAccessible(true);
- Class<?> burstyRateLimiterClass = Class.forName(
- "com.google.common.util.concurrent.SmoothRateLimiter$SmoothBursty");
+ Class<?> burstyRateLimiterClass =
+ Class.forName("com.google.common.util.concurrent.SmoothRateLimiter$SmoothBursty");
constructor = burstyRateLimiterClass.getDeclaredConstructors()[0];
constructor.setAccessible(true);
} catch (ClassNotFoundException | NoSuchMethodException e) {
// shouldn't happen
- throw new RuntimeException(
- "Failed to prepare loading RateLimiter via reflection", e);
+ throw new RuntimeException("Failed to prepare loading RateLimiter via reflection", e);
}
}
/**
- * Create a custom instance of RateLimiter by accessing the non-public
- * constructor of the implementation class SmoothRateLimiter.SmoothBursty
- * through reflection.
+ * Create a custom instance of RateLimiter by accessing the non-public constructor of the
+ * implementation class SmoothRateLimiter.SmoothBursty through reflection.
*
- * <p>
- * RateLimiter's implementation class SmoothRateLimiter.SmoothBursty allows to
- * collect permits during idle times which can be used to send bursts of
- * requests exceeding the average rate until the stored permits are consumed.
- * If the rate per second is 0.2 and you wait 20 seconds you can acquire 4
- * permits which in average matches the configured rate limit of 0.2
- * requests/second. If the permitted rate is smaller than 1 per second the
- * standard implementation doesn't allow any bursts since it hard-codes the
- * maximum time which can be used to collect stored permits to 1 second.
+ * <p>RateLimiter's implementation class SmoothRateLimiter.SmoothBursty allows to collect permits
+ * during idle times which can be used to send bursts of requests exceeding the average rate until
+ * the stored permits are consumed. If the rate per second is 0.2 and you wait 20 seconds you can
+ * acquire 4 permits which in average matches the configured rate limit of 0.2 requests/second. If
+ * the permitted rate is smaller than 1 per second the standard implementation doesn't allow any
+ * bursts since it hard-codes the maximum time which can be used to collect stored permits to 1
+ * second.
*
- * <p>
- * Build jobs fetching updates from Gerrit are typically triggered by events
- * which can arrive in bursts. Hence the standard RateLimiter seems not to be
- * the right choice at least for fetch requests where we probably want to
- * limit the rate to less than 1 request per second per user.
+ * <p>Build jobs fetching updates from Gerrit are typically triggered by events which can arrive
+ * in bursts. Hence the standard RateLimiter seems not to be the right choice at least for fetch
+ * requests where we probably want to limit the rate to less than 1 request per second per user.
*
- * <p>
- * The used constructor can't be accessed through a public method yet hence
- * use reflection to instantiate it.
+ * <p>The used constructor can't be accessed through a public method yet hence use reflection to
+ * instantiate it.
*
* @see "https://github.com/google/guava/issues/1974"
* @param permitsPerSecond the new stable rate of this {@code RateLimiter}
@@ -105,15 +93,14 @@
* @return a new RateLimiter
*/
@VisibleForTesting
- static RateLimiter createSmoothBurstyRateLimiter(double permitsPerSecond,
- double maxBurstSeconds) {
+ static RateLimiter createSmoothBurstyRateLimiter(
+ double permitsPerSecond, double maxBurstSeconds) {
RateLimiter rl;
try {
Object stopwatch = createStopwatchMethod.invoke(null);
rl = (RateLimiter) constructor.newInstance(stopwatch, maxBurstSeconds);
rl.setRate(permitsPerSecond);
- } catch (InvocationTargetException | IllegalAccessException
- | InstantiationException e) {
+ } catch (InvocationTargetException | IllegalAccessException | InstantiationException e) {
// shouldn't happen
throw new RuntimeException(e);
}
@@ -126,7 +113,8 @@
private final String limitExceededMsg;
@Inject
- RateLimitUploadListener(Provider<CurrentUser> user,
+ RateLimitUploadListener(
+ Provider<CurrentUser> user,
@Named(CACHE_NAME_ACCOUNTID) LoadingCache<Account.Id, Holder> limitsPerAccount,
@Named(CACHE_NAME_REMOTEHOST) LoadingCache<String, Holder> limitsPerRemoteHost,
PluginConfigFactory cfg,
@@ -134,15 +122,21 @@
this.user = user;
this.limitsPerAccount = limitsPerAccount;
this.limitsPerRemoteHost = limitsPerRemoteHost;
- String msg = cfg.getFromGerritConfig(pluginName).getString(
- "uploadpackLimitExceededMsg", DEFAULT_RATE_LIMIT_EXCEEDED_MSG);
+ String msg =
+ cfg.getFromGerritConfig(pluginName)
+ .getString("uploadpackLimitExceededMsg", DEFAULT_RATE_LIMIT_EXCEEDED_MSG);
limitExceededMsg = msg.replace(RATE_LIMIT_TOKEN, "{0,number,##.##}");
}
@Override
- public void onBeginNegotiate(Repository repository, Project project,
- String remoteHost, UploadPack up, Collection<? extends ObjectId> wants,
- int cntOffered) throws ValidationException {
+ public void onBeginNegotiate(
+ Repository repository,
+ Project project,
+ String remoteHost,
+ UploadPack up,
+ Collection<? extends ObjectId> wants,
+ int cntOffered)
+ throws ValidationException {
RateLimiter limiter = null;
CurrentUser u = user.get();
if (u.isIdentifiedUser()) {
@@ -150,30 +144,32 @@
try {
limiter = limitsPerAccount.get(accountId).get();
} catch (ExecutionException e) {
- String msg = MessageFormat
- .format("Cannot get rate limits for account ''{}''", accountId);
+ String msg = MessageFormat.format("Cannot get rate limits for account ''{}''", accountId);
log.warn(msg, e);
}
} else {
try {
limiter = limitsPerRemoteHost.get(remoteHost).get();
} catch (ExecutionException e) {
- String msg = MessageFormat.format(
- "Cannot get rate limits for anonymous access from remote host ''{0}''",
- remoteHost);
+ String msg =
+ MessageFormat.format(
+ "Cannot get rate limits for anonymous access from remote host ''{0}''", remoteHost);
log.warn(msg, e);
}
}
if (limiter != null && !limiter.tryAcquire()) {
throw new RateLimitException(
- MessageFormat.format(limitExceededMsg,
- limiter.getRate() * SECONDS_PER_HOUR));
+ MessageFormat.format(limitExceededMsg, limiter.getRate() * SECONDS_PER_HOUR));
}
}
@Override
- public void onPreUpload(Repository repository, Project project,
- String remoteHost, UploadPack up, Collection<? extends ObjectId> wants,
- Collection<? extends ObjectId> haves) throws ValidationException {
- }
+ public void onPreUpload(
+ Repository repository,
+ Project project,
+ String remoteHost,
+ UploadPack up,
+ Collection<? extends ObjectId> wants,
+ Collection<? extends ObjectId> haves)
+ throws ValidationException {}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreator.java b/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreator.java
index 9baf36a..08a9959 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreator.java
@@ -24,15 +24,14 @@
@Singleton
public class RepoSizeEventCreator implements UsageDataEventCreator {
- private static final MetaData REPO_SIZE = new MetaDataImpl("repoSize", "byte", "B",
- "total file size of the repository");
+ private static final MetaData REPO_SIZE =
+ new MetaDataImpl("repoSize", "byte", "B", "total file size of the repository");
private final ProjectCache projectCache;
private final RepoSizeCache repoSizeCache;
@Inject
- public RepoSizeEventCreator(ProjectCache projectCache,
- RepoSizeCache repoSizeCache) {
+ public RepoSizeEventCreator(ProjectCache projectCache, RepoSizeCache repoSizeCache) {
this.projectCache = projectCache;
this.repoSizeCache = repoSizeCache;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/UsageDataEvent.java b/src/main/java/com/googlesource/gerrit/plugins/quota/UsageDataEvent.java
index d37709c..3dc86de 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/UsageDataEvent.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/UsageDataEvent.java
@@ -17,7 +17,6 @@
import com.google.gerrit.extensions.events.UsageDataPublishedListener.Data;
import com.google.gerrit.extensions.events.UsageDataPublishedListener.Event;
import com.google.gerrit.extensions.events.UsageDataPublishedListener.MetaData;
-
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@@ -35,18 +34,19 @@
}
void addData(final long value, final String projectName) {
- Data dataRow = new Data() {
+ Data dataRow =
+ new Data() {
- @Override
- public long getValue() {
- return value;
- }
+ @Override
+ public long getValue() {
+ return value;
+ }
- @Override
- public String getProjectName() {
- return projectName;
- }
- };
+ @Override
+ public String getProjectName() {
+ return projectName;
+ }
+ };
data.add(dataRow);
}
@@ -58,11 +58,11 @@
@Override
public Timestamp getInstant() {
- return timestamp ;
+ return timestamp;
}
@Override
public List<Data> getData() {
return data;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/quota/UsageDataEventCreator.java b/src/main/java/com/googlesource/gerrit/plugins/quota/UsageDataEventCreator.java
index 56db9b3..4a42ead 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/quota/UsageDataEventCreator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/quota/UsageDataEventCreator.java
@@ -21,5 +21,4 @@
String getName();
UsageDataPublishedListener.Event create();
-
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/DeletionListenerTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/DeletionListenerTest.java
index 4620323..034f3b2 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/DeletionListenerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/DeletionListenerTest.java
@@ -23,7 +23,6 @@
import com.google.gerrit.reviewdb.client.Project;
import com.google.gwtorm.client.KeyUtil;
import com.google.gwtorm.server.StandardKeyEncoder;
-
import org.junit.Test;
public class DeletionListenerTest {
@@ -42,20 +41,20 @@
DeletionListener classUnderTest = new DeletionListener(repoSizeCache);
replay(repoSizeCache);
- ProjectDeletedListener.Event event = new ProjectDeletedListener.Event() {
- @Override
- public String getProjectName() {
- return MY_PROJECT;
- }
+ ProjectDeletedListener.Event event =
+ new ProjectDeletedListener.Event() {
+ @Override
+ public String getProjectName() {
+ return MY_PROJECT;
+ }
- @Override
- public NotifyHandling getNotify() {
- return NotifyHandling.ALL;
- }
- };
+ @Override
+ public NotifyHandling getNotify() {
+ return NotifyHandling.ALL;
+ }
+ };
classUnderTest.onProjectDeleted(event);
verify(repoSizeCache);
}
-
-}
\ No newline at end of file
+}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/GCListenerTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/GCListenerTest.java
index f8df792..4e397ba 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/GCListenerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/GCListenerTest.java
@@ -24,10 +24,8 @@
import com.google.gerrit.reviewdb.client.Project;
import com.google.gwtorm.client.KeyUtil;
import com.google.gwtorm.server.StandardKeyEncoder;
-
-import org.junit.Test;
-
import java.util.Properties;
+import org.junit.Test;
public class GCListenerTest {
static {
@@ -104,5 +102,4 @@
};
return event;
}
-
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherExceptionTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherExceptionTest.java
index 28d2ef7..f2d84c5 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherExceptionTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherExceptionTest.java
@@ -20,7 +20,6 @@
import com.google.gerrit.extensions.events.UsageDataPublishedListener;
import com.google.gerrit.extensions.events.UsageDataPublishedListener.Event;
import com.google.gerrit.extensions.registration.DynamicSet;
-
import org.apache.log4j.Appender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
@@ -77,7 +76,7 @@
assertTrue(captor.hasCaptured());
LoggingEvent event = captor.getValue();
assertEquals(Level.WARN, event.getLevel());
- assertTrue(((String)event.getMessage()).contains(CREATOR_NAME));
+ assertTrue(((String) event.getMessage()).contains(CREATOR_NAME));
}
@Test
@@ -139,5 +138,4 @@
verify(listener, good, creator, appender);
}
-
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherTest.java
index fd41489..b86e87d 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/PublisherTest.java
@@ -23,7 +23,6 @@
import com.google.gerrit.extensions.events.UsageDataPublishedListener;
import com.google.gerrit.extensions.events.UsageDataPublishedListener.Event;
import com.google.gerrit.extensions.registration.DynamicSet;
-
import org.junit.Test;
public class PublisherTest {
@@ -42,8 +41,7 @@
creators.add(c1);
creators.add(c2);
- UsageDataPublishedListener listener =
- createMock(UsageDataPublishedListener.class);
+ UsageDataPublishedListener listener = createMock(UsageDataPublishedListener.class);
listener.onUsageDataPublished(e1);
expectLastCall();
listener.onUsageDataPublished(e2);
@@ -67,13 +65,11 @@
DynamicSet<UsageDataEventCreator> creators = DynamicSet.emptySet();
creators.add(creator);
- UsageDataPublishedListener l1 =
- createMock(UsageDataPublishedListener.class);
+ UsageDataPublishedListener l1 = createMock(UsageDataPublishedListener.class);
l1.onUsageDataPublished(event);
expectLastCall();
- UsageDataPublishedListener l2 =
- createMock(UsageDataPublishedListener.class);
+ UsageDataPublishedListener l2 = createMock(UsageDataPublishedListener.class);
l2.onUsageDataPublished(event);
expectLastCall();
@@ -102,5 +98,4 @@
verify(creator);
}
-
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreatorTest.java b/src/test/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreatorTest.java
index fc72e9a..1da13f1 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreatorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/RepoSizeEventCreatorTest.java
@@ -27,13 +27,11 @@
import com.google.gerrit.server.project.ProjectCache;
import com.google.gwtorm.client.KeyUtil;
import com.google.gwtorm.server.StandardKeyEncoder;
-
-import org.junit.Before;
-import org.junit.Test;
-
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
+import org.junit.Before;
+import org.junit.Test;
public class RepoSizeEventCreatorTest {
@@ -62,7 +60,6 @@
classUnderTest = new RepoSizeEventCreator(projectCache, repoSizeCache);
}
-
@Test
public void testEmpty() {
replay(repoSizeCache);
@@ -86,5 +83,4 @@
assertEquals("p1", dataPoint.getProjectName());
assertEquals(100L, dataPoint.getValue());
}
-
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/quota/TestNamespaceMatching.java b/src/test/java/com/googlesource/gerrit/plugins/quota/TestNamespaceMatching.java
index e233252..53253ee 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/quota/TestNamespaceMatching.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/quota/TestNamespaceMatching.java
@@ -18,7 +18,6 @@
import static org.junit.Assert.assertTrue;
import com.google.gerrit.reviewdb.client.Project;
-
import org.junit.Test;
public class TestNamespaceMatching {