-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dbf 71 delete syntactically incorrect objs (#403)
* Basic fix for missing auth attribute in old mntner objects causing deletion problem * now uses a property map instead of single named properties * fixed property * property missing from test properties file * fixed possible null pointer exception * missed a final * do not need to substitute '-' by using literals as keys in properties
- Loading branch information
Rob Miller
authored
Sep 13, 2016
1 parent
506285d
commit f5b3615
Showing
4 changed files
with
134 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
import net.ripe.db.whois.common.IntegrationTest; | ||
import net.ripe.db.whois.common.Message; | ||
import net.ripe.db.whois.common.Messages; | ||
import net.ripe.db.whois.common.dao.jdbc.DatabaseHelper; | ||
import net.ripe.db.whois.common.domain.CIString; | ||
import net.ripe.db.whois.common.domain.User; | ||
import net.ripe.db.whois.common.rpsl.AttributeType; | ||
|
@@ -1086,6 +1087,69 @@ public void delete_role_mnter_pair_with_override() { | |
|
||
} | ||
|
||
@Test | ||
public void delete_role_mnter_pair_with_override_missing_mandatory_attribute() { | ||
databaseHelper.addObject( | ||
"mntner: ANOTHER-MNT\n" + | ||
"upd-to: [email protected]\n" + | ||
"mnt-by: ANOTHER-MNT\n" + | ||
"source: TEST"); | ||
databaseHelper.addObject( | ||
"role: Test Role2\n" + | ||
"nic-hdl: TR2-TEST\n" + | ||
"mnt-by: ANOTHER-MNT\n" + | ||
"source: TEST"); | ||
databaseHelper.updateObject( | ||
"mntner: ANOTHER-MNT\n" + | ||
"upd-to: [email protected]\n" + | ||
"admin-c: TR2-TEST\n" + | ||
"mnt-by: ANOTHER-MNT\n" + | ||
"source: TEST"); | ||
|
||
assertThat(objectExists(ObjectType.MNTNER, "ANOTHER-MNT"), is(true)); | ||
assertThat(objectExists(ObjectType.ROLE, "TR2-TEST"), is(true)); | ||
|
||
RestTest.target(getPort(), "whois/references/TEST/mntner/ANOTHER-MNT") | ||
.queryParam("override", "personadmin,secret,reason") | ||
.request() | ||
.delete(); | ||
|
||
assertThat(objectExists(ObjectType.MNTNER, "ANOTHER-MNT"), is(false)); | ||
assertThat(objectExists(ObjectType.ROLE, "TR2-TEST"), is(false)); | ||
|
||
} | ||
|
||
@Test | ||
public void delete_role_mnter_pair_with_override_missing_mandatory_attribute_not_in_map() { | ||
// upd-to: not in map. no maintainers in db missing this mandatory attr, always been mandatory so should never be missing? | ||
databaseHelper.addObject( | ||
"mntner: ANOTHER-MNT\n" + | ||
"mnt-by: ANOTHER-MNT\n" + | ||
"source: TEST"); | ||
databaseHelper.addObject( | ||
"role: Test Role2\n" + | ||
"nic-hdl: TR2-TEST\n" + | ||
"mnt-by: ANOTHER-MNT\n" + | ||
"source: TEST"); | ||
databaseHelper.updateObject( | ||
"mntner: ANOTHER-MNT\n" + | ||
"admin-c: TR2-TEST\n" + | ||
"mnt-by: ANOTHER-MNT\n" + | ||
"source: TEST"); | ||
|
||
assertThat(objectExists(ObjectType.MNTNER, "ANOTHER-MNT"), is(true)); | ||
assertThat(objectExists(ObjectType.ROLE, "TR2-TEST"), is(true)); | ||
|
||
RestTest.target(getPort(), "whois/references/TEST/mntner/ANOTHER-MNT") | ||
.queryParam("override", "personadmin,secret,reason") | ||
.request() | ||
.delete(); | ||
|
||
assertThat(objectExists(ObjectType.MNTNER, "ANOTHER-MNT"), is(true)); | ||
assertThat(objectExists(ObjectType.ROLE, "TR2-TEST"), is(true)); | ||
|
||
} | ||
|
||
@Test | ||
public void delete_mntner_fails_person_referenced_from_another_mntner_with_override() { | ||
databaseHelper.addObject( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters