org.newsml.toolkit.conformance
Class RefTest

java.lang.Object
  |
  +--org.newsml.toolkit.conformance.TestBase
        |
        +--org.newsml.toolkit.conformance.RefTest

public class RefTest
extends TestBase

Test a reference.

This class provides a configurable base for testing Duid, URL, and URN references of various types. It tests the syntax and attempts to resolve the references where possible and allowed.

Version:
2.0
Author:
Reuters PLC
See Also:
NewsMLTestManager

Field Summary
static int DUID
          Constant: Duid references are allowed.
static int HTTP_URL
          Constant: HTTP URLs are allowed.
static int NEWSML_URN
          Constant: NewsML URNs are allowed.
static int URL
          Constant: General URLs are allowed.
static int URN
          Constant: General URNs are allowed.
 
Constructor Summary
RefTest(int flags)
          Construct a new reference test with the allowed types specified.
RefTest(int flags, String targetName)
          Construct a new reference test with a specific NewsML target type.
 
Method Summary
 void run(BaseNode node, boolean useExternal)
          Test a reference.
 
Methods inherited from class org.newsml.toolkit.conformance.TestBase
error, internal, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUID

public static final int DUID
Constant: Duid references are allowed.

NEWSML_URN

public static final int NEWSML_URN
Constant: NewsML URNs are allowed.

HTTP_URL

public static final int HTTP_URL
Constant: HTTP URLs are allowed.

URL

public static final int URL
Constant: General URLs are allowed.

URN

public static final int URN
Constant: General URNs are allowed.
Constructor Detail

RefTest

public RefTest(int flags)
Construct a new reference test with the allowed types specified.
Parameters:
flags - The flags for the allowed types, or'ed together.

RefTest

public RefTest(int flags,
               String targetName)
Construct a new reference test with a specific NewsML target type.
Parameters:
flags - The flags for the allowed types, or'ed together.
targetName - The XML name of the expected NewsML target (should be null when the target is not NewsML markup).
Method Detail

run

public void run(BaseNode node,
                boolean useExternal)
         throws NewsMLException
Test a reference.
Overrides:
run in class TestBase
Parameters:
node - A Text node.
useExternal - If true, try external references.
Throws:
NewsMLException - If the test fails.
java.lang.ClassCastException - If the node parameter is not an instance of Text.
See Also:
TestBase.run(org.newsml.toolkit.BaseNode, boolean)