mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 17:07:15 +02:00
Make a prettier table to display OT&E check results
We now display the results of each check in addition to the overall result. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=231051913
This commit is contained in:
parent
c6e58d3bff
commit
5272d8ca7f
10 changed files with 182 additions and 105 deletions
|
@ -56,3 +56,29 @@ div#tlds.editing .kd-errormessage {
|
||||||
margin-left: 0.5em;
|
margin-left: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ote-results-table {
|
||||||
|
margin-left: 0.5em;
|
||||||
|
margin-top: -5px;
|
||||||
|
border-top: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ote-fulfilled {
|
||||||
|
background-color: #9df797;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ote-semifulfilled {
|
||||||
|
background-color: #fcd18e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ote-unfulfilled {
|
||||||
|
background-color: #ffa9a9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ote-results-header {
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ote-results-header-cell {
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
@import 'kd_components.css';
|
@import 'admin-settings.css';
|
||||||
@import 'registry.css';
|
|
||||||
@import 'console.css';
|
@import 'console.css';
|
||||||
@import 'forms.css';
|
|
||||||
@import 'epp.css';
|
|
||||||
@import 'dashboard.css';
|
|
||||||
@import 'resources.css';
|
|
||||||
@import 'security-settings.css';
|
|
||||||
@import 'contact-settings.css';
|
@import 'contact-settings.css';
|
||||||
@import 'contact-us.css';
|
@import 'contact-us.css';
|
||||||
|
@import 'dashboard.css';
|
||||||
|
@import 'epp.css';
|
||||||
|
@import 'forms.css';
|
||||||
|
@import 'kd_components.css';
|
||||||
|
@import 'registry.css';
|
||||||
|
@import 'resources.css';
|
||||||
|
@import 'security-settings.css';
|
||||||
|
|
|
@ -34,12 +34,25 @@ registry.json.ote = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{
|
* @typedef {{
|
||||||
* clientId: string,
|
* description: string,
|
||||||
|
* requirement: number,
|
||||||
|
* timesPerformed: number,
|
||||||
* completed: boolean
|
* completed: boolean
|
||||||
* }}
|
* }}
|
||||||
*/
|
*/
|
||||||
|
registry.json.ote.OteStatusDetail;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{
|
||||||
|
* clientId: string,
|
||||||
|
* completed: boolean,
|
||||||
|
* details: !Array.<registry.json.ote.OteStatusDetail>
|
||||||
|
* }}
|
||||||
|
*/
|
||||||
registry.json.ote.OteStatusResult;
|
registry.json.ote.OteStatusResult;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{
|
* @typedef {{
|
||||||
* status: string,
|
* status: string,
|
||||||
|
|
|
@ -102,20 +102,17 @@ registry.registrar.AdminSettings.prototype.oteStatusCheck_ = function(
|
||||||
/** @type {!registry.json.ote.OteStatusResponse} */
|
/** @type {!registry.json.ote.OteStatusResponse} */
|
||||||
(e.target.getResponseJson(
|
(e.target.getResponseJson(
|
||||||
registry.registrar.AdminSettings.PARSER_BREAKER_));
|
registry.registrar.AdminSettings.PARSER_BREAKER_));
|
||||||
var message;
|
var oteResultParent = goog.dom.getRequiredElement('ote-status-area-parent');
|
||||||
if (response.status === 'SUCCESS') {
|
if (response.status === 'SUCCESS') {
|
||||||
var results = response.results[0];
|
var results = response.results[0];
|
||||||
message = 'Passed: '.concat(results.completed);
|
goog.soy.renderElement(
|
||||||
|
oteResultParent, registry.soy.registrar.admin.oteResultsTable,
|
||||||
|
{completed: results.completed, detailsList: results.details});
|
||||||
} else {
|
} else {
|
||||||
message = 'Error: '.concat(response.message);
|
goog.soy.renderElement(
|
||||||
|
oteResultParent, registry.soy.registrar.admin.oteErrorArea,
|
||||||
|
{message: response.message});
|
||||||
}
|
}
|
||||||
var textParent = goog.dom.getRequiredElement('ote-status-area-parent');
|
|
||||||
if (!textParent.hasChildNodes()) {
|
|
||||||
var textElement = document.createElement('p');
|
|
||||||
textElement.id = 'ote-status-area';
|
|
||||||
textParent.appendChild(textElement);
|
|
||||||
}
|
|
||||||
textParent.firstElementChild.textContent = message;
|
|
||||||
}, 'POST', goog.json.serialize({'clientId': clientId}), {
|
}, 'POST', goog.json.serialize({'clientId': clientId}), {
|
||||||
'X-CSRF-Token': xsrfToken,
|
'X-CSRF-Token': xsrfToken,
|
||||||
'Content-Type': 'application/json; charset=UTF-8'
|
'Content-Type': 'application/json; charset=UTF-8'
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
/** Registrar admin settings page for view and edit. */
|
/** Registrar admin settings page for view and edit. */
|
||||||
{template .settings}
|
{template .settings}
|
||||||
{@param allowedTlds: list<string>}
|
{@param allowedTlds: list<string>}
|
||||||
|
{@param type: string} // the registrar type, e.g. REAL, OTE, TEST, etc.
|
||||||
<form name="item" class="{css('item')} {css('registrar')}">
|
<form name="item" class="{css('item')} {css('registrar')}">
|
||||||
<h1>Administrator settings</h1>
|
<h1>Administrator settings</h1>
|
||||||
<table>
|
<table>
|
||||||
|
@ -48,7 +49,9 @@
|
||||||
<p>Generate new OT&E accounts <a href="/registrar-ote-setup">here</a>
|
<p>Generate new OT&E accounts <a href="/registrar-ote-setup">here</a>
|
||||||
</p></td>
|
</p></td>
|
||||||
</tr>
|
</tr>
|
||||||
{call .oteStatus /}
|
{call .oteStatus}
|
||||||
|
{param registrarType: $type /}
|
||||||
|
{/call}
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
{/template}
|
{/template}
|
||||||
|
@ -67,15 +70,63 @@
|
||||||
{/template}
|
{/template}
|
||||||
|
|
||||||
{template .oteStatus}
|
{template .oteStatus}
|
||||||
|
{@param registrarType: string}
|
||||||
<tr class="{css('kd-settings-pane-section')}">
|
<tr class="{css('kd-settings-pane-section')}">
|
||||||
<td class="{css('setting')}">
|
<td class="{css('setting')}">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
id="btn-ote-status"
|
id="btn-ote-status"
|
||||||
value="Check OT&E status"
|
value="Check OT&E status"
|
||||||
class="{css('kd-button')} {css('kd-button-submit')}">Check OT&E status
|
class="{css('kd-button')} {css('kd-button-submit')}
|
||||||
|
{if $registrarType != 'OTE'} {css('disabled')} {/if}">
|
||||||
|
Check OT&E status
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td id="ote-status-area-parent" class="{css('setting')}"></td>
|
<td id="ote-status-area-parent" class="{css('setting')}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
{/template}
|
{/template}
|
||||||
|
|
||||||
|
{template .oteResultsTable}
|
||||||
|
{@param completed: bool}
|
||||||
|
{@param detailsList: list<[description: string, timesPerformed: int, requirement: int, completed: bool]>}
|
||||||
|
<table id="ote-results-table">
|
||||||
|
{if $completed}
|
||||||
|
<tr class={css('ote-fulfilled')}>
|
||||||
|
<td>Status:</td>
|
||||||
|
<td>Completed</td>
|
||||||
|
</tr>
|
||||||
|
{else}
|
||||||
|
<tr class={css('ote-unfulfilled')}>
|
||||||
|
<td>Status:</td>
|
||||||
|
<td>Not Completed</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
<tr class="{css('ote-results-header')}">
|
||||||
|
<th class="{css('ote-results-header-cell')}"><b>Test Name</b></th>
|
||||||
|
<th class="{css('ote-results-header-cell')}"><b>Actions Performed</b></th>
|
||||||
|
</tr>
|
||||||
|
{for $detail in $detailsList}
|
||||||
|
{if $detail.completed}
|
||||||
|
<tr class="{css('ote-fulfilled')}">
|
||||||
|
<td>{$detail.description}</td>
|
||||||
|
<td>Completed</td>
|
||||||
|
</tr>
|
||||||
|
{elseif $detail.timesPerformed > 0}
|
||||||
|
<tr class="{css('ote-semifulfilled')}">
|
||||||
|
<td>{$detail.description}</td>
|
||||||
|
<td>{$detail.timesPerformed} of {$detail.requirement}</td>
|
||||||
|
</tr>
|
||||||
|
{else}
|
||||||
|
<tr class="{css('ote-unfulfilled')}">
|
||||||
|
<td>{$detail.description}</td>
|
||||||
|
<td>Not started</td>
|
||||||
|
</tr>
|
||||||
|
{/if}
|
||||||
|
{/for}
|
||||||
|
</table>
|
||||||
|
{/template}
|
||||||
|
|
||||||
|
{template .oteErrorArea}
|
||||||
|
{@param message: string}
|
||||||
|
<p id="ote-status-area">Error: {$message}</p>
|
||||||
|
{/template}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import google.registry.model.OteStats.StatType;
|
import google.registry.model.OteStats.StatType;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -29,23 +28,17 @@ public final class OteStatsTest {
|
||||||
|
|
||||||
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
||||||
|
|
||||||
@Before
|
|
||||||
public void init() throws Exception {
|
|
||||||
OteStatsTestHelper.setupHistoryEntries("blobio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_allPass() {
|
public void testSuccess_allPass() throws Exception {
|
||||||
|
OteStatsTestHelper.setupCompleteOte("blobio");
|
||||||
OteStats stats = OteStats.getFromRegistrar("blobio");
|
OteStats stats = OteStats.getFromRegistrar("blobio");
|
||||||
assertThat(stats.getFailures()).isEmpty();
|
assertThat(stats.getFailures()).isEmpty();
|
||||||
assertThat(stats.getSize()).isEqualTo(30);
|
assertThat(stats.getSize()).isEqualTo(30);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_someFailures() {
|
public void testSuccess_incomplete() throws Exception {
|
||||||
OteStatsTestHelper.deleteHostDeleteHistoryEntry();
|
OteStatsTestHelper.setupIncompleteOte("blobio");
|
||||||
OteStatsTestHelper.deleteDomainCreateHistoryEntry();
|
|
||||||
OteStatsTestHelper.deleteDomainRestoreHistoryEntry();
|
|
||||||
OteStats stats = OteStats.getFromRegistrar("blobio");
|
OteStats stats = OteStats.getFromRegistrar("blobio");
|
||||||
assertThat(stats.getFailures())
|
assertThat(stats.getFailures())
|
||||||
.containsExactly(
|
.containsExactly(
|
||||||
|
@ -55,7 +48,8 @@ public final class OteStatsTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_toString() {
|
public void testSuccess_toString() throws Exception {
|
||||||
|
OteStatsTestHelper.setupCompleteOte("blobio");
|
||||||
OteStats stats = OteStats.getFromRegistrar("blobio");
|
OteStats stats = OteStats.getFromRegistrar("blobio");
|
||||||
String expected =
|
String expected =
|
||||||
"contact creates: 0\n"
|
"contact creates: 0\n"
|
||||||
|
@ -95,8 +89,8 @@ public final class OteStatsTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMissingHostDeletes_toString() {
|
public void testIncomplete_toString() throws Exception {
|
||||||
OteStatsTestHelper.deleteHostDeleteHistoryEntry();
|
OteStatsTestHelper.setupIncompleteOte("blobio");
|
||||||
OteStats stats = OteStats.getFromRegistrar("blobio");
|
OteStats stats = OteStats.getFromRegistrar("blobio");
|
||||||
String expected =
|
String expected =
|
||||||
"contact creates: 0\n"
|
"contact creates: 0\n"
|
||||||
|
@ -107,17 +101,17 @@ public final class OteStatsTest {
|
||||||
+ "contact transfer requests: 0\n"
|
+ "contact transfer requests: 0\n"
|
||||||
+ "contact updates: 0\n"
|
+ "contact updates: 0\n"
|
||||||
+ "domain autorenews: 0\n"
|
+ "domain autorenews: 0\n"
|
||||||
+ "domain creates: 5\n"
|
+ "domain creates: 4\n"
|
||||||
+ "domain creates ascii: 4\n"
|
+ "domain creates ascii: 4\n"
|
||||||
+ "domain creates idn: 1\n"
|
+ "domain creates idn: 0\n"
|
||||||
+ "domain creates start date sunrise: 1\n"
|
+ "domain creates start date sunrise: 1\n"
|
||||||
+ "domain creates with claims notice: 1\n"
|
+ "domain creates with claims notice: 1\n"
|
||||||
+ "domain creates with fee: 1\n"
|
+ "domain creates with fee: 1\n"
|
||||||
+ "domain creates with sec dns: 1\n"
|
+ "domain creates with sec dns: 1\n"
|
||||||
+ "domain creates without sec dns: 4\n"
|
+ "domain creates without sec dns: 3\n"
|
||||||
+ "domain deletes: 1\n"
|
+ "domain deletes: 1\n"
|
||||||
+ "domain renews: 0\n"
|
+ "domain renews: 0\n"
|
||||||
+ "domain restores: 1\n"
|
+ "domain restores: 0\n"
|
||||||
+ "domain transfer approves: 1\n"
|
+ "domain transfer approves: 1\n"
|
||||||
+ "domain transfer cancels: 1\n"
|
+ "domain transfer cancels: 1\n"
|
||||||
+ "domain transfer rejects: 1\n"
|
+ "domain transfer rejects: 1\n"
|
||||||
|
@ -131,7 +125,7 @@ public final class OteStatsTest {
|
||||||
+ "host deletes: 0\n"
|
+ "host deletes: 0\n"
|
||||||
+ "host updates: 10\n"
|
+ "host updates: 10\n"
|
||||||
+ "unclassified flows: 0\n"
|
+ "unclassified flows: 0\n"
|
||||||
+ "TOTAL: 38";
|
+ "TOTAL: 34";
|
||||||
assertThat(stats.toString()).isEqualTo(expected);
|
assertThat(stats.toString()).isEqualTo(expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
package google.registry.model;
|
package google.registry.model;
|
||||||
|
|
||||||
import static google.registry.testing.DatastoreHelper.deleteResource;
|
|
||||||
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
import static google.registry.testing.DatastoreHelper.persistPremiumList;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.TestDataHelper.loadBytes;
|
import static google.registry.testing.TestDataHelper.loadBytes;
|
||||||
|
@ -27,12 +26,39 @@ import java.io.IOException;
|
||||||
|
|
||||||
public final class OteStatsTestHelper {
|
public final class OteStatsTestHelper {
|
||||||
|
|
||||||
private static HistoryEntry hostDeleteHistoryEntry;
|
public static void setupCompleteOte(String baseClientId) throws IOException {
|
||||||
private static HistoryEntry domainCreateHistoryEntry;
|
setupIncompleteOte(baseClientId);
|
||||||
private static HistoryEntry domainRestoreHistoryEntry;
|
String oteAccount1 = String.format("%s-1", baseClientId);
|
||||||
|
persistResource(
|
||||||
|
new HistoryEntry.Builder()
|
||||||
|
.setClientId(oteAccount1)
|
||||||
|
.setType(Type.DOMAIN_CREATE)
|
||||||
|
.setXmlBytes(getBytes("domain_create_idn.xml"))
|
||||||
|
.build());
|
||||||
|
persistResource(
|
||||||
|
new HistoryEntry.Builder()
|
||||||
|
.setClientId(oteAccount1)
|
||||||
|
.setType(Type.DOMAIN_RESTORE)
|
||||||
|
.setXmlBytes(getBytes("domain_restore.xml"))
|
||||||
|
.build());
|
||||||
|
persistResource(
|
||||||
|
new HistoryEntry.Builder()
|
||||||
|
.setClientId(oteAccount1)
|
||||||
|
.setType(Type.HOST_DELETE)
|
||||||
|
.setXmlBytes(getBytes("host_delete.xml"))
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(b/122830156): Have this replicate the exact OT&E workflow with the correct client IDs
|
/**
|
||||||
public static void setupHistoryEntries(String baseClientId) throws IOException {
|
* Sets up an incomplete OT&E registrar. It is missing the following entries:
|
||||||
|
*
|
||||||
|
* - DOMAIN_CREATES_IDN
|
||||||
|
* - DOMAIN_RESTORES
|
||||||
|
* - HOST_DELETES
|
||||||
|
*
|
||||||
|
* TODO(b/122830156): Have this replicate the exact OT&E workflow with the correct client IDs
|
||||||
|
*/
|
||||||
|
public static void setupIncompleteOte(String baseClientId) throws IOException {
|
||||||
persistPremiumList("default_sandbox_list", "sandbox,USD 1000");
|
persistPremiumList("default_sandbox_list", "sandbox,USD 1000");
|
||||||
OteAccountBuilder.forClientId(baseClientId).addContact("email@example.com").buildAndPersist();
|
OteAccountBuilder.forClientId(baseClientId).addContact("email@example.com").buildAndPersist();
|
||||||
String oteAccount1 = String.format("%s-1", baseClientId);
|
String oteAccount1 = String.format("%s-1", baseClientId);
|
||||||
|
@ -42,13 +68,6 @@ public final class OteStatsTestHelper {
|
||||||
.setType(Type.DOMAIN_CREATE)
|
.setType(Type.DOMAIN_CREATE)
|
||||||
.setXmlBytes(getBytes("domain_create_sunrise.xml"))
|
.setXmlBytes(getBytes("domain_create_sunrise.xml"))
|
||||||
.build());
|
.build());
|
||||||
domainCreateHistoryEntry =
|
|
||||||
persistResource(
|
|
||||||
new HistoryEntry.Builder()
|
|
||||||
.setClientId(oteAccount1)
|
|
||||||
.setType(Type.DOMAIN_CREATE)
|
|
||||||
.setXmlBytes(getBytes("domain_create_idn.xml"))
|
|
||||||
.build());
|
|
||||||
persistResource(
|
persistResource(
|
||||||
new HistoryEntry.Builder()
|
new HistoryEntry.Builder()
|
||||||
.setClientId(oteAccount1)
|
.setClientId(oteAccount1)
|
||||||
|
@ -73,13 +92,6 @@ public final class OteStatsTestHelper {
|
||||||
.setType(Type.DOMAIN_DELETE)
|
.setType(Type.DOMAIN_DELETE)
|
||||||
.setXmlBytes(getBytes("domain_delete.xml"))
|
.setXmlBytes(getBytes("domain_delete.xml"))
|
||||||
.build());
|
.build());
|
||||||
domainRestoreHistoryEntry =
|
|
||||||
persistResource(
|
|
||||||
new HistoryEntry.Builder()
|
|
||||||
.setClientId(oteAccount1)
|
|
||||||
.setType(Type.DOMAIN_RESTORE)
|
|
||||||
.setXmlBytes(getBytes("domain_restore.xml"))
|
|
||||||
.build());
|
|
||||||
persistResource(
|
persistResource(
|
||||||
new HistoryEntry.Builder()
|
new HistoryEntry.Builder()
|
||||||
.setClientId(oteAccount1)
|
.setClientId(oteAccount1)
|
||||||
|
@ -116,13 +128,6 @@ public final class OteStatsTestHelper {
|
||||||
.setType(Type.HOST_CREATE)
|
.setType(Type.HOST_CREATE)
|
||||||
.setXmlBytes(getBytes("host_create_complete.xml"))
|
.setXmlBytes(getBytes("host_create_complete.xml"))
|
||||||
.build());
|
.build());
|
||||||
hostDeleteHistoryEntry =
|
|
||||||
persistResource(
|
|
||||||
new HistoryEntry.Builder()
|
|
||||||
.setClientId(oteAccount1)
|
|
||||||
.setType(Type.HOST_DELETE)
|
|
||||||
.setXmlBytes(getBytes("host_delete.xml"))
|
|
||||||
.build());
|
|
||||||
// Persist 10 host updates for a total of 25 history entries. Since these also sort last by
|
// Persist 10 host updates for a total of 25 history entries. Since these also sort last by
|
||||||
// modification time, when these cause all tests to pass, only the first will be recorded and
|
// modification time, when these cause all tests to pass, only the first will be recorded and
|
||||||
// the rest will be skipped.
|
// the rest will be skipped.
|
||||||
|
@ -138,18 +143,6 @@ public final class OteStatsTestHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteHostDeleteHistoryEntry() {
|
|
||||||
deleteResource(hostDeleteHistoryEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void deleteDomainCreateHistoryEntry() {
|
|
||||||
deleteResource(domainCreateHistoryEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void deleteDomainRestoreHistoryEntry() {
|
|
||||||
deleteResource(domainRestoreHistoryEntry);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] getBytes(String filename) throws IOException {
|
private static byte[] getBytes(String filename) throws IOException {
|
||||||
return loadBytes(OteStatsTestHelper.class, filename).read();
|
return loadBytes(OteStatsTestHelper.class, filename).read();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import google.registry.model.OteAccountBuilder;
|
|
||||||
import google.registry.model.OteStatsTestHelper;
|
import google.registry.model.OteStatsTestHelper;
|
||||||
import google.registry.model.contact.ContactAddress;
|
import google.registry.model.contact.ContactAddress;
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
|
@ -65,9 +64,9 @@ public enum Fixture {
|
||||||
// Used for OT&E TLDs
|
// Used for OT&E TLDs
|
||||||
persistPremiumList("default_sandbox_list");
|
persistPremiumList("default_sandbox_list");
|
||||||
|
|
||||||
OteAccountBuilder.forClientId("oteunfinished").addContact("email@example.com").buildAndPersist();
|
|
||||||
try {
|
try {
|
||||||
OteStatsTestHelper.setupHistoryEntries("otefinished");
|
OteStatsTestHelper.setupCompleteOte("otefinished");
|
||||||
|
OteStatsTestHelper.setupIncompleteOte("oteunfinished");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import google.registry.model.OteStatsTestHelper;
|
||||||
import google.registry.testing.AppEngineRule;
|
import google.registry.testing.AppEngineRule;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -36,28 +35,23 @@ public class VerifyOteActionTest {
|
||||||
|
|
||||||
private final VerifyOteAction action = new VerifyOteAction();
|
private final VerifyOteAction action = new VerifyOteAction();
|
||||||
|
|
||||||
@Before
|
|
||||||
public void init() throws Exception {
|
|
||||||
OteStatsTestHelper.setupHistoryEntries("blobio");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_summarize_allPass() {
|
public void testSuccess_summarize_allPass() throws Exception {
|
||||||
|
OteStatsTestHelper.setupCompleteOte("blobio");
|
||||||
assertThat(getResponse(true))
|
assertThat(getResponse(true))
|
||||||
.isEqualTo("# actions: 30 - Reqs: [----------------] 16/16 - Overall: PASS");
|
.isEqualTo("# actions: 30 - Reqs: [----------------] 16/16 - Overall: PASS");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_summarize_someFailures() {
|
public void testFailure_summarize_someFailures() throws Exception {
|
||||||
OteStatsTestHelper.deleteDomainCreateHistoryEntry();
|
OteStatsTestHelper.setupIncompleteOte("blobio");
|
||||||
OteStatsTestHelper.deleteDomainRestoreHistoryEntry();
|
|
||||||
OteStatsTestHelper.deleteHostDeleteHistoryEntry();
|
|
||||||
assertThat(getResponse(true))
|
assertThat(getResponse(true))
|
||||||
.isEqualTo("# actions: 34 - Reqs: [-.-----.------.-] 13/16 - Overall: FAIL");
|
.isEqualTo("# actions: 34 - Reqs: [-.-----.------.-] 13/16 - Overall: FAIL");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSuccess_passNotSummarized() {
|
public void testSuccess_passNotSummarized() throws Exception {
|
||||||
|
OteStatsTestHelper.setupCompleteOte("blobio");
|
||||||
String expectedOteStatus =
|
String expectedOteStatus =
|
||||||
"domain creates idn: 1\n"
|
"domain creates idn: 1\n"
|
||||||
+ "domain creates start date sunrise: 1\n"
|
+ "domain creates start date sunrise: 1\n"
|
||||||
|
@ -86,10 +80,10 @@ public class VerifyOteActionTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailure_missingHostDelete() {
|
public void testFailure_incomplete() throws Exception {
|
||||||
OteStatsTestHelper.deleteHostDeleteHistoryEntry();
|
OteStatsTestHelper.setupIncompleteOte("blobio");
|
||||||
String expectedOteStatus =
|
String expectedOteStatus =
|
||||||
"domain creates idn: 1\n"
|
"domain creates idn: 0\n"
|
||||||
+ "domain creates start date sunrise: 1\n"
|
+ "domain creates start date sunrise: 1\n"
|
||||||
+ "domain creates with claims notice: 1\n"
|
+ "domain creates with claims notice: 1\n"
|
||||||
+ "domain creates with fee: 1\n"
|
+ "domain creates with fee: 1\n"
|
||||||
|
@ -97,7 +91,7 @@ public class VerifyOteActionTest {
|
||||||
+ ".*"
|
+ ".*"
|
||||||
+ "domain deletes: 1\n"
|
+ "domain deletes: 1\n"
|
||||||
+ ".*"
|
+ ".*"
|
||||||
+ "domain restores: 1\n"
|
+ "domain restores: 0\n"
|
||||||
+ "domain transfer approves: 1\n"
|
+ "domain transfer approves: 1\n"
|
||||||
+ "domain transfer cancels: 1\n"
|
+ "domain transfer cancels: 1\n"
|
||||||
+ "domain transfer rejects: 1\n"
|
+ "domain transfer rejects: 1\n"
|
||||||
|
@ -109,7 +103,7 @@ public class VerifyOteActionTest {
|
||||||
+ "host deletes: 0\n"
|
+ "host deletes: 0\n"
|
||||||
+ "host updates: 10\n"
|
+ "host updates: 10\n"
|
||||||
+ ".*"
|
+ ".*"
|
||||||
+ "Requirements passed: 15/16\n"
|
+ "Requirements passed: 13/16\n"
|
||||||
+ "Overall OT&E status: FAIL\n";
|
+ "Overall OT&E status: FAIL\n";
|
||||||
Pattern expectedOteStatusPattern = Pattern.compile(expectedOteStatus, Pattern.DOTALL);
|
Pattern expectedOteStatusPattern = Pattern.compile(expectedOteStatus, Pattern.DOTALL);
|
||||||
assertThat(getResponse(false)).containsMatch(expectedOteStatusPattern);
|
assertThat(getResponse(false)).containsMatch(expectedOteStatusPattern);
|
||||||
|
|
|
@ -51,10 +51,7 @@ public final class OteStatusActionTest {
|
||||||
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void init() throws Exception {
|
public void init() {
|
||||||
OteStatsTestHelper.setupHistoryEntries(BASE_CLIENT_ID);
|
|
||||||
persistNewRegistrar(CLIENT_ID, "SomeRegistrar", Type.OTE, null);
|
|
||||||
|
|
||||||
ImmutableSetMultimap<String, Role> authValues =
|
ImmutableSetMultimap<String, Role> authValues =
|
||||||
OteAccountBuilder.createClientIdToTldMap(BASE_CLIENT_ID).keySet().stream()
|
OteAccountBuilder.createClientIdToTldMap(BASE_CLIENT_ID).keySet().stream()
|
||||||
.collect(toImmutableSetMultimap(Function.identity(), ignored -> Role.OWNER));
|
.collect(toImmutableSetMultimap(Function.identity(), ignored -> Role.OWNER));
|
||||||
|
@ -63,7 +60,9 @@ public final class OteStatusActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testSuccess_finishedOte() {
|
public void testSuccess_finishedOte() throws Exception {
|
||||||
|
OteStatsTestHelper.setupCompleteOte(BASE_CLIENT_ID);
|
||||||
|
|
||||||
Map<String, ?> actionResult = action.handleJsonRequest(ImmutableMap.of("clientId", CLIENT_ID));
|
Map<String, ?> actionResult = action.handleJsonRequest(ImmutableMap.of("clientId", CLIENT_ID));
|
||||||
assertThat(actionResult).containsEntry("status", "SUCCESS");
|
assertThat(actionResult).containsEntry("status", "SUCCESS");
|
||||||
assertThat(actionResult).containsEntry("message", "OT&E check completed successfully");
|
assertThat(actionResult).containsEntry("message", "OT&E check completed successfully");
|
||||||
|
@ -76,8 +75,8 @@ public final class OteStatusActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void testSuccess_unfinishedOte() {
|
public void testSuccess_incomplete() throws Exception {
|
||||||
OteStatsTestHelper.deleteHostDeleteHistoryEntry();
|
OteStatsTestHelper.setupIncompleteOte(BASE_CLIENT_ID);
|
||||||
|
|
||||||
Map<String, ?> actionResult = action.handleJsonRequest(ImmutableMap.of("clientId", CLIENT_ID));
|
Map<String, ?> actionResult = action.handleJsonRequest(ImmutableMap.of("clientId", CLIENT_ID));
|
||||||
assertThat(actionResult).containsEntry("status", "SUCCESS");
|
assertThat(actionResult).containsEntry("status", "SUCCESS");
|
||||||
|
@ -92,6 +91,16 @@ public final class OteStatusActionTest {
|
||||||
"description", StatType.HOST_DELETES.getDescription(),
|
"description", StatType.HOST_DELETES.getDescription(),
|
||||||
"requirement", StatType.HOST_DELETES.getRequirement(),
|
"requirement", StatType.HOST_DELETES.getRequirement(),
|
||||||
"timesPerformed", 0,
|
"timesPerformed", 0,
|
||||||
|
"completed", false),
|
||||||
|
ImmutableMap.of(
|
||||||
|
"description", StatType.DOMAIN_RESTORES.getDescription(),
|
||||||
|
"requirement", StatType.DOMAIN_RESTORES.getRequirement(),
|
||||||
|
"timesPerformed", 0,
|
||||||
|
"completed", false),
|
||||||
|
ImmutableMap.of(
|
||||||
|
"description", StatType.DOMAIN_CREATES_IDN.getDescription(),
|
||||||
|
"requirement", StatType.DOMAIN_CREATES_IDN.getRequirement(),
|
||||||
|
"timesPerformed", 0,
|
||||||
"completed", false));
|
"completed", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue