Skip to content

Commit

Permalink
Fixed naming
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Oct 8, 2024
1 parent f40fefe commit fd90492
Showing 1 changed file with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "'");
Expand All @@ -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)
{
Expand All @@ -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
{
Expand Down Expand Up @@ -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
Expand All @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}
}

0 comments on commit fd90492

Please sign in to comment.