Commit graph

281 commits

Author SHA1 Message Date
Shicong Huang
1ded33ecea
Resolve warnings in the Hibernate log (#542) 2020-04-03 18:04:55 -04:00
Shicong Huang
bac1998d6a Auto-apply JPA converters for map type (#520)
* Add map converter

* Delete old map usertype

* Refactor bind

* Change to use map entry

* Use Map.Entry
2020-04-02 16:43:08 -04:00
gbrodman
4a34369ba9
Submit a task to relock domains if desired upon verification (#529)
* Submit a task to relock domains if desired upon verification

* Merge remote-tracking branch 'origin/master' into verifyRelock

* Respond to CR
2020-04-02 15:18:29 -04:00
Shicong Huang
db7d49801d
Supress exccesive logging message from Cloud SQL (#540)
* Supress exccesive logging message from Cloud SQL

* Upgrade package versions that were downgraded before
2020-03-31 17:57:18 -04:00
sarahcaseybot
0c52d209e5
Fix IllegalArgumentException (#536)
* Fix IllegalArgumentException

* Add more information about global locks

* Add null checks
2020-03-30 11:36:09 -04:00
gbrodman
73b98d298b
Add a set of radio buttons for relock duration (#535)
* Add a set of radio buttons for relock duration
2020-03-30 11:06:32 -04:00
Michael Muller
7880aab386
Fix optional access for VKey nested keys (#539)
* Fix optional access for VKey nested keys

We should have used ofNullable() instead of of() for key creation.  Also add a
unit test.
2020-03-30 11:01:25 -04:00
Michael Muller
fa9134328a
Improve error information in coverage test. (#537)
* Improve error information in coverage test.

If the golden schema isn't up-to-date with the persistence model, the coverage
tests fail with an exception chain that ends in a PSQLException 'relation
"TableName" does not exist' which is kind of misleading when the problem is
that your golden schema isn't up-to-date.

Check for this error in the coverage tests and generate a more informative
error message indicating a likely root cause.
2020-03-27 14:58:01 -04:00
Michael Muller
5b452bf074
Key to VKey conversion for Nameserver (#476)
* Key to VKey conversion for Nameserver

This change illustrates the conversion of a single key in the system
(Key<HostResource> as used in the "nameservers" field of DomainBase) to a
VKey.

It currently builds, but had some curious (possibly unrelated?) test failures
that I have not fully investigated.

* Latest round of changes, all tests pass.

* Changes requested in review.

* Fix problems with null check in VKey accessors

Add maybeGet versions of getSqlKey() and getOfyKey() that return Optional
objects and make the nameserver management routines use those instead.
2020-03-26 17:13:30 -04:00
Weimin Yu
f749236500
Reuse JPA EntityManagerFactory in tests (#533)
* Reuse JPA EntityManagerFactory in tests

Reuse EntityManagerFactory instance in tests if the requested schema
stays the same. Only truncate tables and reset sequences when reusing.

Note that the jdbc driver needs to be informed to expect out-of-band
schema changes.
2020-03-26 16:51:47 -04:00
gbrodman
e7825fae66
Don't rely on the password field's existence for admins (#534)
* Don't rely on the password field's existence for admins

We don't have the field when it's an admin user that's logged in. A
nicer language would have caught this unfortunately.
2020-03-26 15:55:54 -04:00
gbrodman
91155d6c67
Fix up lock modal wording (#532)
* Fix up lock modal wording

When locking a domain, the "domain" variable is null so we shouldn't
display it.
2020-03-26 15:52:11 -04:00
gbrodman
2ff1026cfd
Handle null GAE user IDs gracefully (for non-admins) (#531)
Unfortunately in our testing environments, we're all admins so it's easy
to miss things like this.
2020-03-26 14:29:05 -04:00
Weimin Yu
f1c46b8030
Drop postgresql schema instead of database in Sql tests (#530)
* Drop schema instead of database in Sql tests

Speed up the database cleanup between tests by dropping the schema
instead of the database. The new approach is much faster.

Ad hoc measurement on my desktop shows that :core:sqlIntegrationTest
improves from 73 seconds to 48 seconds, and :core:standardTest
improves from 12m40 to 7m40.
2020-03-25 21:03:58 -04:00
gbrodman
d663bf4db5
Add CSS spinner while loading locks content (#527)
* Add CSS spinner while loading locks content
2020-03-24 15:33:17 -04:00
gbrodman
acf0baf048
Fix semantic merge conflict (#528) 2020-03-24 12:29:11 -04:00
gbrodman
2998b56982
Add min length to password fields (#524)
* Add min length to password fields
2020-03-24 11:16:05 -04:00
gbrodman
7b602300d8
Use the relock duration if provided in RLPA (#519)
* Use the relock duration if provided in RLPA
2020-03-24 10:33:43 -04:00
Ben McIlwain
fe760d7066
Allow backwards compatibility with JUnit 4 @Rules in JUnit 5 (#526)
* Allow backwards compatibility with JUnit 4 @Rules in JUnit 5

This allows us to defer having to re-implement all of our JUnit 4 Rules as JUnit
5 extensions for now, while continuing to in-place upgrade all existing JUnit 4
test classes to JUnit 5.

As proof of concept, this upgrades PremiumListUtils (which uses AppEngineRule,
our largest and most complicated @Rule) to use the JUnit 5 test runner.

* Apply formatter to entire file
2020-03-23 14:45:54 -04:00
gbrodman
ad06f265a5
Flat-map registry lock emails to avoid unclean errors in bad situations (#525)
* Flat map to avoid unclean errors in bad situations

Also properly reflect that for admins, we will use their user email

* Make MS's GAE user ID a public static field
2020-03-23 11:45:49 -04:00
Shicong Huang
fa9400ebc5
Set postgres package back to runtime dependency (#522) 2020-03-20 15:43:30 -04:00
gbrodman
519a85af85
Add a registryLockEmailAddress field to RegistrarConctact objects (#523)
* Add a registryLockEmailAddress field to RegistrarConctact objects

Because we need to manage the login email, it should be on an account
that we manage. However, for registry lock, we would want to send the
verification emails to a separate email address that the user can use.

As a result, we will use a second field for a user-accessible registry
lock email address. This must be set on the contact when enabling
registry lock for this contact.

* Responses to CR

* derp
2020-03-20 14:12:00 -04:00
sarahcaseybot
b2df127dc4
Add lock dual read (#517)
* Add lock dual read

* small changes
2020-03-20 14:11:00 -04:00
gbrodman
b21042bda9
Fix the test server (#521)
* Fix the test server

This rule isn't necessary any more since we merged the SQL-starting rule
into the AppEngineRule logic. Furthermore, it actually causes the test
server to crash because we try to drop-and-create the DB twice, the
second time while the first instance is still connected.
2020-03-19 11:05:51 -04:00
Shicong Huang
d01f1f7604
Make jpaTm for nomulus tool use local credential (#515)
* Make jpaTm for nomulus tool use local credential

* Remove unused methods in RegistryToolEnvironment

* Fix order of annotations

* Remove unused method in PersistenceComponent

* Move the creation of credential to the module

* Move creadential creation to AuthModule

* Add a TODO
2020-03-17 20:16:42 -04:00
gbrodman
e9610636e4
Add a relockDuration to the RegistryLock SQL object (#514)
* Add a relockDuration to the RegistryLock SQL object

This is the length of time after an unlock that we will re-lock the
domain in question.

* Sort by domain name for stability

Note: this is likely not the best solution for the UI but we can iterate
on this.

* Add nullable

* Add a converter for Duration
2020-03-16 17:44:25 -04:00
gbrodman
d09fc7ee05
Match logged-in GAE user ID with registrar POC user ID (#511)
* Match logged-in GAE user ID with registrar POC user ID

The reasoning for this is thus:
We wish to have the users log in using Google-managed addresses--this is
so that we can manage enforcement of things like 2FA, as well as generic
account management. However, we wish for the registry-lock confirmation
emails to go to their standard non-Google email addresses--e.g.
johndoe@theregistrar.com, rather than johndoe@registry.google.

As a result, for registry lock, we will enable it on
the johndoe@registry.google account, but we will alter the email address
of the corresponding Registrar POC account to contain
johndoe@theregistrar.com. By doing this, the user will still be logging
in using the @registry.google account but we'll match to their actual
contact email.

* fix up comments and messages

* Error if >1 matching contact

* include email addresses

* set default optional

* fix tests
2020-03-16 11:38:05 -04:00
Shicong Huang
0545375eba
Change cloud sql SDK to compile level dependency (#516) 2020-03-16 10:24:19 -04:00
Michael Muller
8a045aedd0
Disambiguate naming of VKey.create() overloads (#513)
* Disambiguate naming of VKey.create() overloads

It was discovered in the course of trying to convert the larger codebase
to VKey.create() calls that method overloading isn't a very effective
discriminator in cases where "Object" is one of the distinguishing
argument types:-)

Convert the two specialized create() methods to createOfy() and
createSql() so that (at least in the former case) we'll get a
compile-time error if we aim to create a VKey for an Ofy key from an
object of the incorrect type.
2020-03-12 16:13:12 -04:00
gbrodman
560bec1e83
Add a RelockDomainAction for future auto-relocks (#485)
* Add a RelockAction and reference to relocks in RegistryLocks

* Respond to CR

- refactor the request param exception logging a bit
- don't log an error if the domain was already locked, just skip

* Save a relock for all locks (if possible)

* derp

* Long -> long + remove unnecessary transact

* semantic merge conflict woo

* fix another semantic merge conflict
2020-03-12 16:02:27 -04:00
Weimin Yu
6ed7e00b00
Update SqlIntegrationTestSuite (#510)
* Update SqlIntegrationTestSuite

Edited Javadoc to emphasize that suite members should be DAO tests.

Removed functional tests from the suite. They do not benefit much
from running against different schemas when the entities they use
are already covered by DAO tests.

Added DomainBaseSqlTest to the suite, which tests DomainBase.
2020-03-11 14:11:53 -04:00
Shicong Huang
3098048fdb
Enable Cloud SQL when Datastore is enabled for unit test (#502)
* Enable Cloud SQL when Datastore is enabled for unit test

* Add explanation for why add a ETA field in GenerateEscrowDepositCommand

* Fix line length

* Ignore membershipt test but bring back test suite

* Fix tiny issue
2020-03-10 12:26:25 -04:00
gbrodman
f2846fc914
Gray out the password field for admins (#506)
* Gray out the password field for admins

We don't check it for admins since it's not necessary, so ignore it

* Remove the field entirely
2020-03-10 11:30:20 -04:00
gbrodman
499237ac57
Listen to the user hitting enter in the lock/unlock modal input fields (#505)
* Listen to the user hitting enter in the lock/unlock modal input fields

Listen to both, just in case one or the other is disabled

* Don't require that the element exist
2020-03-10 11:22:57 -04:00
Weimin Yu
6bd50421bc
Fix broken builds when Maven Central is used (#509)
* Fix broken builds when Maven Central is used

Gradle 6.2.1 apparently introduces a behavior change wrt boolean
expression: empty string used to eval to false, but now evals to
true.

Pre Gradle 6.2.1, root project's Gradle properties apparently were
not set to buildSrc. Now they are passed on to buildSrc -- mavenUrl
in buildSrc changes from null to "".

Both changes break the project when mavenUrl and/or pluginsUrl are
not set on command line.

Also added junit.jupiter-api as testCompile dependencies to projects.
This is a directly used dependency, whose absence causes a Lint
warning.
2020-03-10 11:21:03 -04:00
sarahcaseybot
dbdd2b4491
Add Lock dual write (#496)
* Add Lock dual write

* wrap calls in DB transaction
2020-03-09 11:13:46 -04:00
gbrodman
f83f8f92a3
Show locks in the case where you have an expired unlock request (#507)
* Show locks in the case where you have an expired unlock request
2020-03-06 22:00:42 -05:00
gbrodman
28d3af0ee9
Change the wording on the lock-not-enabled page (#504)
* Change the wording on the lock-not-enabled page

* fix the screenshot
2020-03-06 16:15:11 -05:00
Lai Jiang
08a6a333ad
Upgrade to Gradle 6.2.1 (#501) 2020-03-05 18:47:25 -05:00
Shicong Huang
adafab60c4
Add common CRUD operations to TransactionManager (#487)
* Add BasicDao

* Refactor RegistrarDao to extend BasicDao

* Introduce VKey and rewrite BasicDao

* Move CRUD methods to TransactionManager

* Refactor code to simplify the way to get id from entity and sqlKey

* Assert in transaction

* Fix broken test

* Change methods name
2020-03-05 14:03:03 -05:00
gbrodman
fec806ef8b
Handle both ways the UI passes in booleans (#500)
* Handle both ways the UI passes in booleans

* fix the JS test

* Quote the value
2020-03-02 12:49:09 -05:00
gbrodman
e8ff4081a9
Show pending locks in the locked-domains table (#495)
* Show pending locks in the locked-domains table

* asdf

* fix the tests

* including pending unlocks in the table

* fix the screenshot test
2020-02-28 13:57:33 -05:00
Ben McIlwain
9283cd263f
Always validate domain name on allocation token (#498)
* Always validate domain name on allocation token

This is in response to a client-reported error, where they accidentally sent the
wrong domain name on a domain create that included an allocation token. What
should have happened (and that now happens as of this commit) is an error being
thrown that the allocation token does not match the domain name being created.
What happened instead was that, since the incorrectly submitted domain name was
not reserved, the create succeeded (as it would for all creates of unreserved
domains in GA) and the allocation token was redeemed, which is not what you'd
expect.

* Fix tests to reflect changed check behavior
2020-02-27 16:48:37 -05:00
gbrodman
429bc8e6d2
Set focus correctly in lock modal (#499) 2020-02-27 13:20:10 -05:00
gbrodman
fc0a9160b2
Create methods to administratively (un)lock domains (#494)
* Refactor DomainLockUtils methods to take a time rather than a clock

* Add administratively (un)lock methods

* Responses to CR

- Javadoc changes
- Method renames
- Variable renames

* Refactor lock methods to use JPA transaction time

* Remove clock, use Datastore transaction time

* Properly use Datastore transaction time, batched

* Continue to throw exceptions on invalid domains

* DAO writes should be in a transaction

* Assume in-transaction for all RLDao methods

* clean up test

* Fix more tests

* add comment
2020-02-26 17:11:16 -05:00
sarahcaseybot
cbe216ced2
Add logging to CursorDao.saveCursor (#486)
* Add log messages

* small fix

* add null check

* change to checkArgumentNotNull
2020-02-21 15:49:45 -05:00
sarahcaseybot
1be0ad885c
Add daily cron job for IcannReportingUploadAction (#385)
* Add daily cron job for IcannReportingUploadAction

This job checks each ICANN cursor's cursorTime. If all cursorTime values are in the future, the action exits and does nothing. For each cursor that has a cursorTime in the past, the corresponding report is uploaded if it is staged, or logs an error message if the report has not been staged yet.

* Change cron job description
2020-02-21 12:22:17 -05:00
gbrodman
8b819a27e7
Add Registry Lock UI (#369)
* Add Registry Lock UI

* Responses to CRs, mostly

TODO:
- Figure out wording for the 'not enabled yet' message
- Include the server status change cost in the email, or in the UI?
- Should we show non-completed lock requests in the UI?

* Fix get action test

* Change the not-allowed-for-registrar msg to include support email

* Change the wording on the price

* Move TLD input into the modal, and other changes

- don't log the password
- test to make sure the password shows bullets

* Responses to CR and cleanup

* Format closer to something proper
2020-02-20 18:04:32 -05:00
Ben McIlwain
ec6157b6ac
Use -t instead of main params for TLDs in nomulus count_domains command (#493)
* Use -t instead of main params for TLDs in nomulus count_domains command

This makes the command consistent with list_domains. I use both frequently and it
was annoying forgetting which one takes -t and which uses main parameters. Now
they both work the same way.
2020-02-20 16:23:38 -05:00
gbrodman
05ed4fd849
Check for an empty/null allocation token (#489)
* Check for an empty/null allocation token

In addition, we should be returning an authorization exception for an
invalid token, not a parameter syntax exception. See https://tools.ietf.org/html/draft-ietf-regext-allocation-token-04#section-2.1

* Add comment
2020-02-20 15:50:10 -05:00