Commit graph

623 commits

Author SHA1 Message Date
jart
59f4984083 Upgrade Nomulus to latest Closure Rules
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
2016-12-06 11:52:46 -05:00
jianglai
79a72387ee Migrate getCreatePrice() call to DomainPricingLogic
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
2016-12-06 11:52:46 -05:00
mcilwain
f8b4c9eddb Add extensible custom logic to domain application create flow
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140656367
2016-12-06 11:52:46 -05:00
jianglai
99c16dc345 Make domain pricing customizable
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
2016-12-06 11:52:46 -05:00
mcilwain
5f32d1bbeb Correctly set HTTP error status codes when list objects fails
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
2016-12-06 11:52:46 -05:00
jianglai
b35ac10b7e Add extensible custom logic to the domain delete flow
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140534389
2016-12-06 11:52:46 -05:00
lukes
8a8276e838 ​​​Remove html ambiguity from soy templates.
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 '&lt;'
* 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
2016-12-06 11:52:46 -05:00
mcilwain
2b7d580bb3 Run buildifier on codebase to format BUILD files
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140362453
2016-11-28 18:15:21 -05:00
cgoldfeder
f5d0de61f2 Fix bad javadoc
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140389732
2016-11-28 17:43:10 -05:00
cgoldfeder
bc491fda75 Remove useless status in DomainDeleteFlow
Domains can't have LINKED status.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140389416
2016-11-28 17:41:40 -05:00
nickfelt
aa670e5df2 Remove extraneous modules from FlowComponent
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
2016-11-28 11:38:02 -05:00
mcilwain
5eb9702f05 Improve ListDomainsCommand to list domains on multiple TLDs
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140053423
2016-11-28 11:36:17 -05:00
ctingue
35d88a9f8c Rethrow exceptions in ExpandRecurringBillingEventsAction
Also fixes bug in handling of future-dated Recurring billing events.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140048357
2016-11-28 11:34:30 -05:00
jianglai
9a616ccd7f Add extensible custom logic to the domain renew flow
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
2016-11-28 11:32:47 -05:00
mmuller
ddacd33c5e Retry RDE report on SocketTimeoutException
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
2016-11-28 11:31:16 -05:00
mcilwain
b3907d5d90 Add Javadocs to parameters for DomainCreateFlowCustomLogic methods
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139912059
2016-11-28 11:29:46 -05:00
jianglai
998dae33ec Add extensible custom logic to the domain update flow
This also adds beforeValidation hook to DomainCreateCustomFlow.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139828346
2016-11-28 11:28:16 -05:00
jianglai
2d85ec9aa3 Add extensible custom logic to the domain info flow
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139584129
2016-11-28 11:26:42 -05:00
cgoldfeder
5bac24186f Add the ability to dump the history of a single resource
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
2016-11-28 11:25:06 -05:00
cgoldfeder
419a04bc26 Command to resave datastore entities by websafe key
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
2016-11-28 11:23:29 -05:00
mcilwain
c711097357 Fix a generic type inference issue in Java 7
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139378025
2016-11-28 11:20:09 -05:00
mcilwain
d2139d9825 Add explicit generic type parameters to make Java 7 build happy
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139374166
2016-11-16 17:11:14 -05:00
mcilwain
16c53c6996 Fix uncaught LEADING_HYPHEN IllegalArgumentException in host flows
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
2016-11-16 17:09:45 -05:00
cgoldfeder
438eeb5e38 When resolving a transfer to SERVER_CANCELLED (on delete) still pass in a time
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
2016-11-16 17:08:14 -05:00
mcilwain
a343648b34 Add extensible custom logic to the domain check flow
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
2016-11-16 17:06:43 -05:00
cgoldfeder
fdc8ceb6bb Scope down lastTransferTime to only ContactResource, DomainResource
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
2016-11-16 17:05:13 -05:00
mcilwain
5368489987 Enforce nullness consistency on EppResponse.set...() methods
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
2016-11-16 17:03:43 -05:00
mcilwain
4d2e0941f3 Add a custom logic framework to provide pluggable extensibility
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
2016-11-15 15:19:32 -05:00
mcilwain
3942f0768b Fix Nomulus build type inference error on resolvePendingTransfer()
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139219997
2016-11-15 15:19:29 -05:00
mountford
fb47d2563d Add extra flow logic hooks for transfer approve, cancel and reject
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=139217498
2016-11-15 13:52:01 -05:00
cgoldfeder
84009eaccb Scope down TransferData to only ContactResource and DomainResource
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
2016-11-15 13:47:28 -05:00
mountford
890354938c Switch TMCH SMDRL fetch job to start at 00:15 and 12:15
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
2016-11-15 11:02:42 -05:00
mcilwain
7ed02f4612 Reload resources before saving in ReloadAllEppResourcesAction
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
2016-11-15 10:59:47 -05:00
ctingue
fab8ca8414 Move injectable config values into ConfigModule
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138903917
2016-11-15 10:58:20 -05:00
ctingue
1b6f2f82cd Clean up BillingEvent.Reason.AUTO_RENEW and scraps
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138903021
2016-11-15 10:56:52 -05:00
cgoldfeder
d5104df453 Fix two ErrorProne warnings in TypeUtils
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
2016-11-15 10:50:39 -05:00
nickfelt
f742ac8056 Refactor RequestHandler to handle request component construction
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
2016-11-15 10:49:05 -05:00
mountford
0634e25822 Remove as-of date from argument list for extra create flow logic
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
2016-11-15 10:46:04 -05:00
mcilwain
07a6e55f82 Add missing @Nullable annotations to ForeignKeyIndex load methods
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138782186
2016-11-15 10:44:32 -05:00
mcilwain
780a5add78 Get rid of ReferenceUnions entirely
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
2016-11-15 10:42:58 -05:00
mountford
8d97fa5858 Add TLD-specific logic for application creates
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
2016-11-15 10:39:51 -05:00
mcilwain
274b070b54 Make driveFolderId on Registry entity optional
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
2016-11-15 10:38:20 -05:00
nickfelt
9122372e38 Change Router to do reflective setAccessible() calls itself
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
2016-11-10 12:30:44 -05:00
mountford
59c213c66f Add extra flow logic hook for application info
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138683307
2016-11-10 12:30:44 -05:00
mountford
09beacf746 Add extra flow logic hook for domain allocation
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138679232
2016-11-10 12:30:44 -05:00
mcilwain
225f25bf42 Fix build error by adding testonly=1 to eclipse BUILD file
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138652263
2016-11-10 12:30:20 -05:00
dxy
0263667dae Add Google Cloud Storage helper for non-GAE environment
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138563147
2016-11-10 12:30:00 -05:00
Francis Aiello
1671508547 Set svID in ConfigModule instead of hard-coding it
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138552819
2016-11-10 12:29:53 -05:00
cgoldfeder
1abd0e1123 Remove FieldExposers, since GAE reflection works normally
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
2016-11-10 11:32:07 -05:00
mcilwain
2cbfd6475d Fix @Provides method name in ConfigModule for consistency
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138512734
2016-11-10 11:30:36 -05:00