mirror of
https://github.com/google/nomulus
synced 2026-06-09 16:33:02 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 15df3aea44 | |||
| d000a5dff8 | |||
| 34694b4aef | |||
| 7ce7b23450 | |||
| a5d1469281 |
@@ -15,12 +15,16 @@
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"builder": "@angular-devkit/build-angular:application",
|
||||
"options": {
|
||||
"outputPath": "dist/console-webapp",
|
||||
"outputPath": {
|
||||
"base": "staged/dist/",
|
||||
"browser": ""
|
||||
},
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"polyfills": [
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
@@ -34,7 +38,8 @@
|
||||
"stylePreprocessorOptions": {
|
||||
"includePaths": ["node_modules/"]
|
||||
},
|
||||
"scripts": []
|
||||
"scripts": [],
|
||||
"browser": "src/main.ts"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
@@ -59,9 +64,7 @@
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
|
||||
Generated
+2280
-1631
File diff suppressed because it is too large
Load Diff
+21
-21
@@ -4,7 +4,7 @@
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve --proxy-config dev-proxy.config.json",
|
||||
"build": "ng build --base-href=/console/ --output-path=staged/dist",
|
||||
"build": "ng build --base-href=/console/",
|
||||
"build:local": "ng build --base-href=/default/console/",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test --browsers=ChromeHeadless --watch=false",
|
||||
@@ -16,29 +16,29 @@
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^17.3.5",
|
||||
"@angular/cdk": "^17.3.5",
|
||||
"@angular/common": "^17.3.5",
|
||||
"@angular/compiler": "^17.3.5",
|
||||
"@angular/core": "^17.3.5",
|
||||
"@angular/forms": "^17.3.5",
|
||||
"@angular/material": "^17.3.5",
|
||||
"@angular/platform-browser": "^17.3.5",
|
||||
"@angular/platform-browser-dynamic": "^17.3.5",
|
||||
"@angular/router": "^17.3.5",
|
||||
"@angular/animations": "^18.0.2",
|
||||
"@angular/cdk": "^18.0.2",
|
||||
"@angular/common": "^18.0.2",
|
||||
"@angular/compiler": "^18.0.2",
|
||||
"@angular/core": "^18.0.2",
|
||||
"@angular/forms": "^18.0.2",
|
||||
"@angular/material": "^18.0.2",
|
||||
"@angular/platform-browser": "^18.0.2",
|
||||
"@angular/platform-browser-dynamic": "^18.0.2",
|
||||
"@angular/router": "^18.0.2",
|
||||
"rxjs": "~7.5.0",
|
||||
"tslib": "^2.3.0",
|
||||
"zone.js": "~0.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^17.3.5",
|
||||
"@angular-eslint/builder": "17.3.0",
|
||||
"@angular-eslint/eslint-plugin": "17.3.0",
|
||||
"@angular-eslint/eslint-plugin-template": "17.3.0",
|
||||
"@angular-eslint/schematics": "17.3.0",
|
||||
"@angular-eslint/template-parser": "17.3.0",
|
||||
"@angular/cli": "~17.3.5",
|
||||
"@angular/compiler-cli": "^17.3.5",
|
||||
"@angular-devkit/build-angular": "^18.0.3",
|
||||
"@angular-eslint/builder": "18.0.1",
|
||||
"@angular-eslint/eslint-plugin": "18.0.1",
|
||||
"@angular-eslint/eslint-plugin-template": "18.0.1",
|
||||
"@angular-eslint/schematics": "18.0.1",
|
||||
"@angular-eslint/template-parser": "18.0.1",
|
||||
"@angular/cli": "~18.0.3",
|
||||
"@angular/compiler-cli": "^18.0.2",
|
||||
"@types/jasmine": "~4.0.0",
|
||||
"@types/node": "^18.11.18",
|
||||
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
||||
@@ -52,6 +52,6 @@
|
||||
"karma-jasmine": "~5.1.0",
|
||||
"karma-jasmine-html-reporter": "~2.0.0",
|
||||
"prettier": "2.8.7",
|
||||
"typescript": "~5.2.2"
|
||||
"typescript": "~5.4.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,25 +12,25 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { MaterialModule } from './material.module';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { BackendService } from './shared/services/backend.service';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
RouterTestingModule,
|
||||
MaterialModule,
|
||||
BrowserAnimationsModule,
|
||||
],
|
||||
providers: [BackendService],
|
||||
declarations: [AppComponent],
|
||||
imports: [RouterTestingModule, MaterialModule, BrowserAnimationsModule],
|
||||
providers: [
|
||||
BackendService,
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import { MaterialModule } from './material.module';
|
||||
|
||||
import { BackendService } from './shared/services/backend.service';
|
||||
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
||||
import { BillingInfoComponent } from './billingInfo/billingInfo.component';
|
||||
import { DomainListComponent } from './domains/domainList.component';
|
||||
@@ -80,12 +80,12 @@ import { TldsComponent } from './tlds/tlds.component';
|
||||
WhoisComponent,
|
||||
WhoisEditComponent,
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
imports: [
|
||||
AppRoutingModule,
|
||||
BrowserAnimationsModule,
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
HttpClientModule,
|
||||
MaterialModule,
|
||||
SnackBarModule,
|
||||
],
|
||||
@@ -100,7 +100,7 @@ import { TldsComponent } from './tlds/tlds.component';
|
||||
subscriptSizing: 'dynamic',
|
||||
},
|
||||
},
|
||||
provideHttpClient(),
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
export class AppModule {}
|
||||
|
||||
@@ -14,11 +14,12 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DomainListComponent } from './domainList.component';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { BackendService } from '../shared/services/backend.service';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { DomainListComponent } from './domainList.component';
|
||||
|
||||
describe('DomainListComponent', () => {
|
||||
let component: DomainListComponent;
|
||||
@@ -27,12 +28,12 @@ describe('DomainListComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [DomainListComponent],
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
MaterialModule,
|
||||
BrowserAnimationsModule,
|
||||
imports: [MaterialModule, BrowserAnimationsModule],
|
||||
providers: [
|
||||
BackendService,
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
providers: [BackendService],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(DomainListComponent);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
max-width: 616px;
|
||||
|
||||
h2 {
|
||||
margin: 40px 0 25px 0;
|
||||
margin: 40px 0 25px 0 !important;
|
||||
}
|
||||
|
||||
section {
|
||||
|
||||
@@ -14,18 +14,24 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RegistrarService } from './registrar.service';
|
||||
import { BackendService } from '../shared/services/backend.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { BackendService } from '../shared/services/backend.service';
|
||||
import { RegistrarService } from './registrar.service';
|
||||
|
||||
describe('RegistrarService', () => {
|
||||
let service: RegistrarService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule],
|
||||
providers: [BackendService, MatSnackBar],
|
||||
imports: [],
|
||||
providers: [
|
||||
BackendService,
|
||||
MatSnackBar,
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
});
|
||||
service = TestBed.inject(RegistrarService);
|
||||
});
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<div class="console-app__registrar">
|
||||
<mat-form-field
|
||||
class="example-full-width"
|
||||
class="mat-form-field-density-5"
|
||||
appearance="outline"
|
||||
>
|
||||
<mat-form-field class="example-full-width" appearance="outline">
|
||||
<mat-label>Registrar</mat-label>
|
||||
<input
|
||||
type="text"
|
||||
|
||||
@@ -14,11 +14,12 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RegistrarSelectorComponent } from './registrarSelector.component';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { BackendService } from '../shared/services/backend.service';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RegistrarSelectorComponent } from './registrarSelector.component';
|
||||
|
||||
describe('RegistrarSelectorComponent', () => {
|
||||
let component: RegistrarSelectorComponent;
|
||||
@@ -26,13 +27,13 @@ describe('RegistrarSelectorComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
MaterialModule,
|
||||
BrowserAnimationsModule,
|
||||
],
|
||||
providers: [BackendService],
|
||||
declarations: [RegistrarSelectorComponent],
|
||||
imports: [MaterialModule, BrowserAnimationsModule],
|
||||
providers: [
|
||||
BackendService,
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(RegistrarSelectorComponent);
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RegistrarComponent } from './registrarsTable.component';
|
||||
import { BackendService } from '../shared/services/backend.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { MaterialModule } from '../material.module';
|
||||
import { BackendService } from '../shared/services/backend.service';
|
||||
import { RegistrarComponent } from './registrarsTable.component';
|
||||
|
||||
describe('RegistrarComponent', () => {
|
||||
let component: RegistrarComponent;
|
||||
@@ -28,14 +29,12 @@ describe('RegistrarComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [RegistrarComponent],
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
MaterialModule,
|
||||
BrowserAnimationsModule,
|
||||
],
|
||||
imports: [MaterialModule, BrowserAnimationsModule],
|
||||
providers: [
|
||||
BackendService,
|
||||
{ provide: ActivatedRoute, useValue: {} as ActivatedRoute },
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import ContactComponent from './contact.component';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { MaterialModule } from 'src/app/material.module';
|
||||
import { BackendService } from 'src/app/shared/services/backend.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import ContactComponent from './contact.component';
|
||||
|
||||
describe('ContactComponent', () => {
|
||||
let component: ContactComponent;
|
||||
@@ -26,8 +27,12 @@ describe('ContactComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ContactComponent],
|
||||
imports: [HttpClientTestingModule, MaterialModule],
|
||||
providers: [BackendService],
|
||||
imports: [MaterialModule],
|
||||
providers: [
|
||||
BackendService,
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
}).compileComponents();
|
||||
fixture = TestBed.createComponent(ContactComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
mat-form-field {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin-bottom: 30px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,18 +14,19 @@
|
||||
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import SecurityComponent from './security.component';
|
||||
import { SecurityService, apiToUiConverter } from './security.service';
|
||||
import { BackendService } from 'src/app/shared/services/backend.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { MaterialModule } from 'src/app/material.module';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { of } from 'rxjs';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MaterialModule } from 'src/app/material.module';
|
||||
import {
|
||||
Registrar,
|
||||
RegistrarService,
|
||||
} from 'src/app/registrar/registrar.service';
|
||||
import { BackendService } from 'src/app/shared/services/backend.service';
|
||||
import SecurityComponent from './security.component';
|
||||
import { SecurityService, apiToUiConverter } from './security.service';
|
||||
|
||||
describe('SecurityComponent', () => {
|
||||
let component: SecurityComponent;
|
||||
@@ -50,16 +51,13 @@ describe('SecurityComponent', () => {
|
||||
} as RegistrarService;
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
MaterialModule,
|
||||
BrowserAnimationsModule,
|
||||
FormsModule,
|
||||
],
|
||||
declarations: [SecurityComponent],
|
||||
imports: [MaterialModule, BrowserAnimationsModule, FormsModule],
|
||||
providers: [
|
||||
BackendService,
|
||||
{ provide: RegistrarService, useValue: dummyRegistrarService },
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
.overrideComponent(SecurityComponent, {
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { BackendService } from 'src/app/shared/services/backend.service';
|
||||
import SecurityComponent from './security.component';
|
||||
import {
|
||||
SecurityService,
|
||||
SecuritySettings,
|
||||
@@ -21,10 +26,6 @@ import {
|
||||
apiToUiConverter,
|
||||
uiToApiConverter,
|
||||
} from './security.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import SecurityComponent from './security.component';
|
||||
import { BackendService } from 'src/app/shared/services/backend.service';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
|
||||
describe('SecurityService', () => {
|
||||
const uiMockData: SecuritySettings = {
|
||||
@@ -42,9 +43,15 @@ describe('SecurityService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule],
|
||||
declarations: [SecurityComponent],
|
||||
providers: [MatSnackBar, SecurityService, BackendService],
|
||||
imports: [],
|
||||
providers: [
|
||||
MatSnackBar,
|
||||
SecurityService,
|
||||
BackendService,
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
});
|
||||
service = TestBed.inject(SecurityService);
|
||||
});
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
>Security</a
|
||||
>
|
||||
</nav>
|
||||
<mat-divider></mat-divider>
|
||||
<mat-tab-nav-panel #tabPanel>
|
||||
<router-outlet></router-outlet>
|
||||
</mat-tab-nav-panel>
|
||||
|
||||
@@ -13,9 +13,6 @@
|
||||
// limitations under the License.
|
||||
|
||||
.console-settings {
|
||||
> mat-divider {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.mdc-tab {
|
||||
&.active-link {
|
||||
border-bottom: 2px solid var(--primary);
|
||||
@@ -24,4 +21,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
nav {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin: 20px 0;
|
||||
margin-bottom: 20px;
|
||||
button {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import WhoisComponent from './whois.component';
|
||||
import { MaterialModule } from 'src/app/material.module';
|
||||
import { BackendService } from 'src/app/shared/services/backend.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { RegistrarService } from 'src/app/registrar/registrar.service';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { MaterialModule } from 'src/app/material.module';
|
||||
import { RegistrarService } from 'src/app/registrar/registrar.service';
|
||||
import { BackendService } from 'src/app/shared/services/backend.service';
|
||||
import WhoisComponent from './whois.component';
|
||||
|
||||
describe('WhoisComponent', () => {
|
||||
let component: WhoisComponent;
|
||||
@@ -28,14 +29,12 @@ describe('WhoisComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [WhoisComponent],
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
MaterialModule,
|
||||
BrowserAnimationsModule,
|
||||
],
|
||||
imports: [MaterialModule, BrowserAnimationsModule],
|
||||
providers: [
|
||||
BackendService,
|
||||
{ provide: RegistrarService, useValue: { registrar: {} } },
|
||||
provideHttpClient(),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
}).compileComponents();
|
||||
|
||||
|
||||
@@ -30,14 +30,14 @@ body {
|
||||
|
||||
.console-app {
|
||||
.mat-headline-4 {
|
||||
margin-top: 6px;
|
||||
margin-bottom: 24px;
|
||||
margin-top: 6px !important;
|
||||
margin-bottom: 24px !important;
|
||||
}
|
||||
.spacer {
|
||||
flex: 1;
|
||||
}
|
||||
h1 {
|
||||
margin-bottom: 24px;
|
||||
margin-bottom: 24px !important;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
|
||||
@@ -4,63 +4,19 @@
|
||||
|
||||
$secondary-color: #80868b;
|
||||
$border-color: #dadce0;
|
||||
$hue-undefined: "undefined";
|
||||
$blue-palette: (
|
||||
50: #e8f0fe,
|
||||
100: #d2e3fc,
|
||||
200: #aecbfa,
|
||||
300: #8ab4f8,
|
||||
400: #669df6,
|
||||
500: #4285f4,
|
||||
600: #1a73e8,
|
||||
700: #1967d2,
|
||||
800: #185abc,
|
||||
900: #174ea6,
|
||||
A100: $hue-undefined,
|
||||
A200: $hue-undefined,
|
||||
A400: $hue-undefined,
|
||||
A700: $hue-undefined,
|
||||
contrast: (
|
||||
50: #174ea6,
|
||||
100: #174ea6,
|
||||
200: #174ea6,
|
||||
300: #174ea6,
|
||||
400: #174ea6,
|
||||
500: white,
|
||||
600: white,
|
||||
700: white,
|
||||
800: white,
|
||||
900: white,
|
||||
A100: $hue-undefined,
|
||||
A200: $hue-undefined,
|
||||
A400: $hue-undefined,
|
||||
A700: $hue-undefined,
|
||||
),
|
||||
);
|
||||
|
||||
@function rem($valueInPixels, $rootbase: 16px) {
|
||||
@return math.div($valueInPixels, $rootbase) * 1rem;
|
||||
}
|
||||
|
||||
/** Copied from docs section **/
|
||||
|
||||
// Include the common styles for Angular Material. We include this here so that you only
|
||||
// have to load a single css file for Angular Material in your app.
|
||||
// Be sure that you only ever include this mixin once!
|
||||
@include mat.core();
|
||||
|
||||
// The warn palette is optional (defaults to red).
|
||||
$theme-warn: mat.define-palette(mat.$red-palette);
|
||||
|
||||
/**
|
||||
** Application specific section - Global styles and mixins
|
||||
**/
|
||||
|
||||
$theme-primary: mat.define-palette($blue-palette);
|
||||
|
||||
$typographyConfig: mat.define-typography-config(
|
||||
$typographyConfig: mat.m2-define-typography-config(
|
||||
$headline-1:
|
||||
mat.define-typography-level(
|
||||
mat.m2-define-typography-level(
|
||||
rem(29px),
|
||||
rem(36px),
|
||||
500,
|
||||
@@ -68,7 +24,7 @@ $typographyConfig: mat.define-typography-config(
|
||||
normal
|
||||
),
|
||||
$headline-4:
|
||||
mat.define-typography-level(
|
||||
mat.m2-define-typography-level(
|
||||
rem(28px),
|
||||
rem(36px),
|
||||
500,
|
||||
@@ -76,7 +32,7 @@ $typographyConfig: mat.define-typography-config(
|
||||
normal
|
||||
),
|
||||
$headline-5:
|
||||
mat.define-typography-level(
|
||||
mat.m2-define-typography-level(
|
||||
rem(20px),
|
||||
rem(28px),
|
||||
400,
|
||||
@@ -84,9 +40,15 @@ $typographyConfig: mat.define-typography-config(
|
||||
normal
|
||||
),
|
||||
$headline-6:
|
||||
mat.define-typography-level(rem(16px), rem(2px), 500, "Google Sans", normal),
|
||||
mat.m2-define-typography-level(
|
||||
rem(16px),
|
||||
rem(2px),
|
||||
500,
|
||||
"Google Sans",
|
||||
normal
|
||||
),
|
||||
$body-1:
|
||||
mat.define-typography-level(
|
||||
mat.m2-define-typography-level(
|
||||
rem(16px),
|
||||
rem(24px),
|
||||
400,
|
||||
@@ -94,7 +56,7 @@ $typographyConfig: mat.define-typography-config(
|
||||
normal
|
||||
),
|
||||
$body-2:
|
||||
mat.define-typography-level(
|
||||
mat.m2-define-typography-level(
|
||||
rem(14px),
|
||||
rem(20px),
|
||||
400,
|
||||
@@ -102,7 +64,7 @@ $typographyConfig: mat.define-typography-config(
|
||||
normal
|
||||
),
|
||||
$caption:
|
||||
mat.define-typography-level(
|
||||
mat.m2-define-typography-level(
|
||||
rem(14px),
|
||||
rem(24px),
|
||||
400,
|
||||
@@ -110,37 +72,13 @@ $typographyConfig: mat.define-typography-config(
|
||||
0.15px
|
||||
),
|
||||
$overline:
|
||||
mat.define-typography-level(rem(14px), rem(20px), 500, "Google Sans", 0.5px),
|
||||
);
|
||||
|
||||
@include mat.typography-hierarchy($typographyConfig);
|
||||
@mixin form-field-density($density) {
|
||||
$field-typography: mat.define-typography-config(
|
||||
$body-1: mat.define-typography-level(12px, 24px, 400),
|
||||
);
|
||||
@include mat.typography-level($field-typography, "body-1");
|
||||
@include mat.form-field-density($density);
|
||||
}
|
||||
|
||||
// Define lowest possible density class to be used in application
|
||||
// In the same manner -1...-5 classes can be defined
|
||||
.mat-form-field-density-5 {
|
||||
@include form-field-density(-5);
|
||||
}
|
||||
|
||||
/**
|
||||
** Light theme
|
||||
**/
|
||||
$light-theme: mat.define-light-theme(
|
||||
(
|
||||
color: (
|
||||
primary: $theme-primary,
|
||||
accent: $theme-primary,
|
||||
warn: $theme-warn,
|
||||
mat.m2-define-typography-level(
|
||||
rem(14px),
|
||||
rem(20px),
|
||||
500,
|
||||
"Google Sans",
|
||||
0.5px
|
||||
),
|
||||
density: 0,
|
||||
typography: $typographyConfig,
|
||||
)
|
||||
);
|
||||
|
||||
// Access and define a class with secondary color exposed
|
||||
@@ -165,12 +103,41 @@ mat-row:hover {
|
||||
|
||||
:root {
|
||||
--text: #5f6368;
|
||||
--primary: #{mat.get-color-from-palette($blue-palette, 500)};
|
||||
--lightest: #{mat.get-color-from-palette($blue-palette, 100)};
|
||||
--primary: #4285f4;
|
||||
--lightest: #d2e3fc;
|
||||
--light-highlight: #e8eaed;
|
||||
--lightest-highlight: #f8f9fa;
|
||||
--secondary: #{$secondary-color};
|
||||
--border: #{$border-color};
|
||||
--mat-tree-node-text-font: "Google Sans Text";
|
||||
--mat-tree-node-text-size: 0.95rem;
|
||||
--mat-sidenav-container-width: 280px;
|
||||
}
|
||||
|
||||
@include mat.all-component-themes($light-theme);
|
||||
$theme: mat.define-theme(
|
||||
(
|
||||
color: (
|
||||
theme-type: light,
|
||||
primary: mat.$blue-palette,
|
||||
),
|
||||
typography: (
|
||||
plain-family: "Google Sans",
|
||||
brand-family: "Google Sans Text",
|
||||
bold-weight: 600,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
html {
|
||||
@include mat.all-component-themes($theme);
|
||||
@include mat.typography-hierarchy($typographyConfig);
|
||||
@include mat.form-field-theme(
|
||||
mat.define-theme(
|
||||
(
|
||||
density: (
|
||||
scale: -3,
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true,
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
@@ -12,7 +13,6 @@
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package google.registry.flows;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.replicaTm;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
@@ -37,6 +38,7 @@ import google.registry.model.host.HostHistory;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.persistence.IsolationLevel;
|
||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||
import google.registry.persistence.transaction.JpaTransactionManager;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Qualifier;
|
||||
@@ -191,6 +193,16 @@ public class FlowModule {
|
||||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
@FlowScope
|
||||
static JpaTransactionManager provideJpaTm(Class<? extends Flow> flowClass) {
|
||||
if (MutatingFlow.class.isAssignableFrom(flowClass)) {
|
||||
return tm();
|
||||
} else {
|
||||
return replicaTm();
|
||||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
@FlowScope
|
||||
static ResourceCommand provideResourceCommand(EppInput eppInput) {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package google.registry.flows;
|
||||
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.xml.XmlTransformer.prettyPrint;
|
||||
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
@@ -28,6 +27,7 @@ import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.eppoutput.EppOutput;
|
||||
import google.registry.monitoring.whitebox.EppMetric;
|
||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||
import google.registry.persistence.transaction.JpaTransactionManager;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
@@ -52,6 +52,8 @@ public class FlowRunner {
|
||||
@Inject SessionMetadata sessionMetadata;
|
||||
@Inject Trid trid;
|
||||
@Inject FlowReporter flowReporter;
|
||||
@Inject JpaTransactionManager jpaTransactionManager;
|
||||
|
||||
@Inject FlowRunner() {}
|
||||
|
||||
/** Runs the EPP flow, and records metrics on the given builder. */
|
||||
@@ -77,26 +79,24 @@ public class FlowRunner {
|
||||
return EppOutput.create(flowProvider.get().run());
|
||||
}
|
||||
try {
|
||||
// TODO(mcilwain/weiminyu): Use transactReadOnly() here for TransactionalFlow and transact()
|
||||
// for MutatingFlow.
|
||||
return tm().transact(
|
||||
isolationLevelOverride.orElse(null),
|
||||
() -> {
|
||||
try {
|
||||
EppOutput output = EppOutput.create(flowProvider.get().run());
|
||||
if (isDryRun) {
|
||||
throw new DryRunException(output);
|
||||
}
|
||||
if (flowClass.equals(LoginFlow.class)) {
|
||||
// In LoginFlow, registrarId isn't known until after the flow executes, so save
|
||||
// it then.
|
||||
eppMetricBuilder.setRegistrarId(sessionMetadata.getRegistrarId());
|
||||
}
|
||||
return output;
|
||||
} catch (EppException e) {
|
||||
throw new EppRuntimeException(e);
|
||||
}
|
||||
});
|
||||
return jpaTransactionManager.transact(
|
||||
isolationLevelOverride.orElse(null),
|
||||
() -> {
|
||||
try {
|
||||
EppOutput output = EppOutput.create(flowProvider.get().run());
|
||||
if (isDryRun) {
|
||||
throw new DryRunException(output);
|
||||
}
|
||||
if (flowClass.equals(LoginFlow.class)) {
|
||||
// In LoginFlow, registrarId isn't known until after the flow executes, so save
|
||||
// it then.
|
||||
eppMetricBuilder.setRegistrarId(sessionMetadata.getRegistrarId());
|
||||
}
|
||||
return output;
|
||||
} catch (EppException e) {
|
||||
throw new EppRuntimeException(e);
|
||||
}
|
||||
});
|
||||
} catch (DryRunException e) {
|
||||
return e.output;
|
||||
} catch (EppRuntimeException e) {
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
// Copyright 2024 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.common;
|
||||
|
||||
import static com.google.api.client.util.Preconditions.checkState;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.ImmutableMap.toImmutableMap;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static google.registry.config.RegistryConfig.getSingletonCacheRefreshDuration;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
|
||||
import com.github.benmanes.caffeine.cache.CacheLoader;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Sets;
|
||||
import google.registry.model.Buildable;
|
||||
import google.registry.model.CacheUtils;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.persistence.VKey;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
@Entity
|
||||
public class FeatureFlag extends ImmutableObject implements Buildable {
|
||||
|
||||
/**
|
||||
* The current status of the feature the flag represents.
|
||||
*
|
||||
* <p>Currently, there is no enforced ordering of these status values, but that may change in the
|
||||
* future should new statuses be added to this enum that require it.
|
||||
*/
|
||||
public enum FeatureStatus {
|
||||
ACTIVE,
|
||||
INACTIVE
|
||||
}
|
||||
|
||||
/** The name of the flag/feature. */
|
||||
@Id String featureName;
|
||||
|
||||
/** A map of times for each {@link FeatureStatus} the FeatureFlag should hold. */
|
||||
@Column(nullable = false)
|
||||
TimedTransitionProperty<FeatureStatus> status =
|
||||
TimedTransitionProperty.withInitialValue(FeatureStatus.INACTIVE);
|
||||
|
||||
public static FeatureFlag get(String featureName) {
|
||||
FeatureFlag maybeFeatureFlag = CACHE.get(featureName);
|
||||
if (maybeFeatureFlag == null) {
|
||||
throw new FeatureFlagNotFoundException(featureName);
|
||||
} else {
|
||||
return maybeFeatureFlag;
|
||||
}
|
||||
}
|
||||
|
||||
public static ImmutableSet<FeatureFlag> get(Set<String> featureNames) {
|
||||
Map<String, FeatureFlag> featureFlags = CACHE.getAll(featureNames);
|
||||
ImmutableSet<String> missingFlags =
|
||||
Sets.difference(featureNames, featureFlags.keySet()).immutableCopy();
|
||||
if (missingFlags.isEmpty()) {
|
||||
return featureFlags.values().stream().collect(toImmutableSet());
|
||||
} else {
|
||||
throw new FeatureFlagNotFoundException(missingFlags);
|
||||
}
|
||||
}
|
||||
|
||||
/** A cache that loads the {@link FeatureFlag} for a given featureName. */
|
||||
private static final LoadingCache<String, FeatureFlag> CACHE =
|
||||
CacheUtils.newCacheBuilder(getSingletonCacheRefreshDuration())
|
||||
.build(
|
||||
new CacheLoader<>() {
|
||||
@Override
|
||||
public FeatureFlag load(final String featureName) {
|
||||
return tm().reTransact(() -> tm().loadByKeyIfPresent(createVKey(featureName)))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<? extends String, ? extends FeatureFlag> loadAll(
|
||||
Set<? extends String> featureFlagNames) {
|
||||
ImmutableMap<String, VKey<FeatureFlag>> keysMap =
|
||||
featureFlagNames.stream()
|
||||
.collect(
|
||||
toImmutableMap(featureName -> featureName, FeatureFlag::createVKey));
|
||||
Map<VKey<? extends FeatureFlag>, FeatureFlag> entities =
|
||||
tm().reTransact(() -> tm().loadByKeysIfPresent(keysMap.values()));
|
||||
return entities.values().stream()
|
||||
.collect(toImmutableMap(flag -> flag.featureName, flag -> flag));
|
||||
}
|
||||
});
|
||||
|
||||
public static VKey<FeatureFlag> createVKey(String featureName) {
|
||||
return VKey.create(FeatureFlag.class, featureName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VKey<FeatureFlag> createVKey() {
|
||||
return createVKey(featureName);
|
||||
}
|
||||
|
||||
public String getFeatureName() {
|
||||
return featureName;
|
||||
}
|
||||
|
||||
public TimedTransitionProperty<FeatureStatus> getStatusMap() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public FeatureStatus getStatus(DateTime time) {
|
||||
return status.getValueAtTime(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureFlag.Builder asBuilder() {
|
||||
return new FeatureFlag.Builder(clone(this));
|
||||
}
|
||||
|
||||
/** A builder for constructing {@link FeatureFlag} objects, since they are immutable. */
|
||||
public static class Builder extends Buildable.Builder<FeatureFlag> {
|
||||
|
||||
public Builder() {}
|
||||
|
||||
private Builder(FeatureFlag instance) {
|
||||
super(instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureFlag build() {
|
||||
checkArgument(
|
||||
!Strings.isNullOrEmpty(getInstance().featureName),
|
||||
"Feature name must not be null or empty");
|
||||
getInstance().status.checkValidity();
|
||||
return super.build();
|
||||
}
|
||||
|
||||
public Builder setFeatureName(String featureName) {
|
||||
checkState(getInstance().featureName == null, "Feature name can only be set once");
|
||||
getInstance().featureName = featureName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setStatus(ImmutableSortedMap<DateTime, FeatureStatus> statusMap) {
|
||||
getInstance().status = TimedTransitionProperty.fromValueMap(statusMap);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/** Exception to throw when no FeatureFlag entity is found for given FeatureName string(s). */
|
||||
public static class FeatureFlagNotFoundException extends RuntimeException {
|
||||
|
||||
FeatureFlagNotFoundException(ImmutableSet<String> featureNames) {
|
||||
super("No feature flag object(s) found for " + Joiner.on(", ").join(featureNames));
|
||||
}
|
||||
|
||||
FeatureFlagNotFoundException(String featureName) {
|
||||
this(ImmutableSet.of(featureName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,9 +41,9 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.google.common.collect.Range;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import google.registry.model.Buildable;
|
||||
import google.registry.model.CacheUtils;
|
||||
@@ -204,10 +204,7 @@ public class Tld extends ImmutableObject implements Buildable, UnsafeSerializabl
|
||||
public static ImmutableSet<Tld> get(Set<String> tlds) {
|
||||
Map<String, Tld> registries = CACHE.getAll(tlds);
|
||||
ImmutableSet<String> missingRegistries =
|
||||
registries.entrySet().stream()
|
||||
.filter(e -> e.getValue() == null)
|
||||
.map(Map.Entry::getKey)
|
||||
.collect(toImmutableSet());
|
||||
Sets.difference(tlds, registries.keySet()).immutableCopy();
|
||||
if (missingRegistries.isEmpty()) {
|
||||
return registries.values().stream().collect(toImmutableSet());
|
||||
} else {
|
||||
@@ -243,7 +240,8 @@ public class Tld extends ImmutableObject implements Buildable, UnsafeSerializabl
|
||||
tlds.stream().collect(toImmutableMap(tld -> tld, Tld::createVKey));
|
||||
Map<VKey<? extends Tld>, Tld> entities =
|
||||
tm().reTransact(() -> tm().loadByKeysIfPresent(keysMap.values()));
|
||||
return Maps.transformEntries(keysMap, (k, v) -> entities.getOrDefault(v, null));
|
||||
return entities.values().stream()
|
||||
.collect(toImmutableMap(tld -> tld.tldStr, tld -> tld));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Copyright 2024 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.persistence.converter;
|
||||
|
||||
import google.registry.model.common.FeatureFlag.FeatureStatus;
|
||||
import javax.persistence.Converter;
|
||||
|
||||
/** JPA converter for {@link google.registry.model.common.FeatureFlag} status transitions. */
|
||||
@Converter(autoApply = true)
|
||||
public class FeatureFlagStatusConverter
|
||||
extends TimedTransitionPropertyConverterBase<FeatureStatus> {
|
||||
|
||||
@Override
|
||||
protected String convertValueToString(FeatureStatus value) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FeatureStatus convertStringToValue(String string) {
|
||||
return FeatureStatus.valueOf(string);
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@
|
||||
<class>google.registry.model.contact.Contact</class>
|
||||
<class>google.registry.model.domain.Domain</class>
|
||||
<class>google.registry.model.domain.DomainHistory</class>
|
||||
<class>google.registry.model.common.FeatureFlag</class>
|
||||
<class>google.registry.model.domain.GracePeriod</class>
|
||||
<class>google.registry.model.domain.GracePeriod$GracePeriodHistory</class>
|
||||
<class>google.registry.model.domain.secdns.DomainDsData</class>
|
||||
@@ -97,6 +98,7 @@
|
||||
<class>google.registry.persistence.converter.CurrencyUnitConverter</class>
|
||||
<class>google.registry.persistence.converter.DateTimeConverter</class>
|
||||
<class>google.registry.persistence.converter.DurationConverter</class>
|
||||
<class>google.registry.persistence.converter.FeatureFlagStatusConverter</class>
|
||||
<class>google.registry.persistence.converter.IdnTableEnumSetConverter</class>
|
||||
<class>google.registry.persistence.converter.InetAddressSetConverter</class>
|
||||
<class>google.registry.persistence.converter.LocalDateConverter</class>
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
// Copyright 2024 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.flows;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.replicaTm;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
import static google.registry.testing.DatabaseHelper.newTld;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import dagger.Component;
|
||||
import google.registry.flows.FlowComponent.FlowComponentModule;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.persistence.transaction.DatabaseException;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions;
|
||||
import google.registry.persistence.transaction.JpaTestExtensions.JpaIntegrationTestExtension;
|
||||
import google.registry.persistence.transaction.JpaTransactionManager;
|
||||
import google.registry.testing.EppLoader;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
|
||||
/** Unit tests for {@link FlowModule}. */
|
||||
public class FlowModuleTest {
|
||||
|
||||
@RegisterExtension
|
||||
final JpaIntegrationTestExtension jpa =
|
||||
new JpaTestExtensions.Builder().buildIntegrationTestExtension();
|
||||
|
||||
private EppInput getEppInput(String eppInputXmlFilename) throws EppException {
|
||||
return new EppLoader(this, eppInputXmlFilename).getEpp();
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenMutatingFlow_thenPrimaryTmIsUsed() throws EppException {
|
||||
String eppInputXmlFilename = "domain_create.xml";
|
||||
FlowModule flowModule =
|
||||
new FlowModule.Builder().setEppInput(getEppInput(eppInputXmlFilename)).build();
|
||||
JpaTransactionManager tm =
|
||||
DaggerFlowModuleTest_FlowModuleTestComponent.builder()
|
||||
.flowModule(flowModule)
|
||||
.build()
|
||||
.jpaTm();
|
||||
assertThat(tm).isEqualTo(tm());
|
||||
tm.transact(() -> tm.put(newTld("app", "ROID")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenNonMutatingFlow_thenReplicaTmIsUsed() throws EppException {
|
||||
String eppInputXmlFilename = "domain_info.xml";
|
||||
FlowModule flowModule =
|
||||
new FlowModule.Builder().setEppInput(getEppInput(eppInputXmlFilename)).build();
|
||||
JpaTransactionManager tm =
|
||||
DaggerFlowModuleTest_FlowModuleTestComponent.builder()
|
||||
.flowModule(flowModule)
|
||||
.build()
|
||||
.jpaTm();
|
||||
assertThat(tm).isEqualTo(replicaTm());
|
||||
assertThat(
|
||||
assertThrows(
|
||||
DatabaseException.class, () -> tm.transact(() -> tm.put(newTld("app", "ROID")))))
|
||||
.hasMessageThat()
|
||||
.contains("cannot execute INSERT in a read-only transaction");
|
||||
}
|
||||
|
||||
@FlowScope
|
||||
@Component(modules = {FlowModule.class, FlowComponentModule.class})
|
||||
public interface FlowModuleTestComponent {
|
||||
JpaTransactionManager jpaTm();
|
||||
|
||||
@Component.Builder
|
||||
interface Builder {
|
||||
Builder flowModule(FlowModule flowModule);
|
||||
|
||||
FlowModuleTestComponent build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,6 +111,7 @@ class FlowRunnerTest {
|
||||
new StatelessRequestSessionMetadata("TheRegistrar", ImmutableSet.of());
|
||||
flowRunner.trid = Trid.create("client-123", "server-456");
|
||||
flowRunner.flowReporter = mock(FlowReporter.class);
|
||||
flowRunner.jpaTransactionManager = tm();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
// Copyright 2024 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.common;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static google.registry.model.common.FeatureFlag.FeatureStatus.ACTIVE;
|
||||
import static google.registry.model.common.FeatureFlag.FeatureStatus.INACTIVE;
|
||||
import static google.registry.testing.DatabaseHelper.loadByEntity;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.model.EntityTestCase;
|
||||
import google.registry.model.common.FeatureFlag.FeatureFlagNotFoundException;
|
||||
import google.registry.model.common.FeatureFlag.FeatureStatus;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Unit tests for {@link FeatureFlag}. */
|
||||
public class FeatureFlagTest extends EntityTestCase {
|
||||
|
||||
public FeatureFlagTest() {
|
||||
super(JpaEntityCoverageCheck.ENABLED);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_persistence() {
|
||||
FeatureFlag featureFlag =
|
||||
new FeatureFlag.Builder()
|
||||
.setFeatureName("testFlag")
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.put(DateTime.now(UTC).plusWeeks(8), ACTIVE)
|
||||
.build())
|
||||
.build();
|
||||
persistResource(featureFlag);
|
||||
FeatureFlag flagFromDb = loadByEntity(featureFlag);
|
||||
assertThat(featureFlag).isEqualTo(flagFromDb);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_getSingleFlag() {
|
||||
FeatureFlag featureFlag =
|
||||
new FeatureFlag.Builder()
|
||||
.setFeatureName("testFlag")
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.put(DateTime.now(UTC).plusWeeks(8), ACTIVE)
|
||||
.build())
|
||||
.build();
|
||||
persistResource(featureFlag);
|
||||
assertThat(FeatureFlag.get("testFlag")).isEqualTo(featureFlag);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSuccess_getMultipleFlags() {
|
||||
FeatureFlag featureFlag1 =
|
||||
persistResource(
|
||||
new FeatureFlag.Builder()
|
||||
.setFeatureName("testFlag1")
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.put(DateTime.now(UTC).plusWeeks(8), ACTIVE)
|
||||
.build())
|
||||
.build());
|
||||
FeatureFlag featureFlag2 =
|
||||
persistResource(
|
||||
new FeatureFlag.Builder()
|
||||
.setFeatureName("testFlag2")
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.put(DateTime.now(UTC).plusWeeks(3), INACTIVE)
|
||||
.build())
|
||||
.build());
|
||||
FeatureFlag featureFlag3 =
|
||||
persistResource(
|
||||
new FeatureFlag.Builder()
|
||||
.setFeatureName("testFlag3")
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.build())
|
||||
.build());
|
||||
ImmutableSet<FeatureFlag> featureFlags =
|
||||
FeatureFlag.get(ImmutableSet.of("testFlag1", "testFlag2", "testFlag3"));
|
||||
assertThat(featureFlags.size()).isEqualTo(3);
|
||||
assertThat(featureFlags).containsExactly(featureFlag1, featureFlag2, featureFlag3);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_getMultipleFlagsOneMissing() {
|
||||
persistResource(
|
||||
new FeatureFlag.Builder()
|
||||
.setFeatureName("testFlag1")
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.put(DateTime.now(UTC).plusWeeks(8), ACTIVE)
|
||||
.build())
|
||||
.build());
|
||||
persistResource(
|
||||
new FeatureFlag.Builder()
|
||||
.setFeatureName("testFlag2")
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.put(DateTime.now(UTC).plusWeeks(3), INACTIVE)
|
||||
.build())
|
||||
.build());
|
||||
FeatureFlagNotFoundException thrown =
|
||||
assertThrows(
|
||||
FeatureFlagNotFoundException.class,
|
||||
() -> FeatureFlag.get(ImmutableSet.of("missingFlag", "testFlag1", "testFlag2")));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.isEqualTo("No feature flag object(s) found for missingFlag");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_featureFlagNotPresent() {
|
||||
FeatureFlagNotFoundException thrown =
|
||||
assertThrows(FeatureFlagNotFoundException.class, () -> FeatureFlag.get("fakeFlag"));
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("No feature flag object(s) found for fakeFlag");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_resetFeatureName() {
|
||||
FeatureFlag featureFlag =
|
||||
new FeatureFlag.Builder()
|
||||
.setFeatureName("testFlag")
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.put(DateTime.now(UTC).plusWeeks(8), ACTIVE)
|
||||
.build())
|
||||
.build();
|
||||
IllegalStateException thrown =
|
||||
assertThrows(
|
||||
IllegalStateException.class,
|
||||
() -> featureFlag.asBuilder().setFeatureName("differentName"));
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("Feature name can only be set once");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_nullFeatureName() {
|
||||
FeatureFlag.Builder featureFlagBuilder =
|
||||
new FeatureFlag.Builder()
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.put(DateTime.now(UTC).plusWeeks(8), ACTIVE)
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(IllegalArgumentException.class, () -> featureFlagBuilder.build());
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("Feature name must not be null or empty");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_emptyFeatureName() {
|
||||
FeatureFlag.Builder featureFlagBuilder =
|
||||
new FeatureFlag.Builder()
|
||||
.setFeatureName("")
|
||||
.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(START_OF_TIME, INACTIVE)
|
||||
.put(DateTime.now(UTC).plusWeeks(8), ACTIVE)
|
||||
.build());
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(IllegalArgumentException.class, () -> featureFlagBuilder.build());
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("Feature name must not be null or empty");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_invalidStatusMap() {
|
||||
FeatureFlag.Builder featureFlagBuilder = new FeatureFlag.Builder().setFeatureName("testFlag");
|
||||
IllegalArgumentException thrown =
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() ->
|
||||
featureFlagBuilder.setStatus(
|
||||
ImmutableSortedMap.<DateTime, FeatureStatus>naturalOrder()
|
||||
.put(DateTime.now(UTC).plusWeeks(8), ACTIVE)
|
||||
.build()));
|
||||
assertThat(thrown)
|
||||
.hasMessageThat()
|
||||
.isEqualTo("Must provide transition entry for the start of time (Unix Epoch)");
|
||||
}
|
||||
}
|
||||
@@ -325,6 +325,16 @@ public final class TldTest extends EntityTestCase {
|
||||
.values());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFailure_testGetAllMissingTld() {
|
||||
createTld("foo");
|
||||
TldNotFoundException thrown =
|
||||
assertThrows(
|
||||
TldNotFoundException.class,
|
||||
() -> assertThat(Tld.get(ImmutableSet.of("foo", "tld", "missing"))));
|
||||
assertThat(thrown).hasMessageThat().isEqualTo("No TLD object(s) found for missing");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSetReservedLists() {
|
||||
ReservedList rl5 =
|
||||
|
||||
@@ -23,6 +23,7 @@ import google.registry.bsa.persistence.BsaUnblockableDomainTest;
|
||||
import google.registry.model.billing.BillingBaseTest;
|
||||
import google.registry.model.common.CursorTest;
|
||||
import google.registry.model.common.DnsRefreshRequestTest;
|
||||
import google.registry.model.common.FeatureFlagTest;
|
||||
import google.registry.model.console.ConsoleEppActionHistoryTest;
|
||||
import google.registry.model.console.RegistrarPocUpdateHistoryTest;
|
||||
import google.registry.model.console.RegistrarUpdateHistoryTest;
|
||||
@@ -103,6 +104,7 @@ import org.junit.runner.RunWith;
|
||||
DnsRefreshRequestTest.class,
|
||||
DomainSqlTest.class,
|
||||
DomainHistoryTest.class,
|
||||
FeatureFlagTest.class,
|
||||
HostHistoryTest.class,
|
||||
LockTest.class,
|
||||
PollMessageTest.class,
|
||||
|
||||
@@ -463,6 +463,12 @@
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
create table "FeatureFlag" (
|
||||
feature_name text not null,
|
||||
status hstore not null,
|
||||
primary key (feature_name)
|
||||
);
|
||||
|
||||
create table "GracePeriod" (
|
||||
grace_period_id int8 not null,
|
||||
billing_event_id int8,
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Reference in New Issue
Block a user