Commit graph

2966 commits

Author SHA1 Message Date
Shicong Huang
9c7872dbb7
Add socket factory as runtime dependency (#286)
* Add Cloud SQL socket factory as runtime dependency

* Lock update from update_dependency.sh
2019-09-27 11:41:59 -04:00
Shicong Huang
ff439f598d
Add JpaTransactionManagerRule (#277)
* Add RegistryRuntime and JpaTransactionManagerRule

* Revert RegistryJavaRuntime change

* Add JpaTransactionManager interface
2019-09-24 15:38:53 -04:00
Weimin Yu
b0c13042a6
Upgrade to Truth 1.0 (#281)
* Upgrade to Truth 1.0

Refactored fail(...) to assertWithMessage().fail().

Upgraded com.google.monitoring-client family of dependencies to 1.0.6

Also fixed bad use of io.StringIO (on binary buffer) recently introduced to
google-java-format-diff.py.
2019-09-24 10:23:58 -04:00
Lai Jiang
3009f754fa
Link to Sourcegraph logo a different file. (#280)
The logo will be visible on cloned repos outside GitHub. See
b/141380880.
2019-09-23 15:31:09 -04:00
Shicong Huang
cc314d4838
Make project core depend on db at test runtime (#278)
This PR also upgraded the version of Guava to 28.1-jre to
resolve missing stream package issue.
2019-09-23 14:12:24 -04:00
Michael Muller
153fc7d6bf
Add work-around for our "explode war" failure (#279)
For some reason tools.jar (which we don't need in the runtime in the first
place) gets exploded readonly, causing subsequent builds to fail since they
can't overwrite it.  This hack makes it writable at the end of explodeWar.
2019-09-20 16:23:36 -04:00
Shicong Huang
b35c813ae6
Add sql files to manage nomulus user (#274) 2019-09-20 14:46:02 -04:00
Lai Jiang
3764e2b26c
Update registryTool task to better handle command line arguments (#273)
* Update registryTool task to better handle command line arguments

Tokens are delimited by pipes and can be escaped. If we use -args
directly, we will not be able to escape the delimiter, if both the
double and single quotes happen to be present in the arguments.

See:

https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/JavaExec.html#setArgsString-java.lang.String-
2019-09-20 13:04:01 -04:00
gbrodman
8f5bd5da01
Fix non-Python3-compliant code in formatter script (#275)
* Fix non-Python3-compliant code in formatter script

* Add space
2019-09-19 12:49:22 -04:00
Weimin Yu
8123c53916
Fix dependency-locking config (#276)
* Fix dependency-locking config

Reenable dependency locking after a bug errorneouly turned it off.

Removed the guava-related workaround that forcefully resolve to
the -jre distribution.

Enabled locking for buildSrc by updating its property file.

Updated all lock files.
2019-09-19 11:37:20 -04:00
Shicong Huang
d031dedad6
Implement JpaTransactionManager (#268) 2019-09-19 10:01:40 -04:00
Michael Muller
d14f0fe485
Output command test output as well as consuming it (#248)
* Output command test output as well as consuming it

CommandTestCase currently consumes stdout & stderr for the command being
tested.  Unfortunately, this results in us not being able to see the command
output.  Add an output splitter so that output gets written to the original
stream in addition to being captured.

A simpler approach would be to print the captured data after command
completion.  However, this won't work for tests that become hung and also
won't display results in real-time.

Tested: Ran a command test with verboseTestOutput=true, verified that standard
output was visible.

* Save and restore original stdout/err in cmd tests

We have to restore the original stdout/stderr print streams otherwise we end
up nesting them across tests which eventually causes the RDE tests to OOM.
2019-09-17 13:23:30 -04:00
Lai Jiang
b86a35bca1
Upgrade to Gradle 5.6.2 (#272) 2019-09-16 14:07:59 -07:00
Weimin Yu
1db5fba452
Add RegistryLock schema to Flyway deployment folder (#270)
* Add RegistryLock schema to Flyway deployment folder

Added creation script of RegistryLock to Flyway deployment folder.

Fixed previous scripts (PremiumList- and ClaimsList-related) for
FK name change (cause by table name changes: names are quoted now).
We should consider generating foreign key names by ourselves.

Since the alpha database is empty, we dropped and recreated the schema.

Added instructions on how to submit new database incremental changes
in the README file.

Updated RegistryLock.java, removing unnecessary annotations:
- For most fields, the 'name=' property is no longer necessary not that
  the naming strategy is in place. The exceptions are the two used in
  the unique index.
- The @Column annotation is implicit.
2019-09-16 16:47:58 -04:00
Weimin Yu
668ed7c5f6
Force Gradle to use jre version of Guava (#271)
* Force Gradle to use jre version of Guava

Guava is often specified by version only by other
dependencies. In such cases, Gradle usually resolves
it to the '-android' version, which lacks the collection
classes.

We use custom resolution strategy to force the selection
of the '-jre' version.
2019-09-16 14:36:14 -04:00
Weimin Yu
3fb799f112
Add schema deployment tests (#265)
* Add schema deployment tests

Updated flyway schema script files so that they reflect what is
currently deployed in alpha: ClaimsList and PremiumList related
elements.

Put post-schema-push pg_dump output in nomulus.golden.sql as the
authoritative schema. Also added test to verify that the schema
pushed by flyway will result in exactly the golden schema.

Upgraded testcontainers to 1.12.1.

Added a custom Truth subject for better diffing of multi-line
text blocks.

Removed claims_list.sql and premium_list.sql, as we do not have use for
them.

* Add schema deployment tests

Updated flyway schema script files so that they reflect what is
currently deployed in alpha: ClaimsList and PremiumList related
elements.

Put post-schema-push pg_dump output in nomulus.golden.sql as the
authoritative schema. Also added test to verify that the schema
pushed by flyway will result in exactly the golden schema.

Upgraded testcontainers to 1.12.1.

Added a custom Truth subject for better diffing of multi-line
text blocks.

Removed claims_list.sql and premium_list.sql, as we do not have use for
them.

* Add schema deployment tests

Updated flyway schema script files so that they reflect what is
currently deployed in alpha: ClaimsList and PremiumList related
elements.

Put post-schema-push pg_dump output in nomulus.golden.sql as the
authoritative schema. Also added test to verify that the schema
pushed by flyway will result in exactly the golden schema.

Upgraded testcontainers to 1.12.1.

Added a custom Truth subject for better diffing of multi-line
text blocks.

Removed claims_list.sql and premium_list.sql, as we do not have use for
them.
2019-09-12 15:16:12 -04:00
Weimin Yu
40a6b788a0
Regenerate schema using tools command (#269)
* Regenerate schema using tools command

Rerun GenerateSqlSchemaCommand to pick up RegistryLock
and naming strategy change.

Also updated a new license term which seems to just pop up.
2019-09-12 14:26:22 -04:00
Lai Jiang
b87ef869a0
Add a task to run the nomulus tool (#262) 2019-09-12 08:09:32 -07:00
Shicong Huang
48d8b1274f
Add configurations for Cloud SQL secrets (#266) 2019-09-11 12:20:08 -04:00
gbrodman
401653ad4a
Add RegistryLock SQL schema (#243)
* Add RegistryLock SQL schema

* Refactor a bit

* Move registrylock -> domain

* Clearing up lock workflow

* Add more docs and remove LockStatus

* Responses to CR

* Add repoId javadoc

* Add registry lock to persistence xml file

* Quote rather than backtick

* Remove unnecessary check

* File TODO

* Remove uniqueness constraint on verification code

* Remove import

* add index

* Add to SQL generation task

* Move fields around to be the same order as Hibernate's generated sql
2019-09-10 18:17:36 -04:00
gbrodman
b35026b30d
Add naming strategy (#256)
* Add naming strategy

* Add test for formatting in GenerateSqlSchemaCommandTest

* "domain" -> "Domain"

* Call site literals

* checkstyle

* varchar -> text

* Fix external messaging capitalization typo
2019-09-09 14:27:52 -04:00
Michael Muller
c5e4e862bd
Fix command tests that set stdout/stderr (#258)
* Fix command tests that set stdout/stderr

CommandTestCase already wraps stdout stderr, just use the provided methods.
2019-09-09 09:12:48 -04:00
gbrodman
729b69550e
Add DateTimeUtils conversion methods (#260)
* Add DateTimeUtils conversion methods

* Use a more reliabile method than getId

* Add some more tests
2019-09-06 16:46:51 -04:00
Weimin Yu
471ed7caa7
Use Flyway to deploy SQL schema to non-prod (#255)
* Use Flyway to deploy SQL schema to non-prod

Added Gradle tasks to deploy and drop schema in alpha
using Flyway.

Updated ClaimsList.java so that Hibernate-generated
schema would use the right types.

Using 'varchar(255)' instead of 'text' for string columns
for now. We will need to investigate how to force Hibernate
to use the desired types in all cases.

* Use Flyway to deploy SQL schema to non-prod

Added Gradle tasks to deploy and drop schema in alpha
using Flyway.

Updated ClaimsList.java so that Hibernate-generated
schema would use the right types.

Using 'varchar(255)' instead of 'text' for string columns
for now. We will need to investigate how to force Hibernate
to use the desired types in all cases.Added Gradle tasks to deploy and drop schema in alpha
using Flyway.

Updated ClaimsList.java so that Hibernate-generated
schema would use the right types.

Using 'varchar(255)' instead of 'text' for string columns
for now. We will need to investigate how to force Hibernate
to use the desired types in all cases.

* Use Flyway to deploy SQL schema to non-prod

Added Gradle tasks to deploy and drop schema in alpha
using Flyway.

Corrected the type of ClaimsEntry's revision_id column.
It should be plain int8, not bigserial.

Make GenerateSqlSchemaCommand use a custom dialect that
converts all varchar type to 'text' and timestamp to
'timestamptz'.

* Use Flyway to deploy SQL schema to non-prod

Added Gradle tasks to deploy and drop schema in alpha
using Flyway.

Use a custome dialect in GenerateSqlSchemaCommand to
convert varchar type to 'text' and timestamp to 'timestamptz'.

Corrected ClaimsEntry's revision_id column type to int8.
This column tracks parent table's primary key and should
not be bigserial.

* Use Flyway to deploy SQL schema to non-prod

Added Gradle tasks to deploy and drop schema in alpha
using Flyway.

Use a custome dialect in GenerateSqlSchemaCommand to
convert varchar type to 'text' and timestamp to 'timestamptz'.

Corrected ClaimsEntry's revision_id column type to int8.
This column tracks parent table's primary key and should
not be bigserial.

* Use Flyway to deploy SQL schema to non-prod

Added Gradle tasks to deploy and drop schema in alpha
using Flyway.

Use a custome dialect in GenerateSqlSchemaCommand to
convert varchar type to 'text' and timestamp to 'timestamptz'.

Corrected ClaimsEntry's revision_id column type to int8.
This column tracks parent table's primary key and should
not be bigserial.
2019-09-06 16:29:49 -04:00
Ben McIlwain
ded6d38223
Add Cloud SQL schema for premium lists (#254)
* Re-add other schema classes

* Add Cloud SQL schema for premium lists

This won't work quite yet, pending a solution for the type translator issue
(which will be needed for the currency field, and potentially others).
2019-09-06 11:25:34 -04:00
Ben McIlwain
859b70098c
Fix typo of word "dependencies" in gradle build files (#259)
* Fix typo of word "dependencies" in gradle build files
2019-09-05 16:52:46 -04:00
gbrodman
1e0be188fe
Serve up all the closure library files (#257)
Not necessary for the tests but it gets rid of log lines
2019-09-05 10:57:35 -04:00
Michael Muller
f83a8a221b
Generate basic schema for all of DomainBase (#246)
* Generate basic schema for all of DomainBase

Generate a basic schema for DomainBase and everything that is part of it.
This still isn't complete, in particular it lacks:

- Correct conversions for problematic types (e.g. DateTime, Key...)
- Schema generation for history records.
- Name translation.
2019-09-05 10:54:29 -04:00
Shicong Huang
2967256766
Consolidate EntityManagerFactoryProviderTest (#253)
Check if EntityManagerFactory is null before calling close() to avoid NullPointerException.
2019-09-04 15:46:13 -04:00
Ben McIlwain
28700cd610
Make parameter names in generate_sql_schema command consistent (#250)
* Make parameter names in generate_sql_schema command consistent

The rest of the nomulus commands use underscores for delimiting words in
parameter names, so this should too.

Also fixed capitalization of some proper nouns.
2019-09-04 11:10:22 -04:00
Michael Muller
c4b87a1d13
Move EntityManagerFactoryProviderTest to fragile (#251)
* Move EntityManagerFactoryProviderTest to fragile

* Add EMF Provider Test to docker tests

Add EntityManagerFactoryProviderTest to the docker incompatible test patterns
and use the latter list to compose the fragile tests.
2019-09-03 19:47:58 -04:00
gbrodman
1a728e96cb
Allow setting the registry lock password in the UI (#241)
* Allow setting the lock password in the UI

* Add more screenshot tests

* Responses to CR and more screenshot tests

* Formatting

* Simplify lambda
2019-09-03 16:39:02 -04:00
Michael Muller
d3ccad3aa7
Start postgresql container in generate_sql_schema (#249)
* Start postgresql container in generate_sql_schema

Add a --start-postgresql option to the nomulus generate_sql_schema command so
that users don't have to start their own docker container to run it.

* Made default behavior be to give guidance
2019-08-30 16:04:34 -04:00
Ben McIlwain
dc9d9158d8
Don't write TX records for domains deleted in autorenew grace period (#244)
* Don't write TX records for domains deleted in autorenew grace period

When the project was originally being designed, we envisioned have a purely
point-in-time architecture that would allow the system to run indefinitely
without requiring any background batch jobs. That is, you could create a domain,
and 10 years later you could infer every autorenewal billing event that should
have happened during those 10 years, without ever having to run any code that
would go through and retroactively create those events as they happened.

This ended up being very complicated, especially when it came to generating
invoices, so we gave up on it and instead wrote the
ExpandRecurringBillingEventsAction mapreduce, which would run as a cronjob and
periodically expand the recurring billing information into actual one-time
billing events. This made the invoicing scripts MUCH less complicated since they
only had to tabulate one-time billing events that had actually occurred over the
past month, rather than perform complicated logic to infer every one-time event
over an arbitrarily long period.

I bring this up because this architectural legacy explains why billing events
are more complicated than could otherwise be explained from current
requirements. This is why, for instance, when a domain is deleted during the 45
day autorenewal period, the ExpandRecurringBillingEventsAction will still write
out a history entry (and corresponding billing events) on the 45th day, because
it needs to be offset by the cancellation billing event for the autorenew grace
period that was already written out synchronously as part of the delete flow.

This no longer really makes sense, and it would be simpler to just not write out
these phantom history entries and billing events at all, but it would be a
larger modification to fix this, so I'm not touching it here.

Instead, what I have done is to simply not write out the DomainTransactionRecord
in the mapreduce if the recurring billing event has already been canceled
(i.e. because the domain was deleted or transferred). This seems inconsistent
but actually does make sense, because domain transaction records are never
written out speculatively (unlike history entries and billing events); they
correspond only to actions that have actually happen.  This is because they were
architected much more recently than billing events, and don't use the
point-in-time hierarchy.

So, here's a full accounting of how DomainTransactionRecords work as of this commit:
1. When a domain is created, one is written out.
2. When a domain is explicitly renewed, one is written out.
3. When a domain is autorenewed, one is written out at the end of the grace period.
4. When a domain is deleted (in all cases), a record is written out recording the
   deletion.
5. When a domain is deleted in the add grace period, an offsetting record is
   written out with a negative number of years, in addition to the deletion record.
6. When a domain is deleted in the renewal grace period, an offsetting record is
   likely written out in addition.
7. When a domain is deleted in the autorenew grace period, there is no record that
   needs to be offset because no code ran at the exact time of the autorenew, so
   NO additional record should be written out by the expand mapreduce.
   *THIS IS CHANGED AS OF THIS COMMIT*.
8. When a domain is transferred, all existing grace periods are cancelled and
   corresponding cancelling records are written out. Note that transfers include a
   mandatory, irrevocable 1 year renewal.
9. In the rare event that a domain is restored, all recurring events are
   re-created, and there is a 1 year mandatory renewal as part of the restore with
   corresponding record written out.

So, in summary, billing events and history entries are often written out
speculatively, and can subsequently be canceled, but the same is not true of
domain transaction records.  Domain transaction records are only written out as
part of a corresponding action (which for autorenewals is the expand recurring
cronjob).

* rm unused import
2019-08-30 12:04:35 -04:00
Michael Muller
0daa89ae25
Remove the "showAllOutput" property from the build (#247)
* Remove the "showAllOutput" property from the build

It doesn't work very well and has been superseded by "verboseTestOutput",
which does the same thing and more.
2019-08-30 10:43:07 -04:00
gbrodman
d6bcdc241e
Remove 'value' from RDAP link responses (#236)
* Remove 'value' from RDAP link responses

* Change application type to rdap+json

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

* CR response
2019-08-30 10:21:03 -04:00
Shicong Huang
487b695a10
Set up database connection pool (#234)
Set up database connection pool
2019-08-29 16:12:28 -04:00
Weimin Yu
b5ef99a8f8
Only apply Google Java format to changed lines (#176)
* Only apply Google Java format to changed lines

* Only apply Google Java format to changed lines

* Only apply Google Java format to changed regions

Diffs are relative to origin/master.

Three tasks are added:
- javaIncrementalFormatCheck is added to the build workflow, and
  will abort build if format violations are found.
- javaIncrementalFormatApply needs to be manually invoked to correct
  format violations, the same behavior as spotlessApply.
- javaIncrementalFormatDryRun shows the changes that would happen if
  javaIncrementalFormatApply is invoked.

These tasks work from the root directory and process the buildSrc directory
too.

The Spotless Java config is removed.

* Only apply Google Java format to changed regions

Diffs are relative to origin/master.

Three tasks are added:
- javaIncrementalFormatCheck is added to the build workflow, and
  will abort build if format violations are found.
- javaIncrementalFormatApply needs to be manually invoked to correct
  format violations, the same behavior as spotlessApply.
- javaIncrementalFormatDryRun shows the changes that would happen if
  javaIncrementalFormatApply is invoked.

These tasks work from the root directory and process the buildSrc directory
too.

The Spotless Java config is removed.

* Only apply Google Java format to changed regions

Diffs are relative to origin/master.

Three tasks are added:
- javaIncrementalFormatCheck is added to the build workflow, and
  will abort build if format violations are found.
- javaIncrementalFormatApply needs to be manually invoked to correct
  format violations, the same behavior as spotlessApply.
- javaIncrementalFormatDryRun shows the changes that would happen if
  javaIncrementalFormatApply is invoked.

These tasks work from the root directory and process the buildSrc directory
too.

The Spotless Java config is removed.

* Only apply Google Java format to changed regions

Diffs are relative to origin/master.

Three tasks are added:
- javaIncrementalFormatCheck is added to the build workflow, and
  will abort build if format violations are found.
- javaIncrementalFormatApply needs to be manually invoked to correct
  format violations, the same behavior as spotlessApply.
- javaIncrementalFormatDryRun shows the changes that would happen if
  javaIncrementalFormatApply is invoked.

These tasks work from the root directory and process the buildSrc directory
too.

The Spotless Java config is removed.
2019-08-29 16:04:34 -04:00
Lai Jiang
dd4300fce7
Update proxy deployment script description (#245) 2019-08-28 17:35:43 -04:00
Lai Jiang
844c47061b
Use Gradle from gradle.org in Gradle wrapper (#239)
During release we substitute the link to a binary hosted on GCS. The
normal GitHub build can use the binary on gradle.org
2019-08-27 11:11:35 -04:00
Shicong Huang
dcceb0d49a
Add sql schema and entity class for ClaimsList (#227) 2019-08-26 18:30:51 -04:00
Lai Jiang
f72c6c3c80
Remove GtechTool (#242)
It is burdensome to have to maintain two sets of tools, one of which
contains a strict subset of functionalities of the other. All admins
should use the same tool and their ability to administer should be
restricted by the IAM roles they have, not the tools they use.
2019-08-26 17:15:48 -04:00
Michael Muller
c645fe6766
Fix skipDockerIncompatibleTests (#240)
We have to add a check for the skipDockerIncompatibleTests property in the
fragileTest task, since that's where these tests now live.
2019-08-26 12:31:24 -04:00
Lai Jiang
bf52a78e89
Update Gradle wrapper to 5.6 (#232)
* Update Gradle wrapper to 5.6

* Upgrade shadowJar to 5.1 and increase JVM heap size

* Use Gradle binary on GCS
2019-08-23 22:10:55 -07:00
gbrodman
8ec16dca8d
Add a registry lock password to contacts (#226)
* Add a registry lock password to contacts

* enabled -> allowed

* Simple CR responses, still need to add tests

* Add a very simple hashing test file

* Allow setting of RL password rather than directly setting it

* Round out pw tests

* Include 'allowedToSet...' in registrar contact JSON

* Responses to CR

* fix the hardcoded tests

* Use null or empty rather than just null
2019-08-23 22:34:43 -04:00
Michael Muller
69cb852a9c
Add a "showErrorOutput" property (#237)
* Add a "showErrorOutput" property

Add a property to let us dump test output and final status in real-time to the
console.
2019-08-22 11:10:56 -04:00
Michael Muller
6dee3d526e
Add a generate_sql_schema command (#230)
* Add a generate_schema  command

Add a generate_schema command to nomulus tool and add the necessary
instrumentation to EppResource and DomainBase to allow us to generate a
proof-of-concept schema for DomainBase.

* Added forgotten command description

* Revert "Added forgotten command description"

This reverts commit 09326cb8ac.
(checked in the wrong file)

* Added fixes requested during review

* Add a todo to start postgresql container

Add a todo to start a postgresql container from generate_sql_command.
2019-08-20 12:29:36 -04:00
Shicong Huang
3ba6e7bd06
Remove hardcoded Java home path (#235) 2019-08-20 10:54:45 -04:00
Lai Jiang
2e84cdfc4b
Rename packages in the prober (#233)
Package names should not be plural.
2019-08-19 12:11:19 -04:00
Lai Jiang
77f998ee4b
Disable Travis (#231) 2019-08-16 17:13:43 -04:00