mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Don't add all claims data to NORDN verify task
This claims data can exceed the maximum size of a task, causing the NORDN upload to error out. It also wasn't even being used anyway. This data is already logged during the upload and there's no reason to log it as well during the verify, because there is already a unique actionLogId that can be used to tie the verify task back to the upload task. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=196521160
This commit is contained in:
parent
c25f765fc5
commit
de5645abd9
5 changed files with 5 additions and 30 deletions
|
@ -153,17 +153,15 @@ public final class NordnUploadAction implements Runnable {
|
||||||
actionLogId),
|
actionLogId),
|
||||||
req, rsp);
|
req, rsp);
|
||||||
}
|
}
|
||||||
getQueue(NordnVerifyAction.QUEUE).add(makeVerifyTask(new URL(location.get()), csvData));
|
getQueue(NordnVerifyAction.QUEUE).add(makeVerifyTask(new URL(location.get())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private TaskOptions makeVerifyTask(URL url, String csvData) {
|
private TaskOptions makeVerifyTask(URL url) {
|
||||||
// This task doesn't technically need csvData. The only reason it's passed along is in case the
|
// The actionLogId is used to uniquely associate the verify task back to the upload task.
|
||||||
// upload is rejected, in which case csvData will be logged so that it may be uploaded manually.
|
|
||||||
return withUrl(NordnVerifyAction.PATH)
|
return withUrl(NordnVerifyAction.PATH)
|
||||||
.header(NordnVerifyAction.URL_HEADER, url.toString())
|
.header(NordnVerifyAction.URL_HEADER, url.toString())
|
||||||
.header(NordnVerifyAction.HEADER_ACTION_LOG_ID, actionLogId)
|
.header(NordnVerifyAction.HEADER_ACTION_LOG_ID, actionLogId)
|
||||||
.param(RequestParameters.PARAM_TLD, tld)
|
.param(RequestParameters.PARAM_TLD, tld)
|
||||||
.param(NordnVerifyAction.PARAM_CSV_DATA, csvData)
|
|
||||||
.countdownMillis(VERIFY_DELAY.getMillis());
|
.countdownMillis(VERIFY_DELAY.getMillis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.io.ByteSource;
|
import com.google.common.io.ByteSource;
|
||||||
import google.registry.request.Action;
|
import google.registry.request.Action;
|
||||||
import google.registry.request.Header;
|
import google.registry.request.Header;
|
||||||
import google.registry.request.HttpException.BadRequestException;
|
|
||||||
import google.registry.request.HttpException.ConflictException;
|
import google.registry.request.HttpException.ConflictException;
|
||||||
import google.registry.request.Parameter;
|
import google.registry.request.Parameter;
|
||||||
import google.registry.request.RequestParameters;
|
import google.registry.request.RequestParameters;
|
||||||
|
@ -60,8 +59,6 @@ import javax.inject.Inject;
|
||||||
)
|
)
|
||||||
public final class NordnVerifyAction implements Runnable {
|
public final class NordnVerifyAction implements Runnable {
|
||||||
|
|
||||||
public static final String PARAM_CSV_DATA = "csvData";
|
|
||||||
|
|
||||||
static final String PATH = "/_dr/task/nordnVerify";
|
static final String PATH = "/_dr/task/nordnVerify";
|
||||||
static final String QUEUE = "marksdb";
|
static final String QUEUE = "marksdb";
|
||||||
static final String URL_HEADER = "X-DomainRegistry-Nordn-Url";
|
static final String URL_HEADER = "X-DomainRegistry-Nordn-Url";
|
||||||
|
@ -75,7 +72,6 @@ public final class NordnVerifyAction implements Runnable {
|
||||||
@Inject @Header(URL_HEADER) URL url;
|
@Inject @Header(URL_HEADER) URL url;
|
||||||
@Inject @Header(HEADER_ACTION_LOG_ID) String actionLogId;
|
@Inject @Header(HEADER_ACTION_LOG_ID) String actionLogId;
|
||||||
@Inject @Parameter(RequestParameters.PARAM_TLD) String tld;
|
@Inject @Parameter(RequestParameters.PARAM_TLD) String tld;
|
||||||
@Inject @Parameter(PARAM_CSV_DATA) String csvData;
|
|
||||||
@Inject NordnVerifyAction() {}
|
@Inject NordnVerifyAction() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -99,10 +95,6 @@ public final class NordnVerifyAction implements Runnable {
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
LordnLog verify() throws IOException {
|
LordnLog verify() throws IOException {
|
||||||
if (csvData.isEmpty()) {
|
|
||||||
throw new BadRequestException(
|
|
||||||
String.format("LORDN verify task %s: Missing CSV payload.", actionLogId));
|
|
||||||
}
|
|
||||||
logger.infofmt("LORDN verify task %s: Sending request to URL %s.", actionLogId, url);
|
logger.infofmt("LORDN verify task %s: Sending request to URL %s.", actionLogId, url);
|
||||||
HTTPRequest req = new HTTPRequest(url, GET, validateCertificate().setDeadline(60d));
|
HTTPRequest req = new HTTPRequest(url, GET, validateCertificate().setDeadline(60d));
|
||||||
lordnRequestInitializer.initialize(req, tld);
|
lordnRequestInitializer.initialize(req, tld);
|
||||||
|
|
|
@ -64,10 +64,4 @@ public final class TmchModule {
|
||||||
static String provideActionLogId(HttpServletRequest req) {
|
static String provideActionLogId(HttpServletRequest req) {
|
||||||
return extractRequiredHeader(req, NordnVerifyAction.HEADER_ACTION_LOG_ID);
|
return extractRequiredHeader(req, NordnVerifyAction.HEADER_ACTION_LOG_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Parameter(NordnVerifyAction.PARAM_CSV_DATA)
|
|
||||||
static String provideCsvData(HttpServletRequest req) {
|
|
||||||
return extractRequiredParameter(req, NordnVerifyAction.PARAM_CSV_DATA);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,8 +167,7 @@ public class NordnUploadActionTest {
|
||||||
assertTasksEnqueued(NordnVerifyAction.QUEUE, new TaskMatcher()
|
assertTasksEnqueued(NordnVerifyAction.QUEUE, new TaskMatcher()
|
||||||
.url(NordnVerifyAction.PATH)
|
.url(NordnVerifyAction.PATH)
|
||||||
.header(NordnVerifyAction.URL_HEADER, LOCATION_URL)
|
.header(NordnVerifyAction.URL_HEADER, LOCATION_URL)
|
||||||
.header(CONTENT_TYPE, FORM_DATA.toString())
|
.header(CONTENT_TYPE, FORM_DATA.toString()));
|
||||||
.param(NordnVerifyAction.PARAM_CSV_DATA, CLAIMS_CSV));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -185,8 +184,7 @@ public class NordnUploadActionTest {
|
||||||
assertTasksEnqueued(NordnVerifyAction.QUEUE, new TaskMatcher()
|
assertTasksEnqueued(NordnVerifyAction.QUEUE, new TaskMatcher()
|
||||||
.url(NordnVerifyAction.PATH)
|
.url(NordnVerifyAction.PATH)
|
||||||
.header(NordnVerifyAction.URL_HEADER, LOCATION_URL)
|
.header(NordnVerifyAction.URL_HEADER, LOCATION_URL)
|
||||||
.header(CONTENT_TYPE, FORM_DATA.toString())
|
.header(CONTENT_TYPE, FORM_DATA.toString()));
|
||||||
.param(NordnVerifyAction.PARAM_CSV_DATA, SUNRISE_CSV));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -52,12 +52,6 @@ import org.mockito.Mock;
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
public class NordnVerifyActionTest {
|
public class NordnVerifyActionTest {
|
||||||
|
|
||||||
private static final String CSV_DATA = "1,2012-08-16T00:00:00.0Z,3\n"
|
|
||||||
+ "roid,domain-name,SMD-id,registrar-id,registration-datetime,application-datetime\n"
|
|
||||||
+ "SH8013-REP,example1.gtld,1-2,9999,2012-08-15T13:20:00.0Z,2012-07-15T00:50:00.0Z\n"
|
|
||||||
+ "EK77-REP,example2.gtld,2-2,9999,2012-08-15T14:00:03.0Z\n"
|
|
||||||
+ "HB800-REP,example3.gtld,3-2,9999,2012-08-15T15:40:00.0Z\n";
|
|
||||||
|
|
||||||
private static final String LOG_ACCEPTED = "1,2012-08-16T02:15:00.0Z,2012-08-16T00:00:00.0Z,"
|
private static final String LOG_ACCEPTED = "1,2012-08-16T02:15:00.0Z,2012-08-16T00:00:00.0Z,"
|
||||||
+ "0000000000000478Nzs+3VMkR8ckuUynOLmyeqTmZQSbzDuf/R50n2n5QX4=,accepted,no-warnings,1\n"
|
+ "0000000000000478Nzs+3VMkR8ckuUynOLmyeqTmZQSbzDuf/R50n2n5QX4=,accepted,no-warnings,1\n"
|
||||||
+ "roid,result-code\n"
|
+ "roid,result-code\n"
|
||||||
|
@ -105,7 +99,6 @@ public class NordnVerifyActionTest {
|
||||||
persistResource(Registry.get("gtld").asBuilder().setLordnUsername("lolcat").build());
|
persistResource(Registry.get("gtld").asBuilder().setLordnUsername("lolcat").build());
|
||||||
lordnRequestInitializer.marksdbLordnPassword = Optional.of("attack");
|
lordnRequestInitializer.marksdbLordnPassword = Optional.of("attack");
|
||||||
action.tld = "gtld";
|
action.tld = "gtld";
|
||||||
action.csvData = CSV_DATA;
|
|
||||||
action.fetchService = fetchService;
|
action.fetchService = fetchService;
|
||||||
action.lordnRequestInitializer = lordnRequestInitializer;
|
action.lordnRequestInitializer = lordnRequestInitializer;
|
||||||
action.response = response;
|
action.response = response;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue