mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
The dark lord Gosling designed the Java package naming system so that ownership flows from the DNS system. Since we own the domain name registry.google, it seems only appropriate that we should use google.registry as our package name.
118 lines
3.7 KiB
Java
118 lines
3.7 KiB
Java
// Copyright 2016 The Domain Registry Authors. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package google.registry.loadtest;
|
|
|
|
import static google.registry.request.RequestParameters.extractOptionalIntParameter;
|
|
import static google.registry.request.RequestParameters.extractRequiredParameter;
|
|
|
|
import dagger.Module;
|
|
import dagger.Provides;
|
|
|
|
import google.registry.request.Parameter;
|
|
|
|
import org.joda.time.Minutes;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
/**
|
|
* Dagger module for loadtest package.
|
|
*
|
|
* @see "google.registry.module.backend.ToolsComponent"
|
|
*/
|
|
@Module
|
|
public final class LoadTestModule {
|
|
|
|
// There's already an @Parameter("clientId") for CreateGroupsAction that's only optional, and we
|
|
// want this one to be required, so give it a different name.
|
|
@Provides
|
|
@Parameter("loadtestClientId")
|
|
static String provideClientId(HttpServletRequest req) {
|
|
return extractRequiredParameter(req, "clientId");
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("delaySeconds")
|
|
static int provideDelaySeconds(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "delaySeconds")
|
|
.or(Minutes.ONE.toStandardSeconds().getSeconds());
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("runSeconds")
|
|
static int provideRunSeconds(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "runSeconds")
|
|
.or(Minutes.ONE.toStandardSeconds().getSeconds());
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("successfulDomainCreates")
|
|
static int provideSuccessfulDomainCreates(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "successfulDomainCreates").or(0);
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("failedDomainCreates")
|
|
static int provideFailedDomainCreates(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "failedDomainCreates").or(0);
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("domainInfos")
|
|
static int provideDomainInfos(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "domainInfos").or(0);
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("domainChecks")
|
|
static int provideDomainChecks(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "domainChecks").or(0);
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("successfulContactCreates")
|
|
static int provideSuccessfulContactCreates(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "successfulContactCreates").or(0);
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("failedContactCreates")
|
|
static int provideFailedContactCreates(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "failedContactCreates").or(0);
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("contactInfos")
|
|
static int provideContactInfos(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "contactInfos").or(0);
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("successfulHostCreates")
|
|
static int provideSuccessfulHostCreates(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "successfulHostCreates").or(0);
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("failedHostCreates")
|
|
static int provideFailedHostCreates(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "failedHostCreates").or(0);
|
|
}
|
|
|
|
@Provides
|
|
@Parameter("hostInfos")
|
|
static int provideHostInfos(HttpServletRequest req) {
|
|
return extractOptionalIntParameter(req, "hostInfos").or(0);
|
|
}
|
|
}
|