db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-2419) Tighten encapsulation of state in TestConfiguration
Date Fri, 16 Mar 2007 20:22:09 GMT

     [ https://issues.apache.org/jira/browse/DERBY-2419?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rick Hillegas updated DERBY-2419:
---------------------------------

    Attachment: derby-2419-refactor-01.diff

Attaching derby-2419-refactor-01.diff (I am running regression tests now). This patch removes
the need for SecureServerTest to mention the default hostname and port number constants. It
does this by refactoring TestConfiguration.clientServerDecorator(). The guts of that routine
now live in a new method TestConfiguration.defaultServerDecorator(), which SecureServerTest
calls.

The new method preserves something fishy from the previous code: TestConfiguration exposes
a public static method which allows callers to use the hardcoded hostname and port number
constants regardless of whether they are declared public or private. This fishy code appears
to be invoked in a lot of places already.(I counted 44 references to it).

Along the way, I tried another solution to my problem. That solution was to create a ServerSetup
using the hostname and port gleaned from TestConfiguration.getCurrent(). That gave me a port
number of -1, which wasn't very helpful. So I abandoned that approach.

This patch cleans up SecureServerTest and creates one more invocation of the fishy code. Someone
who understands the secret machinations of TestConfiguration will probably want to fix the
fishy code itself. This patch touches the following files:

M      java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
M      java/testing/org/apache/derbyTesting/junit/TestConfiguration.java


> Tighten encapsulation of state in TestConfiguration
> ---------------------------------------------------
>
>                 Key: DERBY-2419
>                 URL: https://issues.apache.org/jira/browse/DERBY-2419
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>    Affects Versions: 10.3.0.0
>            Reporter: Kristian Waagan
>         Assigned To: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-2419-1a-alternative1.diff, derby-2419-2a-alternative2.diff,
derby-2419-2a-alternative2.stat, derby-2419-refactor-01.diff
>
>
> Parts of the state of TestConfiguration has been made public, which they should not be;
DEFAULT_PORT and DEFAULT_HOSTNAME.
> Using these directly from the outside can cause settings overridden by the user to be
ignored by tests. Further, a test should not care if the host/port it uses is the Derby default
or the values set by the user running the test.
> To obtain a hostname and  a port number, use the methods getPort and getHostName in TestConfiguration.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message