From fd90492d0c47c1d2963e4234d71e48e6097029b2 Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 8 Oct 2024 10:10:01 +0200 Subject: [PATCH] Fixed naming --- .../client/DNSRegistrationFuncTest.java | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/peppol-sml-client/src/test/java/com/helger/peppol/smlclient/client/DNSRegistrationFuncTest.java b/peppol-sml-client/src/test/java/com/helger/peppol/smlclient/client/DNSRegistrationFuncTest.java index b48a5803..7eea29d4 100644 --- a/peppol-sml-client/src/test/java/com/helger/peppol/smlclient/client/DNSRegistrationFuncTest.java +++ b/peppol-sml-client/src/test/java/com/helger/peppol/smlclient/client/DNSRegistrationFuncTest.java @@ -80,20 +80,7 @@ public final class DNSRegistrationFuncTest extends AbstractSMLClientTestCase private static final String INTERNAL_DNS_SERVER = "blixdns0"; @Nullable - private static String _DNSLookupPI (@Nonnull final IParticipantIdentifier aPI) throws Exception - { - final String sHost = PeppolURLProvider.INSTANCE.getDNSNameOfParticipant (aPI, SML_INFO); - return _DNSLookup (sHost); - } - - @Nullable - private static String _DNSLookupPublisher (@Nonnull final String sSMPID) throws Exception - { - return _DNSLookup (sSMPID + "." + SML_INFO.getPublisherDNSZone ()); - } - - @Nullable - private static String _DNSLookup (final String sHost) throws Exception + private static String _dnsLookup (final String sHost) throws Exception { // Wait to let dns propagate : DNS TTL = 60 secs LOGGER.info ("Waiting 10 seconds to lookup '" + sHost + "'"); @@ -111,7 +98,7 @@ private static String _DNSLookup (final String sHost) throws Exception final Record aRecord = aRecords[0]; if (aRecord instanceof CNAMERecord) - return ((CNAMERecord) aRecord).getName ().toString (); + return aRecord.getName ().toString (); if (aRecord instanceof ARecord) { @@ -123,6 +110,19 @@ private static String _DNSLookup (final String sHost) throws Exception return aRecord.toString (); } + @Nullable + private static String _dnsLookupPI (@Nonnull final IParticipantIdentifier aPI) throws Exception + { + final String sHost = PeppolURLProvider.INSTANCE.getDNSNameOfParticipant (aPI, SML_INFO); + return _dnsLookup (sHost); + } + + @Nullable + private static String _dnsLookupPublisher (@Nonnull final String sSMPID) throws Exception + { + return _dnsLookup (sSMPID + "." + SML_INFO.getPublisherDNSZone ()); + } + @Before public void setupSMPBeforeTests () throws Exception { @@ -171,7 +171,7 @@ public void testVerifySMPInDNS () throws Exception // @Before creates new SMP! // verify created - final String publisher = _DNSLookupPublisher (SMP_ID); + final String publisher = _dnsLookupPublisher (SMP_ID); assertEquals (SMP_1_LOGICAL_ADDRESS_VALIDATION, publisher); // Update SML address @@ -180,14 +180,14 @@ public void testVerifySMPInDNS () throws Exception manageServiceMetaData.update (SMP_ID, SMP_2_PHYSICAL_ADDRESS, SMP_2_LOGICAL_ADDRESS); // verify update - final String updatedPublisher = _DNSLookupPublisher (SMP_ID); + final String updatedPublisher = _dnsLookupPublisher (SMP_ID); assertEquals (SMP_2_LOGICAL_ADDRESS_VALIDATION, updatedPublisher); // Delete SML manageServiceMetaData.delete (SMP_ID); // verify delete - final String deletedPublisher = _DNSLookupPublisher (SMP_ID); + final String deletedPublisher = _dnsLookupPublisher (SMP_ID); assertNull (deletedPublisher); } @@ -206,13 +206,13 @@ public void testVerifyParticipantIdentifierInDNS () throws Exception client.create (SMP_ID, aPI); // verify PI in DNS - final String host = _DNSLookupPI (aPI); + final String host = _dnsLookupPI (aPI); assertEquals (SMP_ID + "." + SML_INFO.getPublisherDNSZone (), host); // delete PI client.delete (SMP_ID, aPI); - final String deletedHost = _DNSLookupPI (aPI); + final String deletedHost = _dnsLookupPI (aPI); assertNull (deletedHost); } @@ -231,20 +231,20 @@ public void testVerifyWildcardInDNS () throws Exception client.create (SMP_ID, aPI); // verify that PI can be found in Wildcard domain. - final String piHost = _DNSLookupPI (new PeppolParticipantIdentifier (PeppolIdentifierFactory.INSTANCE, + final String piHost = _dnsLookupPI (new PeppolParticipantIdentifier (PeppolIdentifierFactory.INSTANCE, PI_WILDCARD_SCHEME, PI_VALUE)); assertEquals (SMP_ID + "." + SML_INFO.getPublisherDNSZone (), piHost); // verify that Wildcard can be found - final String wildHost = _DNSLookupPI (aPI); + final String wildHost = _dnsLookupPI (aPI); assertEquals (SMP_ID + "." + SML_INFO.getPublisherDNSZone (), wildHost); // delete wildcard client.delete (SMP_ID, aPI); // verify deleted - final String deletedHost = _DNSLookupPI (aPI); + final String deletedHost = _dnsLookupPI (aPI); assertNull (deletedHost); } }