Significant technical debt has been eliminated. The latest best
practices are also now adopted for dealing with runfiles and dealing
with files across repositories.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140762937
Swap all calls to TldSpecificLogicProxy.getCreatePrice() to the counterpart in
DomainPricingLogic. Also makes necessary changes for testing to work, including
fake implementations of DomainPricingCustomLogic and
DomainCreateLofwCustomLogic.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140754334
By refactoring TldSpecificLogicProxy (and renaming it to DomainPricingLogic) into
a FlowScope object that is injected into each flow, we can further inject a
DomainPricingCustomLogic into the pricer, which has hooks into each pricing
calls, e. g. getCreatePrice(), getRenewPrice(), etc.
The benefit of these customization hooks is that methods like getCreatePrice()
get called in multiple flows, such as DomainAllocateFlow,
DomainApplicationCreateFlow, and DomainCreateFlow. By customizing the return
value of getCreatePrice() itself, all of its callers gets the amended price.
This CL only includes the basic infrastructure needed, with no actual hooks
placed into each flow.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140616990
This makes the associated nomulus tool commands correctly return error
exit codes when the server-side component fails. This improves
scriptability.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140543216
Soy is gaining support for parsing/validating html structure and as such a number of patterns will start getting rejected by the parser. This change fixes newly errant soy templates by:
* transforming '<' characters that are not part of html tags to '<'
* inserting whitespace following tag names so that they are unambiguous
* changing templates not rendering html to kind="text" so html rules don't apply
* fixing control flow such that all tags (and quoted attribute values) are completely defined within a single control flow block. In some cases this required extracting {let..} vars or whole templates and in others it required duplicating conditions.
* removing stray unmatched quote characters in html tags.
* fixing incorrectly written html comments
LSC: https://docs.google.com/document/d/18MLrX8kUVzYGe1dBaSfh1kcQ_1UB02QHOk4KZtvHkIc/edit#
Tested:
$ blaze test //third_party/java_src/gtld/java/google/registry/flows:all //third_party/java_src/gtld/java/google/registry/tools/soy:all
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140475284
This change removes ConfigModule from FlowComponent, since it's already present in all of the standard components that serve as "parents" to FlowComponent (i.e. it's in FrontendComponent, BackendComponent, ToolsComponent, and EppTestComponent). ConfigModule should only ever be included in top-level components, so that it's possible to swap it out without having to make changes deep within subcomponent code.
This change also removes SystemSleeperModule, which belongs at the top-level component as well, and is present in BackendComponent and ToolsComponent but was absent in FrontendComponent and EppTestComponent. I've added it to those two places.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140053552
Also fixes bug in handling of future-dated Recurring billing events.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140048357
This also adds a TODO in DomainCheckFlow to document the fact that as-of date is not overridden when passed to the custom logic.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140031318
It's likely that either 1) we should be doing this for more than a
SocketTimeoutException - we probably want to do this in the case of a number
of different transient failures 2) we don't want to do this at all because it
happens in a background task that will get re-run anyway.
In any case, this seems like the right fix and it addresses a problem we see
occassionally.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139935190
This also adds beforeValidation hook to DomainCreateCustomFlow.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139828346
This would have saved me 2+ hours yesterday of mucking around
in datastore and manually copying out the xml bytes so that
I could base64decode them.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139472542
While I am doing this, promote LoadAndResaveEntityCommand from
javascrap to the main tool since it's repeatedly been useful, and
rename it and update its documentation to better reflect the
difference between that command and the one I am adding.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139460841
This should have been getting turned into an InvalidHostNameException, but
wasn't. I've added tests for HostFlowUtils verifying the correct behavior for
this. Idn.toASCII() can throw IllegalArgumentException for some combinations
of input, including hostnames with a leading hyphen, so the call should be
inside the try block that turns IAEs into InvalidHostNameExceptions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139373849
Currently we pass in null. However, from the spec:
<domain:acDate> element that contains the date and time of a
required or completed response. For a PENDING request, the value
identifies the date and time by which a response is required
before an automated response action will be taken by the server.
For all other status types, the value identifies the date and time
when the request was completed."
- https://tools.ietf.org/html/rfc5731#page-16, section 3.1.3
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139363370
This also fixes up a hook on the domain create flow custom logic to use a single
parameter, which is the general pattern we want to use going forward. It also
establishes a pattern for custom logic being able to add extensions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139362230
and HostResource.
DomainApplication is not transferable and has no need for this
field. HostResource needs it because it can be transferred with
a domain.
This is all in service of removing the ofy().load() inside of
host's cloneProjectedAtTime.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139346925
The callsites were inconsistent between whether they were passing empty list or
null, and many of the ones that were passing null were not correctly annotated
with @Nullable. I'm now going with empty list throughout except for the final
step where the actual field that will be transformed into XML is set, where it
is coerced to null to avoid an empty element in the XML output.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139340837
To add additional logic for flow code, write custom classes that extend the existing custom logic classes (of which DomainCreateFlowCustomLogic is the first provided example), along with a class that extends CustomLogicFactory to provide instances of the new custom logic classes. Then configure the fully qualified class name of your new custom logic factory in ConfigModule.provideCustomLogicFactoryClass().
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139221577
HostResource and DomainApplication are not transferable, (or at
least, not directly in the case of hosts) and have no need for
the TransferData field. In a flat-flow world, we can push it down
to where it's actually used.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139201423
The job was starting at midnight and noon, which is exactly when the files are changing. This resulted in intermittent failures, as the files are temporarily missing during the changeover.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139081163
This prevents a potential blind write scenario in which something else has concurrently modified the EppResource in between load and save, and those changes then get overwritten.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138911873
1) Prefer .getConstructor().newInstance() over .newInstance()
because otherwise checked exceptions can be propagated from
the constructor even though they aren't declared.
2) Use the type T in the parameters to instantiate().
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138874730
This refactors RequestHandler so that it handles the construction of the request
component itself, rather than being handed a pre-built request component
instance constructed by the invoking servlet.
The motivation for this change is so that RequestHandler can be extended in
future CLs to compute authentication results, and can provide those results as
an available binding in the constructed request component. An alternative
approach could have been to compute the authentication results within
RequestModule itself, but I think it's clearer to keep business logic like
that outside of Dagger providers.
This CL makes the following individual changes:
- Adds request component builders, which implement a RequestComponentBuilder
interface so they can all be manipulated by RequestHandler
- Instead of obtaining request components via factory methods on the global
components, one now can have global-scoped bindings just inject the request
component builders (which requires adding a module to each global component
declaring the subcomponent). This follows the recommended approach here:
http://google.github.io/dagger/subcomponents.html
- Instead of exposing request components on the global component interface,
we now expose module-specific subclasses of RequestHandler that @Inject the
appropriate request component builder's provider and pass it to the superclass
(note that inheritance isn't strictly necessary here but saves boilerplate)
- RequestHandler now takes the Provider<RequestComponentBuilder> and builds
the component itself using its own fresh RequestModule instance. This provides
some nice encapsulation but is mainly needed for adding a RequestAuthModule
in future work.
- RequestHandler also takes UserService now, which can be provided via Dagger
by the subclass. Longer-term that will go away in favor of instead providing
AuthStrategy instances, some of which will use UserService internally.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138815648
Lai points out that, for creation, the as-of date should always be equal to the creation time. And, in fact, there was a check to throw an exception if that is not the case. So it's more straightforward just to remove that argument entirely.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138783711
This is the third and final phase in the migration away from ReferenceUnions.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138778148
This CL applies the status flag logic, but doesn't yet do any name checking
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138769004
This defaults to null, and leaving it to null now simply disables reserved terms
exporting, rather than throwing an error every time the action runs.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138763161
This change moves the reflective setAccessible() calls on the request component
methods (needed so that they can be invoked reflectively from RequestHandler)
to within Router itself, eliminating the need to manually call this from each
Servlet class and then pass in the resulting Method objects. Instead, we just
pass in the request component class and let Router do the rest.
Old comments say that cross-package reflection is not allowed on AppEngine, but
while it's quite possible this was once the case, I can't reproduce that
limitation, and the documentation seems to contradict any such restriction:
"""
An application is allowed full, unrestricted, reflective access to its own
classes. It can query any private members, call the method
java.lang.reflect.AccessibleObject.setAccessible(), and read/set private
members.
"""
https://cloud.google.com/appengine/docs/java/runtime#reflection
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138693006
Calling setAccessible() cross-package used to fail in
the custom security manager. It never shouldn have failed,
and now it works correctly (not sure when it was fixed) so
remove these trampolines.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138549703