Commit graph

897 commits

Author SHA1 Message Date
guyben
6bcd40f18a Remove "keepTasks" from ReadDnsQueueAction
"keepTasks" is a flag that prevents ReadDnsQueueAction from removing dns-update
tasks from the dns-pull queue, while still launching PublishDnsUpdates tasks to
update the DNS (meaning these tasks will be updated again in the next
ReadDnsQueueAction).

I'm not sure what's the purpose of this flag, but given we now allow multiple
writers (meaning we can already publish the same DNS multiple times) and given
that we can now recover from a bad writer (if a writer doesn't belong to a TLD,
we put the dns-updates queued for that writer back into the dns-pull queue) - I
suspect we don't need it anymore.

Alternative considered: changing this to a "dryRun" flag that won't actually
launch PublishDnsUpdates tasks, but will log which tasks it would have
launched. Decided against it because we will still need to "own" any task for a
significant amount of time if there are many (tens of thousands) tasks in the
queue. Hence a "dryRun" will still affect any actual runs for some time.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183997187
2018-02-01 22:05:40 -05:00
guyben
4b23523d74 Consolidate some domain creation / deletion EPPs in testdata
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183847223
2018-02-01 22:03:57 -05:00
jianglai
169fd62da7 Add dependencies on classes that are not in the default modules in JDK 9
This is a follow-up to []

Also added jaxws-api Maven dependency and upgraded activation artifacts to 1.2.0, in parity with //third_party/java/activation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183714304
2018-02-01 22:00:49 -05:00
larryruili
74ced1e907 Refactor ICANN reporting and billing into common package
This moves the default yearMonth logic into a common ReportingModule, rather than the coarse-scoped BackendModule, which may not want the default parameter extraction logic, as well as moving the 'yearMonth' parameter constant to the common package it's used in. This also provides a basis for future consolidation of the ReportingEmailUtils and BillingEmailUtils classes, which have modest overlap.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183130311
2018-02-01 21:56:06 -05:00
mcilwain
9d532cb507 Add extensibility framework for allocation tokens
This uses an extensibility mechanism similar to that of WhoisCommandFactory
and CustomLogicFactory, namely, that a fully qualified Java class is
specified in the YAML file for each environment with the allocation token
custom logic to be used.  By default, this points to a no-op base class
that does nothing.  Users that wish to add their own allocation token
custom logic can simply create a new class that extends
AllocationTokenCustomLogic and then configure it in their .yaml config
files.

This also renames the existing *FlowCustomLogic *Flow instance variables
from customLogic to flowCustomLogic, to avoid the potential confusion with
the new AllocationTokenCustomLogic class that also now exists.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=183003112
2018-02-01 21:54:29 -05:00
jianglai
97e962ba0a Add //third_party/java/jaxb dependency to targets using javax.xml.bind
To make FOSS build compile, third_party vendoring rules for jaxb are added to package all jaxb related targets imported from maven into a uber jar, mirroring the same practice done in //third_party/java/jaxb

Cloned from CL 182666460 by 'g4 patch'.
Original change by cushon@cushon:rosie182283995-0071_Rosie:47348:citc on 2018/01/20 13:36:15.

More information:
https://docs.google.com/document/d/1htErgDIoHMEuMBfGwrtS_O4WwhTw8QOGLva-7aYYvYs/edit?usp=sharing
Tested:
    TAP --sample for global presubmit queue
    []    passed FOSS test

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182855173
2018-01-23 16:18:35 -05:00
mcilwain
81dc2bbbc3 Rationalize logging statements across codebase
This fixes up the following problems:
1. Using string concatenation instead of the formatting variant methods.
2. Logging or swallowing exception messages without logging the exception
   itself (this swallows the stack trace).
3. Unnecessary logging on re-thrown exceptions.
4. Unnecessary use of formatting variant methods when not necessary.
5. Complicated logging statements involving significant processing not being
   wrapped inside of a logging level check.
6. Redundant logging both of an exception itself and its message (this is
   unnecessary duplication).
7. Use of the base Logger class instead of our FormattingLogger class.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182419837
2018-01-19 14:56:45 -05:00
guyben
bf321ca044 Add label for the DnsWriter in the publishDnsUpdates metrics
This allows grouping metrics based on the DnsWriter. We can already group by
the TLD, but since a TLD can have multiple writers, and since different writers
perform very differently from one another, it could be important to group by
writer as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182255398
2018-01-19 14:53:21 -05:00
jianglai
b6d2790a13 Add TokenStore and QuotaManager to manage proxy quota requests
The TokenStore is configured by a QuotaConfig for a protocol (EPP/WHOIS). It accepts concurrent take, put and refresh request to grant/accept token to the caller.

The QuotaManager contains a TokenStore and provides abstractions that are appropriate for a quota leasing entity to use. Quota return calls are executed asynchronously by the QuotaManager, and quota refresh tasks are scheduled by the QuotaManager to run periodically.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182109341
2018-01-19 14:46:44 -05:00
mountford
e577d2f5e9 Add support for RDAP retrieval of all registrars
This CL also fixes a bug. Registrars were returned in an arbitrary order. This caused cursor-based pagination to fail. Now we always sort by registrar name (even for handle searches), and use the registrar name in the cursor, to ensure proper behavior.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182098187
2018-01-19 14:45:15 -05:00
mcilwain
c416b3892d Migrate final try/catch test assertions to use assert/expectThrows
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182091814
2018-01-19 14:43:12 -05:00
mcilwain
fe7cc4f782 Fix failing BillingEmailUtilsTest assertion on content type
The new version of the framework that works correctly for this isn't
externally available quite yet, so leave it at text/plain for the time
being.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181817266
2018-01-19 14:41:39 -05:00
mcilwain
315e6d57bf Make EppInput.getSingleExtension() return Optional, not @Nullable
This makes it harder to use it incorrectly by accident.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181795813
2018-01-19 14:40:10 -05:00
larryruili
a42f18798e Move invoice generation to billing bucket and improve emailing
This moves the new pipeline's invoice generation to the billing bucket, under the 'invoices/yyyy-MM' subdirectory.

This also changes the invoice e-mail to use a multipart message that attaches the invoice to the e-mail, to guarantee the correct MIME type and download.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181746191
2018-01-19 14:34:14 -05:00
mcilwain
5726f1dc4e Add base AllocationToken validation logic for domain checks
Next up is adding custom logic so that the results of these checks can be
more meaningful.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181660956
2018-01-19 14:32:48 -05:00
mountford
716ba726fc Add RDAP search support for only contacts or only registrars
By default, RDAP entity searches return both contacts and registrars. This CL
adds a new query parameter to request only one or the other. Among other
benefits, this will allow a future CL to permit wildcard searches that return
all registrars.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181605990
2018-01-19 14:29:54 -05:00
mcilwain
e07d011bc6 Add basic AllocationToken validation/redemption for domain creates
The next step is to add them for domain checks as well (which is simpler
because it doesn't involve validation).

This requires the addition of a TrimWhitespaceAdapter for XML JAXB objects,
which will prove useful for other @XmlValue attributes in the future.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181526726
2018-01-19 14:28:26 -05:00
mcilwain
646dcecd7e Create GenerateAllocationTokens nomulus tool command
This creates a specified number of tokens of a given schema, with a dryrun option
to not persist them.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181403775
2018-01-19 14:26:56 -05:00
mcilwain
ccbe958063 Add create timestamp as field on AllocationToken entity
This definitely seems like a useful thing to have around.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181401799
2018-01-19 14:25:28 -05:00
mcilwain
5f62947691 Add and wire up the AllocationTokenExtension XML class
The extension itself isn't used for anything yet; allocation tokens can be
passed for domain creates and checks but are ignored if present. This will
be changed in a subsequent CL that adds AllocationToken entities and related
logic. Usage of this extension in any other EPP flow will throw an
UnsupportedExtensionException.

The relevant spec is https://tools.ietf.org/html/draft-gould-allocation-token-04

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181343188
2018-01-19 14:23:59 -05:00
mcilwain
f6f43badd4 Add basic AllocationToken entity and tests
Logic actually using this entity to follow in subsequent CLs introducing
the command to generate/save these entities as well as the flow logic for
considering them during domain EPP operations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181342600
2018-01-19 14:22:30 -05:00
larryruili
d2d7fdeb90 Add TODO to filter by tldState in billing pipeline
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180973229
2018-01-19 14:21:00 -05:00
larryruili
ab5e16ab67 Add publish functionality to billing pipeline
This closes the end-to-end billing pipeline, allowing us to share generated detail reports with registrars via Drive and e-mail the invoicing team a link to the generated invoice.

This also factors out the email configs from ICANN reporting into the common 'misc' config, since we'll likely need alert e-mails for future periodic tasks.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180805972
2018-01-04 17:17:59 -05:00
jianglai
07622725bf Move metrics dependencies to artifacts under Maven groupId com.google.monitoring-client
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180580386
2018-01-04 17:12:35 -05:00
guyben
3f7cd00882 Replace FluentIterable with streams
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180005797
2017-12-27 11:40:50 -05:00
larryruili
552ab12314 Prepare billing pipeline for production
This makes a few cosmetic changes that prepares the pipeline for production.

Namely:
- Converts file names to include the input yearMonth, mostly mirroring the original invoicing pipeline.
- Factors out the yearMonth logic from the reporting module to the more common backend module. We will likely use the default yearMonth logic in other backend tasks (such as spec11 reporting).
- Adds the "withTemplateCompatability" flag to the Bigquery read, which allows multiple uses of the same template.
- Adds the 'billing' task queue, which retries up to 5 times every 3 minutes, which is about the rate we desire for checking if the pipeline is complete.
- Adds a shell 'invoicing upload' class, which tests the retry semantics we want for post-generation work (e-mailing the invoice to crr-tech, and publishing detail reports)

While this cl may look big, it's mostly just a refactor and setting up boilerplate needed to frame the upload logic.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179849586
2017-12-27 11:39:21 -05:00
mcilwain
53ed6035c4 Replace LinkedList with ArrayList
ArrayList is more performant and there's no reason to use a LinkedList here.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179717525
2017-12-27 11:37:18 -05:00
guyben
2c96633a20 Replace Stream.concat with Streams.concat
Stream.concat only accepts 2 parameters. Streams.concat on the other hand
accepts any number of parameters.

Moving to Streams.concat for all uses (2 or more) makes sense for uniformity
and convenience reasons.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179716648
2017-12-27 11:35:47 -05:00
larryruili
eb07768200 Add integration test for billing pipeline IO
This creates an end-to-end test that checks for proper billing pipeline IO writes. The only remaining test would be to add a test for the Bigquery query, but see b/70839142 for why I've deemed that more work than worthwhile.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179706561
2017-12-27 11:34:15 -05:00
guyben
7d165a08cf Replace assertThat(stream.collect(toImmutableList())) with assertThat(stream)
In Truth8, we can do assertThat(stream) directly. It's less verbose and clearer
in most cases.

Note that for the "finishers" (e.g. "containsExactyElementsIn") - streams are
still not allowed. So when there is:
assertThat(stream.map(someTransformation).collect(toList()))
.containsExactlyElementsIn(expecteStream.map(someTransformation).collect(toList()));

I kept the .collect in the assertThat to preserve the symmetry with the
finisher.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179697587
2017-12-27 11:32:45 -05:00
mcilwain
b7c8bc6e27 Add an EPP lifecycle test verifying that EAP fees are not refunded
This also incorporates general improvements and additions to the existing EPP
lifecycle tests around domain deletion.  As a refresher: There is a 5 day
add grace period (AGP) following domain creation. Domains that are deleted
during that period have their create costs (but not EAP costs) refunded. This
deletion takes place immediately. Refunds are implemented by issuing a
Cancellation for the associated OneTime billing event.

Domains that are deleted after AGP ends first go through a 30 day redemption
grace period followed by a 5 day pending deletion period. No create fees are
refunded in this case.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179597874
2017-12-27 11:29:07 -05:00
mcilwain
842689f0c1 Use method references when possible
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179586059
2017-12-27 11:25:02 -05:00
mcilwain
ed0670b614 Remove unnecessary type specifications
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179585680
2017-12-27 11:23:03 -05:00
guyben
f1ae66d148 Replace com.google.common.base.Predicate with java.util.function.Predicate
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179579304
2017-12-27 11:21:28 -05:00
guyben
633eb3179a Skip RRS update if existing records are equal to desired records
This is done first and formost to stop "empty" commits that cause errors in
publishDnsUpdates. The reason being that the Cloud DNS api fails when there are
no updates at all in a change.

Allowing this is a requirement for the writer to be idempotent - if we delete a
domain, then run the writer to delete it again - we'll get 0 additions and 0
deletions which fails.

This isn't theoretical either - we've seen it happen, causing a
publishDnsUpdates to fail over and over again.

While fixing this, we also remove all RRS that are common between additions and
deletions. This is just an optimization and shouldn't affect behavior.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179525218
2017-12-27 11:18:21 -05:00
mountford
42795074a8 Add next page navigation for RDAP domain searches
In addition, while adding the tests, I became discontented with the thoroughness of the cursor navigation tests, which checked only the number of items returned, not their proper ordering. So I updated them to be more careful, and backported the changes to the nameserver and entity search tests as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179442118
2017-12-27 11:15:18 -05:00
guyben
8157928a35 Replace com.google.common.base.Function with java.util.function.Function
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179249159
2017-12-27 11:08:55 -05:00
mcilwain
d538dca2e0 Re-add EppException marshalling assertions in domain flow tests
Apologies for the reformatting, but this refactoring is quite rote and it's
definitely a bigger use of total time to perform the reformatting individually
than to simply do it file-wide.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179238852
2017-12-27 11:07:18 -05:00
mcilwain
34699465d5 Re-add EppException marshalling assertions in host flow tests
Apologies for the reformatting, but this refactoring is quite rote and it's
definitely a bigger use of total time to perform the reformatting individually
than to simply do it file-wide.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179238745
2017-12-27 11:05:46 -05:00
mcilwain
e17109a0eb Re-add EppException marshalling assertions in remaining domain flows
Apologies for the reformatting, but this refactoring is quite rote and it's
definitely a bigger use of total time to perform the reformatting individually
than to simply do it file-wide.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179238504
2017-12-27 11:04:16 -05:00
mcilwain
5e4a6b0235 Re-add EppException marshalling assertions in application flow tests
Apologies for the reformatting, but this refactoring is quite rote and it's
definitely a bigger use of total time to perform the reformatting individually
than to simply do it file-wide.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179221800
2017-12-27 11:02:42 -05:00
mcilwain
da08baab92 Re-add assertions that EppExceptions marshal correctly
These checks were removed in [] and re-adding them is the last
step of the migration to using expectThrows/assertThrows globally.

Note that this is roughly half of them. More to come in a follow-up CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179216707
2017-12-27 11:01:09 -05:00
mcilwain
16a1d6d196 Refactor the last usages of ExpectedException to assert/expectThrows
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179095403
2017-12-27 10:56:36 -05:00
mcilwain
fbe11ff33c Use method references instead of lambdas when possible
The assertThrows/expectThrows refactoring script does not use method
references, apparently.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179089048
2017-12-27 10:55:03 -05:00
mountford
e619ea1bff Add next page navigation for RDAP entity searches
A couple methods were moved to new locations so they are accessible to all types of search queries, not just nameservers like they originally were.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179089014
2017-12-27 10:53:30 -05:00
mcilwain
c8059d4d8a Add transactional import helper in RdeImportUtilsTest
This is needed to fix an inability in Java 8 to correctly infer the type
when the transaction was being allowed to return the value it loaded. The
error was:

INFO: Compilation unit  has error diagnostics: [third_party/java_src/gtld/javatests/google/registry/rde/imports/RdeImportUtilsTest.java:109: error: incompatible types: inference variable R has incompatible bounds
    ofy().transact(() -> rdeImportUtils.importEppResource(newContact));
                  ^
    upper bounds: java.lang.Object
    lower bounds: void, third_party/java_src/gtld/javatests/google/registry/rde/imports/RdeImportUtilsTest.java:132:
error: incompatible types: inference variable R has incompatible bounds

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179082154
2017-12-27 10:51:55 -05:00
mcilwain
9157930983 Automatically refactor more exception testing to use new JUnit rules
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179072309
2017-12-27 10:50:20 -05:00
guyben
d5d29959b4 Turn on DNSSEC for new Cloud DNS TLDs
we set the "denial of existence" to NSEC (rather than NSEC3), because preventing "walking the zone" isn't an issue for TLDs.

It uses the default security configuration for everything else, which at the time of this writing is:

Key signing: RSASHA256, key length of 2048
Zone signing: RSASHA256, key length of 1024

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179045575
2017-12-27 10:48:42 -05:00
mcilwain
0d3ec66259 Manually migrate exception assertions in RdeImportUtilsTest
It was easier to simply move these over manually than to try to debug
the automated tooling.

I also changed the case in an exception message.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178926365
2017-12-27 10:47:07 -05:00
mountford
359bab291b Add next page navigation for RDAP nameserver searches
Domain and entity searches will be handled in future CLs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178912832
2017-12-27 10:44:05 -05:00