-
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.
Include AS-SET in NONAUTH dump (#1352)
* Include AS-SET in NONAUTH dump. * Added tests * Define NONAUTH object types once in export code. Don't hard-code source. * Fixed test
- Loading branch information
Showing
5 changed files
with
101 additions
and
68 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
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 |
---|---|---|
|
@@ -50,8 +50,6 @@ public void setTmpDir(final String tmpDirNAme) { | |
|
||
Set<RpslObject> objects; | ||
|
||
private final static Set<ObjectType> NON_AUTH_TYPES = Sets.immutableEnumSet(ObjectType.AUT_NUM, ObjectType.ROUTE, ObjectType.ROUTE6); | ||
|
||
@BeforeEach | ||
public void setupServer() { | ||
objects = Sets.newHashSet(); | ||
|
@@ -69,15 +67,15 @@ public void setupServer() { | |
for (int i = 0; i < 10; i++) { | ||
final RpslObject personObject = RpslObject.parse("" + | ||
"person: Test person " + i + "\n" + | ||
"nic-hdl: PN" + i + "-RIPE\n" + | ||
"nic-hdl: PN" + i + "-TEST\n" + | ||
"source: TEST"); | ||
|
||
databaseHelper.addObject(personObject); | ||
objects.add(personObject); | ||
|
||
final RpslObject roleObject = RpslObject.parse("" + | ||
"role: Test role " + i + "\n" + | ||
"nic-hdl: ROLE" + i + "-RIPE\n" + | ||
"nic-hdl: ROLE" + i + "-TEST\n" + | ||
"source: TEST"); | ||
|
||
databaseHelper.addObject(roleObject); | ||
|
@@ -102,13 +100,13 @@ public void export() throws IOException { | |
assertThat(exportDir.exists(), is(true)); | ||
|
||
for (final ObjectType objectType : ObjectType.values()) { | ||
checkFile("dbase/split/ripe.db." + objectType.getName() + ".gz"); | ||
checkFile("internal/split/ripe.db." + objectType.getName() + ".gz"); | ||
checkFile("dbase/split/test.db." + objectType.getName() + ".gz"); | ||
checkFile("internal/split/test.db." + objectType.getName() + ".gz"); | ||
} | ||
|
||
checkFile("dbase/RIPE.CURRENTSERIAL", "120"); | ||
checkFile("dbase/TEST.CURRENTSERIAL", "120"); | ||
|
||
checkFile("dbase/ripe.db.gz", | ||
checkFile("dbase/test.db.gz", | ||
"person: Placeholder Person Object\n", | ||
"mntner: DEV-MNT0\n", | ||
"mntner: DEV-MNT1\n", | ||
|
@@ -130,9 +128,9 @@ public void export() throws IOException { | |
"remarks: * http://www.ripe.net/whois\n" + | ||
"remarks: ****************************\n"); | ||
|
||
checkFile("dbase/split/ripe.db.person.gz", "person: Placeholder Person Object"); | ||
checkFile("dbase/split/test.db.person.gz", "person: Placeholder Person Object"); | ||
|
||
checkFile("dbase/split/ripe.db.mntner.gz", | ||
checkFile("dbase/split/test.db.mntner.gz", | ||
"mntner: DEV-MNT0\n", | ||
"mntner: DEV-MNT1\n", | ||
"mntner: DEV-MNT2\n", | ||
|
@@ -153,29 +151,29 @@ public void export() throws IOException { | |
"remarks: * http://www.ripe.net/whois\n" + | ||
"remarks: ****************************\n"); | ||
|
||
checkFile("internal/split/ripe.db.person.gz", | ||
checkFile("internal/split/test.db.person.gz", | ||
"person: Test person 0", | ||
"person: Test person 1", | ||
"person: Test person 2", | ||
"person: Test person 3", | ||
"person: Test person 4", | ||
"" + | ||
"person: Test person 9\n" + | ||
"nic-hdl: PN9-RIPE\n" + | ||
"nic-hdl: PN9-TEST\n" + | ||
"source: TEST"); | ||
|
||
checkFile("internal/split/ripe.db.role.gz", | ||
checkFile("internal/split/test.db.role.gz", | ||
"role: Test role 0", | ||
"role: Test role 1", | ||
"role: Test role 2", | ||
"role: Test role 3", | ||
"role: Test role 4", | ||
"" + | ||
"role: Test role 9\n" + | ||
"nic-hdl: ROLE9-RIPE\n" + | ||
"nic-hdl: ROLE9-TEST\n" + | ||
"source: TEST"); | ||
|
||
checkFile("internal/split/ripe.db.mntner.gz", | ||
checkFile("internal/split/test.db.mntner.gz", | ||
"" + | ||
"mntner: DEV-MNT0\n" + | ||
"auth: MD5-PW $1$xNv6umMG$cBd9DXqWEpsqeBq2AUjGy/\n" + | ||
|
@@ -226,13 +224,13 @@ public void export() throws IOException { | |
public void export_role_with_abuse_mailbox() throws IOException { | ||
databaseHelper.addObject(RpslObject.parse("" + | ||
"role: Abuse role\n" + | ||
"nic-hdl: AR1-RIPE\n" + | ||
"nic-hdl: AR1-TEST\n" + | ||
"abuse-mailbox: [email protected]\n" + | ||
"source: TEST")); | ||
|
||
databaseHelper.addObject(RpslObject.parse("" + | ||
"organisation: ORG1\n" + | ||
"abuse-c: AR1-RIPE\n" + | ||
"abuse-c: AR1-TEST\n" + | ||
"source: TEST")); | ||
|
||
sourceContext.removeCurrentSource(); | ||
|
@@ -243,32 +241,32 @@ public void export_role_with_abuse_mailbox() throws IOException { | |
assertThat(exportDir.exists(), is(true)); | ||
|
||
for (final ObjectType objectType : ObjectType.values()) { | ||
checkFile("dbase/split/ripe.db." + objectType.getName() + ".gz"); | ||
checkFile("internal/split/ripe.db." + objectType.getName() + ".gz"); | ||
checkFile("dbase/split/test.db." + objectType.getName() + ".gz"); | ||
checkFile("internal/split/test.db." + objectType.getName() + ".gz"); | ||
} | ||
|
||
checkFile("dbase/split/ripe.db.person.gz", "person: Placeholder Person Object"); | ||
checkFile("dbase/split/test.db.person.gz", "person: Placeholder Person Object"); | ||
|
||
checkFile("dbase/split/ripe.db.role.gz", "" + | ||
checkFile("dbase/split/test.db.role.gz", "" + | ||
"role: Abuse role\n" + | ||
"nic-hdl: AR1-RIPE\n" + | ||
"nic-hdl: AR1-TEST\n" + | ||
"abuse-mailbox: [email protected]\n" + | ||
"source: TEST"); | ||
|
||
checkFile("dbase/split/ripe.db.organisation.gz", "" + | ||
checkFile("dbase/split/test.db.organisation.gz", "" + | ||
"organisation: ORG1\n" + | ||
"abuse-c: AR1-RIPE\n" + | ||
"abuse-c: AR1-TEST\n" + | ||
"source: TEST"); | ||
|
||
checkFile("internal/split/ripe.db.role.gz", "" + | ||
checkFile("internal/split/test.db.role.gz", "" + | ||
"role: Abuse role\n" + | ||
"nic-hdl: AR1-RIPE\n" + | ||
"nic-hdl: AR1-TEST\n" + | ||
"abuse-mailbox: [email protected]\n" + | ||
"source: TEST"); | ||
|
||
checkFile("internal/split/ripe.db.organisation.gz", "" + | ||
checkFile("internal/split/test.db.organisation.gz", "" + | ||
"organisation: ORG1\n" + | ||
"abuse-c: AR1-RIPE\n" + | ||
"abuse-c: AR1-TEST\n" + | ||
"source: TEST"); | ||
} | ||
|
||
|
@@ -308,31 +306,31 @@ public void export_mix_of_sources() throws IOException { | |
databaseHelper.addObject(RpslObject.parse("" + | ||
"aut-num: AS252\n" + | ||
"source: TEST")); | ||
|
||
databaseHelper.addObject(RpslObject.parse("" + | ||
"aut-num: AS251\n" + | ||
"source: TEST-NONAUTH")); | ||
databaseHelper.addObject(RpslObject.parse("" + | ||
"as-set: AS251:AS-ALL\n" + | ||
"source: TEST-NONAUTH")); | ||
|
||
sourceContext.removeCurrentSource(); | ||
|
||
rpslObjectsExporter.export(); | ||
|
||
assertThat(tmpDir.exists(), is(false)); | ||
assertThat(exportDir.exists(), is(true)); | ||
|
||
for (final ObjectType objectType : ObjectType.values()) { | ||
checkFile("dbase/split/ripe.db." + objectType.getName() + ".gz"); | ||
checkFile("internal/split/ripe.db." + objectType.getName() + ".gz"); | ||
if (NON_AUTH_TYPES.contains(objectType)) { | ||
checkFile("dbase/split/ripe-nonauth.db." + objectType.getName() + ".gz"); | ||
checkFile("internal/split/ripe-nonauth.db." + objectType.getName() + ".gz"); | ||
checkFile("dbase/split/test.db." + objectType.getName() + ".gz"); | ||
checkFile("internal/split/test.db." + objectType.getName() + ".gz"); | ||
if (ExportFileWriterFactory.NONAUTH_OBJECT_TYPES.contains(objectType)) { | ||
checkFile("dbase/split/test-nonauth.db." + objectType.getName() + ".gz"); | ||
checkFile("internal/split/test-nonauth.db." + objectType.getName() + ".gz"); | ||
} | ||
} | ||
|
||
|
||
|
||
checkFile("dbase/split/ripe.db.aut-num.gz", "aut-num: AS252"); | ||
checkFile("dbase/split/ripe-nonauth.db.aut-num.gz", "aut-num: AS251"); | ||
checkFile("dbase/split/test.db.aut-num.gz", "aut-num: AS252"); | ||
checkFile("dbase/split/test-nonauth.db.aut-num.gz", "aut-num: AS251"); | ||
checkFile("dbase/split/test-nonauth.db.as-set.gz", "as-set: AS251:AS-ALL"); | ||
} | ||
|
||
} |
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